diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index dd9396201..ff261bad7 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -3,7 +3,7 @@ FROM mcr.microsoft.com/vscode/devcontainers/python:0-${VARIANT} USER vscode -RUN curl -sSf https://rye-up.com/get | RYE_VERSION="0.24.0" RYE_INSTALL_OPTION="--yes" bash +RUN curl -sSf https://rye.astral.sh/get | RYE_VERSION="0.44.0" RYE_INSTALL_OPTION="--yes" bash ENV PATH=/home/vscode/.rye/shims:$PATH -RUN echo "[[ -d .venv ]] && source .venv/bin/activate" >> /home/vscode/.bashrc +RUN echo "[[ -d .venv ]] && source .venv/bin/activate || export PATH=\$PATH" >> /home/vscode/.bashrc diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bbeb30b14..c17fdc169 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -24,6 +24,9 @@ } } } + }, + "features": { + "ghcr.io/devcontainers/features/node:1": {} } // Features to add to the dev container. More info: https://containers.dev/features. diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5072ba654..8728e0ccb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -2,40 +2,103 @@ name: CI on: push: branches: - - main + - '**' + - '!integrated/**' + - '!stl-preview-head/**' + - '!stl-preview-base/**' + - '!generated' + - '!codegen/**' + - 'codegen/stl/**' pull_request: - branches: - - main + branches-ignore: + - 'stl-preview-head/**' + - 'stl-preview-base/**' jobs: lint: + timeout-minutes: 10 name: lint - runs-on: ubuntu-latest - if: github.repository == 'increase/increase-python' - + runs-on: ${{ github.repository == 'stainless-sdks/increase-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v6 - name: Install Rye run: | - curl -sSf https://rye-up.com/get | bash + curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: 0.24.0 - RYE_INSTALL_OPTION: "--yes" + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' - name: Install dependencies - run: | - rye sync --all-features + run: rye sync --all-features - - name: Run ruff - run: | - rye run check:ruff + - name: Run lints + run: ./scripts/lint + + build: + if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata') + timeout-minutes: 10 + name: build + permissions: + contents: read + id-token: write + runs-on: ${{ github.repository == 'stainless-sdks/increase-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + steps: + - uses: actions/checkout@v6 - - name: Run type checking + - name: Install Rye run: | - rye run typecheck + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Install dependencies + run: rye sync --all-features - - name: Ensure importable + - name: Run build + run: rye build + + - name: Get GitHub OIDC Token + if: |- + github.repository == 'stainless-sdks/increase-python' && + !startsWith(github.ref, 'refs/heads/stl/') + id: github-oidc + uses: actions/github-script@v8 + with: + script: core.setOutput('github_token', await core.getIDToken()); + + - name: Upload tarball + if: |- + github.repository == 'stainless-sdks/increase-python' && + !startsWith(github.ref, 'refs/heads/stl/') + env: + URL: https://pkg.stainless.com/s + AUTH: ${{ steps.github-oidc.outputs.github_token }} + SHA: ${{ github.sha }} + run: ./scripts/utils/upload-artifact.sh + + test: + timeout-minutes: 10 + name: test + runs-on: ${{ github.repository == 'stainless-sdks/increase-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }} + if: github.event_name == 'push' || github.event.pull_request.head.repo.fork + steps: + - uses: actions/checkout@v6 + + - name: Install Rye run: | - rye run python -c 'import increase' + curl -sSf https://rye.astral.sh/get | bash + echo "$HOME/.rye/shims" >> $GITHUB_PATH + env: + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' + + - name: Bootstrap + run: ./scripts/bootstrap + + - name: Run tests + run: ./scripts/test diff --git a/.github/workflows/publish-pypi.yml b/.github/workflows/publish-pypi.yml index 845d40ba8..6140ad043 100644 --- a/.github/workflows/publish-pypi.yml +++ b/.github/workflows/publish-pypi.yml @@ -1,6 +1,6 @@ # This workflow is triggered when a GitHub release is created. # It can also be run manually to re-publish to PyPI in case it failed for some reason. -# You can run this workflow by navigating to https://www.github.com/increase/increase-python/actions/workflows/publish-pypi.yml +# You can run this workflow by navigating to https://www.github.com/Increase/increase-python/actions/workflows/publish-pypi.yml name: Publish PyPI on: workflow_dispatch: @@ -14,15 +14,15 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Install Rye run: | - curl -sSf https://rye-up.com/get | bash + curl -sSf https://rye.astral.sh/get | bash echo "$HOME/.rye/shims" >> $GITHUB_PATH env: - RYE_VERSION: 0.24.0 - RYE_INSTALL_OPTION: "--yes" + RYE_VERSION: '0.44.0' + RYE_INSTALL_OPTION: '--yes' - name: Publish to PyPI run: | diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index e5a4ce85a..ecb8ea851 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -1,16 +1,18 @@ name: Release Doctor on: pull_request: + branches: + - main workflow_dispatch: jobs: release_doctor: name: release doctor runs-on: ubuntu-latest - if: github.repository == 'increase/increase-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') + if: github.repository == 'Increase/increase-python' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next') steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v6 - name: Check release environment run: | diff --git a/.gitignore b/.gitignore index a4b2f8c0b..3824f4c48 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ -.vscode +.prism.log +.stdy.log _dev __pycache__ @@ -12,3 +13,4 @@ dist .env .envrc codegen.log +Brewfile.lock.json diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 563004f25..b57b68f88 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.46.0" + ".": "0.475.1" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index 83b7ea96b..cbaea0f5d 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1 +1,4 @@ -configured_endpoints: 183 +configured_endpoints: 241 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-f4f26466e66f9f8c45d2291dac32c1de360e4bb73cac74c5ea5125359dc75fa5.yml +openapi_spec_hash: 4aa51886cd76bc38a881dcea41020d99 +config_hash: d48e9f65bcf642f92610034d6c43f07a diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 000000000..5b0103078 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "python.analysis.importFormat": "relative", +} diff --git a/Brewfile b/Brewfile new file mode 100644 index 000000000..492ca37bb --- /dev/null +++ b/Brewfile @@ -0,0 +1,2 @@ +brew "rye" + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 18ff545e0..e98046a05 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,9 +2,13 @@ ### With Rye -We use [Rye](https://rye-up.com/) to manage dependencies so we highly recommend [installing it](https://rye-up.com/guide/installation/) as it will automatically provision a Python environment with the expected Python version. +We use [Rye](https://rye.astral.sh/) to manage dependencies because it will automatically provision a Python environment with the expected Python version. To set it up, run: -After installing Rye, you'll just have to run this command: +```sh +$ ./scripts/bootstrap +``` + +Or [install Rye manually](https://rye.astral.sh/guide/installation/) and run: ```sh $ rye sync --all-features @@ -13,8 +17,7 @@ $ rye sync --all-features You can then run scripts using `rye run python script.py` or by activating the virtual environment: ```sh -$ rye shell -# or manually activate - https://docs.python.org/3/library/venv.html#how-venvs-work +# Activate the virtual environment - https://docs.python.org/3/library/venv.html#how-venvs-work $ source .venv/bin/activate # now you can omit the `rye run` prefix @@ -31,25 +34,25 @@ $ pip install -r requirements-dev.lock ## Modifying/Adding code -Most of the SDK is generated code, and any modified code will be overridden on the next generation. The -`src/increase/lib/` and `examples/` directories are exceptions and will never be overridden. +Most of the SDK is generated code. Modifications to code will be persisted between generations, but may +result in merge conflicts between manual patches and changes from the generator. The generator will never +modify the contents of the `src/increase/lib/` and `examples/` directories. ## Adding and running examples -All files in the `examples/` directory are not modified by the Stainless generator and can be freely edited or -added to. +All files in the `examples/` directory are not modified by the generator and can be freely edited or added to. -```bash +```py # add an example to examples/.py #!/usr/bin/env -S rye run python … ``` -``` -chmod +x examples/.py +```sh +$ chmod +x examples/.py # run the example against your api -./examples/.py +$ ./examples/.py ``` ## Using the repository from source @@ -58,8 +61,8 @@ If you’d like to use the repository from source, you can either install from g To install via git: -```bash -pip install git+ssh://git@github.com/increase/increase-python.git +```sh +$ pip install git+ssh://git@github.com/Increase/increase-python.git ``` Alternatively, you can build from source and install the wheel file: @@ -68,29 +71,28 @@ Building this package will create two files in the `dist/` directory, a `.tar.gz To create a distributable version of the library, all you have to do is run this command: -```bash -rye build +```sh +$ rye build # or -python -m build +$ python -m build ``` Then to install: ```sh -pip install ./path-to-wheel-file.whl +$ pip install ./path-to-wheel-file.whl ``` ## Running tests -Most tests require you to [set up a mock server](https://github.com/stoplightio/prism) against the OpenAPI spec to run the tests. +Most tests require you to [set up a mock server](https://github.com/dgellow/steady) against the OpenAPI spec to run the tests. -```bash -# you will need npm installed -npx prism mock path/to/your/openapi.yml +```sh +$ ./scripts/mock ``` -```bash -rye run pytest +```sh +$ ./scripts/test ``` ## Linting and formatting @@ -100,14 +102,14 @@ This repository uses [ruff](https://github.com/astral-sh/ruff) and To lint: -```bash -rye run lint +```sh +$ ./scripts/lint ``` To format and fix all ruff issues automatically: -```bash -rye run format +```sh +$ ./scripts/format ``` ## Publishing and releases @@ -117,7 +119,7 @@ the changes aren't made through the automated pipeline, you may want to make rel ### Publish with a GitHub workflow -You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/increase/increase-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. +You can release to package managers by using [the `Publish PyPI` GitHub action](https://www.github.com/Increase/increase-python/actions/workflows/publish-pypi.yml). This requires a setup organization or repository secret to be set up. ### Publish manually diff --git a/LICENSE b/LICENSE index a979e67dd..3bdba4f51 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 Increase + Copyright 2026 Increase 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 3030bb79b..0ac52ffa5 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@ # Increase Python API library -[![PyPI version](https://img.shields.io/pypi/v/increase.svg)](https://pypi.org/project/increase/) + +[![PyPI version](https://img.shields.io/pypi/v/increase.svg?label=pypi%20(stable))](https://pypi.org/project/increase/) -The Increase Python library provides convenient access to the Increase REST API from any Python 3.7+ +The Increase Python library provides convenient access to the Increase REST API from any Python 3.9+ application. The library includes type definitions for all request params and response fields, and offers both synchronous and asynchronous clients powered by [httpx](https://github.com/encode/httpx). ## Documentation -The REST API documentation can be found [on increase.com](https://increase.com/documentation). The full API of this library can be found in [api.md](api.md). +The REST API documentation can be found on [increase.com](https://increase.com/documentation). The full API of this library can be found in [api.md](api.md). ## Installation @@ -26,14 +27,15 @@ import os from increase import Increase client = Increase( - # This is the default and can be omitted - api_key=os.environ.get("INCREASE_API_KEY"), + api_key=os.environ.get("INCREASE_API_KEY"), # This is the default and can be omitted # defaults to "production". environment="sandbox", ) account = client.accounts.create( - name="My First Increase Account", + name="New Account!", + entity_id="entity_n8y8tnk2p9339ti393yi", + program_id="program_i2v2os4mwza1oetokh9i", ) print(account.id) ``` @@ -53,8 +55,7 @@ import asyncio from increase import AsyncIncrease client = AsyncIncrease( - # This is the default and can be omitted - api_key=os.environ.get("INCREASE_API_KEY"), + api_key=os.environ.get("INCREASE_API_KEY"), # This is the default and can be omitted # defaults to "production". environment="sandbox", ) @@ -62,7 +63,9 @@ client = AsyncIncrease( async def main() -> None: account = await client.accounts.create( - name="My First Increase Account", + name="New Account!", + entity_id="entity_n8y8tnk2p9339ti393yi", + program_id="program_i2v2os4mwza1oetokh9i", ) print(account.id) @@ -72,12 +75,48 @@ asyncio.run(main()) Functionality between the synchronous and asynchronous clients is otherwise identical. +### With aiohttp + +By default, the async client uses `httpx` for HTTP requests. However, for improved concurrency performance you may also use `aiohttp` as the HTTP backend. + +You can enable this by installing `aiohttp`: + +```sh +# install from PyPI +pip install increase[aiohttp] +``` + +Then you can enable it by instantiating the client with `http_client=DefaultAioHttpClient()`: + +```python +import os +import asyncio +from increase import DefaultAioHttpClient +from increase import AsyncIncrease + + +async def main() -> None: + async with AsyncIncrease( + api_key=os.environ.get("INCREASE_API_KEY"), # This is the default and can be omitted + http_client=DefaultAioHttpClient(), + ) as client: + account = await client.accounts.create( + name="New Account!", + entity_id="entity_n8y8tnk2p9339ti393yi", + program_id="program_i2v2os4mwza1oetokh9i", + ) + print(account.id) + + +asyncio.run(main()) +``` + ## Using types -Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev), which provide helper methods for things like: +Nested request parameters are [TypedDicts](https://docs.python.org/3/library/typing.html#typing.TypedDict). Responses are [Pydantic models](https://docs.pydantic.dev) which also provide helper methods for things like: -- Serializing back into JSON, `model.model_dump_json(indent=2, exclude_unset=True)` -- Converting to a dictionary, `model.model_dump(exclude_unset=True)` +- Serializing back into JSON, `model.to_json()` +- Converting to a dictionary, `model.to_dict()` Typed requests and responses provide autocomplete and documentation within your editor. If you would like to see type errors in VS Code to help catch bugs earlier, set `python.analysis.typeCheckingMode` to `basic`. @@ -88,7 +127,7 @@ List methods in the Increase API are paginated. This library provides auto-paginating iterators with each list response, so you do not have to request successive pages manually: ```python -import increase +from increase import Increase client = Increase() @@ -104,7 +143,7 @@ Or, asynchronously: ```python import asyncio -import increase +from increase import AsyncIncrease client = AsyncIncrease() @@ -161,7 +200,7 @@ print(account.id) ## File uploads -Request parameters that correspond to file uploads can be passed as `bytes`, a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. +Request parameters that correspond to file uploads can be passed as `bytes`, or a [`PathLike`](https://docs.python.org/3/library/os.html#os.PathLike) instance or a tuple of `(filename, contents, media type)`. ```python from pathlib import Path @@ -171,7 +210,7 @@ client = Increase() client.files.create( file=Path("my/file.txt"), - purpose="other", + purpose="check_image_front", ) ``` @@ -207,7 +246,7 @@ except increase.APIStatusError as e: print(e.response) ``` -Error codes are as followed: +Error codes are as follows: | Status Code | Error Type | | ----------- | -------------------------- | @@ -239,14 +278,16 @@ client = Increase( # Or, configure per-request: client.with_options(max_retries=5).accounts.create( - name="Jack", + name="New Account!", + entity_id="entity_n8y8tnk2p9339ti393yi", + program_id="program_i2v2os4mwza1oetokh9i", ) ``` ### Timeouts By default requests time out after 1 minute. You can configure this with a `timeout` option, -which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/#fine-tuning-the-configuration) object: +which accepts a float or an [`httpx.Timeout`](https://www.python-httpx.org/advanced/timeouts/#fine-tuning-the-configuration) object: ```python from increase import Increase @@ -263,8 +304,10 @@ client = Increase( ) # Override per-request: -client.with_options(timeout=5 * 1000).accounts.list( - status="open", +client.with_options(timeout=5.0).accounts.create( + name="New Account!", + entity_id="entity_n8y8tnk2p9339ti393yi", + program_id="program_i2v2os4mwza1oetokh9i", ) ``` @@ -278,12 +321,14 @@ Note that requests that time out are [retried twice by default](#retries). We use the standard library [`logging`](https://docs.python.org/3/library/logging.html) module. -You can enable logging by setting the environment variable `INCREASE_LOG` to `debug`. +You can enable logging by setting the environment variable `INCREASE_LOG` to `info`. ```shell -$ export INCREASE_LOG=debug +$ export INCREASE_LOG=info ``` +Or to `debug` for more verbose logging. + ### How to tell whether `None` means `null` or missing In an API response, a field may be explicitly `null`, or missing entirely; in either case, its value is `None` in this library. You can differentiate the two cases with `.model_fields_set`: @@ -305,7 +350,9 @@ from increase import Increase client = Increase() response = client.accounts.with_raw_response.create( - name="My First Increase Account", + name="New Account!", + entity_id="entity_n8y8tnk2p9339ti393yi", + program_id="program_i2v2os4mwza1oetokh9i", ) print(response.headers.get('X-My-Header')) @@ -313,14 +360,9 @@ account = response.parse() # get the object that `accounts.create()` would have print(account.id) ``` -These methods return an [`LegacyAPIResponse`](https://github.com/increase/increase-python/tree/main/src/increase/_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 -async client, all methods will be async. +These methods return an [`APIResponse`](https://github.com/Increase/increase-python/tree/main/src/increase/_response.py) object. -A migration script will be provided & the migration in general should -be smooth. +The async client returns an [`AsyncAPIResponse`](https://github.com/Increase/increase-python/tree/main/src/increase/_response.py) with the same structure, the only difference being `await`able methods for reading the response content. #### `.with_streaming_response` @@ -328,11 +370,11 @@ The above interface eagerly reads the full response body when you make the reque To stream the response body, use `.with_streaming_response` instead, which requires a context manager and only reads the response body once you call `.read()`, `.text()`, `.json()`, `.iter_bytes()`, `.iter_text()`, `.iter_lines()` or `.parse()`. In the async client, these are async methods. -As such, `.with_streaming_response` methods return a different [`APIResponse`](https://github.com/increase/increase-python/tree/main/src/increase/_response.py) object, and the async client returns an [`AsyncAPIResponse`](https://github.com/increase/increase-python/tree/main/src/increase/_response.py) object. - ```python with client.accounts.with_streaming_response.create( - name="My First Increase Account", + name="New Account!", + entity_id="entity_n8y8tnk2p9339ti393yi", + program_id="program_i2v2os4mwza1oetokh9i", ) as response: print(response.headers.get("X-My-Header")) @@ -344,15 +386,14 @@ The context manager is required so that the response will reliably be closed. ### Making custom/undocumented requests -This library is typed for convenient access the documented API. +This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used. #### 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 @@ -366,12 +407,12 @@ response = client.post( print(response.headers.get("x-foo")) ``` -#### Undocumented params +#### Undocumented request params If you want to explicitly send an extra param, you can do so with the `extra_query`, `extra_body`, and `extra_headers` request options. -#### Undocumented properties +#### Undocumented response properties To access undocumented response properties, you can access the extra fields like `response.unknown_prop`. You can also get all the extra fields on the Pydantic model as a dict with @@ -381,40 +422,71 @@ can also get all the extra fields on the Pydantic model as a dict with You can directly override the [httpx client](https://www.python-httpx.org/api/#client) to customize it for your use case, including: -- Support for proxies -- Custom transports -- Additional [advanced](https://www.python-httpx.org/advanced/#client-instances) functionality +- Support for [proxies](https://www.python-httpx.org/advanced/proxies/) +- Custom [transports](https://www.python-httpx.org/advanced/transports/) +- Additional [advanced](https://www.python-httpx.org/advanced/clients/) functionality ```python import httpx -from increase import Increase +from increase import Increase, DefaultHttpxClient client = Increase( # Or use the `INCREASE_BASE_URL` env var base_url="http://my.test.server.example.com:8083", - http_client=httpx.Client( - proxies="http://my.test.proxy.example.com", + http_client=DefaultHttpxClient( + proxy="http://my.test.proxy.example.com", transport=httpx.HTTPTransport(local_address="0.0.0.0"), ), ) ``` +You can also customize the client on a per-request basis by using `with_options()`: + +```python +client.with_options(http_client=DefaultHttpxClient(...)) +``` + ### Managing HTTP resources 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 increase import Increase + +with Increase() 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. -We are keen for your feedback; please open an [issue](https://www.github.com/increase/increase-python/issues) with questions, bugs, or suggestions. +We are keen for your feedback; please open an [issue](https://www.github.com/Increase/increase-python/issues) with questions, bugs, or suggestions. + +### Determining the installed version + +If you've upgraded to the latest version but aren't seeing any new features you were expecting then your python environment is likely still using an older version. + +You can determine the version that is being used at runtime with: + +```py +import increase +print(increase.__version__) +``` ## Requirements -Python 3.7 or higher. +Python 3.9 or higher. + +## Contributing + +See [the contributing documentation](./CONTRIBUTING.md). diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 000000000..5a4b96c56 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,27 @@ +# Security Policy + +## Reporting Security Issues + +This SDK is generated by [Stainless Software Inc](http://stainless.com). Stainless takes security seriously, and encourages you to report any security vulnerability promptly so that appropriate action can be taken. + +To report a security issue, please contact the Stainless team at security@stainless.com. + +## Responsible Disclosure + +We appreciate the efforts of security researchers and individuals who help us maintain the security of +SDKs we generate. If you believe you have found a security vulnerability, please adhere to responsible +disclosure practices by allowing us a reasonable amount of time to investigate and address the issue +before making any information public. + +## Reporting Non-SDK Related Security Issues + +If you encounter security issues that are not directly related to SDKs but pertain to the services +or products provided by Increase, please follow the respective company's security reporting guidelines. + +### Increase Terms and Policies + +Please contact dev-feedback@increase.com for any questions or concerns regarding the security of our services. + +--- + +Thank you for helping us keep the SDKs and systems they interact with secure. diff --git a/api.md b/api.md index 96af7b92d..a3952130d 100644 --- a/api.md +++ b/api.md @@ -30,90 +30,65 @@ Methods: - client.account_numbers.update(account_number_id, \*\*params) -> AccountNumber - client.account_numbers.list(\*\*params) -> SyncPage[AccountNumber] -# BookkeepingAccounts - -Types: - -```python -from increase.types import BookkeepingAccount, BookkeepingBalanceLookup -``` - -Methods: - -- client.bookkeeping_accounts.create(\*\*params) -> BookkeepingAccount -- client.bookkeeping_accounts.update(bookkeeping_account_id, \*\*params) -> BookkeepingAccount -- client.bookkeeping_accounts.list(\*\*params) -> SyncPage[BookkeepingAccount] -- client.bookkeeping_accounts.balance(bookkeeping_account_id, \*\*params) -> BookkeepingBalanceLookup - -# BookkeepingEntrySets - -Types: - -```python -from increase.types import BookkeepingEntrySet -``` - -Methods: - -- client.bookkeeping_entry_sets.create(\*\*params) -> BookkeepingEntrySet -- client.bookkeeping_entry_sets.retrieve(bookkeeping_entry_set_id) -> BookkeepingEntrySet -- client.bookkeeping_entry_sets.list(\*\*params) -> SyncPage[BookkeepingEntrySet] - -# BookkeepingEntries +# AccountTransfers Types: ```python -from increase.types import BookkeepingEntry +from increase.types import AccountTransfer ``` Methods: -- client.bookkeeping_entries.retrieve(bookkeeping_entry_id) -> BookkeepingEntry -- client.bookkeeping_entries.list(\*\*params) -> SyncPage[BookkeepingEntry] +- client.account_transfers.create(\*\*params) -> AccountTransfer +- client.account_transfers.retrieve(account_transfer_id) -> AccountTransfer +- client.account_transfers.list(\*\*params) -> SyncPage[AccountTransfer] +- client.account_transfers.approve(account_transfer_id) -> AccountTransfer +- client.account_transfers.cancel(account_transfer_id) -> AccountTransfer -# RealTimeDecisions +# Cards Types: ```python -from increase.types import RealTimeDecision +from increase.types import Card, CardDetails, CardIframeURL ``` Methods: -- client.real_time_decisions.retrieve(real_time_decision_id) -> RealTimeDecision -- client.real_time_decisions.action(real_time_decision_id, \*\*params) -> RealTimeDecision +- client.cards.create(\*\*params) -> Card +- client.cards.retrieve(card_id) -> Card +- client.cards.update(card_id, \*\*params) -> Card +- client.cards.list(\*\*params) -> SyncPage[Card] +- client.cards.create_details_iframe(card_id, \*\*params) -> CardIframeURL +- client.cards.details(card_id) -> CardDetails +- client.cards.update_pin(card_id, \*\*params) -> CardDetails -# RealTimePaymentsTransfers +# CardPayments Types: ```python -from increase.types import RealTimePaymentsTransfer +from increase.types import CardPayment ``` Methods: -- client.real_time_payments_transfers.create(\*\*params) -> RealTimePaymentsTransfer -- client.real_time_payments_transfers.retrieve(real_time_payments_transfer_id) -> RealTimePaymentsTransfer -- client.real_time_payments_transfers.list(\*\*params) -> SyncPage[RealTimePaymentsTransfer] +- client.card_payments.retrieve(card_payment_id) -> CardPayment +- client.card_payments.list(\*\*params) -> SyncPage[CardPayment] -# Cards +# CardPurchaseSupplements Types: ```python -from increase.types import Card, CardDetails +from increase.types import CardPurchaseSupplement ``` Methods: -- client.cards.create(\*\*params) -> Card -- client.cards.retrieve(card_id) -> Card -- client.cards.update(card_id, \*\*params) -> Card -- client.cards.list(\*\*params) -> SyncPage[Card] -- client.cards.retrieve_sensitive_details(card_id) -> CardDetails +- client.card_purchase_supplements.retrieve(card_purchase_supplement_id) -> CardPurchaseSupplement +- client.card_purchase_supplements.list(\*\*params) -> SyncPage[CardPurchaseSupplement] # CardDisputes @@ -128,48 +103,55 @@ Methods: - client.card_disputes.create(\*\*params) -> CardDispute - client.card_disputes.retrieve(card_dispute_id) -> CardDispute - client.card_disputes.list(\*\*params) -> SyncPage[CardDispute] +- client.card_disputes.submit_user_submission(card_dispute_id, \*\*params) -> CardDispute +- client.card_disputes.withdraw(card_dispute_id, \*\*params) -> CardDispute -# CardPurchaseSupplements +# PhysicalCards Types: ```python -from increase.types import CardPurchaseSupplement +from increase.types import PhysicalCard ``` Methods: -- client.card_purchase_supplements.retrieve(card_purchase_supplement_id) -> CardPurchaseSupplement -- client.card_purchase_supplements.list(\*\*params) -> SyncPage[CardPurchaseSupplement] +- client.physical_cards.create(\*\*params) -> PhysicalCard +- client.physical_cards.retrieve(physical_card_id) -> PhysicalCard +- client.physical_cards.update(physical_card_id, \*\*params) -> PhysicalCard +- client.physical_cards.list(\*\*params) -> SyncPage[PhysicalCard] -# ExternalAccounts +# DigitalCardProfiles Types: ```python -from increase.types import ExternalAccount +from increase.types import DigitalCardProfile ``` Methods: -- client.external_accounts.create(\*\*params) -> ExternalAccount -- client.external_accounts.retrieve(external_account_id) -> ExternalAccount -- client.external_accounts.update(external_account_id, \*\*params) -> ExternalAccount -- client.external_accounts.list(\*\*params) -> SyncPage[ExternalAccount] +- client.digital_card_profiles.create(\*\*params) -> DigitalCardProfile +- client.digital_card_profiles.retrieve(digital_card_profile_id) -> DigitalCardProfile +- client.digital_card_profiles.list(\*\*params) -> SyncPage[DigitalCardProfile] +- client.digital_card_profiles.archive(digital_card_profile_id) -> DigitalCardProfile +- client.digital_card_profiles.clone(digital_card_profile_id, \*\*params) -> DigitalCardProfile -# Exports +# PhysicalCardProfiles Types: ```python -from increase.types import Export +from increase.types import PhysicalCardProfile ``` Methods: -- client.exports.create(\*\*params) -> Export -- client.exports.retrieve(export_id) -> Export -- client.exports.list(\*\*params) -> SyncPage[Export] +- client.physical_card_profiles.create(\*\*params) -> PhysicalCardProfile +- client.physical_card_profiles.retrieve(physical_card_profile_id) -> PhysicalCardProfile +- client.physical_card_profiles.list(\*\*params) -> SyncPage[PhysicalCardProfile] +- client.physical_card_profiles.archive(physical_card_profile_id) -> PhysicalCardProfile +- client.physical_card_profiles.clone(physical_card_profile_id, \*\*params) -> PhysicalCardProfile # DigitalWalletTokens @@ -207,21 +189,10 @@ from increase.types import PendingTransaction Methods: +- client.pending_transactions.create(\*\*params) -> PendingTransaction - client.pending_transactions.retrieve(pending_transaction_id) -> PendingTransaction - client.pending_transactions.list(\*\*params) -> SyncPage[PendingTransaction] - -# Programs - -Types: - -```python -from increase.types import Program -``` - -Methods: - -- client.programs.retrieve(program_id) -> Program -- client.programs.list(\*\*params) -> SyncPage[Program] +- client.pending_transactions.release(pending_transaction_id) -> PendingTransaction # DeclinedTransactions @@ -236,22 +207,6 @@ Methods: - client.declined_transactions.retrieve(declined_transaction_id) -> DeclinedTransaction - client.declined_transactions.list(\*\*params) -> SyncPage[DeclinedTransaction] -# AccountTransfers - -Types: - -```python -from increase.types import AccountTransfer -``` - -Methods: - -- client.account_transfers.create(\*\*params) -> AccountTransfer -- client.account_transfers.retrieve(account_transfer_id) -> AccountTransfer -- client.account_transfers.list(\*\*params) -> SyncPage[AccountTransfer] -- client.account_transfers.approve(account_transfer_id) -> AccountTransfer -- client.account_transfers.cancel(account_transfer_id) -> AccountTransfer - # ACHTransfers Types: @@ -282,18 +237,21 @@ Methods: - client.ach_prenotifications.retrieve(ach_prenotification_id) -> ACHPrenotification - client.ach_prenotifications.list(\*\*params) -> SyncPage[ACHPrenotification] -# Documents +# InboundACHTransfers Types: ```python -from increase.types import Document +from increase.types import InboundACHTransfer ``` Methods: -- client.documents.retrieve(document_id) -> Document -- client.documents.list(\*\*params) -> SyncPage[Document] +- client.inbound_ach_transfers.retrieve(inbound_ach_transfer_id) -> InboundACHTransfer +- client.inbound_ach_transfers.list(\*\*params) -> SyncPage[InboundACHTransfer] +- client.inbound_ach_transfers.create_notification_of_change(inbound_ach_transfer_id, \*\*params) -> InboundACHTransfer +- client.inbound_ach_transfers.decline(inbound_ach_transfer_id, \*\*params) -> InboundACHTransfer +- client.inbound_ach_transfers.transfer_return(inbound_ach_transfer_id, \*\*params) -> InboundACHTransfer # WireTransfers @@ -310,534 +268,790 @@ Methods: - client.wire_transfers.list(\*\*params) -> SyncPage[WireTransfer] - client.wire_transfers.approve(wire_transfer_id) -> WireTransfer - client.wire_transfers.cancel(wire_transfer_id) -> WireTransfer -- client.wire_transfers.reverse(wire_transfer_id) -> WireTransfer -- client.wire_transfers.submit(wire_transfer_id) -> WireTransfer -# CheckTransfers +# InboundWireTransfers Types: ```python -from increase.types import CheckTransfer +from increase.types import InboundWireTransfer ``` Methods: -- client.check_transfers.create(\*\*params) -> CheckTransfer -- client.check_transfers.retrieve(check_transfer_id) -> CheckTransfer -- client.check_transfers.list(\*\*params) -> SyncPage[CheckTransfer] -- client.check_transfers.approve(check_transfer_id) -> CheckTransfer -- client.check_transfers.cancel(check_transfer_id) -> CheckTransfer -- client.check_transfers.stop_payment(check_transfer_id, \*\*params) -> CheckTransfer +- client.inbound_wire_transfers.retrieve(inbound_wire_transfer_id) -> InboundWireTransfer +- client.inbound_wire_transfers.list(\*\*params) -> SyncPage[InboundWireTransfer] +- client.inbound_wire_transfers.reverse(inbound_wire_transfer_id, \*\*params) -> InboundWireTransfer -# Entities +# WireDrawdownRequests Types: ```python -from increase.types import Entity +from increase.types import WireDrawdownRequest ``` Methods: -- client.entities.create(\*\*params) -> Entity -- client.entities.retrieve(entity_id) -> Entity -- client.entities.list(\*\*params) -> SyncPage[Entity] -- client.entities.archive(entity_id) -> Entity -- client.entities.confirm(entity_id, \*\*params) -> Entity -- client.entities.update_address(entity_id, \*\*params) -> Entity +- client.wire_drawdown_requests.create(\*\*params) -> WireDrawdownRequest +- client.wire_drawdown_requests.retrieve(wire_drawdown_request_id) -> WireDrawdownRequest +- client.wire_drawdown_requests.list(\*\*params) -> SyncPage[WireDrawdownRequest] + +# InboundWireDrawdownRequests + +Types: -## BeneficialOwners +```python +from increase.types import InboundWireDrawdownRequest +``` Methods: -- client.entities.beneficial_owners.create(\*\*params) -> Entity -- client.entities.beneficial_owners.archive(\*\*params) -> Entity -- client.entities.beneficial_owners.update_address(\*\*params) -> Entity +- client.inbound_wire_drawdown_requests.retrieve(inbound_wire_drawdown_request_id) -> InboundWireDrawdownRequest +- client.inbound_wire_drawdown_requests.list(\*\*params) -> SyncPage[InboundWireDrawdownRequest] -## SupplementalDocuments +# CheckTransfers Types: ```python -from increase.types.entities import SupplementalDocument +from increase.types import CheckTransfer ``` Methods: -- client.entities.supplemental_documents.create(entity_id, \*\*params) -> Entity -- client.entities.supplemental_documents.list(\*\*params) -> SyncPage[SupplementalDocument] +- client.check_transfers.create(\*\*params) -> CheckTransfer +- client.check_transfers.retrieve(check_transfer_id) -> CheckTransfer +- client.check_transfers.list(\*\*params) -> SyncPage[CheckTransfer] +- client.check_transfers.approve(check_transfer_id) -> CheckTransfer +- client.check_transfers.cancel(check_transfer_id) -> CheckTransfer +- client.check_transfers.stop_payment(check_transfer_id, \*\*params) -> CheckTransfer + +# InboundCheckDeposits + +Types: -## IndustryCode +```python +from increase.types import InboundCheckDeposit +``` Methods: -- client.entities.industry_code.create(entity_id, \*\*params) -> Entity +- client.inbound_check_deposits.retrieve(inbound_check_deposit_id) -> InboundCheckDeposit +- client.inbound_check_deposits.list(\*\*params) -> SyncPage[InboundCheckDeposit] +- client.inbound_check_deposits.decline(inbound_check_deposit_id) -> InboundCheckDeposit +- client.inbound*check_deposits.return*(inbound_check_deposit_id, \*\*params) -> InboundCheckDeposit -# InboundACHTransfers +# RealTimePaymentsTransfers Types: ```python -from increase.types import InboundACHTransfer +from increase.types import RealTimePaymentsTransfer ``` Methods: -- client.inbound_ach_transfers.retrieve(inbound_ach_transfer_id) -> InboundACHTransfer -- client.inbound_ach_transfers.list(\*\*params) -> SyncPage[InboundACHTransfer] -- client.inbound_ach_transfers.decline(inbound_ach_transfer_id) -> InboundACHTransfer -- client.inbound_ach_transfers.notification_of_change(inbound_ach_transfer_id, \*\*params) -> InboundACHTransfer -- client.inbound_ach_transfers.transfer_return(inbound_ach_transfer_id, \*\*params) -> InboundACHTransfer +- client.real_time_payments_transfers.create(\*\*params) -> RealTimePaymentsTransfer +- client.real_time_payments_transfers.retrieve(real_time_payments_transfer_id) -> RealTimePaymentsTransfer +- client.real_time_payments_transfers.list(\*\*params) -> SyncPage[RealTimePaymentsTransfer] +- client.real_time_payments_transfers.approve(real_time_payments_transfer_id) -> RealTimePaymentsTransfer +- client.real_time_payments_transfers.cancel(real_time_payments_transfer_id) -> RealTimePaymentsTransfer -# InboundWireDrawdownRequests +# InboundRealTimePaymentsTransfers Types: ```python -from increase.types import InboundWireDrawdownRequest +from increase.types import InboundRealTimePaymentsTransfer ``` Methods: -- client.inbound_wire_drawdown_requests.retrieve(inbound_wire_drawdown_request_id) -> InboundWireDrawdownRequest -- client.inbound_wire_drawdown_requests.list(\*\*params) -> SyncPage[InboundWireDrawdownRequest] +- client.inbound_real_time_payments_transfers.retrieve(inbound_real_time_payments_transfer_id) -> InboundRealTimePaymentsTransfer +- client.inbound_real_time_payments_transfers.list(\*\*params) -> SyncPage[InboundRealTimePaymentsTransfer] -# WireDrawdownRequests +# FednowTransfers Types: ```python -from increase.types import WireDrawdownRequest +from increase.types import FednowTransfer ``` Methods: -- client.wire_drawdown_requests.create(\*\*params) -> WireDrawdownRequest -- client.wire_drawdown_requests.retrieve(wire_drawdown_request_id) -> WireDrawdownRequest -- client.wire_drawdown_requests.list(\*\*params) -> SyncPage[WireDrawdownRequest] +- client.fednow_transfers.create(\*\*params) -> FednowTransfer +- client.fednow_transfers.retrieve(fednow_transfer_id) -> FednowTransfer +- client.fednow_transfers.list(\*\*params) -> SyncPage[FednowTransfer] +- client.fednow_transfers.approve(fednow_transfer_id) -> FednowTransfer +- client.fednow_transfers.cancel(fednow_transfer_id) -> FednowTransfer -# Events +# InboundFednowTransfers Types: ```python -from increase.types import Event +from increase.types import InboundFednowTransfer ``` Methods: -- client.events.retrieve(event_id) -> Event -- client.events.list(\*\*params) -> SyncPage[Event] +- client.inbound_fednow_transfers.retrieve(inbound_fednow_transfer_id) -> InboundFednowTransfer +- client.inbound_fednow_transfers.list(\*\*params) -> SyncPage[InboundFednowTransfer] -# EventSubscriptions +# SwiftTransfers Types: ```python -from increase.types import EventSubscription +from increase.types import SwiftTransfer ``` Methods: -- client.event_subscriptions.create(\*\*params) -> EventSubscription -- client.event_subscriptions.retrieve(event_subscription_id) -> EventSubscription -- client.event_subscriptions.update(event_subscription_id, \*\*params) -> EventSubscription -- client.event_subscriptions.list(\*\*params) -> SyncPage[EventSubscription] +- client.swift_transfers.create(\*\*params) -> SwiftTransfer +- client.swift_transfers.retrieve(swift_transfer_id) -> SwiftTransfer +- client.swift_transfers.list(\*\*params) -> SyncPage[SwiftTransfer] +- client.swift_transfers.approve(swift_transfer_id) -> SwiftTransfer +- client.swift_transfers.cancel(swift_transfer_id) -> SwiftTransfer -# Files +# CheckDeposits Types: ```python -from increase.types import File +from increase.types import CheckDeposit ``` Methods: -- client.files.create(\*\*params) -> File -- client.files.retrieve(file_id) -> File -- client.files.list(\*\*params) -> SyncPage[File] +- client.check_deposits.create(\*\*params) -> CheckDeposit +- client.check_deposits.retrieve(check_deposit_id) -> CheckDeposit +- client.check_deposits.list(\*\*params) -> SyncPage[CheckDeposit] -# Groups +# Lockboxes Types: ```python -from increase.types import Group +from increase.types import Lockbox ``` Methods: -- client.groups.retrieve_details() -> Group +- client.lockboxes.create(\*\*params) -> Lockbox +- client.lockboxes.retrieve(lockbox_id) -> Lockbox +- client.lockboxes.update(lockbox_id, \*\*params) -> Lockbox +- client.lockboxes.list(\*\*params) -> SyncPage[Lockbox] -# OAuthConnections +# InboundMailItems Types: ```python -from increase.types import OAuthConnection +from increase.types import InboundMailItem ``` Methods: -- client.oauth_connections.retrieve(oauth_connection_id) -> OAuthConnection -- client.oauth_connections.list(\*\*params) -> SyncPage[OAuthConnection] +- client.inbound_mail_items.retrieve(inbound_mail_item_id) -> InboundMailItem +- client.inbound_mail_items.list(\*\*params) -> SyncPage[InboundMailItem] +- client.inbound_mail_items.action(inbound_mail_item_id, \*\*params) -> InboundMailItem -# CheckDeposits +# RoutingNumbers Types: ```python -from increase.types import CheckDeposit +from increase.types import RoutingNumberListResponse ``` Methods: -- client.check_deposits.create(\*\*params) -> CheckDeposit -- client.check_deposits.retrieve(check_deposit_id) -> CheckDeposit -- client.check_deposits.list(\*\*params) -> SyncPage[CheckDeposit] +- client.routing_numbers.list(\*\*params) -> SyncPage[RoutingNumberListResponse] -# RoutingNumbers +# ExternalAccounts Types: ```python -from increase.types import RoutingNumber +from increase.types import ExternalAccount ``` Methods: -- client.routing_numbers.list(\*\*params) -> SyncPage[RoutingNumber] +- client.external_accounts.create(\*\*params) -> ExternalAccount +- client.external_accounts.retrieve(external_account_id) -> ExternalAccount +- client.external_accounts.update(external_account_id, \*\*params) -> ExternalAccount +- client.external_accounts.list(\*\*params) -> SyncPage[ExternalAccount] -# AccountStatements +# Entities Types: ```python -from increase.types import AccountStatement +from increase.types import Entity ``` Methods: -- client.account_statements.retrieve(account_statement_id) -> AccountStatement -- client.account_statements.list(\*\*params) -> SyncPage[AccountStatement] - -# Simulations +- client.entities.create(\*\*params) -> Entity +- client.entities.retrieve(entity_id) -> Entity +- client.entities.update(entity_id, \*\*params) -> Entity +- client.entities.list(\*\*params) -> SyncPage[Entity] +- client.entities.archive(entity_id) -> Entity -Methods: +# BeneficialOwners -- client.simulations.card_authorization_expirations(\*\*params) -> CardPayment -- client.simulations.card_fuel_confirmations(\*\*params) -> CardPayment -- client.simulations.card_increments(\*\*params) -> CardPayment -- client.simulations.card_reversals(\*\*params) -> CardPayment +Types: -## AccountTransfers +```python +from increase.types import EntityBeneficialOwner +``` Methods: -- client.simulations.account_transfers.complete(account_transfer_id) -> AccountTransfer - -## AccountStatements +- client.beneficial_owners.create(\*\*params) -> EntityBeneficialOwner +- client.beneficial_owners.retrieve(entity_beneficial_owner_id) -> EntityBeneficialOwner +- client.beneficial_owners.update(entity_beneficial_owner_id, \*\*params) -> EntityBeneficialOwner +- client.beneficial_owners.list(\*\*params) -> SyncPage[EntityBeneficialOwner] +- client.beneficial_owners.archive(entity_beneficial_owner_id) -> EntityBeneficialOwner -Methods: +# SupplementalDocuments -- client.simulations.account_statements.create(\*\*params) -> AccountStatement +Types: -## ACHTransfers +```python +from increase.types import EntitySupplementalDocument +``` Methods: -- client.simulations.ach_transfers.create_inbound(\*\*params) -> InboundACHTransfer -- client.simulations.ach*transfers.return*(ach_transfer_id, \*\*params) -> ACHTransfer -- client.simulations.ach_transfers.submit(ach_transfer_id) -> ACHTransfer +- client.supplemental_documents.create(\*\*params) -> EntitySupplementalDocument +- client.supplemental_documents.list(\*\*params) -> SyncPage[EntitySupplementalDocument] -## CardDisputes - -Methods: +# EntityOnboardingSessions -- client.simulations.card_disputes.action(card_dispute_id, \*\*params) -> CardDispute +Types: -## CardRefunds +```python +from increase.types import EntityOnboardingSession +``` Methods: -- client.simulations.card_refunds.create(\*\*params) -> Transaction - -## CheckTransfers +- client.entity_onboarding_sessions.create(\*\*params) -> EntityOnboardingSession +- client.entity_onboarding_sessions.retrieve(entity_onboarding_session_id) -> EntityOnboardingSession +- client.entity_onboarding_sessions.list(\*\*params) -> SyncPage[EntityOnboardingSession] +- client.entity_onboarding_sessions.expire(entity_onboarding_session_id) -> EntityOnboardingSession -Methods: +# Programs -- client.simulations.check_transfers.deposit(check_transfer_id) -> CheckTransfer -- client.simulations.check_transfers.mail(check_transfer_id) -> CheckTransfer +Types: -## Documents +```python +from increase.types import Program +``` Methods: -- client.simulations.documents.create(\*\*params) -> Document +- client.programs.retrieve(program_id) -> Program +- client.programs.list(\*\*params) -> SyncPage[Program] -## DigitalWalletTokenRequests +# AccountStatements Types: ```python -from increase.types.simulations import DigitalWalletTokenRequestCreateResponse +from increase.types import AccountStatement ``` Methods: -- client.simulations.digital_wallet_token_requests.create(\*\*params) -> DigitalWalletTokenRequestCreateResponse - -## CheckDeposits +- client.account_statements.retrieve(account_statement_id) -> AccountStatement +- client.account_statements.list(\*\*params) -> SyncPage[AccountStatement] -Methods: +# Files -- client.simulations.check_deposits.reject(check_deposit_id) -> CheckDeposit -- client.simulations.check*deposits.return*(check_deposit_id) -> CheckDeposit -- client.simulations.check_deposits.submit(check_deposit_id) -> CheckDeposit +Types: -## Programs +```python +from increase.types import File +``` Methods: -- client.simulations.programs.create(\*\*params) -> Program +- client.files.create(\*\*params) -> File +- client.files.retrieve(file_id) -> File +- client.files.list(\*\*params) -> SyncPage[File] -## InboundWireDrawdownRequests +# FileLinks + +Types: + +```python +from increase.types import FileLink +``` Methods: -- client.simulations.inbound_wire_drawdown_requests.create(\*\*params) -> InboundWireDrawdownRequest +- client.file_links.create(\*\*params) -> FileLink -## InboundFundsHolds +# Exports Types: ```python -from increase.types.simulations import InboundFundsHoldReleaseResponse +from increase.types import Export ``` Methods: -- client.simulations.inbound_funds_holds.release(inbound_funds_hold_id) -> InboundFundsHoldReleaseResponse +- client.exports.create(\*\*params) -> Export +- client.exports.retrieve(export_id) -> Export +- client.exports.list(\*\*params) -> SyncPage[Export] -## InterestPayments +# Events + +Types: + +```python +from increase.types import Event, UnwrapWebhookEvent +``` Methods: -- client.simulations.interest_payments.create(\*\*params) -> Transaction +- client.events.retrieve(event_id) -> Event +- client.events.list(\*\*params) -> SyncPage[Event] -## WireTransfers +# EventSubscriptions + +Types: + +```python +from increase.types import EventSubscription +``` Methods: -- client.simulations.wire_transfers.create_inbound(\*\*params) -> InboundWireTransfer +- client.event_subscriptions.create(\*\*params) -> EventSubscription +- client.event_subscriptions.retrieve(event_subscription_id) -> EventSubscription +- client.event_subscriptions.update(event_subscription_id, \*\*params) -> EventSubscription +- client.event_subscriptions.list(\*\*params) -> SyncPage[EventSubscription] -## Cards +# RealTimeDecisions Types: ```python -from increase.types.simulations import CardAuthorizationSimulation +from increase.types import RealTimeDecision ``` Methods: -- client.simulations.cards.authorize(\*\*params) -> CardAuthorizationSimulation -- client.simulations.cards.settlement(\*\*params) -> Transaction +- client.real_time_decisions.retrieve(real_time_decision_id) -> RealTimeDecision +- client.real_time_decisions.action(real_time_decision_id, \*\*params) -> RealTimeDecision -## RealTimePaymentsTransfers +# BookkeepingAccounts Types: ```python -from increase.types.simulations import InboundRealTimePaymentsTransferSimulationResult +from increase.types import BookkeepingAccount, BookkeepingBalanceLookup ``` Methods: -- client.simulations.real_time_payments_transfers.complete(real_time_payments_transfer_id, \*\*params) -> RealTimePaymentsTransfer -- client.simulations.real_time_payments_transfers.create_inbound(\*\*params) -> InboundRealTimePaymentsTransferSimulationResult +- client.bookkeeping_accounts.create(\*\*params) -> BookkeepingAccount +- client.bookkeeping_accounts.update(bookkeeping_account_id, \*\*params) -> BookkeepingAccount +- client.bookkeeping_accounts.list(\*\*params) -> SyncPage[BookkeepingAccount] +- client.bookkeeping_accounts.balance(bookkeeping_account_id, \*\*params) -> BookkeepingBalanceLookup -## PhysicalCards +# BookkeepingEntrySets + +Types: + +```python +from increase.types import BookkeepingEntrySet +``` Methods: -- client.simulations.physical_cards.shipment_advance(physical_card_id, \*\*params) -> PhysicalCard +- client.bookkeeping_entry_sets.create(\*\*params) -> BookkeepingEntrySet +- client.bookkeeping_entry_sets.retrieve(bookkeeping_entry_set_id) -> BookkeepingEntrySet +- client.bookkeeping_entry_sets.list(\*\*params) -> SyncPage[BookkeepingEntrySet] -# PhysicalCards +# BookkeepingEntries Types: ```python -from increase.types import PhysicalCard +from increase.types import BookkeepingEntry ``` Methods: -- client.physical_cards.create(\*\*params) -> PhysicalCard -- client.physical_cards.retrieve(physical_card_id) -> PhysicalCard -- client.physical_cards.update(physical_card_id, \*\*params) -> PhysicalCard -- client.physical_cards.list(\*\*params) -> SyncPage[PhysicalCard] +- client.bookkeeping_entries.retrieve(bookkeeping_entry_id) -> BookkeepingEntry +- client.bookkeeping_entries.list(\*\*params) -> SyncPage[BookkeepingEntry] -# CardPayments +# Groups Types: ```python -from increase.types import CardPayment +from increase.types import Group ``` Methods: -- client.card_payments.retrieve(card_payment_id) -> CardPayment -- client.card_payments.list(\*\*params) -> SyncPage[CardPayment] +- client.groups.retrieve() -> Group -# ProofOfAuthorizationRequests +# OAuthApplications Types: ```python -from increase.types import ProofOfAuthorizationRequest +from increase.types import OAuthApplication ``` Methods: -- client.proof_of_authorization_requests.retrieve(proof_of_authorization_request_id) -> ProofOfAuthorizationRequest -- client.proof_of_authorization_requests.list(\*\*params) -> SyncPage[ProofOfAuthorizationRequest] +- client.oauth_applications.retrieve(oauth_application_id) -> OAuthApplication +- client.oauth_applications.list(\*\*params) -> SyncPage[OAuthApplication] -# ProofOfAuthorizationRequestSubmissions +# OAuthConnections Types: ```python -from increase.types import ProofOfAuthorizationRequestSubmission +from increase.types import OAuthConnection ``` Methods: -- client.proof_of_authorization_request_submissions.create(\*\*params) -> ProofOfAuthorizationRequestSubmission -- client.proof_of_authorization_request_submissions.retrieve(proof_of_authorization_request_submission_id) -> ProofOfAuthorizationRequestSubmission -- client.proof_of_authorization_request_submissions.list(\*\*params) -> SyncPage[ProofOfAuthorizationRequestSubmission] - -# Intrafi +- client.oauth_connections.retrieve(oauth_connection_id) -> OAuthConnection +- client.oauth_connections.list(\*\*params) -> SyncPage[OAuthConnection] -## AccountEnrollments +# OAuthTokens Types: ```python -from increase.types.intrafi import IntrafiAccountEnrollment +from increase.types import OAuthToken ``` Methods: -- client.intrafi.account_enrollments.create(\*\*params) -> IntrafiAccountEnrollment -- client.intrafi.account_enrollments.retrieve(intrafi_account_enrollment_id) -> IntrafiAccountEnrollment -- client.intrafi.account_enrollments.list(\*\*params) -> SyncPage[IntrafiAccountEnrollment] -- client.intrafi.account_enrollments.unenroll(intrafi_account_enrollment_id) -> IntrafiAccountEnrollment +- client.oauth_tokens.create(\*\*params) -> OAuthToken -## Balances +# IntrafiAccountEnrollments Types: ```python -from increase.types.intrafi import IntrafiBalance +from increase.types import IntrafiAccountEnrollment ``` Methods: -- client.intrafi.balances.retrieve(account_id) -> IntrafiBalance +- client.intrafi_account_enrollments.create(\*\*params) -> IntrafiAccountEnrollment +- client.intrafi_account_enrollments.retrieve(intrafi_account_enrollment_id) -> IntrafiAccountEnrollment +- client.intrafi_account_enrollments.list(\*\*params) -> SyncPage[IntrafiAccountEnrollment] +- client.intrafi_account_enrollments.unenroll(intrafi_account_enrollment_id) -> IntrafiAccountEnrollment -## Exclusions +# IntrafiBalances Types: ```python -from increase.types.intrafi import IntrafiExclusion +from increase.types import IntrafiBalance ``` Methods: -- client.intrafi.exclusions.create(\*\*params) -> IntrafiExclusion -- client.intrafi.exclusions.retrieve(intrafi_exclusion_id) -> IntrafiExclusion -- client.intrafi.exclusions.list(\*\*params) -> SyncPage[IntrafiExclusion] -- client.intrafi.exclusions.archive(intrafi_exclusion_id) -> IntrafiExclusion +- client.intrafi_balances.intrafi_balance(account_id) -> IntrafiBalance -# RealTimePaymentsRequestForPayments +# IntrafiExclusions Types: ```python -from increase.types import RealTimePaymentsRequestForPayment +from increase.types import IntrafiExclusion ``` Methods: -- client.real_time_payments_request_for_payments.create(\*\*params) -> RealTimePaymentsRequestForPayment -- client.real_time_payments_request_for_payments.retrieve(request_for_payment_id) -> RealTimePaymentsRequestForPayment -- client.real_time_payments_request_for_payments.list(\*\*params) -> SyncPage[RealTimePaymentsRequestForPayment] +- client.intrafi_exclusions.create(\*\*params) -> IntrafiExclusion +- client.intrafi_exclusions.retrieve(intrafi_exclusion_id) -> IntrafiExclusion +- client.intrafi_exclusions.list(\*\*params) -> SyncPage[IntrafiExclusion] +- client.intrafi_exclusions.archive(intrafi_exclusion_id) -> IntrafiExclusion -# Webhooks +# CardTokens + +Types: + +```python +from increase.types import CardToken, CardTokenCapabilities +``` Methods: -- client.webhooks.unwrap(\*args) -> object -- client.webhooks.verify_signature(\*args) -> None +- client.card_tokens.retrieve(card_token_id) -> CardToken +- client.card_tokens.list(\*\*params) -> SyncPage[CardToken] +- client.card_tokens.capabilities(card_token_id) -> CardTokenCapabilities -# OAuthTokens +# CardPushTransfers Types: ```python -from increase.types import OAuthToken +from increase.types import CardPushTransfer ``` Methods: -- client.oauth_tokens.create(\*\*params) -> OAuthToken +- client.card_push_transfers.create(\*\*params) -> CardPushTransfer +- client.card_push_transfers.retrieve(card_push_transfer_id) -> CardPushTransfer +- client.card_push_transfers.list(\*\*params) -> SyncPage[CardPushTransfer] +- client.card_push_transfers.approve(card_push_transfer_id) -> CardPushTransfer +- client.card_push_transfers.cancel(card_push_transfer_id) -> CardPushTransfer -# InboundWireTransfers +# CardValidations Types: ```python -from increase.types import InboundWireTransfer +from increase.types import CardValidation ``` Methods: -- client.inbound_wire_transfers.retrieve(inbound_wire_transfer_id) -> InboundWireTransfer -- client.inbound_wire_transfers.list(\*\*params) -> SyncPage[InboundWireTransfer] +- client.card_validations.create(\*\*params) -> CardValidation +- client.card_validations.retrieve(card_validation_id) -> CardValidation +- client.card_validations.list(\*\*params) -> SyncPage[CardValidation] -# DigitalCardProfiles +# Simulations + +## InterestPayments + +Methods: + +- client.simulations.interest_payments.create(\*\*params) -> Transaction + +## AccountTransfers + +Methods: + +- client.simulations.account_transfers.complete(account_transfer_id) -> AccountTransfer + +## CardAuthorizations Types: ```python -from increase.types import DigitalCardProfile +from increase.types.simulations import CardAuthorizationCreateResponse ``` Methods: -- client.digital_card_profiles.create(\*\*params) -> DigitalCardProfile -- client.digital_card_profiles.retrieve(digital_card_profile_id) -> DigitalCardProfile -- client.digital_card_profiles.list(\*\*params) -> SyncPage[DigitalCardProfile] -- client.digital_card_profiles.archive(digital_card_profile_id) -> DigitalCardProfile -- client.digital_card_profiles.clone(digital_card_profile_id, \*\*params) -> DigitalCardProfile +- client.simulations.card_authorizations.create(\*\*params) -> CardAuthorizationCreateResponse -# PhysicalCardProfiles +## CardBalanceInquiries + +Methods: + +- client.simulations.card_balance_inquiries.create(\*\*params) -> CardPayment + +## CardAuthorizationExpirations + +Methods: + +- client.simulations.card_authorization_expirations.create(\*\*params) -> CardPayment + +## CardSettlements + +Methods: + +- client.simulations.card_settlements.create(\*\*params) -> Transaction + +## CardReversals + +Methods: + +- client.simulations.card_reversals.create(\*\*params) -> CardPayment + +## CardIncrements + +Methods: + +- client.simulations.card_increments.create(\*\*params) -> CardPayment + +## CardFuelConfirmations + +Methods: + +- client.simulations.card_fuel_confirmations.create(\*\*params) -> CardPayment + +## CardRefunds + +Methods: + +- client.simulations.card_refunds.create(\*\*params) -> Transaction + +## CardAuthentications + +Methods: + +- client.simulations.card_authentications.create(\*\*params) -> CardPayment +- client.simulations.card_authentications.challenge_attempts(card_payment_id, \*\*params) -> CardPayment +- client.simulations.card_authentications.challenges(card_payment_id) -> CardPayment + +## CardDisputes + +Methods: + +- client.simulations.card_disputes.action(card_dispute_id, \*\*params) -> CardDispute + +## PhysicalCards + +Methods: + +- client.simulations.physical_cards.create(physical_card_id, \*\*params) -> PhysicalCard +- client.simulations.physical_cards.advance_shipment(physical_card_id, \*\*params) -> PhysicalCard + +## DigitalWalletTokenRequests Types: ```python -from increase.types import PhysicalCardProfile +from increase.types.simulations import DigitalWalletTokenRequestCreateResponse ``` Methods: -- client.physical_card_profiles.create(\*\*params) -> PhysicalCardProfile -- client.physical_card_profiles.retrieve(physical_card_profile_id) -> PhysicalCardProfile -- client.physical_card_profiles.list(\*\*params) -> SyncPage[PhysicalCardProfile] -- client.physical_card_profiles.archive(physical_card_profile_id) -> PhysicalCardProfile -- client.physical_card_profiles.clone(physical_card_profile_id, \*\*params) -> PhysicalCardProfile +- client.simulations.digital_wallet_token_requests.create(\*\*params) -> DigitalWalletTokenRequestCreateResponse + +## PendingTransactions + +Methods: + +- client.simulations.pending_transactions.release_inbound_funds_hold(pending_transaction_id) -> PendingTransaction + +## ACHTransfers + +Methods: + +- client.simulations.ach_transfers.acknowledge(ach_transfer_id) -> ACHTransfer +- client.simulations.ach_transfers.create_notification_of_change(ach_transfer_id, \*\*params) -> ACHTransfer +- client.simulations.ach*transfers.return*(ach_transfer_id, \*\*params) -> ACHTransfer +- client.simulations.ach_transfers.settle(ach_transfer_id, \*\*params) -> ACHTransfer +- client.simulations.ach_transfers.submit(ach_transfer_id) -> ACHTransfer + +## InboundACHTransfers + +Methods: + +- client.simulations.inbound_ach_transfers.create(\*\*params) -> InboundACHTransfer + +## WireTransfers + +Methods: + +- client.simulations.wire_transfers.reverse(wire_transfer_id) -> WireTransfer +- client.simulations.wire_transfers.submit(wire_transfer_id) -> WireTransfer + +## InboundWireTransfers + +Methods: + +- client.simulations.inbound_wire_transfers.create(\*\*params) -> InboundWireTransfer + +## WireDrawdownRequests + +Methods: + +- client.simulations.wire_drawdown_requests.refuse(wire_drawdown_request_id) -> WireDrawdownRequest +- client.simulations.wire_drawdown_requests.submit(wire_drawdown_request_id) -> WireDrawdownRequest + +## InboundWireDrawdownRequests + +Methods: + +- client.simulations.inbound_wire_drawdown_requests.create(\*\*params) -> InboundWireDrawdownRequest + +## CheckTransfers + +Methods: + +- client.simulations.check_transfers.mail(check_transfer_id) -> CheckTransfer + +## InboundCheckDeposits + +Methods: + +- client.simulations.inbound_check_deposits.create(\*\*params) -> InboundCheckDeposit +- client.simulations.inbound_check_deposits.adjustment(inbound_check_deposit_id, \*\*params) -> InboundCheckDeposit + +## RealTimePaymentsTransfers + +Methods: + +- client.simulations.real_time_payments_transfers.complete(real_time_payments_transfer_id, \*\*params) -> RealTimePaymentsTransfer + +## InboundRealTimePaymentsTransfers + +Methods: + +- client.simulations.inbound_real_time_payments_transfers.create(\*\*params) -> InboundRealTimePaymentsTransfer + +## InboundFednowTransfers + +Methods: + +- client.simulations.inbound_fednow_transfers.create(\*\*params) -> InboundFednowTransfer + +## CheckDeposits + +Methods: + +- client.simulations.check_deposits.adjustment(check_deposit_id, \*\*params) -> CheckDeposit +- client.simulations.check_deposits.reject(check_deposit_id) -> CheckDeposit +- client.simulations.check*deposits.return*(check_deposit_id) -> CheckDeposit +- client.simulations.check_deposits.submit(check_deposit_id, \*\*params) -> CheckDeposit + +## InboundMailItems + +Methods: + +- client.simulations.inbound_mail_items.create(\*\*params) -> InboundMailItem + +## EntityOnboardingSessions + +Methods: + +- client.simulations.entity_onboarding_sessions.submit(entity_onboarding_session_id) -> EntityOnboardingSession + +## Programs + +Methods: + +- client.simulations.programs.create(\*\*params) -> Program + +## AccountStatements + +Methods: + +- client.simulations.account_statements.create(\*\*params) -> AccountStatement + +## Exports + +Methods: + +- client.simulations.exports.create(\*\*params) -> Export + +## CardTokens + +Methods: + +- client.simulations.card_tokens.create(\*\*params) -> CardToken diff --git a/bin/check-env-state.py b/bin/check-env-state.py deleted file mode 100644 index e1b8b6cb3..000000000 --- a/bin/check-env-state.py +++ /dev/null @@ -1,40 +0,0 @@ -"""Script that exits 1 if the current environment is not -in sync with the `requirements-dev.lock` file. -""" - -from pathlib import Path - -import importlib_metadata - - -def should_run_sync() -> bool: - dev_lock = Path(__file__).parent.parent.joinpath("requirements-dev.lock") - - for line in dev_lock.read_text().splitlines(): - if not line or line.startswith("#") or line.startswith("-e"): - continue - - dep, lock_version = line.split("==") - - try: - version = importlib_metadata.version(dep) - - if lock_version != version: - print(f"mismatch for {dep} current={version} lock={lock_version}") - return True - except Exception: - print(f"could not import {dep}") - return True - - return False - - -def main() -> None: - if should_run_sync(): - exit(1) - else: - exit(0) - - -if __name__ == "__main__": - main() diff --git a/bin/check-release-environment b/bin/check-release-environment index 4beff05b9..b845b0f4c 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -3,7 +3,7 @@ errors=() if [ -z "${PYPI_TOKEN}" ]; then - errors+=("The INCREASE_PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") + errors+=("The PYPI_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets.") fi lenErrors=${#errors[@]} diff --git a/bin/check-test-server b/bin/check-test-server deleted file mode 100755 index a6fa34950..000000000 --- a/bin/check-test-server +++ /dev/null @@ -1,50 +0,0 @@ -#!/usr/bin/env bash - -RED='\033[0;31m' -GREEN='\033[0;32m' -YELLOW='\033[0;33m' -NC='\033[0m' # No Color - -function prism_is_running() { - curl --silent "http://localhost:4010" >/dev/null 2>&1 -} - -function is_overriding_api_base_url() { - [ -n "$TEST_API_BASE_URL" ] -} - -if is_overriding_api_base_url ; then - # If someone is running the tests against the live API, we can trust they know - # what they're doing and exit early. - echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" - - exit 0 -elif prism_is_running ; then - echo -e "${GREEN}✔ Mock prism server is running with your OpenAPI spec${NC}" - echo - - exit 0 -else - echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Prism server" - echo -e "running against your OpenAPI spec." - echo - echo -e "${YELLOW}To fix:${NC}" - echo - echo -e "1. Install Prism (requires Node 16+):" - echo - echo -e " With npm:" - echo -e " \$ ${YELLOW}npm install -g @stoplight/prism-cli${NC}" - echo - echo -e " With yarn:" - echo -e " \$ ${YELLOW}yarn global add @stoplight/prism-cli${NC}" - echo - echo -e "2. Run the mock server" - echo - echo -e " To run the server, pass in the path of your OpenAPI" - echo -e " spec to the prism command:" - echo - echo -e " \$ ${YELLOW}prism mock path/to/your.openapi.yml${NC}" - echo - - exit 1 -fi diff --git a/bin/test b/bin/test deleted file mode 100755 index 60ede7a84..000000000 --- a/bin/test +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -bin/check-test-server && rye run pytest "$@" diff --git a/mypy.ini b/mypy.ini deleted file mode 100644 index f3e97c62c..000000000 --- a/mypy.ini +++ /dev/null @@ -1,47 +0,0 @@ -[mypy] -pretty = True -show_error_codes = True - -# Exclude _files.py because mypy isn't smart enough to apply -# the correct type narrowing and as this is an internal module -# it's fine to just use Pyright. -exclude = ^(src/increase/_files\.py|_dev/.*\.py)$ - -strict_equality = True -implicit_reexport = True -check_untyped_defs = True -no_implicit_optional = True - -warn_return_any = True -warn_unreachable = True -warn_unused_configs = True - -# Turn these options off as it could cause conflicts -# with the Pyright options. -warn_unused_ignores = False -warn_redundant_casts = False - -disallow_any_generics = True -disallow_untyped_defs = True -disallow_untyped_calls = True -disallow_subclassing_any = True -disallow_incomplete_defs = True -disallow_untyped_decorators = True -cache_fine_grained = True - -# By default, mypy reports an error if you assign a value to the result -# of a function call that doesn't return anything. We do this in our test -# cases: -# ``` -# result = ... -# assert result is None -# ``` -# Changing this codegen to make mypy happy would increase complexity -# and would not be worth it. -disable_error_code = func-returns-value - -# https://github.com/python/mypy/issues/12162 -[mypy.overrides] -module = "black.files.*" -ignore_errors = true -ignore_missing_imports = true diff --git a/pyproject.toml b/pyproject.toml index 426c5229f..20bdf8a88 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,32 +1,32 @@ [project] name = "increase" -version = "0.46.0" +version = "0.475.1" description = "The official Python library for the increase API" -readme = "README.md" +dynamic = ["readme"] license = "Apache-2.0" authors = [ { name = "Increase", email = "dev-feedback@increase.com" }, ] -dependencies = [ - "httpx>=0.23.0, <1", - "pydantic>=1.9.0, <3", - "typing-extensions>=4.7, <5", - "anyio>=3.5.0, <5", - "distro>=1.7.0, <2", - "sniffio", - "cached-property; python_version < '3.8'", +dependencies = [ + "httpx>=0.23.0, <1", + "pydantic>=1.9.0, <3", + "typing-extensions>=4.14, <5", + "anyio>=3.5.0, <5", + "distro>=1.7.0, <2", + "sniffio", ] -requires-python = ">= 3.7" + +requires-python = ">= 3.9" classifiers = [ "Typing :: Typed", "Intended Audience :: Developers", - "Programming Language :: Python :: 3.7", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", @@ -36,20 +36,20 @@ classifiers = [ "License :: OSI Approved :: Apache Software License" ] - - [project.urls] -Homepage = "https://github.com/increase/increase-python" -Repository = "https://github.com/increase/increase-python" - +Homepage = "https://github.com/Increase/increase-python" +Repository = "https://github.com/Increase/increase-python" +[project.optional-dependencies] +aiohttp = ["aiohttp", "httpx_aiohttp>=0.1.9"] +webhooks = ["standardwebhooks >= 1.0.1, < 2"] [tool.rye] managed = true # version pins are in requirements-dev.lock dev-dependencies = [ - "pyright", - "mypy", + "pyright==1.1.399", + "mypy==1.17", "respx", "pytest", "pytest-asyncio", @@ -58,7 +58,8 @@ dev-dependencies = [ "nox", "dirty-equals>=0.6.0", "importlib-metadata>=6.7.0", - + "rich>=13.7.1", + "pytest-xdist>=3.6.1", ] [tool.rye.scripts] @@ -66,18 +67,21 @@ format = { chain = [ "format:ruff", "format:docs", "fix:ruff", + # run formatting again to fix any inconsistencies when imports are stripped + "format:ruff", ]} -"format:black" = "black ." -"format:docs" = "python bin/ruffen-docs.py README.md api.md" +"format:docs" = "bash -c 'python scripts/utils/ruffen-docs.py README.md $(find . -type f -name api.md)'" "format:ruff" = "ruff format" -"format:isort" = "isort ." "lint" = { chain = [ "check:ruff", "typecheck", + "check:importable", ]} -"check:ruff" = "ruff ." -"fix:ruff" = "ruff --fix ." +"check:ruff" = "ruff check ." +"fix:ruff" = "ruff check --fix ." + +"check:importable" = "python -c 'import increase'" typecheck = { chain = [ "typecheck:pyright", @@ -88,7 +92,7 @@ typecheck = { chain = [ "typecheck:mypy" = "mypy ." [build-system] -requires = ["hatchling"] +requires = ["hatchling==1.26.3", "hatch-fancy-pypi-readme"] build-backend = "hatchling.build" [tool.hatch.build] @@ -99,15 +103,38 @@ include = [ [tool.hatch.build.targets.wheel] packages = ["src/increase"] -[tool.black] -line-length = 120 -target-version = ["py37"] +[tool.hatch.build.targets.sdist] +# Basically everything except hidden files/directories (such as .github, .devcontainers, .python-version, etc) +include = [ + "/*.toml", + "/*.json", + "/*.lock", + "/*.md", + "/mypy.ini", + "/noxfile.py", + "bin/*", + "examples/*", + "src/*", + "tests/*", +] + +[tool.hatch.metadata.hooks.fancy-pypi-readme] +content-type = "text/markdown" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.fragments]] +path = "README.md" + +[[tool.hatch.metadata.hooks.fancy-pypi-readme.substitutions]] +# replace relative links with absolute links +pattern = '\[(.+?)\]\(((?!https?://)\S+?)\)' +replacement = '[\1](https://github.com/Increase/increase-python/tree/main/\g<2>)' [tool.pytest.ini_options] testpaths = ["tests"] -addopts = "--tb=short" +addopts = "--tb=short -n auto" xfail_strict = true asyncio_mode = "auto" +asyncio_default_fixture_loop_scope = "session" filterwarnings = [ "error" ] @@ -117,24 +144,82 @@ filterwarnings = [ # there are a couple of flags that are still disabled by # default in strict mode as they are experimental and niche. typeCheckingMode = "strict" -pythonVersion = "3.7" +pythonVersion = "3.9" exclude = [ "_dev", ".venv", ".nox", + ".git", ] reportImplicitOverride = true +reportOverlappingOverload = false reportImportCycles = false reportPrivateUsage = false +[tool.mypy] +pretty = true +show_error_codes = true + +# Exclude _files.py because mypy isn't smart enough to apply +# the correct type narrowing and as this is an internal module +# it's fine to just use Pyright. +# +# We also exclude our `tests` as mypy doesn't always infer +# types correctly and Pyright will still catch any type errors. +exclude = ['src/increase/_files.py', '_dev/.*.py', 'tests/.*'] + +strict_equality = true +implicit_reexport = true +check_untyped_defs = true +no_implicit_optional = true + +warn_return_any = true +warn_unreachable = true +warn_unused_configs = true + +# Turn these options off as it could cause conflicts +# with the Pyright options. +warn_unused_ignores = false +warn_redundant_casts = false + +disallow_any_generics = true +disallow_untyped_defs = true +disallow_untyped_calls = true +disallow_subclassing_any = true +disallow_incomplete_defs = true +disallow_untyped_decorators = true +cache_fine_grained = true + +# By default, mypy reports an error if you assign a value to the result +# of a function call that doesn't return anything. We do this in our test +# cases: +# ``` +# result = ... +# assert result is None +# ``` +# Changing this codegen to make mypy happy would increase complexity +# and would not be worth it. +disable_error_code = "func-returns-value,overload-cannot-match" + +# https://github.com/python/mypy/issues/12162 +[[tool.mypy.overrides]] +module = "black.files.*" +ignore_errors = true +ignore_missing_imports = true + [tool.ruff] line-length = 120 output-format = "grouped" -target-version = "py37" +target-version = "py38" + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint] select = [ # isort "I", @@ -142,6 +227,8 @@ select = [ "B", # remove unused imports "F401", + # check for missing future annotations + "FA102", # bare except statements "E722", # unused arguments @@ -150,7 +237,9 @@ select = [ "T201", "T203", # misuse of typing.TYPE_CHECKING - "TCH004" + "TC004", + # import rules + "TID251", ] ignore = [ # mutable defaults @@ -161,10 +250,11 @@ unfixable = [ "T201", "T203", ] -ignore-init-module-imports = true -[tool.ruff.format] -docstring-code-format = true +extend-safe-fixes = ["FA102"] + +[tool.ruff.lint.flake8-tidy-imports.banned-api] +"functools.lru_cache".msg = "This function does not retain type information for the wrapped function's arguments; The `lru_cache` function from `_utils` should be used instead" [tool.ruff.lint.isort] length-sort = true @@ -173,7 +263,8 @@ combine-as-imports = true extra-standard-library = ["typing_extensions"] known-first-party = ["increase", "tests"] -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "bin/**.py" = ["T201", "T203"] +"scripts/**.py" = ["T201", "T203"] "tests/**.py" = ["T201", "T203"] "examples/**.py" = ["T201", "T203"] diff --git a/requirements-dev.lock b/requirements-dev.lock index be54931ea..9a4f79b84 100644 --- a/requirements-dev.lock +++ b/requirements-dev.lock @@ -6,91 +6,157 @@ # features: [] # all-features: true # with-sources: false +# generate-hashes: false +# universal: false -e file:. -annotated-types==0.6.0 +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.13.3 + # via httpx-aiohttp + # via increase +aiosignal==1.4.0 + # via aiohttp +annotated-types==0.7.0 # via pydantic -anyio==4.1.0 +anyio==4.12.1 # via httpx # via increase -argcomplete==3.1.2 +argcomplete==3.6.3 # via nox -attrs==23.1.0 - # via pytest -certifi==2023.7.22 +async-timeout==5.0.1 + # via aiohttp +attrs==25.4.0 + # via aiohttp + # via nox + # via standardwebhooks +backports-asyncio-runner==1.2.0 + # via pytest-asyncio +certifi==2026.1.4 # via httpcore # via httpx -colorlog==6.7.0 +colorlog==6.10.1 + # via nox +dependency-groups==1.3.1 # via nox -dirty-equals==0.6.0 -distlib==0.3.7 +deprecated==1.3.1 + # via standardwebhooks +dirty-equals==0.11 +distlib==0.4.0 # via virtualenv -distro==1.8.0 +distro==1.9.0 # via increase -exceptiongroup==1.1.3 +exceptiongroup==1.3.1 # via anyio -filelock==3.12.4 + # via pytest +execnet==2.1.2 + # via pytest-xdist +filelock==3.19.1 # via virtualenv -h11==0.14.0 +frozenlist==1.8.0 + # via aiohttp + # via aiosignal +h11==0.16.0 # via httpcore -httpcore==1.0.2 +httpcore==1.0.9 # via httpx -httpx==0.25.2 +httpx==0.28.1 + # via httpx-aiohttp # via increase # via respx -idna==3.4 + # via standardwebhooks +httpx-aiohttp==0.1.12 + # via increase +humanize==4.13.0 + # via nox +idna==3.11 # via anyio # via httpx -importlib-metadata==7.0.0 -iniconfig==2.0.0 + # via yarl +importlib-metadata==8.7.1 +iniconfig==2.1.0 # via pytest -mypy==1.7.1 -mypy-extensions==1.0.0 +markdown-it-py==3.0.0 + # via rich +mdurl==0.1.2 + # via markdown-it-py +multidict==6.7.0 + # via aiohttp + # via yarl +mypy==1.17.0 +mypy-extensions==1.1.0 # via mypy -nodeenv==1.8.0 +nodeenv==1.10.0 # via pyright -nox==2023.4.22 -packaging==23.2 +nox==2025.11.12 +packaging==25.0 + # via dependency-groups # via nox # via pytest -platformdirs==3.11.0 +pathspec==1.0.3 + # via mypy +platformdirs==4.4.0 # via virtualenv -pluggy==1.3.0 - # via pytest -py==1.11.0 +pluggy==1.6.0 # via pytest -pydantic==2.4.2 +propcache==0.4.1 + # via aiohttp + # via yarl +pydantic==2.12.5 # via increase -pydantic-core==2.10.1 +pydantic-core==2.41.5 # via pydantic -pyright==1.1.353 -pytest==7.1.1 +pygments==2.19.2 + # via pytest + # via rich +pyright==1.1.399 +pytest==8.4.2 # via pytest-asyncio -pytest-asyncio==0.21.1 -python-dateutil==2.8.2 + # via pytest-xdist +pytest-asyncio==1.2.0 +pytest-xdist==3.8.0 +python-dateutil==2.9.0.post0 + # via standardwebhooks # via time-machine -pytz==2023.3.post1 - # via dirty-equals -respx==0.20.2 -ruff==0.1.9 -setuptools==68.2.2 - # via nodeenv -six==1.16.0 +respx==0.22.0 +rich==14.2.0 +ruff==0.14.13 +six==1.17.0 # via python-dateutil -sniffio==1.3.0 - # via anyio - # via httpx +sniffio==1.3.1 # via increase -time-machine==2.9.0 -tomli==2.0.1 +standardwebhooks==1.0.1 + # via increase +time-machine==2.19.0 +tomli==2.4.0 + # via dependency-groups # via mypy + # via nox # via pytest -typing-extensions==4.8.0 +types-deprecated==1.3.1.20251101 + # via standardwebhooks +types-python-dateutil==2.9.0.20251115 + # via standardwebhooks +typing-extensions==4.15.0 + # via aiosignal + # via anyio + # via exceptiongroup # via increase + # via multidict # via mypy # via pydantic # via pydantic-core -virtualenv==20.24.5 + # via pyright + # via pytest-asyncio + # via typing-inspection + # via virtualenv +typing-inspection==0.4.2 + # via pydantic +virtualenv==20.36.1 # via nox -zipp==3.17.0 +wrapt==2.0.1 + # via deprecated +yarl==1.22.0 + # via aiohttp +zipp==3.23.0 # via importlib-metadata diff --git a/requirements.lock b/requirements.lock index f2450c2bf..a730a50a3 100644 --- a/requirements.lock +++ b/requirements.lock @@ -6,38 +6,87 @@ # features: [] # all-features: true # with-sources: false +# generate-hashes: false +# universal: false -e file:. -annotated-types==0.6.0 +aiohappyeyeballs==2.6.1 + # via aiohttp +aiohttp==3.13.3 + # via httpx-aiohttp + # via increase +aiosignal==1.4.0 + # via aiohttp +annotated-types==0.7.0 # via pydantic -anyio==4.1.0 +anyio==4.12.1 # via httpx # via increase -certifi==2023.7.22 +async-timeout==5.0.1 + # via aiohttp +attrs==25.4.0 + # via aiohttp + # via standardwebhooks +certifi==2026.1.4 # via httpcore # via httpx -distro==1.8.0 +deprecated==1.3.1 + # via standardwebhooks +distro==1.9.0 # via increase -exceptiongroup==1.1.3 +exceptiongroup==1.3.1 # via anyio -h11==0.14.0 +frozenlist==1.8.0 + # via aiohttp + # via aiosignal +h11==0.16.0 # via httpcore -httpcore==1.0.2 +httpcore==1.0.9 # via httpx -httpx==0.25.2 +httpx==0.28.1 + # via httpx-aiohttp + # via increase + # via standardwebhooks +httpx-aiohttp==0.1.12 # via increase -idna==3.4 +idna==3.11 # via anyio # via httpx -pydantic==2.4.2 + # via yarl +multidict==6.7.0 + # via aiohttp + # via yarl +propcache==0.4.1 + # via aiohttp + # via yarl +pydantic==2.12.5 # via increase -pydantic-core==2.10.1 +pydantic-core==2.41.5 # via pydantic -sniffio==1.3.0 - # via anyio - # via httpx +python-dateutil==2.9.0.post0 + # via standardwebhooks +six==1.17.0 + # via python-dateutil +sniffio==1.3.1 # via increase -typing-extensions==4.8.0 +standardwebhooks==1.0.1 # via increase +types-deprecated==1.3.1.20251101 + # via standardwebhooks +types-python-dateutil==2.9.0.20251115 + # via standardwebhooks +typing-extensions==4.15.0 + # via aiosignal + # via anyio + # via exceptiongroup + # via increase + # via multidict # via pydantic # via pydantic-core + # via typing-inspection +typing-inspection==0.4.2 + # via pydantic +wrapt==2.0.1 + # via deprecated +yarl==1.22.0 + # via aiohttp diff --git a/scripts/bootstrap b/scripts/bootstrap new file mode 100755 index 000000000..b430fee36 --- /dev/null +++ b/scripts/bootstrap @@ -0,0 +1,27 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [ -f "Brewfile" ] && [ "$(uname -s)" = "Darwin" ] && [ "$SKIP_BREW" != "1" ] && [ -t 0 ]; then + brew bundle check >/dev/null 2>&1 || { + echo -n "==> Install Homebrew dependencies? (y/N): " + read -r response + case "$response" in + [yY][eE][sS]|[yY]) + brew bundle + ;; + *) + ;; + esac + echo + } +fi + +echo "==> Installing Python dependencies…" + +# experimental uv support makes installations significantly faster +rye config --set-bool behavior.use-uv=true + +rye sync --all-features diff --git a/scripts/format b/scripts/format new file mode 100755 index 000000000..667ec2d7a --- /dev/null +++ b/scripts/format @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +echo "==> Running formatters" +rye run format diff --git a/scripts/lint b/scripts/lint new file mode 100755 index 000000000..7dc201de4 --- /dev/null +++ b/scripts/lint @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [ "$1" = "--fix" ]; then + echo "==> Running lints with --fix" + rye run fix:ruff +else + echo "==> Running lints" + rye run lint +fi + +echo "==> Making sure it imports" +rye run python -c 'import increase' diff --git a/scripts/mock b/scripts/mock new file mode 100755 index 000000000..1aea7aabe --- /dev/null +++ b/scripts/mock @@ -0,0 +1,52 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +if [[ -n "$1" && "$1" != '--'* ]]; then + URL="$1" + shift +else + URL="$(grep 'openapi_spec_url' .stats.yml | cut -d' ' -f2)" +fi + +# Check if the URL is empty +if [ -z "$URL" ]; then + echo "Error: No OpenAPI spec path/url provided or found in .stats.yml" + exit 1 +fi + +echo "==> Starting mock server with URL ${URL}" + +# Run steady mock on the given spec +if [ "$1" == "--daemon" ]; then + # Pre-install the package so the download doesn't eat into the startup timeout + npm exec --package=@stdy/cli@0.20.2 -- steady --version + + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=dots --validator-form-object-format=dots "$URL" &> .stdy.log & + + # Wait for server to come online via health endpoint (max 30s) + echo -n "Waiting for server" + attempts=0 + while ! curl --silent --fail "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1; do + if ! kill -0 $! 2>/dev/null; then + echo + cat .stdy.log + exit 1 + fi + attempts=$((attempts + 1)) + if [ "$attempts" -ge 300 ]; then + echo + echo "Timed out waiting for Steady server to start" + cat .stdy.log + exit 1 + fi + echo -n "." + sleep 0.1 + done + + echo +else + npm exec --package=@stdy/cli@0.20.2 -- steady --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=dots --validator-form-object-format=dots "$URL" +fi diff --git a/scripts/test b/scripts/test new file mode 100755 index 000000000..2e29bcf80 --- /dev/null +++ b/scripts/test @@ -0,0 +1,61 @@ +#!/usr/bin/env bash + +set -e + +cd "$(dirname "$0")/.." + +RED='\033[0;31m' +GREEN='\033[0;32m' +YELLOW='\033[0;33m' +NC='\033[0m' # No Color + +function steady_is_running() { + curl --silent "http://127.0.0.1:4010/_x-steady/health" >/dev/null 2>&1 +} + +kill_server_on_port() { + pids=$(lsof -t -i tcp:"$1" || echo "") + if [ "$pids" != "" ]; then + kill "$pids" + echo "Stopped $pids." + fi +} + +function is_overriding_api_base_url() { + [ -n "$TEST_API_BASE_URL" ] +} + +if ! is_overriding_api_base_url && ! steady_is_running ; then + # When we exit this script, make sure to kill the background mock server process + trap 'kill_server_on_port 4010' EXIT + + # Start the dev server + ./scripts/mock --daemon +fi + +if is_overriding_api_base_url ; then + echo -e "${GREEN}✔ Running tests against ${TEST_API_BASE_URL}${NC}" + echo +elif ! steady_is_running ; then + echo -e "${RED}ERROR:${NC} The test suite will not run without a mock Steady server" + echo -e "running against your OpenAPI spec." + echo + echo -e "To run the server, pass in the path or url of your OpenAPI" + echo -e "spec to the steady command:" + echo + echo -e " \$ ${YELLOW}npm exec --package=@stdy/cli@0.20.2 -- steady path/to/your.openapi.yml --host 127.0.0.1 -p 4010 --validator-query-array-format=comma --validator-form-array-format=comma --validator-query-object-format=dots --validator-form-object-format=dots${NC}" + echo + + exit 1 +else + echo -e "${GREEN}✔ Mock steady server is running with your OpenAPI spec${NC}" + echo +fi + +export DEFER_PYDANTIC_BUILD=false + +echo "==> Running tests" +rye run pytest "$@" + +echo "==> Running Pydantic v1 tests" +rye run nox -s test-pydantic-v1 -- "$@" diff --git a/bin/ruffen-docs.py b/scripts/utils/ruffen-docs.py similarity index 97% rename from bin/ruffen-docs.py rename to scripts/utils/ruffen-docs.py index 37b3d94f0..0cf2bd2fd 100644 --- a/bin/ruffen-docs.py +++ b/scripts/utils/ruffen-docs.py @@ -47,7 +47,7 @@ def _md_match(match: Match[str]) -> str: with _collect_error(match): code = format_code_block(code) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" def _pycon_match(match: Match[str]) -> str: code = "" @@ -97,7 +97,7 @@ def finish_fragment() -> None: def _md_pycon_match(match: Match[str]) -> str: code = _pycon_match(match) code = textwrap.indent(code, match["indent"]) - return f'{match["before"]}{code}{match["after"]}' + return f"{match['before']}{code}{match['after']}" src = MD_RE.sub(_md_match, src) src = MD_PYCON_RE.sub(_md_pycon_match, src) diff --git a/scripts/utils/upload-artifact.sh b/scripts/utils/upload-artifact.sh new file mode 100755 index 000000000..7f63b4fa1 --- /dev/null +++ b/scripts/utils/upload-artifact.sh @@ -0,0 +1,27 @@ +#!/usr/bin/env bash +set -exuo pipefail + +FILENAME=$(basename dist/*.whl) + +RESPONSE=$(curl -X POST "$URL?filename=$FILENAME" \ + -H "Authorization: Bearer $AUTH" \ + -H "Content-Type: application/json") + +SIGNED_URL=$(echo "$RESPONSE" | jq -r '.url') + +if [[ "$SIGNED_URL" == "null" ]]; then + echo -e "\033[31mFailed to get signed URL.\033[0m" + exit 1 +fi + +UPLOAD_RESPONSE=$(curl -v -X PUT \ + -H "Content-Type: binary/octet-stream" \ + --data-binary "@dist/$FILENAME" "$SIGNED_URL" 2>&1) + +if echo "$UPLOAD_RESPONSE" | grep -q "HTTP/[0-9.]* 200"; then + echo -e "\033[32mUploaded build to Stainless storage.\033[0m" + echo -e "\033[32mInstallation: pip install 'https://pkg.stainless.com/s/increase-python/$SHA/$FILENAME'\033[0m" +else + echo -e "\033[31mFailed to upload artifact.\033[0m" + exit 1 +fi diff --git a/src/increase/__init__.py b/src/increase/__init__.py index d6dfcf7e2..55ed1eb5d 100644 --- a/src/increase/__init__.py +++ b/src/increase/__init__.py @@ -1,7 +1,9 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +import typing as _t + from . import types -from ._types import NOT_GIVEN, NoneType, NotGiven, Transport, ProxiesTypes +from ._types import NOT_GIVEN, Omit, NoneType, NotGiven, Transport, ProxiesTypes, omit, not_given from ._utils import file_from_path from ._client import ( ENVIRONMENTS, @@ -18,6 +20,7 @@ from ._models import BaseModel from ._version import __title__, __version__ from ._response import APIResponse as APIResponse, AsyncAPIResponse as AsyncAPIResponse +from ._constants import DEFAULT_TIMEOUT, DEFAULT_MAX_RETRIES, DEFAULT_CONNECTION_LIMITS from ._exceptions import ( APIError, ConflictError, @@ -41,10 +44,12 @@ InvalidParametersError, EnvironmentMismatchError, UnprocessableEntityError, + APIWebhookValidationError, APIResponseValidationError, InsufficientPermissionsError, IdempotencyKeyAlreadyUsedError, ) +from ._base_client import DefaultHttpxClient, DefaultAioHttpClient, DefaultAsyncHttpxClient from ._utils._logs import setup_logging as _setup_logging __all__ = [ @@ -56,12 +61,16 @@ "ProxiesTypes", "NotGiven", "NOT_GIVEN", + "not_given", + "Omit", + "omit", "IncreaseError", "APIError", "APIStatusError", "APITimeoutError", "APIConnectionError", "APIResponseValidationError", + "APIWebhookValidationError", "BadRequestError", "AuthenticationError", "PermissionDeniedError", @@ -92,8 +101,17 @@ "ENVIRONMENTS", "file_from_path", "BaseModel", + "DEFAULT_TIMEOUT", + "DEFAULT_MAX_RETRIES", + "DEFAULT_CONNECTION_LIMITS", + "DefaultHttpxClient", + "DefaultAsyncHttpxClient", + "DefaultAioHttpClient", ] +if not _t.TYPE_CHECKING: + from ._utils._resources_proxy import resources as resources + _setup_logging() # Update the __module__ attribute for exported symbols so that diff --git a/src/increase/_base_client.py b/src/increase/_base_client.py index f431128ee..695509fc4 100644 --- a/src/increase/_base_client.py +++ b/src/increase/_base_client.py @@ -1,5 +1,6 @@ from __future__ import annotations +import sys import json import time import uuid @@ -29,21 +30,19 @@ cast, overload, ) -from functools import lru_cache from typing_extensions import Literal, override, get_origin import anyio import httpx import distro import pydantic -from httpx import URL, Limits +from httpx import URL from pydantic import PrivateAttr from . import _exceptions from ._qs import Querystring from ._files import to_httpx_files, async_to_httpx_files from ._types import ( - NOT_GIVEN, Body, Omit, Query, @@ -51,18 +50,19 @@ Timeout, NotGiven, ResponseT, - Transport, AnyMapping, PostParser, - ProxiesTypes, + BinaryTypes, RequestFiles, HttpxSendArgs, - AsyncTransport, RequestOptions, + AsyncBinaryTypes, + HttpxRequestFiles, ModelBuilderProtocol, + not_given, ) -from ._utils import is_dict, is_list, is_given, is_mapping -from ._compat import model_copy, model_dump +from ._utils import is_dict, is_list, asyncify, is_given, lru_cache, is_mapping +from ._compat import PYDANTIC_V1, model_copy, model_dump from ._models import GenericModel, FinalRequestOptions, validate_type, construct_type from ._response import ( APIResponse, @@ -71,13 +71,13 @@ extract_response_type, ) from ._constants import ( - DEFAULT_LIMITS, DEFAULT_TIMEOUT, MAX_RETRY_DELAY, DEFAULT_MAX_RETRIES, INITIAL_RETRY_DELAY, RAW_RESPONSE_HEADER, OVERRIDE_CAST_TO_HEADER, + DEFAULT_CONNECTION_LIMITS, ) from ._streaming import Stream, SSEDecoder, AsyncStream, SSEBytesDecoder from ._exceptions import ( @@ -86,7 +86,7 @@ APIConnectionError, APIResponseValidationError, ) -from ._legacy_response import LegacyAPIResponse +from ._utils._json import openapi_dumps log: logging.Logger = logging.getLogger(__name__) @@ -102,7 +102,11 @@ _AsyncStreamT = TypeVar("_AsyncStreamT", bound=AsyncStream[Any]) if TYPE_CHECKING: - from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT + from httpx._config import ( + DEFAULT_TIMEOUT_CONFIG, # pyright: ignore[reportPrivateImportUsage] + ) + + HTTPX_DEFAULT_TIMEOUT = DEFAULT_TIMEOUT_CONFIG else: try: from httpx._config import DEFAULT_TIMEOUT_CONFIG as HTTPX_DEFAULT_TIMEOUT @@ -119,32 +123,48 @@ class PageInfo: url: URL | NotGiven params: Query | NotGiven + json: Body | NotGiven @overload def __init__( self, *, url: URL, - ) -> None: - ... + ) -> None: ... @overload def __init__( self, *, params: Query, - ) -> None: - ... + ) -> None: ... + @overload def __init__( self, *, - url: URL | NotGiven = NOT_GIVEN, - params: Query | NotGiven = NOT_GIVEN, + json: Body, + ) -> None: ... + + def __init__( + self, + *, + url: URL | NotGiven = not_given, + json: Body | NotGiven = not_given, + params: Query | NotGiven = not_given, ) -> None: self.url = url + self.json = json self.params = params + @override + def __repr__(self) -> str: + if self.url: + return f"{self.__class__.__name__}(url={self.url})" + if self.json: + return f"{self.__class__.__name__}(json={self.json})" + return f"{self.__class__.__name__}(params={self.params})" + class BasePage(GenericModel, Generic[_T]): """ @@ -167,8 +187,7 @@ def has_next_page(self) -> bool: return False return self.next_page_info() is not None - def next_page_info(self) -> Optional[PageInfo]: - ... + def next_page_info(self) -> Optional[PageInfo]: ... def _get_page_items(self) -> Iterable[_T]: # type: ignore[empty-body] ... @@ -192,6 +211,19 @@ def _info_to_options(self, info: PageInfo) -> FinalRequestOptions: options.url = str(url) return options + if not isinstance(info.json, NotGiven): + if not is_mapping(info.json): + raise TypeError("Pagination is only supported with mappings") + + if not options.json_data: + options.json_data = {**info.json} + else: + if not is_mapping(options.json_data): + raise TypeError("Pagination is only supported with mappings") + + options.json_data = {**options.json_data, **info.json} + return options + raise ValueError("Unexpected PageInfo state") @@ -204,6 +236,9 @@ def _set_private_attributes( model: Type[_T], options: FinalRequestOptions, ) -> None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -289,6 +324,9 @@ def _set_private_attributes( client: AsyncAPIClient, options: FinalRequestOptions, ) -> None: + if (not PYDANTIC_V1) and getattr(self, "__pydantic_private__", None) is None: + self.__pydantic_private__ = {} + self._model = model self._client = client self._options = options @@ -328,9 +366,6 @@ class BaseClient(Generic[_HttpxClientT, _DefaultStreamT]): _base_url: URL max_retries: int timeout: Union[float, Timeout, None] - _limits: httpx.Limits - _proxies: ProxiesTypes | None - _transport: Transport | AsyncTransport | None _strict_response_validation: bool _idempotency_header: str | None _default_stream_cls: type[_DefaultStreamT] | None = None @@ -343,9 +378,6 @@ def __init__( _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, timeout: float | Timeout | None = DEFAULT_TIMEOUT, - limits: httpx.Limits, - transport: Transport | AsyncTransport | None, - proxies: ProxiesTypes | None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: @@ -353,13 +385,16 @@ def __init__( self._base_url = self._enforce_trailing_slash(URL(base_url)) self.max_retries = max_retries self.timeout = timeout - self._limits = limits - self._proxies = proxies - self._transport = transport self._custom_headers = custom_headers or {} self._custom_query = custom_query or {} self._strict_response_validation = _strict_response_validation self._idempotency_header = None + self._platform: Platform | None = None + + if max_retries is None: # pyright: ignore[reportUnnecessaryComparison] + raise TypeError( + "max_retries cannot be None. If you want to disable retries, pass `0`; if you want unlimited retries, pass `math.inf` or a very high number; if you want the default behavior, pass `increase.DEFAULT_MAX_RETRIES`" + ) def _enforce_trailing_slash(self, url: URL) -> URL: if url.raw_path.endswith(b"/"): @@ -397,14 +432,7 @@ def _make_status_error( ) -> _exceptions.APIStatusError: raise NotImplementedError() - def _remaining_retries( - self, - remaining_retries: Optional[int], - options: FinalRequestOptions, - ) -> int: - return remaining_retries if remaining_retries is not None else options.get_max_retries(self.max_retries) - - def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers: + def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0) -> httpx.Headers: custom_headers = options.headers or {} headers_dict = _merge_mappings(self.default_headers, custom_headers) self._validate_headers(headers_dict, custom_headers) @@ -413,8 +441,20 @@ def _build_headers(self, options: FinalRequestOptions) -> httpx.Headers: headers = httpx.Headers(headers_dict) idempotency_header = self._idempotency_header - if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers: - headers[idempotency_header] = options.idempotency_key or self._idempotency_key() + if idempotency_header and options.idempotency_key and idempotency_header not in headers: + headers[idempotency_header] = options.idempotency_key + + # Don't set these headers if they were already set or removed by the caller. We check + # `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case. + lower_custom_headers = [header.lower() for header in custom_headers] + if "x-stainless-retry-count" not in lower_custom_headers: + headers["x-stainless-retry-count"] = str(retries_taken) + if "x-stainless-read-timeout" not in lower_custom_headers: + timeout = self.timeout if isinstance(options.timeout, NotGiven) else options.timeout + if isinstance(timeout, Timeout): + timeout = timeout.read + if timeout is not None: + headers["x-stainless-read-timeout"] = str(timeout) return headers @@ -437,10 +477,23 @@ def _make_sse_decoder(self) -> SSEDecoder | SSEBytesDecoder: def _build_request( self, options: FinalRequestOptions, + *, + retries_taken: int = 0, ) -> httpx.Request: if log.isEnabledFor(logging.DEBUG): - log.debug("Request options: %s", model_dump(options, exclude_unset=True)) - + log.debug( + "Request options: %s", + model_dump( + options, + exclude_unset=True, + # Pydantic v1 can't dump every type we support in content, so we exclude it for now. + exclude={ + "content", + } + if PYDANTIC_V1 + else {}, + ), + ) kwargs: dict[str, Any] = {} json_data = options.json_data @@ -452,9 +505,10 @@ def _build_request( else: raise RuntimeError(f"Unexpected JSON data type, {type(json_data)}, cannot merge with `extra_body`") - headers = self._build_headers(options) - params = _merge_mappings(self._custom_query, options.params) + headers = self._build_headers(options, retries_taken=retries_taken) + params = _merge_mappings(self.default_query, options.params) content_type = headers.get("Content-Type") + files = options.files # If the given Content-Type header is multipart/form-data then it # has to be removed so that httpx can generate the header with @@ -468,7 +522,7 @@ def _build_request( headers.pop("Content-Type") # As we are now sending multipart/form-data instead of application/json - # we need to tell httpx to use it, https://www.python-httpx.org/advanced/#multipart-file-encoding + # we need to tell httpx to use it, https://www.python-httpx.org/advanced/clients/#multipart-file-encoding if json_data: if not is_dict(json_data): raise TypeError( @@ -476,19 +530,55 @@ def _build_request( ) kwargs["data"] = self._serialize_multipartform(json_data) + # httpx determines whether or not to send a "multipart/form-data" + # request based on the truthiness of the "files" argument. + # This gets around that issue by generating a dict value that + # evaluates to true. + # + # https://github.com/encode/httpx/discussions/2399#discussioncomment-3814186 + if not files: + files = cast(HttpxRequestFiles, ForceMultipartDict()) + + prepared_url = self._prepare_url(options.url) + # preserve hard-coded query params from the url + if params and prepared_url.query: + params = {**dict(prepared_url.params.items()), **params} + prepared_url = prepared_url.copy_with(raw_path=prepared_url.raw_path.split(b"?", 1)[0]) + if "_" in prepared_url.host: + # work around https://github.com/encode/httpx/discussions/2880 + kwargs["extensions"] = {"sni_hostname": prepared_url.host.replace("_", "-")} + + is_body_allowed = options.method.lower() != "get" + + if is_body_allowed: + if options.content is not None and json_data is not None: + raise TypeError("Passing both `content` and `json_data` is not supported") + if options.content is not None and files is not None: + raise TypeError("Passing both `content` and `files` is not supported") + if options.content is not None: + kwargs["content"] = options.content + elif isinstance(json_data, bytes): + kwargs["content"] = json_data + elif not files: + # Don't set content when JSON is sent as multipart/form-data, + # since httpx's content param overrides other body arguments + kwargs["content"] = openapi_dumps(json_data) if is_given(json_data) and json_data is not None else None + kwargs["files"] = files + else: + headers.pop("Content-Type", None) + kwargs.pop("data", None) + # TODO: report this error to httpx return self._client.build_request( # pyright: ignore[reportUnknownMemberType] headers=headers, timeout=self.timeout if isinstance(options.timeout, NotGiven) else options.timeout, method=options.method, - url=self._prepare_url(options.url), + url=prepared_url, # the `Query` type that we use is incompatible with qs' # `Params` type as it needs to be typed as `Mapping[str, object]` # so that passing a `TypedDict` doesn't cause an error. # https://github.com/microsoft/pyright/issues/3526#event-6715453066 params=self.qs.stringify(cast(Mapping[str, Any], params)) if params else None, - json=json_data, - files=options.files, **kwargs, ) @@ -532,7 +622,7 @@ def _maybe_override_cast_to(self, cast_to: type[ResponseT], options: FinalReques # we internally support defining a temporary header to override the # default `cast_to` type for use with `.with_raw_response` and `.with_streaming_response` # see _response.py for implementation details - override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, NOT_GIVEN) + override_cast_to = headers.pop(OVERRIDE_CAST_TO_HEADER, not_given) if is_given(override_cast_to): options.headers = headers return cast(Type[ResponseT], override_cast_to) @@ -589,6 +679,12 @@ def default_headers(self) -> dict[str, str | Omit]: **self._custom_headers, } + @property + def default_query(self) -> dict[str, object]: + return { + **self._custom_query, + } + def _validate_headers( self, headers: Headers, # noqa: ARG002 @@ -613,7 +709,10 @@ def base_url(self, url: URL | str) -> None: self._base_url = self._enforce_trailing_slash(url if isinstance(url, URL) else URL(url)) def platform_headers(self) -> Dict[str, str]: - return platform_headers(self._version) + # the actual implementation is in a separate `lru_cache` decorated + # function because adding `lru_cache` to methods will leak memory + # https://github.com/python/cpython/issues/88476 + return platform_headers(self._version, platform=self._platform) def _parse_retry_after_header(self, response_headers: Optional[httpx.Headers] = None) -> float | None: """Returns a float of the number of seconds (not milliseconds) to wait after retrying, or None if unspecified. @@ -662,7 +761,8 @@ def _calculate_retry_timeout( if retry_after is not None and 0 < retry_after <= 60: return retry_after - nb_retries = max_retries - remaining_retries + # Also cap retry count to 1000 to avoid any potential overflows with `pow` + nb_retries = min(max_retries - remaining_retries, 1000) # Apply exponential backoff, but not more than the max. sleep_seconds = min(INITIAL_RETRY_DELAY * pow(2.0, nb_retries), MAX_RETRY_DELAY) @@ -711,8 +811,31 @@ def _idempotency_key(self) -> str: return f"stainless-python-retry-{uuid.uuid4()}" -class SyncHttpxClientWrapper(httpx.Client): +class _DefaultHttpxClient(httpx.Client): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultHttpxClient = httpx.Client + """An alias to `httpx.Client` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.Client` will result in httpx's defaults being used, not ours. + """ +else: + DefaultHttpxClient = _DefaultHttpxClient + + +class SyncHttpxClientWrapper(DefaultHttpxClient): def __del__(self) -> None: + if self.is_closed: + return + try: self.close() except Exception: @@ -729,44 +852,12 @@ def __init__( version: str, base_url: str | URL, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: Transport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, _strict_response_validation: bool, ) -> None: - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_LIMITS - - if transport is not None: - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -787,12 +878,9 @@ def __init__( super().__init__( version=version, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, base_url=base_url, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -802,10 +890,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, - limits=limits, - follow_redirects=True, ) def is_closed(self) -> bool: @@ -835,9 +919,9 @@ def __exit__( def _prepare_options( self, options: FinalRequestOptions, # noqa: ARG002 - ) -> None: + ) -> FinalRequestOptions: """Hook for mutating the given options""" - return None + return options def _prepare_request( self, @@ -855,177 +939,164 @@ def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[True], stream_cls: Type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: Type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def request( self, cast_to: Type[ResponseT], options: FinalRequestOptions, - remaining_retries: Optional[int] = None, *, stream: bool = False, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - return self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - remaining_retries=remaining_retries, - ) - - def _request( - self, - *, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - remaining_retries: int | None, - stream: bool, - stream_cls: type[_StreamT] | None, ) -> ResponseT | _StreamT: cast_to = self._maybe_override_cast_to(cast_to, options) - self._prepare_options(options) - retries = self._remaining_retries(remaining_retries, options) - request = self._build_request(options) - self._prepare_request(request) + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - try: - response = self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = self._prepare_options(options) - if retries > 0: - return self._retry_request( - options, - cast_to, - retries, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + self._prepare_request(request) - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - if retries > 0: - return self._retry_request( - options, - cast_to, - retries, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - log.debug( - 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase - ) + response = None + try: + response = self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) + log.debug("idempotent_replayed: %s", response.headers.get("Idempotent-Replayed")) - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + err.response.close() + self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - if retries > 0 and self._should_retry(err.response): - err.response.close() - return self._retry_request( - options, - cast_to, - retries, - err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + err.response.read() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - err.response.read() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return self._process_response( cast_to=cast_to, options=options, response=response, stream=stream, stream_cls=stream_cls, + retries_taken=retries_taken, ) - def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - remaining_retries: int, - response_headers: httpx.Headers | None, - *, - stream: bool, - stream_cls: type[_StreamT] | None, - ) -> ResponseT | _StreamT: - remaining = remaining_retries - 1 - if remaining == 1: + def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken + if remaining_retries == 1: log.debug("1 retry left") else: - log.debug("%i retries left", remaining) + log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) - # In a synchronous context we are blocking the entire thread. Up to the library user to run the client in a - # different thread if necessary. time.sleep(timeout) - return self._request( - options=options, - cast_to=cast_to, - remaining_retries=remaining, - stream=stream, - stream_cls=stream_cls, - ) - def _process_response( self, *, @@ -1034,23 +1105,18 @@ def _process_response( response: httpx.Response, stream: bool, stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, ) -> ResponseT: - if response.request.headers.get(RAW_RESPONSE_HEADER) == "true": - return cast( - ResponseT, - LegacyAPIResponse( - raw=response, - client=self, - cast_to=cast_to, - stream=stream, - stream_cls=stream_cls, - options=options, - ), - ) - origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): if not issubclass(origin, APIResponse): raise TypeError(f"API Response types must subclass {APIResponse}; Received {origin}") @@ -1064,6 +1130,7 @@ def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ), ) @@ -1077,6 +1144,7 @@ def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ) if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): return cast(ResponseT, api_response) @@ -1109,8 +1177,7 @@ def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def get( @@ -1121,8 +1188,7 @@ def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def get( @@ -1133,8 +1199,7 @@ def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def get( self, @@ -1157,11 +1222,11 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload def post( @@ -1170,12 +1235,12 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: Literal[True], stream_cls: type[_StreamT], - ) -> _StreamT: - ... + ) -> _StreamT: ... @overload def post( @@ -1184,12 +1249,12 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool, stream_cls: type[_StreamT] | None = None, - ) -> ResponseT | _StreamT: - ... + ) -> ResponseT | _StreamT: ... def post( self, @@ -1197,13 +1262,25 @@ def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, files: RequestFiles | None = None, stream: bool = False, stream_cls: type[_StreamT] | None = None, ) -> ResponseT | _StreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) @@ -1213,9 +1290,24 @@ def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct( + method="patch", url=path, json_data=body, content=content, files=to_httpx_files(files), **options + ) return self.request(cast_to, opts) def put( @@ -1224,11 +1316,23 @@ def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=to_httpx_files(files), **options ) return self.request(cast_to, opts) @@ -1238,9 +1342,19 @@ def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: BinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return self.request(cast_to, opts) def get_api_list( @@ -1257,8 +1371,53 @@ def get_api_list( return self._request_api_list(model, page, opts) -class AsyncHttpxClientWrapper(httpx.AsyncClient): +class _DefaultAsyncHttpxClient(httpx.AsyncClient): + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + super().__init__(**kwargs) + + +try: + import httpx_aiohttp +except ImportError: + + class _DefaultAioHttpClient(httpx.AsyncClient): + def __init__(self, **_kwargs: Any) -> None: + raise RuntimeError("To use the aiohttp client you must have installed the package with the `aiohttp` extra") +else: + + class _DefaultAioHttpClient(httpx_aiohttp.HttpxAiohttpClient): # type: ignore + def __init__(self, **kwargs: Any) -> None: + kwargs.setdefault("timeout", DEFAULT_TIMEOUT) + kwargs.setdefault("limits", DEFAULT_CONNECTION_LIMITS) + kwargs.setdefault("follow_redirects", True) + + super().__init__(**kwargs) + + +if TYPE_CHECKING: + DefaultAsyncHttpxClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that provides the same defaults that this SDK + uses internally. + + This is useful because overriding the `http_client` with your own instance of + `httpx.AsyncClient` will result in httpx's defaults being used, not ours. + """ + + DefaultAioHttpClient = httpx.AsyncClient + """An alias to `httpx.AsyncClient` that changes the default HTTP transport to `aiohttp`.""" +else: + DefaultAsyncHttpxClient = _DefaultAsyncHttpxClient + DefaultAioHttpClient = _DefaultAioHttpClient + + +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()) @@ -1277,43 +1436,11 @@ def __init__( base_url: str | URL, _strict_response_validation: bool, max_retries: int = DEFAULT_MAX_RETRIES, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, - transport: AsyncTransport | None = None, - proxies: ProxiesTypes | None = None, - limits: Limits | None = None, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, custom_headers: Mapping[str, str] | None = None, custom_query: Mapping[str, object] | None = None, ) -> None: - if limits is not None: - warnings.warn( - "The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `connection_pool_limits`") - else: - limits = DEFAULT_LIMITS - - if transport is not None: - warnings.warn( - "The `transport` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `transport`") - - if proxies is not None: - warnings.warn( - "The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - category=DeprecationWarning, - stacklevel=3, - ) - if http_client is not None: - raise ValueError("The `http_client` argument is mutually exclusive with `proxies`") - if not is_given(timeout): # if the user passed in a custom http client with a non-default # timeout set then we use that timeout. @@ -1335,11 +1462,8 @@ def __init__( super().__init__( version=version, base_url=base_url, - limits=limits, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, max_retries=max_retries, custom_query=custom_query, custom_headers=custom_headers, @@ -1349,10 +1473,6 @@ def __init__( base_url=base_url, # cast to a valid type because mypy doesn't understand our type narrowing timeout=cast(Timeout, timeout), - proxies=proxies, - transport=transport, - limits=limits, - follow_redirects=True, ) def is_closed(self) -> bool: @@ -1379,9 +1499,9 @@ async def __aexit__( async def _prepare_options( self, options: FinalRequestOptions, # noqa: ARG002 - ) -> None: + ) -> FinalRequestOptions: """Hook for mutating the given options""" - return None + return options async def _prepare_request( self, @@ -1401,9 +1521,7 @@ async def request( options: FinalRequestOptions, *, stream: Literal[False] = False, - remaining_retries: Optional[int] = None, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def request( @@ -1413,9 +1531,7 @@ async def request( *, stream: Literal[True], stream_cls: type[_AsyncStreamT], - remaining_retries: Optional[int] = None, - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def request( @@ -1425,9 +1541,7 @@ async def request( *, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def request( self, @@ -1436,138 +1550,138 @@ async def request( *, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, - remaining_retries: Optional[int] = None, ) -> ResponseT | _AsyncStreamT: - return await self._request( - cast_to=cast_to, - options=options, - stream=stream, - stream_cls=stream_cls, - remaining_retries=remaining_retries, - ) + if self._platform is None: + # `get_platform` can make blocking IO calls so we + # execute it earlier while we are in an async context + self._platform = await asyncify(get_platform)() - async def _request( - self, - cast_to: Type[ResponseT], - options: FinalRequestOptions, - *, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - remaining_retries: int | None, - ) -> ResponseT | _AsyncStreamT: cast_to = self._maybe_override_cast_to(cast_to, options) - await self._prepare_options(options) - retries = self._remaining_retries(remaining_retries, options) - request = self._build_request(options) - await self._prepare_request(request) + # create a copy of the options we were given so that if the + # options are mutated later & we then retry, the retries are + # given the original options + input_options = model_copy(options) + if input_options.idempotency_key is None and input_options.method.lower() != "get": + # ensure the idempotency key is reused between requests + input_options.idempotency_key = self._idempotency_key() - kwargs: HttpxSendArgs = {} - if self.custom_auth is not None: - kwargs["auth"] = self.custom_auth + response: httpx.Response | None = None + max_retries = input_options.get_max_retries(self.max_retries) - try: - response = await self._client.send( - request, - stream=stream or self._should_stream_response_body(request=request), - **kwargs, - ) - except httpx.TimeoutException as err: - log.debug("Encountered httpx.TimeoutException", exc_info=True) + retries_taken = 0 + for retries_taken in range(max_retries + 1): + options = model_copy(input_options) + options = await self._prepare_options(options) - if retries > 0: - return await self._retry_request( - options, - cast_to, - retries, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + remaining_retries = max_retries - retries_taken + request = self._build_request(options, retries_taken=retries_taken) + await self._prepare_request(request) - log.debug("Raising timeout error") - raise APITimeoutError(request=request) from err - except Exception as err: - log.debug("Encountered Exception", exc_info=True) + kwargs: HttpxSendArgs = {} + if self.custom_auth is not None: + kwargs["auth"] = self.custom_auth - if retries > 0: - return await self._retry_request( - options, - cast_to, - retries, - stream=stream, - stream_cls=stream_cls, - response_headers=None, - ) + if options.follow_redirects is not None: + kwargs["follow_redirects"] = options.follow_redirects - log.debug("Raising connection error") - raise APIConnectionError(request=request) from err + log.debug("Sending HTTP Request: %s %s", request.method, request.url) - log.debug( - 'HTTP Request: %s %s "%i %s"', request.method, request.url, response.status_code, response.reason_phrase - ) + response = None + try: + response = await self._client.send( + request, + stream=stream or self._should_stream_response_body(request=request), + **kwargs, + ) + except httpx.TimeoutException as err: + log.debug("Encountered httpx.TimeoutException", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising timeout error") + raise APITimeoutError(request=request) from err + except Exception as err: + log.debug("Encountered Exception", exc_info=True) + + if remaining_retries > 0: + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=None, + ) + continue + + log.debug("Raising connection error") + raise APIConnectionError(request=request) from err + + log.debug( + 'HTTP Response: %s %s "%i %s" %s', + request.method, + request.url, + response.status_code, + response.reason_phrase, + response.headers, + ) + log.debug("idempotent_replayed: %s", response.headers.get("Idempotent-Replayed")) - try: - response.raise_for_status() - except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code - log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + try: + response.raise_for_status() + except httpx.HTTPStatusError as err: # thrown on 4xx and 5xx status code + log.debug("Encountered httpx.HTTPStatusError", exc_info=True) + + if remaining_retries > 0 and self._should_retry(err.response): + await err.response.aclose() + await self._sleep_for_retry( + retries_taken=retries_taken, + max_retries=max_retries, + options=input_options, + response=response, + ) + continue - if retries > 0 and self._should_retry(err.response): - await err.response.aclose() - return await self._retry_request( - options, - cast_to, - retries, - err.response.headers, - stream=stream, - stream_cls=stream_cls, - ) + # If the response is streamed then we need to explicitly read the response + # to completion before attempting to access the response text. + if not err.response.is_closed: + await err.response.aread() - # If the response is streamed then we need to explicitly read the response - # to completion before attempting to access the response text. - if not err.response.is_closed: - await err.response.aread() + log.debug("Re-raising status error") + raise self._make_status_error_from_response(err.response) from None - log.debug("Re-raising status error") - raise self._make_status_error_from_response(err.response) from None + break + assert response is not None, "could not resolve response (should never happen)" return await self._process_response( cast_to=cast_to, options=options, response=response, stream=stream, stream_cls=stream_cls, + retries_taken=retries_taken, ) - async def _retry_request( - self, - options: FinalRequestOptions, - cast_to: Type[ResponseT], - remaining_retries: int, - response_headers: httpx.Headers | None, - *, - stream: bool, - stream_cls: type[_AsyncStreamT] | None, - ) -> ResponseT | _AsyncStreamT: - remaining = remaining_retries - 1 - if remaining == 1: + async def _sleep_for_retry( + self, *, retries_taken: int, max_retries: int, options: FinalRequestOptions, response: httpx.Response | None + ) -> None: + remaining_retries = max_retries - retries_taken + if remaining_retries == 1: log.debug("1 retry left") else: - log.debug("%i retries left", remaining) + log.debug("%i retries left", remaining_retries) - timeout = self._calculate_retry_timeout(remaining, options, response_headers) + timeout = self._calculate_retry_timeout(remaining_retries, options, response.headers if response else None) log.info("Retrying request to %s in %f seconds", options.url, timeout) await anyio.sleep(timeout) - return await self._request( - options=options, - cast_to=cast_to, - remaining_retries=remaining, - stream=stream, - stream_cls=stream_cls, - ) - async def _process_response( self, *, @@ -1576,23 +1690,18 @@ async def _process_response( response: httpx.Response, stream: bool, stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, + retries_taken: int = 0, ) -> ResponseT: - if response.request.headers.get(RAW_RESPONSE_HEADER) == "true": - return cast( - ResponseT, - LegacyAPIResponse( - raw=response, - client=self, - cast_to=cast_to, - stream=stream, - stream_cls=stream_cls, - options=options, - ), - ) - origin = get_origin(cast_to) or cast_to - if inspect.isclass(origin) and issubclass(origin, BaseAPIResponse): + if ( + inspect.isclass(origin) + and issubclass(origin, BaseAPIResponse) + # we only want to actually return the custom BaseAPIResponse class if we're + # returning the raw response, or if we're not streaming SSE, as if we're streaming + # SSE then `cast_to` doesn't actively reflect the type we need to parse into + and (not stream or bool(response.request.headers.get(RAW_RESPONSE_HEADER))) + ): if not issubclass(origin, AsyncAPIResponse): raise TypeError(f"API Response types must subclass {AsyncAPIResponse}; Received {origin}") @@ -1606,6 +1715,7 @@ async def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ), ) @@ -1619,6 +1729,7 @@ async def _process_response( stream=stream, stream_cls=stream_cls, options=options, + retries_taken=retries_taken, ) if bool(response.request.headers.get(RAW_RESPONSE_HEADER)): return cast(ResponseT, api_response) @@ -1641,8 +1752,7 @@ async def get( cast_to: Type[ResponseT], options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def get( @@ -1653,8 +1763,7 @@ async def get( options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def get( @@ -1665,8 +1774,7 @@ async def get( options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def get( self, @@ -1687,11 +1795,11 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[False] = False, - ) -> ResponseT: - ... + ) -> ResponseT: ... @overload async def post( @@ -1700,12 +1808,12 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: Literal[True], stream_cls: type[_AsyncStreamT], - ) -> _AsyncStreamT: - ... + ) -> _AsyncStreamT: ... @overload async def post( @@ -1714,12 +1822,12 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool, stream_cls: type[_AsyncStreamT] | None = None, - ) -> ResponseT | _AsyncStreamT: - ... + ) -> ResponseT | _AsyncStreamT: ... async def post( self, @@ -1727,13 +1835,25 @@ async def post( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, stream: bool = False, stream_cls: type[_AsyncStreamT] | None = None, ) -> ResponseT | _AsyncStreamT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="post", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="post", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts, stream=stream, stream_cls=stream_cls) @@ -1743,9 +1863,29 @@ async def patch( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, + files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="patch", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct( + method="patch", + url=path, + json_data=body, + content=content, + files=await async_to_httpx_files(files), + **options, + ) return await self.request(cast_to, opts) async def put( @@ -1754,11 +1894,23 @@ async def put( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, files: RequestFiles | None = None, options: RequestOptions = {}, ) -> ResponseT: + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if files is not None and content is not None: + raise TypeError("Passing both `files` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) opts = FinalRequestOptions.construct( - method="put", url=path, json_data=body, files=await async_to_httpx_files(files), **options + method="put", url=path, json_data=body, content=content, files=await async_to_httpx_files(files), **options ) return await self.request(cast_to, opts) @@ -1768,9 +1920,19 @@ async def delete( *, cast_to: Type[ResponseT], body: Body | None = None, + content: AsyncBinaryTypes | None = None, options: RequestOptions = {}, ) -> ResponseT: - opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, **options) + if body is not None and content is not None: + raise TypeError("Passing both `body` and `content` is not supported") + if isinstance(body, bytes): + warnings.warn( + "Passing raw bytes as `body` is deprecated and will be removed in a future version. " + "Please pass raw bytes via the `content` parameter instead.", + DeprecationWarning, + stacklevel=2, + ) + opts = FinalRequestOptions.construct(method="delete", url=path, json_data=body, content=content, **options) return await self.request(cast_to, opts) def get_api_list( @@ -1794,8 +1956,8 @@ def make_request_options( extra_query: Query | None = None, extra_body: Body | None = None, idempotency_key: str | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - post_parser: PostParser | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + post_parser: PostParser | NotGiven = not_given, ) -> RequestOptions: """Create a dict of type RequestOptions without keys of NotGiven values.""" options: RequestOptions = {} @@ -1824,6 +1986,11 @@ def make_request_options( return options +class ForceMultipartDict(Dict[str, None]): + def __bool__(self) -> bool: + return True + + class OtherPlatform: def __init__(self, name: str) -> None: self.name = name @@ -1891,11 +2058,11 @@ def get_platform() -> Platform: @lru_cache(maxsize=None) -def platform_headers(version: str) -> Dict[str, str]: +def platform_headers(version: str, *, platform: Platform | None) -> Dict[str, str]: return { "X-Stainless-Lang": "python", "X-Stainless-Package-Version": version, - "X-Stainless-OS": str(get_platform()), + "X-Stainless-OS": str(platform or get_platform()), "X-Stainless-Arch": str(get_architecture()), "X-Stainless-Runtime": get_python_runtime(), "X-Stainless-Runtime-Version": get_python_version(), @@ -1930,7 +2097,6 @@ def get_python_version() -> str: def get_architecture() -> Arch: try: - python_bitness, _ = platform.architecture() machine = platform.machine().lower() except Exception: return "unknown" @@ -1946,7 +2112,7 @@ def get_architecture() -> Arch: return "x64" # TODO: untested - if python_bitness == "32bit": + if sys.maxsize <= 2**32: return "x32" if machine: diff --git a/src/increase/_client.py b/src/increase/_client.py index 8d21cea77..49280b23e 100644 --- a/src/increase/_client.py +++ b/src/increase/_client.py @@ -3,47 +3,183 @@ from __future__ import annotations import os -from typing import Any, Dict, Union, Mapping, cast +from typing import TYPE_CHECKING, Any, Dict, Mapping, cast from typing_extensions import Self, Literal, override import httpx -from . import resources, _exceptions +from . import _exceptions from ._qs import Querystring from ._types import ( - NOT_GIVEN, Omit, Timeout, NotGiven, Transport, ProxiesTypes, - AsyncTransport, RequestOptions, + not_given, ) from ._utils import ( is_given, is_mapping, get_async_library, ) +from ._compat import cached_property from ._version import __version__ from ._streaming import Stream as Stream, AsyncStream as AsyncStream from ._exceptions import IncreaseError, APIStatusError from ._base_client import ( - DEFAULT_LIMITS, DEFAULT_MAX_RETRIES, SyncAPIClient, AsyncAPIClient, - SyncHttpxClientWrapper, - AsyncHttpxClientWrapper, ) +if TYPE_CHECKING: + from .resources import ( + cards, + files, + events, + groups, + exports, + accounts, + entities, + programs, + lockboxes, + file_links, + card_tokens, + simulations, + oauth_tokens, + transactions, + ach_transfers, + card_disputes, + card_payments, + check_deposits, + physical_cards, + wire_transfers, + account_numbers, + check_transfers, + routing_numbers, + swift_transfers, + card_validations, + fednow_transfers, + intrafi_balances, + account_transfers, + beneficial_owners, + external_accounts, + oauth_connections, + account_statements, + inbound_mail_items, + intrafi_exclusions, + oauth_applications, + bookkeeping_entries, + card_push_transfers, + event_subscriptions, + real_time_decisions, + ach_prenotifications, + bookkeeping_accounts, + pending_transactions, + declined_transactions, + digital_card_profiles, + digital_wallet_tokens, + inbound_ach_transfers, + bookkeeping_entry_sets, + inbound_check_deposits, + inbound_wire_transfers, + physical_card_profiles, + supplemental_documents, + wire_drawdown_requests, + inbound_fednow_transfers, + card_purchase_supplements, + entity_onboarding_sessions, + intrafi_account_enrollments, + real_time_payments_transfers, + inbound_wire_drawdown_requests, + inbound_real_time_payments_transfers, + ) + from .resources.cards import CardsResource, AsyncCardsResource + from .resources.files import FilesResource, AsyncFilesResource + from .resources.events import EventsResource, AsyncEventsResource + from .resources.groups import GroupsResource, AsyncGroupsResource + from .resources.exports import ExportsResource, AsyncExportsResource + from .resources.accounts import AccountsResource, AsyncAccountsResource + from .resources.entities import EntitiesResource, AsyncEntitiesResource + from .resources.programs import ProgramsResource, AsyncProgramsResource + from .resources.lockboxes import LockboxesResource, AsyncLockboxesResource + from .resources.file_links import FileLinksResource, AsyncFileLinksResource + from .resources.card_tokens import CardTokensResource, AsyncCardTokensResource + from .resources.oauth_tokens import OAuthTokensResource, AsyncOAuthTokensResource + from .resources.transactions import TransactionsResource, AsyncTransactionsResource + from .resources.ach_transfers import ACHTransfersResource, AsyncACHTransfersResource + from .resources.card_disputes import CardDisputesResource, AsyncCardDisputesResource + from .resources.card_payments import CardPaymentsResource, AsyncCardPaymentsResource + from .resources.check_deposits import CheckDepositsResource, AsyncCheckDepositsResource + from .resources.physical_cards import PhysicalCardsResource, AsyncPhysicalCardsResource + from .resources.wire_transfers import WireTransfersResource, AsyncWireTransfersResource + from .resources.account_numbers import AccountNumbersResource, AsyncAccountNumbersResource + from .resources.check_transfers import CheckTransfersResource, AsyncCheckTransfersResource + from .resources.routing_numbers import RoutingNumbersResource, AsyncRoutingNumbersResource + from .resources.swift_transfers import SwiftTransfersResource, AsyncSwiftTransfersResource + from .resources.card_validations import CardValidationsResource, AsyncCardValidationsResource + from .resources.fednow_transfers import FednowTransfersResource, AsyncFednowTransfersResource + from .resources.intrafi_balances import IntrafiBalancesResource, AsyncIntrafiBalancesResource + from .resources.account_transfers import AccountTransfersResource, AsyncAccountTransfersResource + from .resources.beneficial_owners import BeneficialOwnersResource, AsyncBeneficialOwnersResource + from .resources.external_accounts import ExternalAccountsResource, AsyncExternalAccountsResource + from .resources.oauth_connections import OAuthConnectionsResource, AsyncOAuthConnectionsResource + from .resources.account_statements import AccountStatementsResource, AsyncAccountStatementsResource + from .resources.inbound_mail_items import InboundMailItemsResource, AsyncInboundMailItemsResource + from .resources.intrafi_exclusions import IntrafiExclusionsResource, AsyncIntrafiExclusionsResource + from .resources.oauth_applications import OAuthApplicationsResource, AsyncOAuthApplicationsResource + from .resources.bookkeeping_entries import BookkeepingEntriesResource, AsyncBookkeepingEntriesResource + from .resources.card_push_transfers import CardPushTransfersResource, AsyncCardPushTransfersResource + from .resources.event_subscriptions import EventSubscriptionsResource, AsyncEventSubscriptionsResource + from .resources.real_time_decisions import RealTimeDecisionsResource, AsyncRealTimeDecisionsResource + from .resources.ach_prenotifications import ACHPrenotificationsResource, AsyncACHPrenotificationsResource + from .resources.bookkeeping_accounts import BookkeepingAccountsResource, AsyncBookkeepingAccountsResource + from .resources.pending_transactions import PendingTransactionsResource, AsyncPendingTransactionsResource + from .resources.declined_transactions import DeclinedTransactionsResource, AsyncDeclinedTransactionsResource + from .resources.digital_card_profiles import DigitalCardProfilesResource, AsyncDigitalCardProfilesResource + from .resources.digital_wallet_tokens import DigitalWalletTokensResource, AsyncDigitalWalletTokensResource + from .resources.inbound_ach_transfers import InboundACHTransfersResource, AsyncInboundACHTransfersResource + from .resources.bookkeeping_entry_sets import BookkeepingEntrySetsResource, AsyncBookkeepingEntrySetsResource + from .resources.inbound_check_deposits import InboundCheckDepositsResource, AsyncInboundCheckDepositsResource + from .resources.inbound_wire_transfers import InboundWireTransfersResource, AsyncInboundWireTransfersResource + from .resources.physical_card_profiles import PhysicalCardProfilesResource, AsyncPhysicalCardProfilesResource + from .resources.supplemental_documents import SupplementalDocumentsResource, AsyncSupplementalDocumentsResource + from .resources.wire_drawdown_requests import WireDrawdownRequestsResource, AsyncWireDrawdownRequestsResource + from .resources.simulations.simulations import SimulationsResource, AsyncSimulationsResource + from .resources.inbound_fednow_transfers import InboundFednowTransfersResource, AsyncInboundFednowTransfersResource + from .resources.card_purchase_supplements import ( + CardPurchaseSupplementsResource, + AsyncCardPurchaseSupplementsResource, + ) + from .resources.entity_onboarding_sessions import ( + EntityOnboardingSessionsResource, + AsyncEntityOnboardingSessionsResource, + ) + from .resources.intrafi_account_enrollments import ( + IntrafiAccountEnrollmentsResource, + AsyncIntrafiAccountEnrollmentsResource, + ) + from .resources.real_time_payments_transfers import ( + RealTimePaymentsTransfersResource, + AsyncRealTimePaymentsTransfersResource, + ) + from .resources.inbound_wire_drawdown_requests import ( + InboundWireDrawdownRequestsResource, + AsyncInboundWireDrawdownRequestsResource, + ) + from .resources.inbound_real_time_payments_transfers import ( + InboundRealTimePaymentsTransfersResource, + AsyncInboundRealTimePaymentsTransfersResource, + ) + __all__ = [ "ENVIRONMENTS", "Timeout", "Transport", "ProxiesTypes", "RequestOptions", - "resources", "Increase", "AsyncIncrease", "Client", @@ -57,56 +193,6 @@ class Increase(SyncAPIClient): - accounts: resources.Accounts - account_numbers: resources.AccountNumbers - bookkeeping_accounts: resources.BookkeepingAccounts - bookkeeping_entry_sets: resources.BookkeepingEntrySets - bookkeeping_entries: resources.BookkeepingEntries - real_time_decisions: resources.RealTimeDecisions - real_time_payments_transfers: resources.RealTimePaymentsTransfers - cards: resources.Cards - card_disputes: resources.CardDisputes - card_purchase_supplements: resources.CardPurchaseSupplements - external_accounts: resources.ExternalAccounts - exports: resources.Exports - digital_wallet_tokens: resources.DigitalWalletTokens - transactions: resources.Transactions - pending_transactions: resources.PendingTransactions - programs: resources.Programs - declined_transactions: resources.DeclinedTransactions - account_transfers: resources.AccountTransfers - ach_transfers: resources.ACHTransfers - ach_prenotifications: resources.ACHPrenotifications - documents: resources.Documents - wire_transfers: resources.WireTransfers - check_transfers: resources.CheckTransfers - entities: resources.Entities - inbound_ach_transfers: resources.InboundACHTransfers - inbound_wire_drawdown_requests: resources.InboundWireDrawdownRequests - wire_drawdown_requests: resources.WireDrawdownRequests - events: resources.Events - event_subscriptions: resources.EventSubscriptions - files: resources.Files - groups: resources.Groups - oauth_connections: resources.OAuthConnections - check_deposits: resources.CheckDeposits - routing_numbers: resources.RoutingNumbers - account_statements: resources.AccountStatements - simulations: resources.Simulations - physical_cards: resources.PhysicalCards - card_payments: resources.CardPayments - proof_of_authorization_requests: resources.ProofOfAuthorizationRequests - proof_of_authorization_request_submissions: resources.ProofOfAuthorizationRequestSubmissions - intrafi: resources.Intrafi - real_time_payments_request_for_payments: resources.RealTimePaymentsRequestForPayments - webhooks: resources.Webhooks - oauth_tokens: resources.OAuthTokens - inbound_wire_transfers: resources.InboundWireTransfers - digital_card_profiles: resources.DigitalCardProfiles - physical_card_profiles: resources.PhysicalCardProfiles - with_raw_response: IncreaseWithRawResponse - with_streaming_response: IncreaseWithStreamedResponse - # client options api_key: str webhook_secret: str | None @@ -118,20 +204,16 @@ def __init__( *, api_key: str | None = None, webhook_secret: str | None = None, - environment: Literal["production", "sandbox"] | NotGiven = NOT_GIVEN, - base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + environment: Literal["production", "sandbox"] | NotGiven = not_given, + base_url: str | httpx.URL | None | NotGiven = not_given, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. + # Configure a custom httpx client. + # We provide a `DefaultHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#client) for more details. http_client: httpx.Client | None = None, - # See httpx documentation for [custom transports](https://www.python-httpx.org/advanced/#custom-transports) - transport: Transport | None = None, - # See httpx documentation for [proxies](https://www.python-httpx.org/advanced/#http-proxying) - proxies: ProxiesTypes | None = None, - # See httpx documentation for [limits](https://www.python-httpx.org/advanced/#pool-limit-configuration) - connection_pool_limits: httpx.Limits | None = None, # Enable or disable schema validation for data returned by the API. # When enabled an error APIResponseValidationError is raised # if the API responds with invalid data for the expected schema. @@ -142,7 +224,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new synchronous increase client instance. + """Construct a new synchronous Increase client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_key` from `INCREASE_API_KEY` @@ -192,9 +274,6 @@ def __init__( max_retries=max_retries, timeout=timeout, http_client=http_client, - transport=transport, - proxies=proxies, - limits=connection_pool_limits, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation, @@ -202,55 +281,367 @@ def __init__( self._idempotency_header = "Idempotency-Key" - self.accounts = resources.Accounts(self) - self.account_numbers = resources.AccountNumbers(self) - self.bookkeeping_accounts = resources.BookkeepingAccounts(self) - self.bookkeeping_entry_sets = resources.BookkeepingEntrySets(self) - self.bookkeeping_entries = resources.BookkeepingEntries(self) - self.real_time_decisions = resources.RealTimeDecisions(self) - self.real_time_payments_transfers = resources.RealTimePaymentsTransfers(self) - self.cards = resources.Cards(self) - self.card_disputes = resources.CardDisputes(self) - self.card_purchase_supplements = resources.CardPurchaseSupplements(self) - self.external_accounts = resources.ExternalAccounts(self) - self.exports = resources.Exports(self) - self.digital_wallet_tokens = resources.DigitalWalletTokens(self) - self.transactions = resources.Transactions(self) - self.pending_transactions = resources.PendingTransactions(self) - self.programs = resources.Programs(self) - self.declined_transactions = resources.DeclinedTransactions(self) - self.account_transfers = resources.AccountTransfers(self) - self.ach_transfers = resources.ACHTransfers(self) - self.ach_prenotifications = resources.ACHPrenotifications(self) - self.documents = resources.Documents(self) - self.wire_transfers = resources.WireTransfers(self) - self.check_transfers = resources.CheckTransfers(self) - self.entities = resources.Entities(self) - self.inbound_ach_transfers = resources.InboundACHTransfers(self) - self.inbound_wire_drawdown_requests = resources.InboundWireDrawdownRequests(self) - self.wire_drawdown_requests = resources.WireDrawdownRequests(self) - self.events = resources.Events(self) - self.event_subscriptions = resources.EventSubscriptions(self) - self.files = resources.Files(self) - self.groups = resources.Groups(self) - self.oauth_connections = resources.OAuthConnections(self) - self.check_deposits = resources.CheckDeposits(self) - self.routing_numbers = resources.RoutingNumbers(self) - self.account_statements = resources.AccountStatements(self) - self.simulations = resources.Simulations(self) - self.physical_cards = resources.PhysicalCards(self) - self.card_payments = resources.CardPayments(self) - self.proof_of_authorization_requests = resources.ProofOfAuthorizationRequests(self) - self.proof_of_authorization_request_submissions = resources.ProofOfAuthorizationRequestSubmissions(self) - self.intrafi = resources.Intrafi(self) - self.real_time_payments_request_for_payments = resources.RealTimePaymentsRequestForPayments(self) - self.webhooks = resources.Webhooks(self) - self.oauth_tokens = resources.OAuthTokens(self) - self.inbound_wire_transfers = resources.InboundWireTransfers(self) - self.digital_card_profiles = resources.DigitalCardProfiles(self) - self.physical_card_profiles = resources.PhysicalCardProfiles(self) - self.with_raw_response = IncreaseWithRawResponse(self) - self.with_streaming_response = IncreaseWithStreamedResponse(self) + @cached_property + def accounts(self) -> AccountsResource: + from .resources.accounts import AccountsResource + + return AccountsResource(self) + + @cached_property + def account_numbers(self) -> AccountNumbersResource: + from .resources.account_numbers import AccountNumbersResource + + return AccountNumbersResource(self) + + @cached_property + def account_transfers(self) -> AccountTransfersResource: + from .resources.account_transfers import AccountTransfersResource + + return AccountTransfersResource(self) + + @cached_property + def cards(self) -> CardsResource: + from .resources.cards import CardsResource + + return CardsResource(self) + + @cached_property + def card_payments(self) -> CardPaymentsResource: + from .resources.card_payments import CardPaymentsResource + + return CardPaymentsResource(self) + + @cached_property + def card_purchase_supplements(self) -> CardPurchaseSupplementsResource: + from .resources.card_purchase_supplements import CardPurchaseSupplementsResource + + return CardPurchaseSupplementsResource(self) + + @cached_property + def card_disputes(self) -> CardDisputesResource: + from .resources.card_disputes import CardDisputesResource + + return CardDisputesResource(self) + + @cached_property + def physical_cards(self) -> PhysicalCardsResource: + from .resources.physical_cards import PhysicalCardsResource + + return PhysicalCardsResource(self) + + @cached_property + def digital_card_profiles(self) -> DigitalCardProfilesResource: + from .resources.digital_card_profiles import DigitalCardProfilesResource + + return DigitalCardProfilesResource(self) + + @cached_property + def physical_card_profiles(self) -> PhysicalCardProfilesResource: + from .resources.physical_card_profiles import PhysicalCardProfilesResource + + return PhysicalCardProfilesResource(self) + + @cached_property + def digital_wallet_tokens(self) -> DigitalWalletTokensResource: + from .resources.digital_wallet_tokens import DigitalWalletTokensResource + + return DigitalWalletTokensResource(self) + + @cached_property + def transactions(self) -> TransactionsResource: + from .resources.transactions import TransactionsResource + + return TransactionsResource(self) + + @cached_property + def pending_transactions(self) -> PendingTransactionsResource: + from .resources.pending_transactions import PendingTransactionsResource + + return PendingTransactionsResource(self) + + @cached_property + def declined_transactions(self) -> DeclinedTransactionsResource: + from .resources.declined_transactions import DeclinedTransactionsResource + + return DeclinedTransactionsResource(self) + + @cached_property + def ach_transfers(self) -> ACHTransfersResource: + from .resources.ach_transfers import ACHTransfersResource + + return ACHTransfersResource(self) + + @cached_property + def ach_prenotifications(self) -> ACHPrenotificationsResource: + from .resources.ach_prenotifications import ACHPrenotificationsResource + + return ACHPrenotificationsResource(self) + + @cached_property + def inbound_ach_transfers(self) -> InboundACHTransfersResource: + from .resources.inbound_ach_transfers import InboundACHTransfersResource + + return InboundACHTransfersResource(self) + + @cached_property + def wire_transfers(self) -> WireTransfersResource: + from .resources.wire_transfers import WireTransfersResource + + return WireTransfersResource(self) + + @cached_property + def inbound_wire_transfers(self) -> InboundWireTransfersResource: + from .resources.inbound_wire_transfers import InboundWireTransfersResource + + return InboundWireTransfersResource(self) + + @cached_property + def wire_drawdown_requests(self) -> WireDrawdownRequestsResource: + from .resources.wire_drawdown_requests import WireDrawdownRequestsResource + + return WireDrawdownRequestsResource(self) + + @cached_property + def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsResource: + from .resources.inbound_wire_drawdown_requests import InboundWireDrawdownRequestsResource + + return InboundWireDrawdownRequestsResource(self) + + @cached_property + def check_transfers(self) -> CheckTransfersResource: + from .resources.check_transfers import CheckTransfersResource + + return CheckTransfersResource(self) + + @cached_property + def inbound_check_deposits(self) -> InboundCheckDepositsResource: + from .resources.inbound_check_deposits import InboundCheckDepositsResource + + return InboundCheckDepositsResource(self) + + @cached_property + def real_time_payments_transfers(self) -> RealTimePaymentsTransfersResource: + from .resources.real_time_payments_transfers import RealTimePaymentsTransfersResource + + return RealTimePaymentsTransfersResource(self) + + @cached_property + def inbound_real_time_payments_transfers(self) -> InboundRealTimePaymentsTransfersResource: + from .resources.inbound_real_time_payments_transfers import InboundRealTimePaymentsTransfersResource + + return InboundRealTimePaymentsTransfersResource(self) + + @cached_property + def fednow_transfers(self) -> FednowTransfersResource: + from .resources.fednow_transfers import FednowTransfersResource + + return FednowTransfersResource(self) + + @cached_property + def inbound_fednow_transfers(self) -> InboundFednowTransfersResource: + from .resources.inbound_fednow_transfers import InboundFednowTransfersResource + + return InboundFednowTransfersResource(self) + + @cached_property + def swift_transfers(self) -> SwiftTransfersResource: + from .resources.swift_transfers import SwiftTransfersResource + + return SwiftTransfersResource(self) + + @cached_property + def check_deposits(self) -> CheckDepositsResource: + from .resources.check_deposits import CheckDepositsResource + + return CheckDepositsResource(self) + + @cached_property + def lockboxes(self) -> LockboxesResource: + from .resources.lockboxes import LockboxesResource + + return LockboxesResource(self) + + @cached_property + def inbound_mail_items(self) -> InboundMailItemsResource: + from .resources.inbound_mail_items import InboundMailItemsResource + + return InboundMailItemsResource(self) + + @cached_property + def routing_numbers(self) -> RoutingNumbersResource: + from .resources.routing_numbers import RoutingNumbersResource + + return RoutingNumbersResource(self) + + @cached_property + def external_accounts(self) -> ExternalAccountsResource: + from .resources.external_accounts import ExternalAccountsResource + + return ExternalAccountsResource(self) + + @cached_property + def entities(self) -> EntitiesResource: + from .resources.entities import EntitiesResource + + return EntitiesResource(self) + + @cached_property + def beneficial_owners(self) -> BeneficialOwnersResource: + from .resources.beneficial_owners import BeneficialOwnersResource + + return BeneficialOwnersResource(self) + + @cached_property + def supplemental_documents(self) -> SupplementalDocumentsResource: + from .resources.supplemental_documents import SupplementalDocumentsResource + + return SupplementalDocumentsResource(self) + + @cached_property + def entity_onboarding_sessions(self) -> EntityOnboardingSessionsResource: + from .resources.entity_onboarding_sessions import EntityOnboardingSessionsResource + + return EntityOnboardingSessionsResource(self) + + @cached_property + def programs(self) -> ProgramsResource: + from .resources.programs import ProgramsResource + + return ProgramsResource(self) + + @cached_property + def account_statements(self) -> AccountStatementsResource: + from .resources.account_statements import AccountStatementsResource + + return AccountStatementsResource(self) + + @cached_property + def files(self) -> FilesResource: + from .resources.files import FilesResource + + return FilesResource(self) + + @cached_property + def file_links(self) -> FileLinksResource: + from .resources.file_links import FileLinksResource + + return FileLinksResource(self) + + @cached_property + def exports(self) -> ExportsResource: + from .resources.exports import ExportsResource + + return ExportsResource(self) + + @cached_property + def events(self) -> EventsResource: + from .resources.events import EventsResource + + return EventsResource(self) + + @cached_property + def event_subscriptions(self) -> EventSubscriptionsResource: + from .resources.event_subscriptions import EventSubscriptionsResource + + return EventSubscriptionsResource(self) + + @cached_property + def real_time_decisions(self) -> RealTimeDecisionsResource: + from .resources.real_time_decisions import RealTimeDecisionsResource + + return RealTimeDecisionsResource(self) + + @cached_property + def bookkeeping_accounts(self) -> BookkeepingAccountsResource: + from .resources.bookkeeping_accounts import BookkeepingAccountsResource + + return BookkeepingAccountsResource(self) + + @cached_property + def bookkeeping_entry_sets(self) -> BookkeepingEntrySetsResource: + from .resources.bookkeeping_entry_sets import BookkeepingEntrySetsResource + + return BookkeepingEntrySetsResource(self) + + @cached_property + def bookkeeping_entries(self) -> BookkeepingEntriesResource: + from .resources.bookkeeping_entries import BookkeepingEntriesResource + + return BookkeepingEntriesResource(self) + + @cached_property + def groups(self) -> GroupsResource: + from .resources.groups import GroupsResource + + return GroupsResource(self) + + @cached_property + def oauth_applications(self) -> OAuthApplicationsResource: + from .resources.oauth_applications import OAuthApplicationsResource + + return OAuthApplicationsResource(self) + + @cached_property + def oauth_connections(self) -> OAuthConnectionsResource: + from .resources.oauth_connections import OAuthConnectionsResource + + return OAuthConnectionsResource(self) + + @cached_property + def oauth_tokens(self) -> OAuthTokensResource: + from .resources.oauth_tokens import OAuthTokensResource + + return OAuthTokensResource(self) + + @cached_property + def intrafi_account_enrollments(self) -> IntrafiAccountEnrollmentsResource: + from .resources.intrafi_account_enrollments import IntrafiAccountEnrollmentsResource + + return IntrafiAccountEnrollmentsResource(self) + + @cached_property + def intrafi_balances(self) -> IntrafiBalancesResource: + from .resources.intrafi_balances import IntrafiBalancesResource + + return IntrafiBalancesResource(self) + + @cached_property + def intrafi_exclusions(self) -> IntrafiExclusionsResource: + from .resources.intrafi_exclusions import IntrafiExclusionsResource + + return IntrafiExclusionsResource(self) + + @cached_property + def card_tokens(self) -> CardTokensResource: + from .resources.card_tokens import CardTokensResource + + return CardTokensResource(self) + + @cached_property + def card_push_transfers(self) -> CardPushTransfersResource: + from .resources.card_push_transfers import CardPushTransfersResource + + return CardPushTransfersResource(self) + + @cached_property + def card_validations(self) -> CardValidationsResource: + from .resources.card_validations import CardValidationsResource + + return CardValidationsResource(self) + + @cached_property + def simulations(self) -> SimulationsResource: + from .resources.simulations import SimulationsResource + + return SimulationsResource(self) + + @cached_property + def with_raw_response(self) -> IncreaseWithRawResponse: + return IncreaseWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IncreaseWithStreamedResponse: + return IncreaseWithStreamedResponse(self) @property @override @@ -279,10 +670,9 @@ def copy( webhook_secret: str | None = None, environment: Literal["production", "sandbox"] | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.Client | None = None, - connection_pool_limits: httpx.Limits | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -310,24 +700,7 @@ def copy( elif set_default_query is not None: params = set_default_query - if connection_pool_limits is not None: - if http_client is not None: - raise ValueError("The 'http_client' argument is mutually exclusive with 'connection_pool_limits'") - - if not isinstance(self._client, SyncHttpxClientWrapper): - raise ValueError( - "A custom HTTP client has been set and is mutually exclusive with the 'connection_pool_limits' argument" - ) - - http_client = None - else: - if self._limits is not DEFAULT_LIMITS: - connection_pool_limits = self._limits - else: - connection_pool_limits = None - - http_client = http_client or self._client - + http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, webhook_secret=webhook_secret or self.webhook_secret, @@ -335,7 +708,6 @@ def copy( environment=environment or self._environment, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, - connection_pool_limits=connection_pool_limits, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, @@ -390,7 +762,7 @@ def _make_status_error( if type_ == "internal_server_error": return _exceptions.InternalServerError(err_msg, response=response, body=body) - if response.status_code == 500 or response.status_code >= 500: + if response.status_code >= 500: return _exceptions.InternalServerError( err_msg, response=response, @@ -426,56 +798,6 @@ def _make_status_error( class AsyncIncrease(AsyncAPIClient): - accounts: resources.AsyncAccounts - account_numbers: resources.AsyncAccountNumbers - bookkeeping_accounts: resources.AsyncBookkeepingAccounts - bookkeeping_entry_sets: resources.AsyncBookkeepingEntrySets - bookkeeping_entries: resources.AsyncBookkeepingEntries - real_time_decisions: resources.AsyncRealTimeDecisions - real_time_payments_transfers: resources.AsyncRealTimePaymentsTransfers - cards: resources.AsyncCards - card_disputes: resources.AsyncCardDisputes - card_purchase_supplements: resources.AsyncCardPurchaseSupplements - external_accounts: resources.AsyncExternalAccounts - exports: resources.AsyncExports - digital_wallet_tokens: resources.AsyncDigitalWalletTokens - transactions: resources.AsyncTransactions - pending_transactions: resources.AsyncPendingTransactions - programs: resources.AsyncPrograms - declined_transactions: resources.AsyncDeclinedTransactions - account_transfers: resources.AsyncAccountTransfers - ach_transfers: resources.AsyncACHTransfers - ach_prenotifications: resources.AsyncACHPrenotifications - documents: resources.AsyncDocuments - wire_transfers: resources.AsyncWireTransfers - check_transfers: resources.AsyncCheckTransfers - entities: resources.AsyncEntities - inbound_ach_transfers: resources.AsyncInboundACHTransfers - inbound_wire_drawdown_requests: resources.AsyncInboundWireDrawdownRequests - wire_drawdown_requests: resources.AsyncWireDrawdownRequests - events: resources.AsyncEvents - event_subscriptions: resources.AsyncEventSubscriptions - files: resources.AsyncFiles - groups: resources.AsyncGroups - oauth_connections: resources.AsyncOAuthConnections - check_deposits: resources.AsyncCheckDeposits - routing_numbers: resources.AsyncRoutingNumbers - account_statements: resources.AsyncAccountStatements - simulations: resources.AsyncSimulations - physical_cards: resources.AsyncPhysicalCards - card_payments: resources.AsyncCardPayments - proof_of_authorization_requests: resources.AsyncProofOfAuthorizationRequests - proof_of_authorization_request_submissions: resources.AsyncProofOfAuthorizationRequestSubmissions - intrafi: resources.AsyncIntrafi - real_time_payments_request_for_payments: resources.AsyncRealTimePaymentsRequestForPayments - webhooks: resources.AsyncWebhooks - oauth_tokens: resources.AsyncOAuthTokens - inbound_wire_transfers: resources.AsyncInboundWireTransfers - digital_card_profiles: resources.AsyncDigitalCardProfiles - physical_card_profiles: resources.AsyncPhysicalCardProfiles - with_raw_response: AsyncIncreaseWithRawResponse - with_streaming_response: AsyncIncreaseWithStreamedResponse - # client options api_key: str webhook_secret: str | None @@ -487,20 +809,16 @@ def __init__( *, api_key: str | None = None, webhook_secret: str | None = None, - environment: Literal["production", "sandbox"] | NotGiven = NOT_GIVEN, - base_url: str | httpx.URL | None | NotGiven = NOT_GIVEN, - timeout: Union[float, Timeout, None, NotGiven] = NOT_GIVEN, + environment: Literal["production", "sandbox"] | NotGiven = not_given, + base_url: str | httpx.URL | None | NotGiven = not_given, + timeout: float | Timeout | None | NotGiven = not_given, max_retries: int = DEFAULT_MAX_RETRIES, default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, - # Configure a custom httpx client. See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. + # Configure a custom httpx client. + # We provide a `DefaultAsyncHttpxClient` class that you can pass to retain the default values we use for `limits`, `timeout` & `follow_redirects`. + # See the [httpx documentation](https://www.python-httpx.org/api/#asyncclient) for more details. http_client: httpx.AsyncClient | None = None, - # See httpx documentation for [custom transports](https://www.python-httpx.org/advanced/#custom-transports) - transport: AsyncTransport | None = None, - # See httpx documentation for [proxies](https://www.python-httpx.org/advanced/#http-proxying) - proxies: ProxiesTypes | None = None, - # See httpx documentation for [limits](https://www.python-httpx.org/advanced/#pool-limit-configuration) - connection_pool_limits: httpx.Limits | None = None, # Enable or disable schema validation for data returned by the API. # When enabled an error APIResponseValidationError is raised # if the API responds with invalid data for the expected schema. @@ -511,7 +829,7 @@ def __init__( # part of our public interface in the future. _strict_response_validation: bool = False, ) -> None: - """Construct a new async increase client instance. + """Construct a new async AsyncIncrease client instance. This automatically infers the following arguments from their corresponding environment variables if they are not provided: - `api_key` from `INCREASE_API_KEY` @@ -561,9 +879,6 @@ def __init__( max_retries=max_retries, timeout=timeout, http_client=http_client, - transport=transport, - proxies=proxies, - limits=connection_pool_limits, custom_headers=default_headers, custom_query=default_query, _strict_response_validation=_strict_response_validation, @@ -571,55 +886,367 @@ def __init__( self._idempotency_header = "Idempotency-Key" - self.accounts = resources.AsyncAccounts(self) - self.account_numbers = resources.AsyncAccountNumbers(self) - self.bookkeeping_accounts = resources.AsyncBookkeepingAccounts(self) - self.bookkeeping_entry_sets = resources.AsyncBookkeepingEntrySets(self) - self.bookkeeping_entries = resources.AsyncBookkeepingEntries(self) - self.real_time_decisions = resources.AsyncRealTimeDecisions(self) - self.real_time_payments_transfers = resources.AsyncRealTimePaymentsTransfers(self) - self.cards = resources.AsyncCards(self) - self.card_disputes = resources.AsyncCardDisputes(self) - self.card_purchase_supplements = resources.AsyncCardPurchaseSupplements(self) - self.external_accounts = resources.AsyncExternalAccounts(self) - self.exports = resources.AsyncExports(self) - self.digital_wallet_tokens = resources.AsyncDigitalWalletTokens(self) - self.transactions = resources.AsyncTransactions(self) - self.pending_transactions = resources.AsyncPendingTransactions(self) - self.programs = resources.AsyncPrograms(self) - self.declined_transactions = resources.AsyncDeclinedTransactions(self) - self.account_transfers = resources.AsyncAccountTransfers(self) - self.ach_transfers = resources.AsyncACHTransfers(self) - self.ach_prenotifications = resources.AsyncACHPrenotifications(self) - self.documents = resources.AsyncDocuments(self) - self.wire_transfers = resources.AsyncWireTransfers(self) - self.check_transfers = resources.AsyncCheckTransfers(self) - self.entities = resources.AsyncEntities(self) - self.inbound_ach_transfers = resources.AsyncInboundACHTransfers(self) - self.inbound_wire_drawdown_requests = resources.AsyncInboundWireDrawdownRequests(self) - self.wire_drawdown_requests = resources.AsyncWireDrawdownRequests(self) - self.events = resources.AsyncEvents(self) - self.event_subscriptions = resources.AsyncEventSubscriptions(self) - self.files = resources.AsyncFiles(self) - self.groups = resources.AsyncGroups(self) - self.oauth_connections = resources.AsyncOAuthConnections(self) - self.check_deposits = resources.AsyncCheckDeposits(self) - self.routing_numbers = resources.AsyncRoutingNumbers(self) - self.account_statements = resources.AsyncAccountStatements(self) - self.simulations = resources.AsyncSimulations(self) - self.physical_cards = resources.AsyncPhysicalCards(self) - self.card_payments = resources.AsyncCardPayments(self) - self.proof_of_authorization_requests = resources.AsyncProofOfAuthorizationRequests(self) - self.proof_of_authorization_request_submissions = resources.AsyncProofOfAuthorizationRequestSubmissions(self) - self.intrafi = resources.AsyncIntrafi(self) - self.real_time_payments_request_for_payments = resources.AsyncRealTimePaymentsRequestForPayments(self) - self.webhooks = resources.AsyncWebhooks(self) - self.oauth_tokens = resources.AsyncOAuthTokens(self) - self.inbound_wire_transfers = resources.AsyncInboundWireTransfers(self) - self.digital_card_profiles = resources.AsyncDigitalCardProfiles(self) - self.physical_card_profiles = resources.AsyncPhysicalCardProfiles(self) - self.with_raw_response = AsyncIncreaseWithRawResponse(self) - self.with_streaming_response = AsyncIncreaseWithStreamedResponse(self) + @cached_property + def accounts(self) -> AsyncAccountsResource: + from .resources.accounts import AsyncAccountsResource + + return AsyncAccountsResource(self) + + @cached_property + def account_numbers(self) -> AsyncAccountNumbersResource: + from .resources.account_numbers import AsyncAccountNumbersResource + + return AsyncAccountNumbersResource(self) + + @cached_property + def account_transfers(self) -> AsyncAccountTransfersResource: + from .resources.account_transfers import AsyncAccountTransfersResource + + return AsyncAccountTransfersResource(self) + + @cached_property + def cards(self) -> AsyncCardsResource: + from .resources.cards import AsyncCardsResource + + return AsyncCardsResource(self) + + @cached_property + def card_payments(self) -> AsyncCardPaymentsResource: + from .resources.card_payments import AsyncCardPaymentsResource + + return AsyncCardPaymentsResource(self) + + @cached_property + def card_purchase_supplements(self) -> AsyncCardPurchaseSupplementsResource: + from .resources.card_purchase_supplements import AsyncCardPurchaseSupplementsResource + + return AsyncCardPurchaseSupplementsResource(self) + + @cached_property + def card_disputes(self) -> AsyncCardDisputesResource: + from .resources.card_disputes import AsyncCardDisputesResource + + return AsyncCardDisputesResource(self) + + @cached_property + def physical_cards(self) -> AsyncPhysicalCardsResource: + from .resources.physical_cards import AsyncPhysicalCardsResource + + return AsyncPhysicalCardsResource(self) + + @cached_property + def digital_card_profiles(self) -> AsyncDigitalCardProfilesResource: + from .resources.digital_card_profiles import AsyncDigitalCardProfilesResource + + return AsyncDigitalCardProfilesResource(self) + + @cached_property + def physical_card_profiles(self) -> AsyncPhysicalCardProfilesResource: + from .resources.physical_card_profiles import AsyncPhysicalCardProfilesResource + + return AsyncPhysicalCardProfilesResource(self) + + @cached_property + def digital_wallet_tokens(self) -> AsyncDigitalWalletTokensResource: + from .resources.digital_wallet_tokens import AsyncDigitalWalletTokensResource + + return AsyncDigitalWalletTokensResource(self) + + @cached_property + def transactions(self) -> AsyncTransactionsResource: + from .resources.transactions import AsyncTransactionsResource + + return AsyncTransactionsResource(self) + + @cached_property + def pending_transactions(self) -> AsyncPendingTransactionsResource: + from .resources.pending_transactions import AsyncPendingTransactionsResource + + return AsyncPendingTransactionsResource(self) + + @cached_property + def declined_transactions(self) -> AsyncDeclinedTransactionsResource: + from .resources.declined_transactions import AsyncDeclinedTransactionsResource + + return AsyncDeclinedTransactionsResource(self) + + @cached_property + def ach_transfers(self) -> AsyncACHTransfersResource: + from .resources.ach_transfers import AsyncACHTransfersResource + + return AsyncACHTransfersResource(self) + + @cached_property + def ach_prenotifications(self) -> AsyncACHPrenotificationsResource: + from .resources.ach_prenotifications import AsyncACHPrenotificationsResource + + return AsyncACHPrenotificationsResource(self) + + @cached_property + def inbound_ach_transfers(self) -> AsyncInboundACHTransfersResource: + from .resources.inbound_ach_transfers import AsyncInboundACHTransfersResource + + return AsyncInboundACHTransfersResource(self) + + @cached_property + def wire_transfers(self) -> AsyncWireTransfersResource: + from .resources.wire_transfers import AsyncWireTransfersResource + + return AsyncWireTransfersResource(self) + + @cached_property + def inbound_wire_transfers(self) -> AsyncInboundWireTransfersResource: + from .resources.inbound_wire_transfers import AsyncInboundWireTransfersResource + + return AsyncInboundWireTransfersResource(self) + + @cached_property + def wire_drawdown_requests(self) -> AsyncWireDrawdownRequestsResource: + from .resources.wire_drawdown_requests import AsyncWireDrawdownRequestsResource + + return AsyncWireDrawdownRequestsResource(self) + + @cached_property + def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsResource: + from .resources.inbound_wire_drawdown_requests import AsyncInboundWireDrawdownRequestsResource + + return AsyncInboundWireDrawdownRequestsResource(self) + + @cached_property + def check_transfers(self) -> AsyncCheckTransfersResource: + from .resources.check_transfers import AsyncCheckTransfersResource + + return AsyncCheckTransfersResource(self) + + @cached_property + def inbound_check_deposits(self) -> AsyncInboundCheckDepositsResource: + from .resources.inbound_check_deposits import AsyncInboundCheckDepositsResource + + return AsyncInboundCheckDepositsResource(self) + + @cached_property + def real_time_payments_transfers(self) -> AsyncRealTimePaymentsTransfersResource: + from .resources.real_time_payments_transfers import AsyncRealTimePaymentsTransfersResource + + return AsyncRealTimePaymentsTransfersResource(self) + + @cached_property + def inbound_real_time_payments_transfers(self) -> AsyncInboundRealTimePaymentsTransfersResource: + from .resources.inbound_real_time_payments_transfers import AsyncInboundRealTimePaymentsTransfersResource + + return AsyncInboundRealTimePaymentsTransfersResource(self) + + @cached_property + def fednow_transfers(self) -> AsyncFednowTransfersResource: + from .resources.fednow_transfers import AsyncFednowTransfersResource + + return AsyncFednowTransfersResource(self) + + @cached_property + def inbound_fednow_transfers(self) -> AsyncInboundFednowTransfersResource: + from .resources.inbound_fednow_transfers import AsyncInboundFednowTransfersResource + + return AsyncInboundFednowTransfersResource(self) + + @cached_property + def swift_transfers(self) -> AsyncSwiftTransfersResource: + from .resources.swift_transfers import AsyncSwiftTransfersResource + + return AsyncSwiftTransfersResource(self) + + @cached_property + def check_deposits(self) -> AsyncCheckDepositsResource: + from .resources.check_deposits import AsyncCheckDepositsResource + + return AsyncCheckDepositsResource(self) + + @cached_property + def lockboxes(self) -> AsyncLockboxesResource: + from .resources.lockboxes import AsyncLockboxesResource + + return AsyncLockboxesResource(self) + + @cached_property + def inbound_mail_items(self) -> AsyncInboundMailItemsResource: + from .resources.inbound_mail_items import AsyncInboundMailItemsResource + + return AsyncInboundMailItemsResource(self) + + @cached_property + def routing_numbers(self) -> AsyncRoutingNumbersResource: + from .resources.routing_numbers import AsyncRoutingNumbersResource + + return AsyncRoutingNumbersResource(self) + + @cached_property + def external_accounts(self) -> AsyncExternalAccountsResource: + from .resources.external_accounts import AsyncExternalAccountsResource + + return AsyncExternalAccountsResource(self) + + @cached_property + def entities(self) -> AsyncEntitiesResource: + from .resources.entities import AsyncEntitiesResource + + return AsyncEntitiesResource(self) + + @cached_property + def beneficial_owners(self) -> AsyncBeneficialOwnersResource: + from .resources.beneficial_owners import AsyncBeneficialOwnersResource + + return AsyncBeneficialOwnersResource(self) + + @cached_property + def supplemental_documents(self) -> AsyncSupplementalDocumentsResource: + from .resources.supplemental_documents import AsyncSupplementalDocumentsResource + + return AsyncSupplementalDocumentsResource(self) + + @cached_property + def entity_onboarding_sessions(self) -> AsyncEntityOnboardingSessionsResource: + from .resources.entity_onboarding_sessions import AsyncEntityOnboardingSessionsResource + + return AsyncEntityOnboardingSessionsResource(self) + + @cached_property + def programs(self) -> AsyncProgramsResource: + from .resources.programs import AsyncProgramsResource + + return AsyncProgramsResource(self) + + @cached_property + def account_statements(self) -> AsyncAccountStatementsResource: + from .resources.account_statements import AsyncAccountStatementsResource + + return AsyncAccountStatementsResource(self) + + @cached_property + def files(self) -> AsyncFilesResource: + from .resources.files import AsyncFilesResource + + return AsyncFilesResource(self) + + @cached_property + def file_links(self) -> AsyncFileLinksResource: + from .resources.file_links import AsyncFileLinksResource + + return AsyncFileLinksResource(self) + + @cached_property + def exports(self) -> AsyncExportsResource: + from .resources.exports import AsyncExportsResource + + return AsyncExportsResource(self) + + @cached_property + def events(self) -> AsyncEventsResource: + from .resources.events import AsyncEventsResource + + return AsyncEventsResource(self) + + @cached_property + def event_subscriptions(self) -> AsyncEventSubscriptionsResource: + from .resources.event_subscriptions import AsyncEventSubscriptionsResource + + return AsyncEventSubscriptionsResource(self) + + @cached_property + def real_time_decisions(self) -> AsyncRealTimeDecisionsResource: + from .resources.real_time_decisions import AsyncRealTimeDecisionsResource + + return AsyncRealTimeDecisionsResource(self) + + @cached_property + def bookkeeping_accounts(self) -> AsyncBookkeepingAccountsResource: + from .resources.bookkeeping_accounts import AsyncBookkeepingAccountsResource + + return AsyncBookkeepingAccountsResource(self) + + @cached_property + def bookkeeping_entry_sets(self) -> AsyncBookkeepingEntrySetsResource: + from .resources.bookkeeping_entry_sets import AsyncBookkeepingEntrySetsResource + + return AsyncBookkeepingEntrySetsResource(self) + + @cached_property + def bookkeeping_entries(self) -> AsyncBookkeepingEntriesResource: + from .resources.bookkeeping_entries import AsyncBookkeepingEntriesResource + + return AsyncBookkeepingEntriesResource(self) + + @cached_property + def groups(self) -> AsyncGroupsResource: + from .resources.groups import AsyncGroupsResource + + return AsyncGroupsResource(self) + + @cached_property + def oauth_applications(self) -> AsyncOAuthApplicationsResource: + from .resources.oauth_applications import AsyncOAuthApplicationsResource + + return AsyncOAuthApplicationsResource(self) + + @cached_property + def oauth_connections(self) -> AsyncOAuthConnectionsResource: + from .resources.oauth_connections import AsyncOAuthConnectionsResource + + return AsyncOAuthConnectionsResource(self) + + @cached_property + def oauth_tokens(self) -> AsyncOAuthTokensResource: + from .resources.oauth_tokens import AsyncOAuthTokensResource + + return AsyncOAuthTokensResource(self) + + @cached_property + def intrafi_account_enrollments(self) -> AsyncIntrafiAccountEnrollmentsResource: + from .resources.intrafi_account_enrollments import AsyncIntrafiAccountEnrollmentsResource + + return AsyncIntrafiAccountEnrollmentsResource(self) + + @cached_property + def intrafi_balances(self) -> AsyncIntrafiBalancesResource: + from .resources.intrafi_balances import AsyncIntrafiBalancesResource + + return AsyncIntrafiBalancesResource(self) + + @cached_property + def intrafi_exclusions(self) -> AsyncIntrafiExclusionsResource: + from .resources.intrafi_exclusions import AsyncIntrafiExclusionsResource + + return AsyncIntrafiExclusionsResource(self) + + @cached_property + def card_tokens(self) -> AsyncCardTokensResource: + from .resources.card_tokens import AsyncCardTokensResource + + return AsyncCardTokensResource(self) + + @cached_property + def card_push_transfers(self) -> AsyncCardPushTransfersResource: + from .resources.card_push_transfers import AsyncCardPushTransfersResource + + return AsyncCardPushTransfersResource(self) + + @cached_property + def card_validations(self) -> AsyncCardValidationsResource: + from .resources.card_validations import AsyncCardValidationsResource + + return AsyncCardValidationsResource(self) + + @cached_property + def simulations(self) -> AsyncSimulationsResource: + from .resources.simulations import AsyncSimulationsResource + + return AsyncSimulationsResource(self) + + @cached_property + def with_raw_response(self) -> AsyncIncreaseWithRawResponse: + return AsyncIncreaseWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIncreaseWithStreamedResponse: + return AsyncIncreaseWithStreamedResponse(self) @property @override @@ -648,10 +1275,9 @@ def copy( webhook_secret: str | None = None, environment: Literal["production", "sandbox"] | None = None, base_url: str | httpx.URL | None = None, - timeout: float | Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | Timeout | None | NotGiven = not_given, http_client: httpx.AsyncClient | None = None, - connection_pool_limits: httpx.Limits | None = None, - max_retries: int | NotGiven = NOT_GIVEN, + max_retries: int | NotGiven = not_given, default_headers: Mapping[str, str] | None = None, set_default_headers: Mapping[str, str] | None = None, default_query: Mapping[str, object] | None = None, @@ -679,24 +1305,7 @@ def copy( elif set_default_query is not None: params = set_default_query - if connection_pool_limits is not None: - if http_client is not None: - raise ValueError("The 'http_client' argument is mutually exclusive with 'connection_pool_limits'") - - if not isinstance(self._client, AsyncHttpxClientWrapper): - raise ValueError( - "A custom HTTP client has been set and is mutually exclusive with the 'connection_pool_limits' argument" - ) - - http_client = None - else: - if self._limits is not DEFAULT_LIMITS: - connection_pool_limits = self._limits - else: - connection_pool_limits = None - - http_client = http_client or self._client - + http_client = http_client or self._client return self.__class__( api_key=api_key or self.api_key, webhook_secret=webhook_secret or self.webhook_secret, @@ -704,7 +1313,6 @@ def copy( environment=environment or self._environment, timeout=self.timeout if isinstance(timeout, NotGiven) else timeout, http_client=http_client, - connection_pool_limits=connection_pool_limits, max_retries=max_retries if is_given(max_retries) else self.max_retries, default_headers=headers, default_query=params, @@ -759,7 +1367,7 @@ def _make_status_error( if type_ == "internal_server_error": return _exceptions.InternalServerError(err_msg, response=response, body=body) - if response.status_code == 500 or response.status_code >= 500: + if response.status_code >= 500: return _exceptions.InternalServerError( err_msg, response=response, @@ -795,280 +1403,1514 @@ def _make_status_error( class IncreaseWithRawResponse: + _client: Increase + def __init__(self, client: Increase) -> None: - self.accounts = resources.AccountsWithRawResponse(client.accounts) - self.account_numbers = resources.AccountNumbersWithRawResponse(client.account_numbers) - self.bookkeeping_accounts = resources.BookkeepingAccountsWithRawResponse(client.bookkeeping_accounts) - self.bookkeeping_entry_sets = resources.BookkeepingEntrySetsWithRawResponse(client.bookkeeping_entry_sets) - self.bookkeeping_entries = resources.BookkeepingEntriesWithRawResponse(client.bookkeeping_entries) - self.real_time_decisions = resources.RealTimeDecisionsWithRawResponse(client.real_time_decisions) - self.real_time_payments_transfers = resources.RealTimePaymentsTransfersWithRawResponse( - client.real_time_payments_transfers - ) - self.cards = resources.CardsWithRawResponse(client.cards) - self.card_disputes = resources.CardDisputesWithRawResponse(client.card_disputes) - self.card_purchase_supplements = resources.CardPurchaseSupplementsWithRawResponse( - client.card_purchase_supplements - ) - self.external_accounts = resources.ExternalAccountsWithRawResponse(client.external_accounts) - self.exports = resources.ExportsWithRawResponse(client.exports) - self.digital_wallet_tokens = resources.DigitalWalletTokensWithRawResponse(client.digital_wallet_tokens) - self.transactions = resources.TransactionsWithRawResponse(client.transactions) - self.pending_transactions = resources.PendingTransactionsWithRawResponse(client.pending_transactions) - self.programs = resources.ProgramsWithRawResponse(client.programs) - self.declined_transactions = resources.DeclinedTransactionsWithRawResponse(client.declined_transactions) - self.account_transfers = resources.AccountTransfersWithRawResponse(client.account_transfers) - self.ach_transfers = resources.ACHTransfersWithRawResponse(client.ach_transfers) - self.ach_prenotifications = resources.ACHPrenotificationsWithRawResponse(client.ach_prenotifications) - self.documents = resources.DocumentsWithRawResponse(client.documents) - self.wire_transfers = resources.WireTransfersWithRawResponse(client.wire_transfers) - self.check_transfers = resources.CheckTransfersWithRawResponse(client.check_transfers) - self.entities = resources.EntitiesWithRawResponse(client.entities) - self.inbound_ach_transfers = resources.InboundACHTransfersWithRawResponse(client.inbound_ach_transfers) - self.inbound_wire_drawdown_requests = resources.InboundWireDrawdownRequestsWithRawResponse( - client.inbound_wire_drawdown_requests + self._client = client + + @cached_property + def accounts(self) -> accounts.AccountsResourceWithRawResponse: + from .resources.accounts import AccountsResourceWithRawResponse + + return AccountsResourceWithRawResponse(self._client.accounts) + + @cached_property + def account_numbers(self) -> account_numbers.AccountNumbersResourceWithRawResponse: + from .resources.account_numbers import AccountNumbersResourceWithRawResponse + + return AccountNumbersResourceWithRawResponse(self._client.account_numbers) + + @cached_property + def account_transfers(self) -> account_transfers.AccountTransfersResourceWithRawResponse: + from .resources.account_transfers import AccountTransfersResourceWithRawResponse + + return AccountTransfersResourceWithRawResponse(self._client.account_transfers) + + @cached_property + def cards(self) -> cards.CardsResourceWithRawResponse: + from .resources.cards import CardsResourceWithRawResponse + + return CardsResourceWithRawResponse(self._client.cards) + + @cached_property + def card_payments(self) -> card_payments.CardPaymentsResourceWithRawResponse: + from .resources.card_payments import CardPaymentsResourceWithRawResponse + + return CardPaymentsResourceWithRawResponse(self._client.card_payments) + + @cached_property + def card_purchase_supplements(self) -> card_purchase_supplements.CardPurchaseSupplementsResourceWithRawResponse: + from .resources.card_purchase_supplements import CardPurchaseSupplementsResourceWithRawResponse + + return CardPurchaseSupplementsResourceWithRawResponse(self._client.card_purchase_supplements) + + @cached_property + def card_disputes(self) -> card_disputes.CardDisputesResourceWithRawResponse: + from .resources.card_disputes import CardDisputesResourceWithRawResponse + + return CardDisputesResourceWithRawResponse(self._client.card_disputes) + + @cached_property + def physical_cards(self) -> physical_cards.PhysicalCardsResourceWithRawResponse: + from .resources.physical_cards import PhysicalCardsResourceWithRawResponse + + return PhysicalCardsResourceWithRawResponse(self._client.physical_cards) + + @cached_property + def digital_card_profiles(self) -> digital_card_profiles.DigitalCardProfilesResourceWithRawResponse: + from .resources.digital_card_profiles import DigitalCardProfilesResourceWithRawResponse + + return DigitalCardProfilesResourceWithRawResponse(self._client.digital_card_profiles) + + @cached_property + def physical_card_profiles(self) -> physical_card_profiles.PhysicalCardProfilesResourceWithRawResponse: + from .resources.physical_card_profiles import PhysicalCardProfilesResourceWithRawResponse + + return PhysicalCardProfilesResourceWithRawResponse(self._client.physical_card_profiles) + + @cached_property + def digital_wallet_tokens(self) -> digital_wallet_tokens.DigitalWalletTokensResourceWithRawResponse: + from .resources.digital_wallet_tokens import DigitalWalletTokensResourceWithRawResponse + + return DigitalWalletTokensResourceWithRawResponse(self._client.digital_wallet_tokens) + + @cached_property + def transactions(self) -> transactions.TransactionsResourceWithRawResponse: + from .resources.transactions import TransactionsResourceWithRawResponse + + return TransactionsResourceWithRawResponse(self._client.transactions) + + @cached_property + def pending_transactions(self) -> pending_transactions.PendingTransactionsResourceWithRawResponse: + from .resources.pending_transactions import PendingTransactionsResourceWithRawResponse + + return PendingTransactionsResourceWithRawResponse(self._client.pending_transactions) + + @cached_property + def declined_transactions(self) -> declined_transactions.DeclinedTransactionsResourceWithRawResponse: + from .resources.declined_transactions import DeclinedTransactionsResourceWithRawResponse + + return DeclinedTransactionsResourceWithRawResponse(self._client.declined_transactions) + + @cached_property + def ach_transfers(self) -> ach_transfers.ACHTransfersResourceWithRawResponse: + from .resources.ach_transfers import ACHTransfersResourceWithRawResponse + + return ACHTransfersResourceWithRawResponse(self._client.ach_transfers) + + @cached_property + def ach_prenotifications(self) -> ach_prenotifications.ACHPrenotificationsResourceWithRawResponse: + from .resources.ach_prenotifications import ACHPrenotificationsResourceWithRawResponse + + return ACHPrenotificationsResourceWithRawResponse(self._client.ach_prenotifications) + + @cached_property + def inbound_ach_transfers(self) -> inbound_ach_transfers.InboundACHTransfersResourceWithRawResponse: + from .resources.inbound_ach_transfers import InboundACHTransfersResourceWithRawResponse + + return InboundACHTransfersResourceWithRawResponse(self._client.inbound_ach_transfers) + + @cached_property + def wire_transfers(self) -> wire_transfers.WireTransfersResourceWithRawResponse: + from .resources.wire_transfers import WireTransfersResourceWithRawResponse + + return WireTransfersResourceWithRawResponse(self._client.wire_transfers) + + @cached_property + def inbound_wire_transfers(self) -> inbound_wire_transfers.InboundWireTransfersResourceWithRawResponse: + from .resources.inbound_wire_transfers import InboundWireTransfersResourceWithRawResponse + + return InboundWireTransfersResourceWithRawResponse(self._client.inbound_wire_transfers) + + @cached_property + def wire_drawdown_requests(self) -> wire_drawdown_requests.WireDrawdownRequestsResourceWithRawResponse: + from .resources.wire_drawdown_requests import WireDrawdownRequestsResourceWithRawResponse + + return WireDrawdownRequestsResourceWithRawResponse(self._client.wire_drawdown_requests) + + @cached_property + def inbound_wire_drawdown_requests( + self, + ) -> inbound_wire_drawdown_requests.InboundWireDrawdownRequestsResourceWithRawResponse: + from .resources.inbound_wire_drawdown_requests import InboundWireDrawdownRequestsResourceWithRawResponse + + return InboundWireDrawdownRequestsResourceWithRawResponse(self._client.inbound_wire_drawdown_requests) + + @cached_property + def check_transfers(self) -> check_transfers.CheckTransfersResourceWithRawResponse: + from .resources.check_transfers import CheckTransfersResourceWithRawResponse + + return CheckTransfersResourceWithRawResponse(self._client.check_transfers) + + @cached_property + def inbound_check_deposits(self) -> inbound_check_deposits.InboundCheckDepositsResourceWithRawResponse: + from .resources.inbound_check_deposits import InboundCheckDepositsResourceWithRawResponse + + return InboundCheckDepositsResourceWithRawResponse(self._client.inbound_check_deposits) + + @cached_property + def real_time_payments_transfers( + self, + ) -> real_time_payments_transfers.RealTimePaymentsTransfersResourceWithRawResponse: + from .resources.real_time_payments_transfers import RealTimePaymentsTransfersResourceWithRawResponse + + return RealTimePaymentsTransfersResourceWithRawResponse(self._client.real_time_payments_transfers) + + @cached_property + def inbound_real_time_payments_transfers( + self, + ) -> inbound_real_time_payments_transfers.InboundRealTimePaymentsTransfersResourceWithRawResponse: + from .resources.inbound_real_time_payments_transfers import ( + InboundRealTimePaymentsTransfersResourceWithRawResponse, ) - self.wire_drawdown_requests = resources.WireDrawdownRequestsWithRawResponse(client.wire_drawdown_requests) - self.events = resources.EventsWithRawResponse(client.events) - self.event_subscriptions = resources.EventSubscriptionsWithRawResponse(client.event_subscriptions) - self.files = resources.FilesWithRawResponse(client.files) - self.groups = resources.GroupsWithRawResponse(client.groups) - self.oauth_connections = resources.OAuthConnectionsWithRawResponse(client.oauth_connections) - self.check_deposits = resources.CheckDepositsWithRawResponse(client.check_deposits) - self.routing_numbers = resources.RoutingNumbersWithRawResponse(client.routing_numbers) - self.account_statements = resources.AccountStatementsWithRawResponse(client.account_statements) - self.simulations = resources.SimulationsWithRawResponse(client.simulations) - self.physical_cards = resources.PhysicalCardsWithRawResponse(client.physical_cards) - self.card_payments = resources.CardPaymentsWithRawResponse(client.card_payments) - self.proof_of_authorization_requests = resources.ProofOfAuthorizationRequestsWithRawResponse( - client.proof_of_authorization_requests + + return InboundRealTimePaymentsTransfersResourceWithRawResponse( + self._client.inbound_real_time_payments_transfers ) - self.proof_of_authorization_request_submissions = ( - resources.ProofOfAuthorizationRequestSubmissionsWithRawResponse( - client.proof_of_authorization_request_submissions - ) + + @cached_property + def fednow_transfers(self) -> fednow_transfers.FednowTransfersResourceWithRawResponse: + from .resources.fednow_transfers import FednowTransfersResourceWithRawResponse + + return FednowTransfersResourceWithRawResponse(self._client.fednow_transfers) + + @cached_property + def inbound_fednow_transfers(self) -> inbound_fednow_transfers.InboundFednowTransfersResourceWithRawResponse: + from .resources.inbound_fednow_transfers import InboundFednowTransfersResourceWithRawResponse + + return InboundFednowTransfersResourceWithRawResponse(self._client.inbound_fednow_transfers) + + @cached_property + def swift_transfers(self) -> swift_transfers.SwiftTransfersResourceWithRawResponse: + from .resources.swift_transfers import SwiftTransfersResourceWithRawResponse + + return SwiftTransfersResourceWithRawResponse(self._client.swift_transfers) + + @cached_property + def check_deposits(self) -> check_deposits.CheckDepositsResourceWithRawResponse: + from .resources.check_deposits import CheckDepositsResourceWithRawResponse + + return CheckDepositsResourceWithRawResponse(self._client.check_deposits) + + @cached_property + def lockboxes(self) -> lockboxes.LockboxesResourceWithRawResponse: + from .resources.lockboxes import LockboxesResourceWithRawResponse + + return LockboxesResourceWithRawResponse(self._client.lockboxes) + + @cached_property + def inbound_mail_items(self) -> inbound_mail_items.InboundMailItemsResourceWithRawResponse: + from .resources.inbound_mail_items import InboundMailItemsResourceWithRawResponse + + return InboundMailItemsResourceWithRawResponse(self._client.inbound_mail_items) + + @cached_property + def routing_numbers(self) -> routing_numbers.RoutingNumbersResourceWithRawResponse: + from .resources.routing_numbers import RoutingNumbersResourceWithRawResponse + + return RoutingNumbersResourceWithRawResponse(self._client.routing_numbers) + + @cached_property + def external_accounts(self) -> external_accounts.ExternalAccountsResourceWithRawResponse: + from .resources.external_accounts import ExternalAccountsResourceWithRawResponse + + return ExternalAccountsResourceWithRawResponse(self._client.external_accounts) + + @cached_property + def entities(self) -> entities.EntitiesResourceWithRawResponse: + from .resources.entities import EntitiesResourceWithRawResponse + + return EntitiesResourceWithRawResponse(self._client.entities) + + @cached_property + def beneficial_owners(self) -> beneficial_owners.BeneficialOwnersResourceWithRawResponse: + from .resources.beneficial_owners import BeneficialOwnersResourceWithRawResponse + + return BeneficialOwnersResourceWithRawResponse(self._client.beneficial_owners) + + @cached_property + def supplemental_documents(self) -> supplemental_documents.SupplementalDocumentsResourceWithRawResponse: + from .resources.supplemental_documents import SupplementalDocumentsResourceWithRawResponse + + return SupplementalDocumentsResourceWithRawResponse(self._client.supplemental_documents) + + @cached_property + def entity_onboarding_sessions(self) -> entity_onboarding_sessions.EntityOnboardingSessionsResourceWithRawResponse: + from .resources.entity_onboarding_sessions import EntityOnboardingSessionsResourceWithRawResponse + + return EntityOnboardingSessionsResourceWithRawResponse(self._client.entity_onboarding_sessions) + + @cached_property + def programs(self) -> programs.ProgramsResourceWithRawResponse: + from .resources.programs import ProgramsResourceWithRawResponse + + return ProgramsResourceWithRawResponse(self._client.programs) + + @cached_property + def account_statements(self) -> account_statements.AccountStatementsResourceWithRawResponse: + from .resources.account_statements import AccountStatementsResourceWithRawResponse + + return AccountStatementsResourceWithRawResponse(self._client.account_statements) + + @cached_property + def files(self) -> files.FilesResourceWithRawResponse: + from .resources.files import FilesResourceWithRawResponse + + return FilesResourceWithRawResponse(self._client.files) + + @cached_property + def file_links(self) -> file_links.FileLinksResourceWithRawResponse: + from .resources.file_links import FileLinksResourceWithRawResponse + + return FileLinksResourceWithRawResponse(self._client.file_links) + + @cached_property + def exports(self) -> exports.ExportsResourceWithRawResponse: + from .resources.exports import ExportsResourceWithRawResponse + + return ExportsResourceWithRawResponse(self._client.exports) + + @cached_property + def events(self) -> events.EventsResourceWithRawResponse: + from .resources.events import EventsResourceWithRawResponse + + return EventsResourceWithRawResponse(self._client.events) + + @cached_property + def event_subscriptions(self) -> event_subscriptions.EventSubscriptionsResourceWithRawResponse: + from .resources.event_subscriptions import EventSubscriptionsResourceWithRawResponse + + return EventSubscriptionsResourceWithRawResponse(self._client.event_subscriptions) + + @cached_property + def real_time_decisions(self) -> real_time_decisions.RealTimeDecisionsResourceWithRawResponse: + from .resources.real_time_decisions import RealTimeDecisionsResourceWithRawResponse + + return RealTimeDecisionsResourceWithRawResponse(self._client.real_time_decisions) + + @cached_property + def bookkeeping_accounts(self) -> bookkeeping_accounts.BookkeepingAccountsResourceWithRawResponse: + from .resources.bookkeeping_accounts import BookkeepingAccountsResourceWithRawResponse + + return BookkeepingAccountsResourceWithRawResponse(self._client.bookkeeping_accounts) + + @cached_property + def bookkeeping_entry_sets(self) -> bookkeeping_entry_sets.BookkeepingEntrySetsResourceWithRawResponse: + from .resources.bookkeeping_entry_sets import BookkeepingEntrySetsResourceWithRawResponse + + return BookkeepingEntrySetsResourceWithRawResponse(self._client.bookkeeping_entry_sets) + + @cached_property + def bookkeeping_entries(self) -> bookkeeping_entries.BookkeepingEntriesResourceWithRawResponse: + from .resources.bookkeeping_entries import BookkeepingEntriesResourceWithRawResponse + + return BookkeepingEntriesResourceWithRawResponse(self._client.bookkeeping_entries) + + @cached_property + def groups(self) -> groups.GroupsResourceWithRawResponse: + from .resources.groups import GroupsResourceWithRawResponse + + return GroupsResourceWithRawResponse(self._client.groups) + + @cached_property + def oauth_applications(self) -> oauth_applications.OAuthApplicationsResourceWithRawResponse: + from .resources.oauth_applications import OAuthApplicationsResourceWithRawResponse + + return OAuthApplicationsResourceWithRawResponse(self._client.oauth_applications) + + @cached_property + def oauth_connections(self) -> oauth_connections.OAuthConnectionsResourceWithRawResponse: + from .resources.oauth_connections import OAuthConnectionsResourceWithRawResponse + + return OAuthConnectionsResourceWithRawResponse(self._client.oauth_connections) + + @cached_property + def oauth_tokens(self) -> oauth_tokens.OAuthTokensResourceWithRawResponse: + from .resources.oauth_tokens import OAuthTokensResourceWithRawResponse + + return OAuthTokensResourceWithRawResponse(self._client.oauth_tokens) + + @cached_property + def intrafi_account_enrollments( + self, + ) -> intrafi_account_enrollments.IntrafiAccountEnrollmentsResourceWithRawResponse: + from .resources.intrafi_account_enrollments import IntrafiAccountEnrollmentsResourceWithRawResponse + + return IntrafiAccountEnrollmentsResourceWithRawResponse(self._client.intrafi_account_enrollments) + + @cached_property + def intrafi_balances(self) -> intrafi_balances.IntrafiBalancesResourceWithRawResponse: + from .resources.intrafi_balances import IntrafiBalancesResourceWithRawResponse + + return IntrafiBalancesResourceWithRawResponse(self._client.intrafi_balances) + + @cached_property + def intrafi_exclusions(self) -> intrafi_exclusions.IntrafiExclusionsResourceWithRawResponse: + from .resources.intrafi_exclusions import IntrafiExclusionsResourceWithRawResponse + + return IntrafiExclusionsResourceWithRawResponse(self._client.intrafi_exclusions) + + @cached_property + def card_tokens(self) -> card_tokens.CardTokensResourceWithRawResponse: + from .resources.card_tokens import CardTokensResourceWithRawResponse + + return CardTokensResourceWithRawResponse(self._client.card_tokens) + + @cached_property + def card_push_transfers(self) -> card_push_transfers.CardPushTransfersResourceWithRawResponse: + from .resources.card_push_transfers import CardPushTransfersResourceWithRawResponse + + return CardPushTransfersResourceWithRawResponse(self._client.card_push_transfers) + + @cached_property + def card_validations(self) -> card_validations.CardValidationsResourceWithRawResponse: + from .resources.card_validations import CardValidationsResourceWithRawResponse + + return CardValidationsResourceWithRawResponse(self._client.card_validations) + + @cached_property + def simulations(self) -> simulations.SimulationsResourceWithRawResponse: + from .resources.simulations import SimulationsResourceWithRawResponse + + return SimulationsResourceWithRawResponse(self._client.simulations) + + +class AsyncIncreaseWithRawResponse: + _client: AsyncIncrease + + def __init__(self, client: AsyncIncrease) -> None: + self._client = client + + @cached_property + def accounts(self) -> accounts.AsyncAccountsResourceWithRawResponse: + from .resources.accounts import AsyncAccountsResourceWithRawResponse + + return AsyncAccountsResourceWithRawResponse(self._client.accounts) + + @cached_property + def account_numbers(self) -> account_numbers.AsyncAccountNumbersResourceWithRawResponse: + from .resources.account_numbers import AsyncAccountNumbersResourceWithRawResponse + + return AsyncAccountNumbersResourceWithRawResponse(self._client.account_numbers) + + @cached_property + def account_transfers(self) -> account_transfers.AsyncAccountTransfersResourceWithRawResponse: + from .resources.account_transfers import AsyncAccountTransfersResourceWithRawResponse + + return AsyncAccountTransfersResourceWithRawResponse(self._client.account_transfers) + + @cached_property + def cards(self) -> cards.AsyncCardsResourceWithRawResponse: + from .resources.cards import AsyncCardsResourceWithRawResponse + + return AsyncCardsResourceWithRawResponse(self._client.cards) + + @cached_property + def card_payments(self) -> card_payments.AsyncCardPaymentsResourceWithRawResponse: + from .resources.card_payments import AsyncCardPaymentsResourceWithRawResponse + + return AsyncCardPaymentsResourceWithRawResponse(self._client.card_payments) + + @cached_property + def card_purchase_supplements( + self, + ) -> card_purchase_supplements.AsyncCardPurchaseSupplementsResourceWithRawResponse: + from .resources.card_purchase_supplements import AsyncCardPurchaseSupplementsResourceWithRawResponse + + return AsyncCardPurchaseSupplementsResourceWithRawResponse(self._client.card_purchase_supplements) + + @cached_property + def card_disputes(self) -> card_disputes.AsyncCardDisputesResourceWithRawResponse: + from .resources.card_disputes import AsyncCardDisputesResourceWithRawResponse + + return AsyncCardDisputesResourceWithRawResponse(self._client.card_disputes) + + @cached_property + def physical_cards(self) -> physical_cards.AsyncPhysicalCardsResourceWithRawResponse: + from .resources.physical_cards import AsyncPhysicalCardsResourceWithRawResponse + + return AsyncPhysicalCardsResourceWithRawResponse(self._client.physical_cards) + + @cached_property + def digital_card_profiles(self) -> digital_card_profiles.AsyncDigitalCardProfilesResourceWithRawResponse: + from .resources.digital_card_profiles import AsyncDigitalCardProfilesResourceWithRawResponse + + return AsyncDigitalCardProfilesResourceWithRawResponse(self._client.digital_card_profiles) + + @cached_property + def physical_card_profiles(self) -> physical_card_profiles.AsyncPhysicalCardProfilesResourceWithRawResponse: + from .resources.physical_card_profiles import AsyncPhysicalCardProfilesResourceWithRawResponse + + return AsyncPhysicalCardProfilesResourceWithRawResponse(self._client.physical_card_profiles) + + @cached_property + def digital_wallet_tokens(self) -> digital_wallet_tokens.AsyncDigitalWalletTokensResourceWithRawResponse: + from .resources.digital_wallet_tokens import AsyncDigitalWalletTokensResourceWithRawResponse + + return AsyncDigitalWalletTokensResourceWithRawResponse(self._client.digital_wallet_tokens) + + @cached_property + def transactions(self) -> transactions.AsyncTransactionsResourceWithRawResponse: + from .resources.transactions import AsyncTransactionsResourceWithRawResponse + + return AsyncTransactionsResourceWithRawResponse(self._client.transactions) + + @cached_property + def pending_transactions(self) -> pending_transactions.AsyncPendingTransactionsResourceWithRawResponse: + from .resources.pending_transactions import AsyncPendingTransactionsResourceWithRawResponse + + return AsyncPendingTransactionsResourceWithRawResponse(self._client.pending_transactions) + + @cached_property + def declined_transactions(self) -> declined_transactions.AsyncDeclinedTransactionsResourceWithRawResponse: + from .resources.declined_transactions import AsyncDeclinedTransactionsResourceWithRawResponse + + return AsyncDeclinedTransactionsResourceWithRawResponse(self._client.declined_transactions) + + @cached_property + def ach_transfers(self) -> ach_transfers.AsyncACHTransfersResourceWithRawResponse: + from .resources.ach_transfers import AsyncACHTransfersResourceWithRawResponse + + return AsyncACHTransfersResourceWithRawResponse(self._client.ach_transfers) + + @cached_property + def ach_prenotifications(self) -> ach_prenotifications.AsyncACHPrenotificationsResourceWithRawResponse: + from .resources.ach_prenotifications import AsyncACHPrenotificationsResourceWithRawResponse + + return AsyncACHPrenotificationsResourceWithRawResponse(self._client.ach_prenotifications) + + @cached_property + def inbound_ach_transfers(self) -> inbound_ach_transfers.AsyncInboundACHTransfersResourceWithRawResponse: + from .resources.inbound_ach_transfers import AsyncInboundACHTransfersResourceWithRawResponse + + return AsyncInboundACHTransfersResourceWithRawResponse(self._client.inbound_ach_transfers) + + @cached_property + def wire_transfers(self) -> wire_transfers.AsyncWireTransfersResourceWithRawResponse: + from .resources.wire_transfers import AsyncWireTransfersResourceWithRawResponse + + return AsyncWireTransfersResourceWithRawResponse(self._client.wire_transfers) + + @cached_property + def inbound_wire_transfers(self) -> inbound_wire_transfers.AsyncInboundWireTransfersResourceWithRawResponse: + from .resources.inbound_wire_transfers import AsyncInboundWireTransfersResourceWithRawResponse + + return AsyncInboundWireTransfersResourceWithRawResponse(self._client.inbound_wire_transfers) + + @cached_property + def wire_drawdown_requests(self) -> wire_drawdown_requests.AsyncWireDrawdownRequestsResourceWithRawResponse: + from .resources.wire_drawdown_requests import AsyncWireDrawdownRequestsResourceWithRawResponse + + return AsyncWireDrawdownRequestsResourceWithRawResponse(self._client.wire_drawdown_requests) + + @cached_property + def inbound_wire_drawdown_requests( + self, + ) -> inbound_wire_drawdown_requests.AsyncInboundWireDrawdownRequestsResourceWithRawResponse: + from .resources.inbound_wire_drawdown_requests import AsyncInboundWireDrawdownRequestsResourceWithRawResponse + + return AsyncInboundWireDrawdownRequestsResourceWithRawResponse(self._client.inbound_wire_drawdown_requests) + + @cached_property + def check_transfers(self) -> check_transfers.AsyncCheckTransfersResourceWithRawResponse: + from .resources.check_transfers import AsyncCheckTransfersResourceWithRawResponse + + return AsyncCheckTransfersResourceWithRawResponse(self._client.check_transfers) + + @cached_property + def inbound_check_deposits(self) -> inbound_check_deposits.AsyncInboundCheckDepositsResourceWithRawResponse: + from .resources.inbound_check_deposits import AsyncInboundCheckDepositsResourceWithRawResponse + + return AsyncInboundCheckDepositsResourceWithRawResponse(self._client.inbound_check_deposits) + + @cached_property + def real_time_payments_transfers( + self, + ) -> real_time_payments_transfers.AsyncRealTimePaymentsTransfersResourceWithRawResponse: + from .resources.real_time_payments_transfers import AsyncRealTimePaymentsTransfersResourceWithRawResponse + + return AsyncRealTimePaymentsTransfersResourceWithRawResponse(self._client.real_time_payments_transfers) + + @cached_property + def inbound_real_time_payments_transfers( + self, + ) -> inbound_real_time_payments_transfers.AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse: + from .resources.inbound_real_time_payments_transfers import ( + AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse, ) - self.intrafi = resources.IntrafiWithRawResponse(client.intrafi) - self.real_time_payments_request_for_payments = resources.RealTimePaymentsRequestForPaymentsWithRawResponse( - client.real_time_payments_request_for_payments + + return AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse( + self._client.inbound_real_time_payments_transfers ) - self.oauth_tokens = resources.OAuthTokensWithRawResponse(client.oauth_tokens) - self.inbound_wire_transfers = resources.InboundWireTransfersWithRawResponse(client.inbound_wire_transfers) - self.digital_card_profiles = resources.DigitalCardProfilesWithRawResponse(client.digital_card_profiles) - self.physical_card_profiles = resources.PhysicalCardProfilesWithRawResponse(client.physical_card_profiles) + @cached_property + def fednow_transfers(self) -> fednow_transfers.AsyncFednowTransfersResourceWithRawResponse: + from .resources.fednow_transfers import AsyncFednowTransfersResourceWithRawResponse + + return AsyncFednowTransfersResourceWithRawResponse(self._client.fednow_transfers) + + @cached_property + def inbound_fednow_transfers(self) -> inbound_fednow_transfers.AsyncInboundFednowTransfersResourceWithRawResponse: + from .resources.inbound_fednow_transfers import AsyncInboundFednowTransfersResourceWithRawResponse + + return AsyncInboundFednowTransfersResourceWithRawResponse(self._client.inbound_fednow_transfers) + + @cached_property + def swift_transfers(self) -> swift_transfers.AsyncSwiftTransfersResourceWithRawResponse: + from .resources.swift_transfers import AsyncSwiftTransfersResourceWithRawResponse + + return AsyncSwiftTransfersResourceWithRawResponse(self._client.swift_transfers) + + @cached_property + def check_deposits(self) -> check_deposits.AsyncCheckDepositsResourceWithRawResponse: + from .resources.check_deposits import AsyncCheckDepositsResourceWithRawResponse + + return AsyncCheckDepositsResourceWithRawResponse(self._client.check_deposits) + + @cached_property + def lockboxes(self) -> lockboxes.AsyncLockboxesResourceWithRawResponse: + from .resources.lockboxes import AsyncLockboxesResourceWithRawResponse + + return AsyncLockboxesResourceWithRawResponse(self._client.lockboxes) + + @cached_property + def inbound_mail_items(self) -> inbound_mail_items.AsyncInboundMailItemsResourceWithRawResponse: + from .resources.inbound_mail_items import AsyncInboundMailItemsResourceWithRawResponse + + return AsyncInboundMailItemsResourceWithRawResponse(self._client.inbound_mail_items) + + @cached_property + def routing_numbers(self) -> routing_numbers.AsyncRoutingNumbersResourceWithRawResponse: + from .resources.routing_numbers import AsyncRoutingNumbersResourceWithRawResponse + + return AsyncRoutingNumbersResourceWithRawResponse(self._client.routing_numbers) + + @cached_property + def external_accounts(self) -> external_accounts.AsyncExternalAccountsResourceWithRawResponse: + from .resources.external_accounts import AsyncExternalAccountsResourceWithRawResponse + + return AsyncExternalAccountsResourceWithRawResponse(self._client.external_accounts) + + @cached_property + def entities(self) -> entities.AsyncEntitiesResourceWithRawResponse: + from .resources.entities import AsyncEntitiesResourceWithRawResponse + + return AsyncEntitiesResourceWithRawResponse(self._client.entities) + + @cached_property + def beneficial_owners(self) -> beneficial_owners.AsyncBeneficialOwnersResourceWithRawResponse: + from .resources.beneficial_owners import AsyncBeneficialOwnersResourceWithRawResponse + + return AsyncBeneficialOwnersResourceWithRawResponse(self._client.beneficial_owners) + + @cached_property + def supplemental_documents(self) -> supplemental_documents.AsyncSupplementalDocumentsResourceWithRawResponse: + from .resources.supplemental_documents import AsyncSupplementalDocumentsResourceWithRawResponse + + return AsyncSupplementalDocumentsResourceWithRawResponse(self._client.supplemental_documents) + + @cached_property + def entity_onboarding_sessions( + self, + ) -> entity_onboarding_sessions.AsyncEntityOnboardingSessionsResourceWithRawResponse: + from .resources.entity_onboarding_sessions import AsyncEntityOnboardingSessionsResourceWithRawResponse + + return AsyncEntityOnboardingSessionsResourceWithRawResponse(self._client.entity_onboarding_sessions) + + @cached_property + def programs(self) -> programs.AsyncProgramsResourceWithRawResponse: + from .resources.programs import AsyncProgramsResourceWithRawResponse + + return AsyncProgramsResourceWithRawResponse(self._client.programs) + + @cached_property + def account_statements(self) -> account_statements.AsyncAccountStatementsResourceWithRawResponse: + from .resources.account_statements import AsyncAccountStatementsResourceWithRawResponse + + return AsyncAccountStatementsResourceWithRawResponse(self._client.account_statements) + + @cached_property + def files(self) -> files.AsyncFilesResourceWithRawResponse: + from .resources.files import AsyncFilesResourceWithRawResponse + + return AsyncFilesResourceWithRawResponse(self._client.files) + + @cached_property + def file_links(self) -> file_links.AsyncFileLinksResourceWithRawResponse: + from .resources.file_links import AsyncFileLinksResourceWithRawResponse + + return AsyncFileLinksResourceWithRawResponse(self._client.file_links) + + @cached_property + def exports(self) -> exports.AsyncExportsResourceWithRawResponse: + from .resources.exports import AsyncExportsResourceWithRawResponse + + return AsyncExportsResourceWithRawResponse(self._client.exports) + + @cached_property + def events(self) -> events.AsyncEventsResourceWithRawResponse: + from .resources.events import AsyncEventsResourceWithRawResponse + + return AsyncEventsResourceWithRawResponse(self._client.events) + + @cached_property + def event_subscriptions(self) -> event_subscriptions.AsyncEventSubscriptionsResourceWithRawResponse: + from .resources.event_subscriptions import AsyncEventSubscriptionsResourceWithRawResponse + + return AsyncEventSubscriptionsResourceWithRawResponse(self._client.event_subscriptions) + + @cached_property + def real_time_decisions(self) -> real_time_decisions.AsyncRealTimeDecisionsResourceWithRawResponse: + from .resources.real_time_decisions import AsyncRealTimeDecisionsResourceWithRawResponse + + return AsyncRealTimeDecisionsResourceWithRawResponse(self._client.real_time_decisions) + + @cached_property + def bookkeeping_accounts(self) -> bookkeeping_accounts.AsyncBookkeepingAccountsResourceWithRawResponse: + from .resources.bookkeeping_accounts import AsyncBookkeepingAccountsResourceWithRawResponse + + return AsyncBookkeepingAccountsResourceWithRawResponse(self._client.bookkeeping_accounts) + + @cached_property + def bookkeeping_entry_sets(self) -> bookkeeping_entry_sets.AsyncBookkeepingEntrySetsResourceWithRawResponse: + from .resources.bookkeeping_entry_sets import AsyncBookkeepingEntrySetsResourceWithRawResponse + + return AsyncBookkeepingEntrySetsResourceWithRawResponse(self._client.bookkeeping_entry_sets) + + @cached_property + def bookkeeping_entries(self) -> bookkeeping_entries.AsyncBookkeepingEntriesResourceWithRawResponse: + from .resources.bookkeeping_entries import AsyncBookkeepingEntriesResourceWithRawResponse + + return AsyncBookkeepingEntriesResourceWithRawResponse(self._client.bookkeeping_entries) + + @cached_property + def groups(self) -> groups.AsyncGroupsResourceWithRawResponse: + from .resources.groups import AsyncGroupsResourceWithRawResponse + + return AsyncGroupsResourceWithRawResponse(self._client.groups) + + @cached_property + def oauth_applications(self) -> oauth_applications.AsyncOAuthApplicationsResourceWithRawResponse: + from .resources.oauth_applications import AsyncOAuthApplicationsResourceWithRawResponse + + return AsyncOAuthApplicationsResourceWithRawResponse(self._client.oauth_applications) + + @cached_property + def oauth_connections(self) -> oauth_connections.AsyncOAuthConnectionsResourceWithRawResponse: + from .resources.oauth_connections import AsyncOAuthConnectionsResourceWithRawResponse + + return AsyncOAuthConnectionsResourceWithRawResponse(self._client.oauth_connections) + + @cached_property + def oauth_tokens(self) -> oauth_tokens.AsyncOAuthTokensResourceWithRawResponse: + from .resources.oauth_tokens import AsyncOAuthTokensResourceWithRawResponse + + return AsyncOAuthTokensResourceWithRawResponse(self._client.oauth_tokens) + + @cached_property + def intrafi_account_enrollments( + self, + ) -> intrafi_account_enrollments.AsyncIntrafiAccountEnrollmentsResourceWithRawResponse: + from .resources.intrafi_account_enrollments import AsyncIntrafiAccountEnrollmentsResourceWithRawResponse + + return AsyncIntrafiAccountEnrollmentsResourceWithRawResponse(self._client.intrafi_account_enrollments) + + @cached_property + def intrafi_balances(self) -> intrafi_balances.AsyncIntrafiBalancesResourceWithRawResponse: + from .resources.intrafi_balances import AsyncIntrafiBalancesResourceWithRawResponse + + return AsyncIntrafiBalancesResourceWithRawResponse(self._client.intrafi_balances) + + @cached_property + def intrafi_exclusions(self) -> intrafi_exclusions.AsyncIntrafiExclusionsResourceWithRawResponse: + from .resources.intrafi_exclusions import AsyncIntrafiExclusionsResourceWithRawResponse + + return AsyncIntrafiExclusionsResourceWithRawResponse(self._client.intrafi_exclusions) + + @cached_property + def card_tokens(self) -> card_tokens.AsyncCardTokensResourceWithRawResponse: + from .resources.card_tokens import AsyncCardTokensResourceWithRawResponse + + return AsyncCardTokensResourceWithRawResponse(self._client.card_tokens) + + @cached_property + def card_push_transfers(self) -> card_push_transfers.AsyncCardPushTransfersResourceWithRawResponse: + from .resources.card_push_transfers import AsyncCardPushTransfersResourceWithRawResponse + + return AsyncCardPushTransfersResourceWithRawResponse(self._client.card_push_transfers) + + @cached_property + def card_validations(self) -> card_validations.AsyncCardValidationsResourceWithRawResponse: + from .resources.card_validations import AsyncCardValidationsResourceWithRawResponse + + return AsyncCardValidationsResourceWithRawResponse(self._client.card_validations) + + @cached_property + def simulations(self) -> simulations.AsyncSimulationsResourceWithRawResponse: + from .resources.simulations import AsyncSimulationsResourceWithRawResponse + + return AsyncSimulationsResourceWithRawResponse(self._client.simulations) + + +class IncreaseWithStreamedResponse: + _client: Increase + + def __init__(self, client: Increase) -> None: + self._client = client + + @cached_property + def accounts(self) -> accounts.AccountsResourceWithStreamingResponse: + from .resources.accounts import AccountsResourceWithStreamingResponse + + return AccountsResourceWithStreamingResponse(self._client.accounts) + + @cached_property + def account_numbers(self) -> account_numbers.AccountNumbersResourceWithStreamingResponse: + from .resources.account_numbers import AccountNumbersResourceWithStreamingResponse + + return AccountNumbersResourceWithStreamingResponse(self._client.account_numbers) + + @cached_property + def account_transfers(self) -> account_transfers.AccountTransfersResourceWithStreamingResponse: + from .resources.account_transfers import AccountTransfersResourceWithStreamingResponse + + return AccountTransfersResourceWithStreamingResponse(self._client.account_transfers) + + @cached_property + def cards(self) -> cards.CardsResourceWithStreamingResponse: + from .resources.cards import CardsResourceWithStreamingResponse + + return CardsResourceWithStreamingResponse(self._client.cards) + + @cached_property + def card_payments(self) -> card_payments.CardPaymentsResourceWithStreamingResponse: + from .resources.card_payments import CardPaymentsResourceWithStreamingResponse + + return CardPaymentsResourceWithStreamingResponse(self._client.card_payments) + + @cached_property + def card_purchase_supplements( + self, + ) -> card_purchase_supplements.CardPurchaseSupplementsResourceWithStreamingResponse: + from .resources.card_purchase_supplements import CardPurchaseSupplementsResourceWithStreamingResponse + + return CardPurchaseSupplementsResourceWithStreamingResponse(self._client.card_purchase_supplements) + + @cached_property + def card_disputes(self) -> card_disputes.CardDisputesResourceWithStreamingResponse: + from .resources.card_disputes import CardDisputesResourceWithStreamingResponse + + return CardDisputesResourceWithStreamingResponse(self._client.card_disputes) + + @cached_property + def physical_cards(self) -> physical_cards.PhysicalCardsResourceWithStreamingResponse: + from .resources.physical_cards import PhysicalCardsResourceWithStreamingResponse + + return PhysicalCardsResourceWithStreamingResponse(self._client.physical_cards) + + @cached_property + def digital_card_profiles(self) -> digital_card_profiles.DigitalCardProfilesResourceWithStreamingResponse: + from .resources.digital_card_profiles import DigitalCardProfilesResourceWithStreamingResponse + + return DigitalCardProfilesResourceWithStreamingResponse(self._client.digital_card_profiles) + + @cached_property + def physical_card_profiles(self) -> physical_card_profiles.PhysicalCardProfilesResourceWithStreamingResponse: + from .resources.physical_card_profiles import PhysicalCardProfilesResourceWithStreamingResponse -class AsyncIncreaseWithRawResponse: - def __init__(self, client: AsyncIncrease) -> None: - self.accounts = resources.AsyncAccountsWithRawResponse(client.accounts) - self.account_numbers = resources.AsyncAccountNumbersWithRawResponse(client.account_numbers) - self.bookkeeping_accounts = resources.AsyncBookkeepingAccountsWithRawResponse(client.bookkeeping_accounts) - self.bookkeeping_entry_sets = resources.AsyncBookkeepingEntrySetsWithRawResponse(client.bookkeeping_entry_sets) - self.bookkeeping_entries = resources.AsyncBookkeepingEntriesWithRawResponse(client.bookkeeping_entries) - self.real_time_decisions = resources.AsyncRealTimeDecisionsWithRawResponse(client.real_time_decisions) - self.real_time_payments_transfers = resources.AsyncRealTimePaymentsTransfersWithRawResponse( - client.real_time_payments_transfers - ) - self.cards = resources.AsyncCardsWithRawResponse(client.cards) - self.card_disputes = resources.AsyncCardDisputesWithRawResponse(client.card_disputes) - self.card_purchase_supplements = resources.AsyncCardPurchaseSupplementsWithRawResponse( - client.card_purchase_supplements - ) - self.external_accounts = resources.AsyncExternalAccountsWithRawResponse(client.external_accounts) - self.exports = resources.AsyncExportsWithRawResponse(client.exports) - self.digital_wallet_tokens = resources.AsyncDigitalWalletTokensWithRawResponse(client.digital_wallet_tokens) - self.transactions = resources.AsyncTransactionsWithRawResponse(client.transactions) - self.pending_transactions = resources.AsyncPendingTransactionsWithRawResponse(client.pending_transactions) - self.programs = resources.AsyncProgramsWithRawResponse(client.programs) - self.declined_transactions = resources.AsyncDeclinedTransactionsWithRawResponse(client.declined_transactions) - self.account_transfers = resources.AsyncAccountTransfersWithRawResponse(client.account_transfers) - self.ach_transfers = resources.AsyncACHTransfersWithRawResponse(client.ach_transfers) - self.ach_prenotifications = resources.AsyncACHPrenotificationsWithRawResponse(client.ach_prenotifications) - self.documents = resources.AsyncDocumentsWithRawResponse(client.documents) - self.wire_transfers = resources.AsyncWireTransfersWithRawResponse(client.wire_transfers) - self.check_transfers = resources.AsyncCheckTransfersWithRawResponse(client.check_transfers) - self.entities = resources.AsyncEntitiesWithRawResponse(client.entities) - self.inbound_ach_transfers = resources.AsyncInboundACHTransfersWithRawResponse(client.inbound_ach_transfers) - self.inbound_wire_drawdown_requests = resources.AsyncInboundWireDrawdownRequestsWithRawResponse( - client.inbound_wire_drawdown_requests - ) - self.wire_drawdown_requests = resources.AsyncWireDrawdownRequestsWithRawResponse(client.wire_drawdown_requests) - self.events = resources.AsyncEventsWithRawResponse(client.events) - self.event_subscriptions = resources.AsyncEventSubscriptionsWithRawResponse(client.event_subscriptions) - self.files = resources.AsyncFilesWithRawResponse(client.files) - self.groups = resources.AsyncGroupsWithRawResponse(client.groups) - self.oauth_connections = resources.AsyncOAuthConnectionsWithRawResponse(client.oauth_connections) - self.check_deposits = resources.AsyncCheckDepositsWithRawResponse(client.check_deposits) - self.routing_numbers = resources.AsyncRoutingNumbersWithRawResponse(client.routing_numbers) - self.account_statements = resources.AsyncAccountStatementsWithRawResponse(client.account_statements) - self.simulations = resources.AsyncSimulationsWithRawResponse(client.simulations) - self.physical_cards = resources.AsyncPhysicalCardsWithRawResponse(client.physical_cards) - self.card_payments = resources.AsyncCardPaymentsWithRawResponse(client.card_payments) - self.proof_of_authorization_requests = resources.AsyncProofOfAuthorizationRequestsWithRawResponse( - client.proof_of_authorization_requests - ) - self.proof_of_authorization_request_submissions = ( - resources.AsyncProofOfAuthorizationRequestSubmissionsWithRawResponse( - client.proof_of_authorization_request_submissions - ) - ) - self.intrafi = resources.AsyncIntrafiWithRawResponse(client.intrafi) - self.real_time_payments_request_for_payments = resources.AsyncRealTimePaymentsRequestForPaymentsWithRawResponse( - client.real_time_payments_request_for_payments - ) - self.oauth_tokens = resources.AsyncOAuthTokensWithRawResponse(client.oauth_tokens) - self.inbound_wire_transfers = resources.AsyncInboundWireTransfersWithRawResponse(client.inbound_wire_transfers) - self.digital_card_profiles = resources.AsyncDigitalCardProfilesWithRawResponse(client.digital_card_profiles) - self.physical_card_profiles = resources.AsyncPhysicalCardProfilesWithRawResponse(client.physical_card_profiles) + return PhysicalCardProfilesResourceWithStreamingResponse(self._client.physical_card_profiles) + @cached_property + def digital_wallet_tokens(self) -> digital_wallet_tokens.DigitalWalletTokensResourceWithStreamingResponse: + from .resources.digital_wallet_tokens import DigitalWalletTokensResourceWithStreamingResponse -class IncreaseWithStreamedResponse: - def __init__(self, client: Increase) -> None: - self.accounts = resources.AccountsWithStreamingResponse(client.accounts) - self.account_numbers = resources.AccountNumbersWithStreamingResponse(client.account_numbers) - self.bookkeeping_accounts = resources.BookkeepingAccountsWithStreamingResponse(client.bookkeeping_accounts) - self.bookkeeping_entry_sets = resources.BookkeepingEntrySetsWithStreamingResponse(client.bookkeeping_entry_sets) - self.bookkeeping_entries = resources.BookkeepingEntriesWithStreamingResponse(client.bookkeeping_entries) - self.real_time_decisions = resources.RealTimeDecisionsWithStreamingResponse(client.real_time_decisions) - self.real_time_payments_transfers = resources.RealTimePaymentsTransfersWithStreamingResponse( - client.real_time_payments_transfers - ) - self.cards = resources.CardsWithStreamingResponse(client.cards) - self.card_disputes = resources.CardDisputesWithStreamingResponse(client.card_disputes) - self.card_purchase_supplements = resources.CardPurchaseSupplementsWithStreamingResponse( - client.card_purchase_supplements - ) - self.external_accounts = resources.ExternalAccountsWithStreamingResponse(client.external_accounts) - self.exports = resources.ExportsWithStreamingResponse(client.exports) - self.digital_wallet_tokens = resources.DigitalWalletTokensWithStreamingResponse(client.digital_wallet_tokens) - self.transactions = resources.TransactionsWithStreamingResponse(client.transactions) - self.pending_transactions = resources.PendingTransactionsWithStreamingResponse(client.pending_transactions) - self.programs = resources.ProgramsWithStreamingResponse(client.programs) - self.declined_transactions = resources.DeclinedTransactionsWithStreamingResponse(client.declined_transactions) - self.account_transfers = resources.AccountTransfersWithStreamingResponse(client.account_transfers) - self.ach_transfers = resources.ACHTransfersWithStreamingResponse(client.ach_transfers) - self.ach_prenotifications = resources.ACHPrenotificationsWithStreamingResponse(client.ach_prenotifications) - self.documents = resources.DocumentsWithStreamingResponse(client.documents) - self.wire_transfers = resources.WireTransfersWithStreamingResponse(client.wire_transfers) - self.check_transfers = resources.CheckTransfersWithStreamingResponse(client.check_transfers) - self.entities = resources.EntitiesWithStreamingResponse(client.entities) - self.inbound_ach_transfers = resources.InboundACHTransfersWithStreamingResponse(client.inbound_ach_transfers) - self.inbound_wire_drawdown_requests = resources.InboundWireDrawdownRequestsWithStreamingResponse( - client.inbound_wire_drawdown_requests - ) - self.wire_drawdown_requests = resources.WireDrawdownRequestsWithStreamingResponse(client.wire_drawdown_requests) - self.events = resources.EventsWithStreamingResponse(client.events) - self.event_subscriptions = resources.EventSubscriptionsWithStreamingResponse(client.event_subscriptions) - self.files = resources.FilesWithStreamingResponse(client.files) - self.groups = resources.GroupsWithStreamingResponse(client.groups) - self.oauth_connections = resources.OAuthConnectionsWithStreamingResponse(client.oauth_connections) - self.check_deposits = resources.CheckDepositsWithStreamingResponse(client.check_deposits) - self.routing_numbers = resources.RoutingNumbersWithStreamingResponse(client.routing_numbers) - self.account_statements = resources.AccountStatementsWithStreamingResponse(client.account_statements) - self.simulations = resources.SimulationsWithStreamingResponse(client.simulations) - self.physical_cards = resources.PhysicalCardsWithStreamingResponse(client.physical_cards) - self.card_payments = resources.CardPaymentsWithStreamingResponse(client.card_payments) - self.proof_of_authorization_requests = resources.ProofOfAuthorizationRequestsWithStreamingResponse( - client.proof_of_authorization_requests - ) - self.proof_of_authorization_request_submissions = ( - resources.ProofOfAuthorizationRequestSubmissionsWithStreamingResponse( - client.proof_of_authorization_request_submissions - ) + return DigitalWalletTokensResourceWithStreamingResponse(self._client.digital_wallet_tokens) + + @cached_property + def transactions(self) -> transactions.TransactionsResourceWithStreamingResponse: + from .resources.transactions import TransactionsResourceWithStreamingResponse + + return TransactionsResourceWithStreamingResponse(self._client.transactions) + + @cached_property + def pending_transactions(self) -> pending_transactions.PendingTransactionsResourceWithStreamingResponse: + from .resources.pending_transactions import PendingTransactionsResourceWithStreamingResponse + + return PendingTransactionsResourceWithStreamingResponse(self._client.pending_transactions) + + @cached_property + def declined_transactions(self) -> declined_transactions.DeclinedTransactionsResourceWithStreamingResponse: + from .resources.declined_transactions import DeclinedTransactionsResourceWithStreamingResponse + + return DeclinedTransactionsResourceWithStreamingResponse(self._client.declined_transactions) + + @cached_property + def ach_transfers(self) -> ach_transfers.ACHTransfersResourceWithStreamingResponse: + from .resources.ach_transfers import ACHTransfersResourceWithStreamingResponse + + return ACHTransfersResourceWithStreamingResponse(self._client.ach_transfers) + + @cached_property + def ach_prenotifications(self) -> ach_prenotifications.ACHPrenotificationsResourceWithStreamingResponse: + from .resources.ach_prenotifications import ACHPrenotificationsResourceWithStreamingResponse + + return ACHPrenotificationsResourceWithStreamingResponse(self._client.ach_prenotifications) + + @cached_property + def inbound_ach_transfers(self) -> inbound_ach_transfers.InboundACHTransfersResourceWithStreamingResponse: + from .resources.inbound_ach_transfers import InboundACHTransfersResourceWithStreamingResponse + + return InboundACHTransfersResourceWithStreamingResponse(self._client.inbound_ach_transfers) + + @cached_property + def wire_transfers(self) -> wire_transfers.WireTransfersResourceWithStreamingResponse: + from .resources.wire_transfers import WireTransfersResourceWithStreamingResponse + + return WireTransfersResourceWithStreamingResponse(self._client.wire_transfers) + + @cached_property + def inbound_wire_transfers(self) -> inbound_wire_transfers.InboundWireTransfersResourceWithStreamingResponse: + from .resources.inbound_wire_transfers import InboundWireTransfersResourceWithStreamingResponse + + return InboundWireTransfersResourceWithStreamingResponse(self._client.inbound_wire_transfers) + + @cached_property + def wire_drawdown_requests(self) -> wire_drawdown_requests.WireDrawdownRequestsResourceWithStreamingResponse: + from .resources.wire_drawdown_requests import WireDrawdownRequestsResourceWithStreamingResponse + + return WireDrawdownRequestsResourceWithStreamingResponse(self._client.wire_drawdown_requests) + + @cached_property + def inbound_wire_drawdown_requests( + self, + ) -> inbound_wire_drawdown_requests.InboundWireDrawdownRequestsResourceWithStreamingResponse: + from .resources.inbound_wire_drawdown_requests import InboundWireDrawdownRequestsResourceWithStreamingResponse + + return InboundWireDrawdownRequestsResourceWithStreamingResponse(self._client.inbound_wire_drawdown_requests) + + @cached_property + def check_transfers(self) -> check_transfers.CheckTransfersResourceWithStreamingResponse: + from .resources.check_transfers import CheckTransfersResourceWithStreamingResponse + + return CheckTransfersResourceWithStreamingResponse(self._client.check_transfers) + + @cached_property + def inbound_check_deposits(self) -> inbound_check_deposits.InboundCheckDepositsResourceWithStreamingResponse: + from .resources.inbound_check_deposits import InboundCheckDepositsResourceWithStreamingResponse + + return InboundCheckDepositsResourceWithStreamingResponse(self._client.inbound_check_deposits) + + @cached_property + def real_time_payments_transfers( + self, + ) -> real_time_payments_transfers.RealTimePaymentsTransfersResourceWithStreamingResponse: + from .resources.real_time_payments_transfers import RealTimePaymentsTransfersResourceWithStreamingResponse + + return RealTimePaymentsTransfersResourceWithStreamingResponse(self._client.real_time_payments_transfers) + + @cached_property + def inbound_real_time_payments_transfers( + self, + ) -> inbound_real_time_payments_transfers.InboundRealTimePaymentsTransfersResourceWithStreamingResponse: + from .resources.inbound_real_time_payments_transfers import ( + InboundRealTimePaymentsTransfersResourceWithStreamingResponse, ) - self.intrafi = resources.IntrafiWithStreamingResponse(client.intrafi) - self.real_time_payments_request_for_payments = ( - resources.RealTimePaymentsRequestForPaymentsWithStreamingResponse( - client.real_time_payments_request_for_payments - ) + + return InboundRealTimePaymentsTransfersResourceWithStreamingResponse( + self._client.inbound_real_time_payments_transfers ) - self.oauth_tokens = resources.OAuthTokensWithStreamingResponse(client.oauth_tokens) - self.inbound_wire_transfers = resources.InboundWireTransfersWithStreamingResponse(client.inbound_wire_transfers) - self.digital_card_profiles = resources.DigitalCardProfilesWithStreamingResponse(client.digital_card_profiles) - self.physical_card_profiles = resources.PhysicalCardProfilesWithStreamingResponse(client.physical_card_profiles) + + @cached_property + def fednow_transfers(self) -> fednow_transfers.FednowTransfersResourceWithStreamingResponse: + from .resources.fednow_transfers import FednowTransfersResourceWithStreamingResponse + + return FednowTransfersResourceWithStreamingResponse(self._client.fednow_transfers) + + @cached_property + def inbound_fednow_transfers(self) -> inbound_fednow_transfers.InboundFednowTransfersResourceWithStreamingResponse: + from .resources.inbound_fednow_transfers import InboundFednowTransfersResourceWithStreamingResponse + + return InboundFednowTransfersResourceWithStreamingResponse(self._client.inbound_fednow_transfers) + + @cached_property + def swift_transfers(self) -> swift_transfers.SwiftTransfersResourceWithStreamingResponse: + from .resources.swift_transfers import SwiftTransfersResourceWithStreamingResponse + + return SwiftTransfersResourceWithStreamingResponse(self._client.swift_transfers) + + @cached_property + def check_deposits(self) -> check_deposits.CheckDepositsResourceWithStreamingResponse: + from .resources.check_deposits import CheckDepositsResourceWithStreamingResponse + + return CheckDepositsResourceWithStreamingResponse(self._client.check_deposits) + + @cached_property + def lockboxes(self) -> lockboxes.LockboxesResourceWithStreamingResponse: + from .resources.lockboxes import LockboxesResourceWithStreamingResponse + + return LockboxesResourceWithStreamingResponse(self._client.lockboxes) + + @cached_property + def inbound_mail_items(self) -> inbound_mail_items.InboundMailItemsResourceWithStreamingResponse: + from .resources.inbound_mail_items import InboundMailItemsResourceWithStreamingResponse + + return InboundMailItemsResourceWithStreamingResponse(self._client.inbound_mail_items) + + @cached_property + def routing_numbers(self) -> routing_numbers.RoutingNumbersResourceWithStreamingResponse: + from .resources.routing_numbers import RoutingNumbersResourceWithStreamingResponse + + return RoutingNumbersResourceWithStreamingResponse(self._client.routing_numbers) + + @cached_property + def external_accounts(self) -> external_accounts.ExternalAccountsResourceWithStreamingResponse: + from .resources.external_accounts import ExternalAccountsResourceWithStreamingResponse + + return ExternalAccountsResourceWithStreamingResponse(self._client.external_accounts) + + @cached_property + def entities(self) -> entities.EntitiesResourceWithStreamingResponse: + from .resources.entities import EntitiesResourceWithStreamingResponse + + return EntitiesResourceWithStreamingResponse(self._client.entities) + + @cached_property + def beneficial_owners(self) -> beneficial_owners.BeneficialOwnersResourceWithStreamingResponse: + from .resources.beneficial_owners import BeneficialOwnersResourceWithStreamingResponse + + return BeneficialOwnersResourceWithStreamingResponse(self._client.beneficial_owners) + + @cached_property + def supplemental_documents(self) -> supplemental_documents.SupplementalDocumentsResourceWithStreamingResponse: + from .resources.supplemental_documents import SupplementalDocumentsResourceWithStreamingResponse + + return SupplementalDocumentsResourceWithStreamingResponse(self._client.supplemental_documents) + + @cached_property + def entity_onboarding_sessions( + self, + ) -> entity_onboarding_sessions.EntityOnboardingSessionsResourceWithStreamingResponse: + from .resources.entity_onboarding_sessions import EntityOnboardingSessionsResourceWithStreamingResponse + + return EntityOnboardingSessionsResourceWithStreamingResponse(self._client.entity_onboarding_sessions) + + @cached_property + def programs(self) -> programs.ProgramsResourceWithStreamingResponse: + from .resources.programs import ProgramsResourceWithStreamingResponse + + return ProgramsResourceWithStreamingResponse(self._client.programs) + + @cached_property + def account_statements(self) -> account_statements.AccountStatementsResourceWithStreamingResponse: + from .resources.account_statements import AccountStatementsResourceWithStreamingResponse + + return AccountStatementsResourceWithStreamingResponse(self._client.account_statements) + + @cached_property + def files(self) -> files.FilesResourceWithStreamingResponse: + from .resources.files import FilesResourceWithStreamingResponse + + return FilesResourceWithStreamingResponse(self._client.files) + + @cached_property + def file_links(self) -> file_links.FileLinksResourceWithStreamingResponse: + from .resources.file_links import FileLinksResourceWithStreamingResponse + + return FileLinksResourceWithStreamingResponse(self._client.file_links) + + @cached_property + def exports(self) -> exports.ExportsResourceWithStreamingResponse: + from .resources.exports import ExportsResourceWithStreamingResponse + + return ExportsResourceWithStreamingResponse(self._client.exports) + + @cached_property + def events(self) -> events.EventsResourceWithStreamingResponse: + from .resources.events import EventsResourceWithStreamingResponse + + return EventsResourceWithStreamingResponse(self._client.events) + + @cached_property + def event_subscriptions(self) -> event_subscriptions.EventSubscriptionsResourceWithStreamingResponse: + from .resources.event_subscriptions import EventSubscriptionsResourceWithStreamingResponse + + return EventSubscriptionsResourceWithStreamingResponse(self._client.event_subscriptions) + + @cached_property + def real_time_decisions(self) -> real_time_decisions.RealTimeDecisionsResourceWithStreamingResponse: + from .resources.real_time_decisions import RealTimeDecisionsResourceWithStreamingResponse + + return RealTimeDecisionsResourceWithStreamingResponse(self._client.real_time_decisions) + + @cached_property + def bookkeeping_accounts(self) -> bookkeeping_accounts.BookkeepingAccountsResourceWithStreamingResponse: + from .resources.bookkeeping_accounts import BookkeepingAccountsResourceWithStreamingResponse + + return BookkeepingAccountsResourceWithStreamingResponse(self._client.bookkeeping_accounts) + + @cached_property + def bookkeeping_entry_sets(self) -> bookkeeping_entry_sets.BookkeepingEntrySetsResourceWithStreamingResponse: + from .resources.bookkeeping_entry_sets import BookkeepingEntrySetsResourceWithStreamingResponse + + return BookkeepingEntrySetsResourceWithStreamingResponse(self._client.bookkeeping_entry_sets) + + @cached_property + def bookkeeping_entries(self) -> bookkeeping_entries.BookkeepingEntriesResourceWithStreamingResponse: + from .resources.bookkeeping_entries import BookkeepingEntriesResourceWithStreamingResponse + + return BookkeepingEntriesResourceWithStreamingResponse(self._client.bookkeeping_entries) + + @cached_property + def groups(self) -> groups.GroupsResourceWithStreamingResponse: + from .resources.groups import GroupsResourceWithStreamingResponse + + return GroupsResourceWithStreamingResponse(self._client.groups) + + @cached_property + def oauth_applications(self) -> oauth_applications.OAuthApplicationsResourceWithStreamingResponse: + from .resources.oauth_applications import OAuthApplicationsResourceWithStreamingResponse + + return OAuthApplicationsResourceWithStreamingResponse(self._client.oauth_applications) + + @cached_property + def oauth_connections(self) -> oauth_connections.OAuthConnectionsResourceWithStreamingResponse: + from .resources.oauth_connections import OAuthConnectionsResourceWithStreamingResponse + + return OAuthConnectionsResourceWithStreamingResponse(self._client.oauth_connections) + + @cached_property + def oauth_tokens(self) -> oauth_tokens.OAuthTokensResourceWithStreamingResponse: + from .resources.oauth_tokens import OAuthTokensResourceWithStreamingResponse + + return OAuthTokensResourceWithStreamingResponse(self._client.oauth_tokens) + + @cached_property + def intrafi_account_enrollments( + self, + ) -> intrafi_account_enrollments.IntrafiAccountEnrollmentsResourceWithStreamingResponse: + from .resources.intrafi_account_enrollments import IntrafiAccountEnrollmentsResourceWithStreamingResponse + + return IntrafiAccountEnrollmentsResourceWithStreamingResponse(self._client.intrafi_account_enrollments) + + @cached_property + def intrafi_balances(self) -> intrafi_balances.IntrafiBalancesResourceWithStreamingResponse: + from .resources.intrafi_balances import IntrafiBalancesResourceWithStreamingResponse + + return IntrafiBalancesResourceWithStreamingResponse(self._client.intrafi_balances) + + @cached_property + def intrafi_exclusions(self) -> intrafi_exclusions.IntrafiExclusionsResourceWithStreamingResponse: + from .resources.intrafi_exclusions import IntrafiExclusionsResourceWithStreamingResponse + + return IntrafiExclusionsResourceWithStreamingResponse(self._client.intrafi_exclusions) + + @cached_property + def card_tokens(self) -> card_tokens.CardTokensResourceWithStreamingResponse: + from .resources.card_tokens import CardTokensResourceWithStreamingResponse + + return CardTokensResourceWithStreamingResponse(self._client.card_tokens) + + @cached_property + def card_push_transfers(self) -> card_push_transfers.CardPushTransfersResourceWithStreamingResponse: + from .resources.card_push_transfers import CardPushTransfersResourceWithStreamingResponse + + return CardPushTransfersResourceWithStreamingResponse(self._client.card_push_transfers) + + @cached_property + def card_validations(self) -> card_validations.CardValidationsResourceWithStreamingResponse: + from .resources.card_validations import CardValidationsResourceWithStreamingResponse + + return CardValidationsResourceWithStreamingResponse(self._client.card_validations) + + @cached_property + def simulations(self) -> simulations.SimulationsResourceWithStreamingResponse: + from .resources.simulations import SimulationsResourceWithStreamingResponse + + return SimulationsResourceWithStreamingResponse(self._client.simulations) class AsyncIncreaseWithStreamedResponse: + _client: AsyncIncrease + def __init__(self, client: AsyncIncrease) -> None: - self.accounts = resources.AsyncAccountsWithStreamingResponse(client.accounts) - self.account_numbers = resources.AsyncAccountNumbersWithStreamingResponse(client.account_numbers) - self.bookkeeping_accounts = resources.AsyncBookkeepingAccountsWithStreamingResponse(client.bookkeeping_accounts) - self.bookkeeping_entry_sets = resources.AsyncBookkeepingEntrySetsWithStreamingResponse( - client.bookkeeping_entry_sets - ) - self.bookkeeping_entries = resources.AsyncBookkeepingEntriesWithStreamingResponse(client.bookkeeping_entries) - self.real_time_decisions = resources.AsyncRealTimeDecisionsWithStreamingResponse(client.real_time_decisions) - self.real_time_payments_transfers = resources.AsyncRealTimePaymentsTransfersWithStreamingResponse( - client.real_time_payments_transfers - ) - self.cards = resources.AsyncCardsWithStreamingResponse(client.cards) - self.card_disputes = resources.AsyncCardDisputesWithStreamingResponse(client.card_disputes) - self.card_purchase_supplements = resources.AsyncCardPurchaseSupplementsWithStreamingResponse( - client.card_purchase_supplements - ) - self.external_accounts = resources.AsyncExternalAccountsWithStreamingResponse(client.external_accounts) - self.exports = resources.AsyncExportsWithStreamingResponse(client.exports) - self.digital_wallet_tokens = resources.AsyncDigitalWalletTokensWithStreamingResponse( - client.digital_wallet_tokens - ) - self.transactions = resources.AsyncTransactionsWithStreamingResponse(client.transactions) - self.pending_transactions = resources.AsyncPendingTransactionsWithStreamingResponse(client.pending_transactions) - self.programs = resources.AsyncProgramsWithStreamingResponse(client.programs) - self.declined_transactions = resources.AsyncDeclinedTransactionsWithStreamingResponse( - client.declined_transactions - ) - self.account_transfers = resources.AsyncAccountTransfersWithStreamingResponse(client.account_transfers) - self.ach_transfers = resources.AsyncACHTransfersWithStreamingResponse(client.ach_transfers) - self.ach_prenotifications = resources.AsyncACHPrenotificationsWithStreamingResponse(client.ach_prenotifications) - self.documents = resources.AsyncDocumentsWithStreamingResponse(client.documents) - self.wire_transfers = resources.AsyncWireTransfersWithStreamingResponse(client.wire_transfers) - self.check_transfers = resources.AsyncCheckTransfersWithStreamingResponse(client.check_transfers) - self.entities = resources.AsyncEntitiesWithStreamingResponse(client.entities) - self.inbound_ach_transfers = resources.AsyncInboundACHTransfersWithStreamingResponse( - client.inbound_ach_transfers - ) - self.inbound_wire_drawdown_requests = resources.AsyncInboundWireDrawdownRequestsWithStreamingResponse( - client.inbound_wire_drawdown_requests - ) - self.wire_drawdown_requests = resources.AsyncWireDrawdownRequestsWithStreamingResponse( - client.wire_drawdown_requests - ) - self.events = resources.AsyncEventsWithStreamingResponse(client.events) - self.event_subscriptions = resources.AsyncEventSubscriptionsWithStreamingResponse(client.event_subscriptions) - self.files = resources.AsyncFilesWithStreamingResponse(client.files) - self.groups = resources.AsyncGroupsWithStreamingResponse(client.groups) - self.oauth_connections = resources.AsyncOAuthConnectionsWithStreamingResponse(client.oauth_connections) - self.check_deposits = resources.AsyncCheckDepositsWithStreamingResponse(client.check_deposits) - self.routing_numbers = resources.AsyncRoutingNumbersWithStreamingResponse(client.routing_numbers) - self.account_statements = resources.AsyncAccountStatementsWithStreamingResponse(client.account_statements) - self.simulations = resources.AsyncSimulationsWithStreamingResponse(client.simulations) - self.physical_cards = resources.AsyncPhysicalCardsWithStreamingResponse(client.physical_cards) - self.card_payments = resources.AsyncCardPaymentsWithStreamingResponse(client.card_payments) - self.proof_of_authorization_requests = resources.AsyncProofOfAuthorizationRequestsWithStreamingResponse( - client.proof_of_authorization_requests - ) - self.proof_of_authorization_request_submissions = ( - resources.AsyncProofOfAuthorizationRequestSubmissionsWithStreamingResponse( - client.proof_of_authorization_request_submissions - ) - ) - self.intrafi = resources.AsyncIntrafiWithStreamingResponse(client.intrafi) - self.real_time_payments_request_for_payments = ( - resources.AsyncRealTimePaymentsRequestForPaymentsWithStreamingResponse( - client.real_time_payments_request_for_payments - ) + self._client = client + + @cached_property + def accounts(self) -> accounts.AsyncAccountsResourceWithStreamingResponse: + from .resources.accounts import AsyncAccountsResourceWithStreamingResponse + + return AsyncAccountsResourceWithStreamingResponse(self._client.accounts) + + @cached_property + def account_numbers(self) -> account_numbers.AsyncAccountNumbersResourceWithStreamingResponse: + from .resources.account_numbers import AsyncAccountNumbersResourceWithStreamingResponse + + return AsyncAccountNumbersResourceWithStreamingResponse(self._client.account_numbers) + + @cached_property + def account_transfers(self) -> account_transfers.AsyncAccountTransfersResourceWithStreamingResponse: + from .resources.account_transfers import AsyncAccountTransfersResourceWithStreamingResponse + + return AsyncAccountTransfersResourceWithStreamingResponse(self._client.account_transfers) + + @cached_property + def cards(self) -> cards.AsyncCardsResourceWithStreamingResponse: + from .resources.cards import AsyncCardsResourceWithStreamingResponse + + return AsyncCardsResourceWithStreamingResponse(self._client.cards) + + @cached_property + def card_payments(self) -> card_payments.AsyncCardPaymentsResourceWithStreamingResponse: + from .resources.card_payments import AsyncCardPaymentsResourceWithStreamingResponse + + return AsyncCardPaymentsResourceWithStreamingResponse(self._client.card_payments) + + @cached_property + def card_purchase_supplements( + self, + ) -> card_purchase_supplements.AsyncCardPurchaseSupplementsResourceWithStreamingResponse: + from .resources.card_purchase_supplements import AsyncCardPurchaseSupplementsResourceWithStreamingResponse + + return AsyncCardPurchaseSupplementsResourceWithStreamingResponse(self._client.card_purchase_supplements) + + @cached_property + def card_disputes(self) -> card_disputes.AsyncCardDisputesResourceWithStreamingResponse: + from .resources.card_disputes import AsyncCardDisputesResourceWithStreamingResponse + + return AsyncCardDisputesResourceWithStreamingResponse(self._client.card_disputes) + + @cached_property + def physical_cards(self) -> physical_cards.AsyncPhysicalCardsResourceWithStreamingResponse: + from .resources.physical_cards import AsyncPhysicalCardsResourceWithStreamingResponse + + return AsyncPhysicalCardsResourceWithStreamingResponse(self._client.physical_cards) + + @cached_property + def digital_card_profiles(self) -> digital_card_profiles.AsyncDigitalCardProfilesResourceWithStreamingResponse: + from .resources.digital_card_profiles import AsyncDigitalCardProfilesResourceWithStreamingResponse + + return AsyncDigitalCardProfilesResourceWithStreamingResponse(self._client.digital_card_profiles) + + @cached_property + def physical_card_profiles(self) -> physical_card_profiles.AsyncPhysicalCardProfilesResourceWithStreamingResponse: + from .resources.physical_card_profiles import AsyncPhysicalCardProfilesResourceWithStreamingResponse + + return AsyncPhysicalCardProfilesResourceWithStreamingResponse(self._client.physical_card_profiles) + + @cached_property + def digital_wallet_tokens(self) -> digital_wallet_tokens.AsyncDigitalWalletTokensResourceWithStreamingResponse: + from .resources.digital_wallet_tokens import AsyncDigitalWalletTokensResourceWithStreamingResponse + + return AsyncDigitalWalletTokensResourceWithStreamingResponse(self._client.digital_wallet_tokens) + + @cached_property + def transactions(self) -> transactions.AsyncTransactionsResourceWithStreamingResponse: + from .resources.transactions import AsyncTransactionsResourceWithStreamingResponse + + return AsyncTransactionsResourceWithStreamingResponse(self._client.transactions) + + @cached_property + def pending_transactions(self) -> pending_transactions.AsyncPendingTransactionsResourceWithStreamingResponse: + from .resources.pending_transactions import AsyncPendingTransactionsResourceWithStreamingResponse + + return AsyncPendingTransactionsResourceWithStreamingResponse(self._client.pending_transactions) + + @cached_property + def declined_transactions(self) -> declined_transactions.AsyncDeclinedTransactionsResourceWithStreamingResponse: + from .resources.declined_transactions import AsyncDeclinedTransactionsResourceWithStreamingResponse + + return AsyncDeclinedTransactionsResourceWithStreamingResponse(self._client.declined_transactions) + + @cached_property + def ach_transfers(self) -> ach_transfers.AsyncACHTransfersResourceWithStreamingResponse: + from .resources.ach_transfers import AsyncACHTransfersResourceWithStreamingResponse + + return AsyncACHTransfersResourceWithStreamingResponse(self._client.ach_transfers) + + @cached_property + def ach_prenotifications(self) -> ach_prenotifications.AsyncACHPrenotificationsResourceWithStreamingResponse: + from .resources.ach_prenotifications import AsyncACHPrenotificationsResourceWithStreamingResponse + + return AsyncACHPrenotificationsResourceWithStreamingResponse(self._client.ach_prenotifications) + + @cached_property + def inbound_ach_transfers(self) -> inbound_ach_transfers.AsyncInboundACHTransfersResourceWithStreamingResponse: + from .resources.inbound_ach_transfers import AsyncInboundACHTransfersResourceWithStreamingResponse + + return AsyncInboundACHTransfersResourceWithStreamingResponse(self._client.inbound_ach_transfers) + + @cached_property + def wire_transfers(self) -> wire_transfers.AsyncWireTransfersResourceWithStreamingResponse: + from .resources.wire_transfers import AsyncWireTransfersResourceWithStreamingResponse + + return AsyncWireTransfersResourceWithStreamingResponse(self._client.wire_transfers) + + @cached_property + def inbound_wire_transfers(self) -> inbound_wire_transfers.AsyncInboundWireTransfersResourceWithStreamingResponse: + from .resources.inbound_wire_transfers import AsyncInboundWireTransfersResourceWithStreamingResponse + + return AsyncInboundWireTransfersResourceWithStreamingResponse(self._client.inbound_wire_transfers) + + @cached_property + def wire_drawdown_requests(self) -> wire_drawdown_requests.AsyncWireDrawdownRequestsResourceWithStreamingResponse: + from .resources.wire_drawdown_requests import AsyncWireDrawdownRequestsResourceWithStreamingResponse + + return AsyncWireDrawdownRequestsResourceWithStreamingResponse(self._client.wire_drawdown_requests) + + @cached_property + def inbound_wire_drawdown_requests( + self, + ) -> inbound_wire_drawdown_requests.AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse: + from .resources.inbound_wire_drawdown_requests import ( + AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse, ) - self.oauth_tokens = resources.AsyncOAuthTokensWithStreamingResponse(client.oauth_tokens) - self.inbound_wire_transfers = resources.AsyncInboundWireTransfersWithStreamingResponse( - client.inbound_wire_transfers + + return AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse( + self._client.inbound_wire_drawdown_requests ) - self.digital_card_profiles = resources.AsyncDigitalCardProfilesWithStreamingResponse( - client.digital_card_profiles + + @cached_property + def check_transfers(self) -> check_transfers.AsyncCheckTransfersResourceWithStreamingResponse: + from .resources.check_transfers import AsyncCheckTransfersResourceWithStreamingResponse + + return AsyncCheckTransfersResourceWithStreamingResponse(self._client.check_transfers) + + @cached_property + def inbound_check_deposits(self) -> inbound_check_deposits.AsyncInboundCheckDepositsResourceWithStreamingResponse: + from .resources.inbound_check_deposits import AsyncInboundCheckDepositsResourceWithStreamingResponse + + return AsyncInboundCheckDepositsResourceWithStreamingResponse(self._client.inbound_check_deposits) + + @cached_property + def real_time_payments_transfers( + self, + ) -> real_time_payments_transfers.AsyncRealTimePaymentsTransfersResourceWithStreamingResponse: + from .resources.real_time_payments_transfers import AsyncRealTimePaymentsTransfersResourceWithStreamingResponse + + return AsyncRealTimePaymentsTransfersResourceWithStreamingResponse(self._client.real_time_payments_transfers) + + @cached_property + def inbound_real_time_payments_transfers( + self, + ) -> inbound_real_time_payments_transfers.AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse: + from .resources.inbound_real_time_payments_transfers import ( + AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse, ) - self.physical_card_profiles = resources.AsyncPhysicalCardProfilesWithStreamingResponse( - client.physical_card_profiles + + return AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse( + self._client.inbound_real_time_payments_transfers ) + @cached_property + def fednow_transfers(self) -> fednow_transfers.AsyncFednowTransfersResourceWithStreamingResponse: + from .resources.fednow_transfers import AsyncFednowTransfersResourceWithStreamingResponse + + return AsyncFednowTransfersResourceWithStreamingResponse(self._client.fednow_transfers) + + @cached_property + def inbound_fednow_transfers( + self, + ) -> inbound_fednow_transfers.AsyncInboundFednowTransfersResourceWithStreamingResponse: + from .resources.inbound_fednow_transfers import AsyncInboundFednowTransfersResourceWithStreamingResponse + + return AsyncInboundFednowTransfersResourceWithStreamingResponse(self._client.inbound_fednow_transfers) + + @cached_property + def swift_transfers(self) -> swift_transfers.AsyncSwiftTransfersResourceWithStreamingResponse: + from .resources.swift_transfers import AsyncSwiftTransfersResourceWithStreamingResponse + + return AsyncSwiftTransfersResourceWithStreamingResponse(self._client.swift_transfers) + + @cached_property + def check_deposits(self) -> check_deposits.AsyncCheckDepositsResourceWithStreamingResponse: + from .resources.check_deposits import AsyncCheckDepositsResourceWithStreamingResponse + + return AsyncCheckDepositsResourceWithStreamingResponse(self._client.check_deposits) + + @cached_property + def lockboxes(self) -> lockboxes.AsyncLockboxesResourceWithStreamingResponse: + from .resources.lockboxes import AsyncLockboxesResourceWithStreamingResponse + + return AsyncLockboxesResourceWithStreamingResponse(self._client.lockboxes) + + @cached_property + def inbound_mail_items(self) -> inbound_mail_items.AsyncInboundMailItemsResourceWithStreamingResponse: + from .resources.inbound_mail_items import AsyncInboundMailItemsResourceWithStreamingResponse + + return AsyncInboundMailItemsResourceWithStreamingResponse(self._client.inbound_mail_items) + + @cached_property + def routing_numbers(self) -> routing_numbers.AsyncRoutingNumbersResourceWithStreamingResponse: + from .resources.routing_numbers import AsyncRoutingNumbersResourceWithStreamingResponse + + return AsyncRoutingNumbersResourceWithStreamingResponse(self._client.routing_numbers) + + @cached_property + def external_accounts(self) -> external_accounts.AsyncExternalAccountsResourceWithStreamingResponse: + from .resources.external_accounts import AsyncExternalAccountsResourceWithStreamingResponse + + return AsyncExternalAccountsResourceWithStreamingResponse(self._client.external_accounts) + + @cached_property + def entities(self) -> entities.AsyncEntitiesResourceWithStreamingResponse: + from .resources.entities import AsyncEntitiesResourceWithStreamingResponse + + return AsyncEntitiesResourceWithStreamingResponse(self._client.entities) + + @cached_property + def beneficial_owners(self) -> beneficial_owners.AsyncBeneficialOwnersResourceWithStreamingResponse: + from .resources.beneficial_owners import AsyncBeneficialOwnersResourceWithStreamingResponse + + return AsyncBeneficialOwnersResourceWithStreamingResponse(self._client.beneficial_owners) + + @cached_property + def supplemental_documents(self) -> supplemental_documents.AsyncSupplementalDocumentsResourceWithStreamingResponse: + from .resources.supplemental_documents import AsyncSupplementalDocumentsResourceWithStreamingResponse + + return AsyncSupplementalDocumentsResourceWithStreamingResponse(self._client.supplemental_documents) + + @cached_property + def entity_onboarding_sessions( + self, + ) -> entity_onboarding_sessions.AsyncEntityOnboardingSessionsResourceWithStreamingResponse: + from .resources.entity_onboarding_sessions import AsyncEntityOnboardingSessionsResourceWithStreamingResponse + + return AsyncEntityOnboardingSessionsResourceWithStreamingResponse(self._client.entity_onboarding_sessions) + + @cached_property + def programs(self) -> programs.AsyncProgramsResourceWithStreamingResponse: + from .resources.programs import AsyncProgramsResourceWithStreamingResponse + + return AsyncProgramsResourceWithStreamingResponse(self._client.programs) + + @cached_property + def account_statements(self) -> account_statements.AsyncAccountStatementsResourceWithStreamingResponse: + from .resources.account_statements import AsyncAccountStatementsResourceWithStreamingResponse + + return AsyncAccountStatementsResourceWithStreamingResponse(self._client.account_statements) + + @cached_property + def files(self) -> files.AsyncFilesResourceWithStreamingResponse: + from .resources.files import AsyncFilesResourceWithStreamingResponse + + return AsyncFilesResourceWithStreamingResponse(self._client.files) + + @cached_property + def file_links(self) -> file_links.AsyncFileLinksResourceWithStreamingResponse: + from .resources.file_links import AsyncFileLinksResourceWithStreamingResponse + + return AsyncFileLinksResourceWithStreamingResponse(self._client.file_links) + + @cached_property + def exports(self) -> exports.AsyncExportsResourceWithStreamingResponse: + from .resources.exports import AsyncExportsResourceWithStreamingResponse + + return AsyncExportsResourceWithStreamingResponse(self._client.exports) + + @cached_property + def events(self) -> events.AsyncEventsResourceWithStreamingResponse: + from .resources.events import AsyncEventsResourceWithStreamingResponse + + return AsyncEventsResourceWithStreamingResponse(self._client.events) + + @cached_property + def event_subscriptions(self) -> event_subscriptions.AsyncEventSubscriptionsResourceWithStreamingResponse: + from .resources.event_subscriptions import AsyncEventSubscriptionsResourceWithStreamingResponse + + return AsyncEventSubscriptionsResourceWithStreamingResponse(self._client.event_subscriptions) + + @cached_property + def real_time_decisions(self) -> real_time_decisions.AsyncRealTimeDecisionsResourceWithStreamingResponse: + from .resources.real_time_decisions import AsyncRealTimeDecisionsResourceWithStreamingResponse + + return AsyncRealTimeDecisionsResourceWithStreamingResponse(self._client.real_time_decisions) + + @cached_property + def bookkeeping_accounts(self) -> bookkeeping_accounts.AsyncBookkeepingAccountsResourceWithStreamingResponse: + from .resources.bookkeeping_accounts import AsyncBookkeepingAccountsResourceWithStreamingResponse + + return AsyncBookkeepingAccountsResourceWithStreamingResponse(self._client.bookkeeping_accounts) + + @cached_property + def bookkeeping_entry_sets(self) -> bookkeeping_entry_sets.AsyncBookkeepingEntrySetsResourceWithStreamingResponse: + from .resources.bookkeeping_entry_sets import AsyncBookkeepingEntrySetsResourceWithStreamingResponse + + return AsyncBookkeepingEntrySetsResourceWithStreamingResponse(self._client.bookkeeping_entry_sets) + + @cached_property + def bookkeeping_entries(self) -> bookkeeping_entries.AsyncBookkeepingEntriesResourceWithStreamingResponse: + from .resources.bookkeeping_entries import AsyncBookkeepingEntriesResourceWithStreamingResponse + + return AsyncBookkeepingEntriesResourceWithStreamingResponse(self._client.bookkeeping_entries) + + @cached_property + def groups(self) -> groups.AsyncGroupsResourceWithStreamingResponse: + from .resources.groups import AsyncGroupsResourceWithStreamingResponse + + return AsyncGroupsResourceWithStreamingResponse(self._client.groups) + + @cached_property + def oauth_applications(self) -> oauth_applications.AsyncOAuthApplicationsResourceWithStreamingResponse: + from .resources.oauth_applications import AsyncOAuthApplicationsResourceWithStreamingResponse + + return AsyncOAuthApplicationsResourceWithStreamingResponse(self._client.oauth_applications) + + @cached_property + def oauth_connections(self) -> oauth_connections.AsyncOAuthConnectionsResourceWithStreamingResponse: + from .resources.oauth_connections import AsyncOAuthConnectionsResourceWithStreamingResponse + + return AsyncOAuthConnectionsResourceWithStreamingResponse(self._client.oauth_connections) + + @cached_property + def oauth_tokens(self) -> oauth_tokens.AsyncOAuthTokensResourceWithStreamingResponse: + from .resources.oauth_tokens import AsyncOAuthTokensResourceWithStreamingResponse + + return AsyncOAuthTokensResourceWithStreamingResponse(self._client.oauth_tokens) + + @cached_property + def intrafi_account_enrollments( + self, + ) -> intrafi_account_enrollments.AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse: + from .resources.intrafi_account_enrollments import AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse + + return AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse(self._client.intrafi_account_enrollments) + + @cached_property + def intrafi_balances(self) -> intrafi_balances.AsyncIntrafiBalancesResourceWithStreamingResponse: + from .resources.intrafi_balances import AsyncIntrafiBalancesResourceWithStreamingResponse + + return AsyncIntrafiBalancesResourceWithStreamingResponse(self._client.intrafi_balances) + + @cached_property + def intrafi_exclusions(self) -> intrafi_exclusions.AsyncIntrafiExclusionsResourceWithStreamingResponse: + from .resources.intrafi_exclusions import AsyncIntrafiExclusionsResourceWithStreamingResponse + + return AsyncIntrafiExclusionsResourceWithStreamingResponse(self._client.intrafi_exclusions) + + @cached_property + def card_tokens(self) -> card_tokens.AsyncCardTokensResourceWithStreamingResponse: + from .resources.card_tokens import AsyncCardTokensResourceWithStreamingResponse + + return AsyncCardTokensResourceWithStreamingResponse(self._client.card_tokens) + + @cached_property + def card_push_transfers(self) -> card_push_transfers.AsyncCardPushTransfersResourceWithStreamingResponse: + from .resources.card_push_transfers import AsyncCardPushTransfersResourceWithStreamingResponse + + return AsyncCardPushTransfersResourceWithStreamingResponse(self._client.card_push_transfers) + + @cached_property + def card_validations(self) -> card_validations.AsyncCardValidationsResourceWithStreamingResponse: + from .resources.card_validations import AsyncCardValidationsResourceWithStreamingResponse + + return AsyncCardValidationsResourceWithStreamingResponse(self._client.card_validations) + + @cached_property + def simulations(self) -> simulations.AsyncSimulationsResourceWithStreamingResponse: + from .resources.simulations import AsyncSimulationsResourceWithStreamingResponse + + return AsyncSimulationsResourceWithStreamingResponse(self._client.simulations) + Client = Increase diff --git a/src/increase/_compat.py b/src/increase/_compat.py index 74c7639b4..e6690a4f2 100644 --- a/src/increase/_compat.py +++ b/src/increase/_compat.py @@ -2,24 +2,23 @@ from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, cast, overload from datetime import date, datetime -from typing_extensions import Self +from typing_extensions import Self, Literal, TypedDict import pydantic from pydantic.fields import FieldInfo -from ._types import StrBytesIntFloat +from ._types import IncEx, StrBytesIntFloat _T = TypeVar("_T") _ModelT = TypeVar("_ModelT", bound=pydantic.BaseModel) -# --------------- Pydantic v2 compatibility --------------- +# --------------- Pydantic v2, v3 compatibility --------------- # Pyright incorrectly reports some of our functions as overriding a method when they don't # pyright: reportIncompatibleMethodOverride=false -PYDANTIC_V2 = pydantic.VERSION.startswith("2.") +PYDANTIC_V1 = pydantic.VERSION.startswith("1.") -# v1 re-exports if TYPE_CHECKING: def parse_date(value: date | StrBytesIntFloat) -> date: # noqa: ARG001 @@ -44,137 +43,150 @@ def is_typeddict(type_: type[Any]) -> bool: # noqa: ARG001 ... else: - if PYDANTIC_V2: - from pydantic.v1.typing import ( + # v1 re-exports + if PYDANTIC_V1: + from pydantic.typing import ( get_args as get_args, is_union as is_union, get_origin as get_origin, is_typeddict as is_typeddict, is_literal_type as is_literal_type, ) - from pydantic.v1.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime + from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime else: - from pydantic.typing import ( + from ._utils import ( get_args as get_args, is_union as is_union, get_origin as get_origin, + parse_date as parse_date, is_typeddict as is_typeddict, + parse_datetime as parse_datetime, is_literal_type as is_literal_type, ) - from pydantic.datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime # refactored config if TYPE_CHECKING: from pydantic import ConfigDict as ConfigDict else: - if PYDANTIC_V2: - from pydantic import ConfigDict - else: + if PYDANTIC_V1: # TODO: provide an error message here? ConfigDict = None + else: + from pydantic import ConfigDict as ConfigDict # renamed methods / properties def parse_obj(model: type[_ModelT], value: object) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(value) - else: + if PYDANTIC_V1: return cast(_ModelT, model.parse_obj(value)) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + else: + return model.model_validate(value) def field_is_required(field: FieldInfo) -> bool: - if PYDANTIC_V2: - return field.is_required() - return field.required # type: ignore + if PYDANTIC_V1: + return field.required # type: ignore + return field.is_required() def field_get_default(field: FieldInfo) -> Any: value = field.get_default() - if PYDANTIC_V2: - from pydantic_core import PydanticUndefined - - if value == PydanticUndefined: - return None + if PYDANTIC_V1: return value + from pydantic_core import PydanticUndefined + + if value == PydanticUndefined: + return None return value def field_outer_type(field: FieldInfo) -> Any: - if PYDANTIC_V2: - return field.annotation - return field.outer_type_ # type: ignore + if PYDANTIC_V1: + return field.outer_type_ # type: ignore + return field.annotation def get_model_config(model: type[pydantic.BaseModel]) -> Any: - if PYDANTIC_V2: - return model.model_config - return model.__config__ # type: ignore + if PYDANTIC_V1: + return model.__config__ # type: ignore + return model.model_config def get_model_fields(model: type[pydantic.BaseModel]) -> dict[str, FieldInfo]: - if PYDANTIC_V2: - return model.model_fields - return model.__fields__ # type: ignore + if PYDANTIC_V1: + return model.__fields__ # type: ignore + return model.model_fields -def model_copy(model: _ModelT) -> _ModelT: - if PYDANTIC_V2: - return model.model_copy() - return model.copy() # type: ignore +def model_copy(model: _ModelT, *, deep: bool = False) -> _ModelT: + if PYDANTIC_V1: + return model.copy(deep=deep) # type: ignore + return model.model_copy(deep=deep) def model_json(model: pydantic.BaseModel, *, indent: int | None = None) -> str: - if PYDANTIC_V2: - return model.model_dump_json(indent=indent) - return model.json(indent=indent) # type: ignore + if PYDANTIC_V1: + return model.json(indent=indent) # type: ignore + return model.model_dump_json(indent=indent) + + +class _ModelDumpKwargs(TypedDict, total=False): + by_alias: bool def model_dump( model: pydantic.BaseModel, *, + exclude: IncEx | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, + warnings: bool = True, + mode: Literal["json", "python"] = "python", + by_alias: bool | None = None, ) -> dict[str, Any]: - if PYDANTIC_V2: + if (not PYDANTIC_V1) or hasattr(model, "model_dump"): + kwargs: _ModelDumpKwargs = {} + if by_alias is not None: + kwargs["by_alias"] = by_alias return model.model_dump( + mode=mode, + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, + # warnings are not supported in Pydantic v1 + warnings=True if PYDANTIC_V1 else warnings, + **kwargs, ) return cast( "dict[str, Any]", model.dict( # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - exclude_unset=exclude_unset, - exclude_defaults=exclude_defaults, + exclude=exclude, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, by_alias=bool(by_alias) ), ) def model_parse(model: type[_ModelT], data: Any) -> _ModelT: - if PYDANTIC_V2: - return model.model_validate(data) - return model.parse_obj(data) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return model.parse_obj(data) # pyright: ignore[reportDeprecated] + return model.model_validate(data) # generic models if TYPE_CHECKING: - class GenericModel(pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... else: - if PYDANTIC_V2: + if PYDANTIC_V1: + import pydantic.generics + + class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): ... + else: # there no longer needs to be a distinction in v2 but # we still have to create our own subclass to avoid # inconsistent MRO ordering errors - class GenericModel(pydantic.BaseModel): - ... - - else: - import pydantic.generics - - class GenericModel(pydantic.generics.GenericModel, pydantic.BaseModel): - ... + class GenericModel(pydantic.BaseModel): ... # cached properties @@ -193,30 +205,22 @@ class typed_cached_property(Generic[_T]): func: Callable[[Any], _T] attrname: str | None - def __init__(self, func: Callable[[Any], _T]) -> None: - ... + def __init__(self, func: Callable[[Any], _T]) -> None: ... @overload - def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: - ... + def __get__(self, instance: None, owner: type[Any] | None = None) -> Self: ... @overload - def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: - ... + def __get__(self, instance: object, owner: type[Any] | None = None) -> _T: ... def __get__(self, instance: object, owner: type[Any] | None = None) -> _T | Self: raise NotImplementedError() - def __set_name__(self, owner: type[Any], name: str) -> None: - ... + def __set_name__(self, owner: type[Any], name: str) -> None: ... # __set__ is not defined at runtime, but @cached_property is designed to be settable - def __set__(self, instance: object, value: _T) -> None: - ... + def __set__(self, instance: object, value: _T) -> None: ... else: - try: - from functools import cached_property as cached_property - except ImportError: - from cached_property import cached_property as cached_property + from functools import cached_property as cached_property typed_cached_property = cached_property diff --git a/src/increase/_constants.py b/src/increase/_constants.py index 1d56f7fde..6ddf2c717 100644 --- a/src/increase/_constants.py +++ b/src/increase/_constants.py @@ -6,9 +6,9 @@ OVERRIDE_CAST_TO_HEADER = "____stainless_override_cast_to" # default timeout is 1 minute -DEFAULT_TIMEOUT = httpx.Timeout(timeout=60.0, connect=5.0) +DEFAULT_TIMEOUT = httpx.Timeout(timeout=60, connect=5.0) DEFAULT_MAX_RETRIES = 2 -DEFAULT_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) +DEFAULT_CONNECTION_LIMITS = httpx.Limits(max_connections=100, max_keepalive_connections=20) INITIAL_RETRY_DELAY = 0.5 MAX_RETRY_DELAY = 8.0 diff --git a/src/increase/_exceptions.py b/src/increase/_exceptions.py index a64976e2a..66d395d78 100644 --- a/src/increase/_exceptions.py +++ b/src/increase/_exceptions.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing import Any, List, Mapping, Optional, cast +from typing import Any, Dict, List, Mapping, Optional, cast from typing_extensions import Literal import httpx @@ -69,16 +69,22 @@ def __init__(self, response: httpx.Response, body: object | None, *, message: st self.status_code = response.status_code +class APIWebhookValidationError(APIError): + pass + + class APIStatusError(APIError): """Raised when an API response has a status code of 4xx or 5xx.""" response: httpx.Response status_code: int + idempotent_replayed: str | None def __init__(self, message: str, *, response: httpx.Response, body: object | None) -> None: super().__init__(message, response.request, body=body) self.response = response self.status_code = response.status_code + self.idempotent_replayed = response.headers.get("Idempotent-Replayed") class APIConnectionError(APIError): @@ -122,7 +128,7 @@ class RateLimitError(APIStatusError): class InvalidParametersError(BadRequestError): detail: Optional[str] = None - errors: List[object] + errors: List[Dict[str, object]] """All errors related to parsing the request parameters.""" status: Literal[400] @@ -138,7 +144,7 @@ def __init__(self, message: str, *, body: object, response: httpx.Response) -> N self.title = title self.detail = cast(Any, construct_type(type_=Optional[str], value=data.get("detail"))) - self.errors = cast(Any, construct_type(type_=List[object], value=data.get("errors"))) + self.errors = cast(Any, construct_type(type_=List[Dict[str, object]], value=data.get("errors"))) self.status = cast(Any, construct_type(type_=Literal[400], value=data.get("status"))) self.type = cast(Any, construct_type(type_=Literal["invalid_parameters_error"], value=data.get("type"))) @@ -166,6 +172,25 @@ def __init__(self, message: str, *, body: object, response: httpx.Response) -> N class InvalidAPIKeyError(AuthenticationError): detail: Optional[str] = None + reason: Literal[ + "deleted_credential", + "expired_credential", + "ip_not_allowed", + "no_credential", + "no_header", + "no_api_access", + "wrong_environment", + ] + """ + - `deleted_credential` - deleted_credential + - `expired_credential` - expired_credential + - `ip_not_allowed` - ip_not_allowed + - `no_credential` - no_credential + - `no_header` - no_header + - `no_api_access` - no_api_access + - `wrong_environment` - wrong_environment + """ + status: Literal[401] title: str @@ -179,6 +204,21 @@ def __init__(self, message: str, *, body: object, response: httpx.Response) -> N self.title = title self.detail = cast(Any, construct_type(type_=Optional[str], value=data.get("detail"))) + self.reason = cast( + Any, + construct_type( + type_=Literal[ + "deleted_credential", + "expired_credential", + "ip_not_allowed", + "no_credential", + "no_header", + "no_api_access", + "wrong_environment", + ], + value=data.get("reason"), + ), + ) self.status = cast(Any, construct_type(type_=Literal[401], value=data.get("status"))) self.type = cast(Any, construct_type(type_=Literal["invalid_api_key_error"], value=data.get("type"))) diff --git a/src/increase/_files.py b/src/increase/_files.py index 46bb828c9..08afe4fac 100644 --- a/src/increase/_files.py +++ b/src/increase/_files.py @@ -34,18 +34,16 @@ def assert_is_file_content(obj: object, *, key: str | None = None) -> None: if not is_file_content(obj): prefix = f"Expected entry at `{key}`" if key is not None else f"Expected file input `{obj!r}`" raise RuntimeError( - f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/increase/increase-python/tree/main#file-uploads" + f"{prefix} to be bytes, an io.IOBase instance, PathLike or a tuple but received {type(obj)} instead. See https://github.com/Increase/increase-python/tree/main#file-uploads" ) from None @overload -def to_httpx_files(files: None) -> None: - ... +def to_httpx_files(files: None) -> None: ... @overload -def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +def to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... def to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: @@ -71,25 +69,23 @@ def _transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], _read_file_content(file[1]), *file[2:]) + return (file[0], read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -def _read_file_content(file: FileContent) -> HttpxFileContent: +def read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return pathlib.Path(file).read_bytes() return file @overload -async def async_to_httpx_files(files: None) -> None: - ... +async def async_to_httpx_files(files: None) -> None: ... @overload -async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: - ... +async def async_to_httpx_files(files: RequestFiles) -> HttpxRequestFiles: ... async def async_to_httpx_files(files: RequestFiles | None) -> HttpxRequestFiles | None: @@ -115,12 +111,12 @@ async def _async_transform_file(file: FileTypes) -> HttpxFileTypes: return file if is_tuple_t(file): - return (file[0], await _async_read_file_content(file[1]), *file[2:]) + return (file[0], await async_read_file_content(file[1]), *file[2:]) raise TypeError(f"Expected file types input to be a FileContent type or to be a tuple") -async def _async_read_file_content(file: FileContent) -> HttpxFileContent: +async def async_read_file_content(file: FileContent) -> HttpxFileContent: if isinstance(file, os.PathLike): return await anyio.Path(file).read_bytes() diff --git a/src/increase/_legacy_response.py b/src/increase/_legacy_response.py deleted file mode 100644 index fecb9b503..000000000 --- a/src/increase/_legacy_response.py +++ /dev/null @@ -1,456 +0,0 @@ -from __future__ import annotations - -import os -import inspect -import logging -import datetime -import functools -from typing import TYPE_CHECKING, Any, Union, Generic, TypeVar, Callable, Iterator, AsyncIterator, cast, overload -from typing_extensions import Awaitable, ParamSpec, override, deprecated, get_origin - -import anyio -import httpx -import pydantic - -from ._types import NoneType -from ._utils import is_given, extract_type_arg, is_annotated_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 -from ._exceptions import APIResponseValidationError - -if TYPE_CHECKING: - from ._models import FinalRequestOptions - from ._base_client import BaseClient - - -P = ParamSpec("P") -R = TypeVar("R") -_T = TypeVar("_T") - -log: logging.Logger = logging.getLogger(__name__) - - -class LegacyAPIResponse(Generic[R]): - """This is a legacy class as it will be replaced by `APIResponse` - and `AsyncAPIResponse` in the `_response.py` file in the next major - release. - - For the sync client this will mostly be the same with the exception - of `content` & `text` will be methods instead of properties. In the - async client, all methods will be async. - - A migration script will be provided & the migration in general should - be smooth. - """ - - _cast_to: type[R] - _client: BaseClient[Any, Any] - _parsed_by_type: dict[type[Any], Any] - _stream: bool - _stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None - _options: FinalRequestOptions - - http_response: httpx.Response - - def __init__( - self, - *, - raw: httpx.Response, - cast_to: type[R], - client: BaseClient[Any, Any], - stream: bool, - stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, - options: FinalRequestOptions, - ) -> None: - self._cast_to = cast_to - self._client = client - self._parsed_by_type = {} - self._stream = stream - self._stream_cls = stream_cls - self._options = options - self.http_response = raw - - @overload - def parse(self, *, to: type[_T]) -> _T: - ... - - @overload - def parse(self) -> R: - ... - - def parse(self, *, to: type[_T] | None = None) -> R | _T: - """Returns the rich python representation of this response's data. - - NOTE: For the async client: this will become a coroutine in the next major version. - - For lower-level control, see `.read()`, `.json()`, `.iter_bytes()`. - - You can customise the type that the response is parsed into through - the `to` argument, e.g. - - ```py - from increase import BaseModel - - - class MyModel(BaseModel): - foo: str - - - obj = response.parse(to=MyModel) - print(obj.foo) - ``` - - We support parsing: - - `BaseModel` - - `dict` - - `list` - - `Union` - - `str` - - `int` - - `float` - - `httpx.Response` - """ - cache_key = to if to is not None else self._cast_to - cached = self._parsed_by_type.get(cache_key) - if cached is not None: - return cached # type: ignore[no-any-return] - - parsed = self._parse(to=to) - if is_given(self._options.post_parser): - parsed = self._options.post_parser(parsed) - - self._parsed_by_type[cache_key] = parsed - return parsed - - @property - def headers(self) -> httpx.Headers: - return self.http_response.headers - - @property - def http_request(self) -> httpx.Request: - return self.http_response.request - - @property - def status_code(self) -> int: - return self.http_response.status_code - - @property - def url(self) -> httpx.URL: - return self.http_response.url - - @property - def method(self) -> str: - return self.http_request.method - - @property - def content(self) -> bytes: - """Return the binary response content. - - NOTE: this will be removed in favour of `.read()` in the - next major version. - """ - return self.http_response.content - - @property - def text(self) -> str: - """Return the decoded response content. - - NOTE: this will be turned into a method in the next major version. - """ - return self.http_response.text - - @property - def http_version(self) -> str: - return self.http_response.http_version - - @property - def is_closed(self) -> bool: - return self.http_response.is_closed - - @property - def elapsed(self) -> datetime.timedelta: - """The time taken for the complete request/response cycle to complete.""" - return self.http_response.elapsed - - def _parse(self, *, to: type[_T] | None = None) -> R | _T: - # unwrap `Annotated[T, ...]` -> `T` - if to and is_annotated_type(to): - to = extract_type_arg(to, 0) - - if self._stream: - if to: - if not is_stream_class_type(to): - raise TypeError(f"Expected custom parse type to be a subclass of {Stream} or {AsyncStream}") - - return cast( - _T, - to( - cast_to=extract_stream_chunk_type( - to, - failure_message="Expected custom stream type to be passed with a type argument, e.g. Stream[ChunkType]", - ), - response=self.http_response, - client=cast(Any, self._client), - ), - ) - - if self._stream_cls: - return cast( - R, - self._stream_cls( - cast_to=extract_stream_chunk_type(self._stream_cls), - response=self.http_response, - client=cast(Any, self._client), - ), - ) - - stream_cls = cast("type[Stream[Any]] | type[AsyncStream[Any]] | None", self._client._default_stream_cls) - if stream_cls is None: - raise MissingStreamClassError() - - return cast( - R, - stream_cls( - cast_to=self._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) - - response = self.http_response - if cast_to == str: - return cast(R, response.text) - - if cast_to == int: - return cast(R, int(response.text)) - - if cast_to == float: - return cast(R, float(response.text)) - - 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): - # 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 - # the response class ourselves but that is something that should be supported directly in httpx - # as it would be easy to incorrectly construct the Response object due to the multitude of arguments. - if cast_to != httpx.Response: - 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): - raise TypeError("Pydantic models must subclass our base model type, e.g. `from increase import BaseModel`") - - if ( - cast_to is not object - and not origin is list - and not origin is dict - and not origin is Union - and not issubclass(origin, BaseModel) - ): - raise RuntimeError( - f"Unsupported type, expected {cast_to} to be a subclass of {BaseModel}, {dict}, {list}, {Union}, {NoneType}, {str} or {httpx.Response}." - ) - - # split is required to handle cases where additional information is included - # in the response, e.g. application/json; charset=utf-8 - content_type, *_ = response.headers.get("content-type", "*").split(";") - if content_type != "application/json": - if is_basemodel(cast_to): - try: - data = response.json() - except Exception as exc: - log.debug("Could not read JSON from response data due to %s - %s", type(exc), exc) - else: - return self._client._process_response_data( - data=data, - cast_to=cast_to, # type: ignore - response=response, - ) - - if self._client._strict_response_validation: - raise APIResponseValidationError( - response=response, - message=f"Expected Content-Type response header to be `application/json` but received `{content_type}` instead.", - body=response.text, - ) - - # If the API responds with content that isn't JSON then we just return - # the (decoded) text without performing any parsing so that you can still - # handle the response however you need to. - return response.text # type: ignore - - data = response.json() - - return self._client._process_response_data( - data=data, - cast_to=cast_to, # type: ignore - response=response, - ) - - @override - def __repr__(self) -> str: - return f"" - - -class MissingStreamClassError(TypeError): - def __init__(self) -> None: - super().__init__( - "The `stream` argument was set to `True` but the `stream_cls` argument was not given. See `increase._streaming` for reference", - ) - - -def to_raw_response_wrapper(func: Callable[P, R]) -> Callable[P, LegacyAPIResponse[R]]: - """Higher order function that takes one of our bound API methods and wraps it - to support returning the raw `APIResponse` object directly. - """ - - @functools.wraps(func) - def wrapped(*args: P.args, **kwargs: P.kwargs) -> LegacyAPIResponse[R]: - extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} - extra_headers[RAW_RESPONSE_HEADER] = "true" - - kwargs["extra_headers"] = extra_headers - - return cast(LegacyAPIResponse[R], func(*args, **kwargs)) - - return wrapped - - -def async_to_raw_response_wrapper(func: Callable[P, Awaitable[R]]) -> Callable[P, Awaitable[LegacyAPIResponse[R]]]: - """Higher order function that takes one of our bound API methods and wraps it - to support returning the raw `APIResponse` object directly. - """ - - @functools.wraps(func) - async def wrapped(*args: P.args, **kwargs: P.kwargs) -> LegacyAPIResponse[R]: - extra_headers: dict[str, str] = {**(cast(Any, kwargs.get("extra_headers")) or {})} - extra_headers[RAW_RESPONSE_HEADER] = "true" - - kwargs["extra_headers"] = extra_headers - - return cast(LegacyAPIResponse[R], await func(*args, **kwargs)) - - return wrapped - - -class HttpxBinaryResponseContent: - response: httpx.Response - - def __init__(self, response: httpx.Response) -> None: - self.response = response - - @property - def content(self) -> bytes: - return self.response.content - - @property - def text(self) -> str: - return self.response.text - - @property - def encoding(self) -> str | None: - return self.response.encoding - - @property - def charset_encoding(self) -> str | None: - return self.response.charset_encoding - - def json(self, **kwargs: Any) -> Any: - return self.response.json(**kwargs) - - def read(self) -> bytes: - return self.response.read() - - def iter_bytes(self, chunk_size: int | None = None) -> Iterator[bytes]: - return self.response.iter_bytes(chunk_size) - - def iter_text(self, chunk_size: int | None = None) -> Iterator[str]: - return self.response.iter_text(chunk_size) - - def iter_lines(self) -> Iterator[str]: - return self.response.iter_lines() - - def iter_raw(self, chunk_size: int | None = None) -> Iterator[bytes]: - return self.response.iter_raw(chunk_size) - - def write_to_file( - self, - file: str | os.PathLike[str], - ) -> None: - """Write the output to the given file. - - Accepts a filename or any path-like object, e.g. pathlib.Path - - Note: if you want to stream the data to the file instead of writing - all at once then you should use `.with_streaming_response` when making - the API request, e.g. `client.with_streaming_response.foo().stream_to_file('my_filename.txt')` - """ - with open(file, mode="wb") as f: - for data in self.response.iter_bytes(): - f.write(data) - - @deprecated( - "Due to a bug, this method doesn't actually stream the response content, `.with_streaming_response.method()` should be used instead" - ) - def stream_to_file( - self, - file: str | os.PathLike[str], - *, - chunk_size: int | None = None, - ) -> None: - with open(file, mode="wb") as f: - for data in self.response.iter_bytes(chunk_size): - f.write(data) - - def close(self) -> None: - return self.response.close() - - async def aread(self) -> bytes: - return await self.response.aread() - - async def aiter_bytes(self, chunk_size: int | None = None) -> AsyncIterator[bytes]: - return self.response.aiter_bytes(chunk_size) - - async def aiter_text(self, chunk_size: int | None = None) -> AsyncIterator[str]: - return self.response.aiter_text(chunk_size) - - async def aiter_lines(self) -> AsyncIterator[str]: - return self.response.aiter_lines() - - async def aiter_raw(self, chunk_size: int | None = None) -> AsyncIterator[bytes]: - return self.response.aiter_raw(chunk_size) - - @deprecated( - "Due to a bug, this method doesn't actually stream the response content, `.with_streaming_response.method()` should be used instead" - ) - async def astream_to_file( - self, - file: str | os.PathLike[str], - *, - chunk_size: int | None = None, - ) -> None: - path = anyio.Path(file) - async with await path.open(mode="wb") as f: - async for data in self.response.aiter_bytes(chunk_size): - await f.write(data) - - async def aclose(self) -> None: - return await self.response.aclose() diff --git a/src/increase/_models.py b/src/increase/_models.py index 77c755b13..29070e055 100644 --- a/src/increase/_models.py +++ b/src/increase/_models.py @@ -1,15 +1,31 @@ from __future__ import annotations +import os import inspect -from typing import TYPE_CHECKING, Any, Type, Union, Generic, TypeVar, Callable, cast +import weakref +from typing import ( + IO, + TYPE_CHECKING, + Any, + Type, + Union, + Generic, + TypeVar, + Callable, + Iterable, + Optional, + AsyncIterable, + cast, +) from datetime import date, datetime -from functools import lru_cache from typing_extensions import ( + List, Unpack, Literal, ClassVar, Protocol, Required, + ParamSpec, TypedDict, TypeGuard, final, @@ -18,7 +34,6 @@ ) import pydantic -import pydantic.generics from pydantic.fields import FieldInfo from ._types import ( @@ -36,16 +51,20 @@ PropertyInfo, is_list, is_given, + json_safe, + lru_cache, is_mapping, parse_date, + coerce_boolean, parse_datetime, strip_not_given, extract_type_arg, is_annotated_type, + is_type_alias_type, strip_annotated_type, ) from ._compat import ( - PYDANTIC_V2, + PYDANTIC_V1, ConfigDict, GenericModel as BaseGenericModel, get_args, @@ -60,11 +79,14 @@ from ._constants import RAW_RESPONSE_HEADER if TYPE_CHECKING: - from pydantic_core.core_schema import ModelField, ModelFieldsSchema + from pydantic_core.core_schema import ModelField, ModelSchema, LiteralSchema, ModelFieldsSchema __all__ = ["BaseModel", "GenericModel"] _T = TypeVar("_T") +_BaseModelT = TypeVar("_BaseModelT", bound="BaseModel") + +P = ParamSpec("P") @runtime_checkable @@ -73,9 +95,7 @@ class _ConfigProtocol(Protocol): class BaseModel(pydantic.BaseModel): - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict(extra="allow") - else: + if PYDANTIC_V1: @property @override @@ -85,25 +105,102 @@ def model_fields_set(self) -> set[str]: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] extra: Any = pydantic.Extra.allow # type: ignore + else: + model_config: ClassVar[ConfigDict] = ConfigDict( + extra="allow", defer_build=coerce_boolean(os.environ.get("DEFER_PYDANTIC_BUILD", "true")) + ) + + def to_dict( + self, + *, + mode: Literal["json", "python"] = "python", + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> dict[str, object]: + """Recursively generate a dictionary representation of the model, optionally specifying which fields to include or exclude. + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + mode: + If mode is 'json', the dictionary will only contain JSON serializable types. e.g. `datetime` will be turned into a string, `"2024-3-22T18:11:19.117000Z"`. + If mode is 'python', the dictionary may contain any Python objects. e.g. `datetime(2024, 3, 22)` + + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value from the output. + exclude_none: Whether to exclude fields that have a value of `None` from the output. + warnings: Whether to log warnings when invalid fields are encountered. This is only supported in Pydantic v2. + """ + return self.model_dump( + mode=mode, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) + + def to_json( + self, + *, + indent: int | None = 2, + use_api_names: bool = True, + exclude_unset: bool = True, + exclude_defaults: bool = False, + exclude_none: bool = False, + warnings: bool = True, + ) -> str: + """Generates a JSON string representing this model as it would be received from or sent to the API (but with indentation). + + By default, fields that were not set by the API will not be included, + and keys will match the API response, *not* the property names from the model. + + For example, if the API responds with `"fooBar": true` but we've defined a `foo_bar: bool` property, + the output will use the `"fooBar"` key (unless `use_api_names=False` is passed). + + Args: + indent: Indentation to use in the JSON output. If `None` is passed, the output will be compact. Defaults to `2` + use_api_names: Whether to use the key that the API responded with or the property name. Defaults to `True`. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that have the default value. + exclude_none: Whether to exclude fields that have a value of `None`. + warnings: Whether to show any warnings that occurred during serialization. This is only supported in Pydantic v2. + """ + return self.model_dump_json( + indent=indent, + by_alias=use_api_names, + exclude_unset=exclude_unset, + exclude_defaults=exclude_defaults, + exclude_none=exclude_none, + warnings=warnings, + ) @override def __str__(self) -> str: # mypy complains about an invalid self arg - return f'{self.__repr_name__()}({self.__repr_str__(", ")})' # type: ignore[misc] + return f"{self.__repr_name__()}({self.__repr_str__(', ')})" # type: ignore[misc] # Override the 'construct' method in a way that supports recursive parsing without validation. # Based on https://github.com/samuelcolvin/pydantic/issues/1168#issuecomment-817742836. @classmethod @override - def construct( - cls: Type[ModelT], + def construct( # pyright: ignore[reportIncompatibleMethodOverride] + __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) @@ -113,7 +210,7 @@ def construct( 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): @@ -125,28 +222,32 @@ def construct( else: fields_values[name] = field_get_default(field) + extra_field_type = _get_extra_fields_type(__cls) + _extra = {} for key, value in values.items(): if key not in model_fields: - if PYDANTIC_V2: - _extra[key] = value - else: + parsed = construct_type(value=value, type_=extra_field_type) if extra_field_type is not None else value + + if PYDANTIC_V1: _fields_set.add(key) - fields_values[key] = value + fields_values[key] = parsed + else: + _extra[key] = parsed object.__setattr__(m, "__dict__", fields_values) - if PYDANTIC_V2: - # these properties are copied from Pydantic's `model_construct()` method - object.__setattr__(m, "__pydantic_private__", None) - object.__setattr__(m, "__pydantic_extra__", _extra) - object.__setattr__(m, "__pydantic_fields_set__", _fields_set) - else: + if PYDANTIC_V1: # init_private_attributes() does not exist in v2 m._init_private_attributes() # type: ignore # copied from Pydantic v1's `construct()` method object.__setattr__(m, "__fields_set__", _fields_set) + else: + # these properties are copied from Pydantic's `model_construct()` method + object.__setattr__(m, "__pydantic_private__", None) + object.__setattr__(m, "__pydantic_extra__", _extra) + object.__setattr__(m, "__pydantic_fields_set__", _fields_set) return m @@ -156,7 +257,7 @@ def construct( # although not in practice model_construct = construct - if not PYDANTIC_V2: + if PYDANTIC_V1: # we define aliases for some of the new pydantic v2 methods so # that we can just document these methods without having to specify # a specific pydantic version as some users may not know which @@ -167,14 +268,18 @@ def model_dump( self, *, mode: Literal["json", "python"] | str = "python", - include: IncEx = None, - exclude: IncEx = None, - by_alias: bool = False, + include: IncEx | None = None, + exclude: IncEx | None = None, + context: Any | None = None, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, - warnings: bool = True, + warnings: bool | Literal["none", "warn", "error"] = True, + fallback: Callable[[Any], Any] | None = None, + serialize_as_any: bool = False, ) -> dict[str, Any]: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump @@ -182,48 +287,71 @@ def model_dump( Args: mode: The mode in which `to_python` should run. - If mode is 'json', the dictionary will only contain JSON serializable types. - If mode is 'python', the dictionary may contain any Python objects. - include: A list of fields to include in the output. - exclude: A list of fields to exclude from the output. + If mode is 'json', the output will only contain JSON serializable types. + If mode is 'python', the output may contain non-JSON-serializable Python objects. + include: A set of fields to include in the output. + exclude: A set of fields to exclude from the output. + context: Additional context to pass to the serializer. by_alias: Whether to use the field's alias in the dictionary key if defined. - exclude_unset: Whether to exclude fields that are unset or None from the output. - exclude_defaults: Whether to exclude fields that are set to their default value from the output. - exclude_none: Whether to exclude fields that have a value of `None` from the output. - round_trip: Whether to enable serialization and deserialization round-trip support. - warnings: Whether to log warnings when invalid fields are encountered. + exclude_unset: Whether to exclude fields that have not been explicitly set. + exclude_defaults: Whether to exclude fields that are set to their default value. + exclude_none: Whether to exclude fields that have a value of `None`. + exclude_computed_fields: Whether to exclude computed fields. + While this can be useful for round-tripping, it is usually recommended to use the dedicated + `round_trip` parameter instead. + round_trip: If True, dumped values should be valid as input for non-idempotent types such as Json[T]. + warnings: How to handle serialization errors. False/"none" ignores them, True/"warn" logs errors, + "error" raises a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError]. + fallback: A function to call when an unknown value is encountered. If not provided, + a [`PydanticSerializationError`][pydantic_core.PydanticSerializationError] error is raised. + serialize_as_any: Whether to serialize fields with duck-typing serialization behavior. Returns: A dictionary representation of the model. """ - if mode != "python": - raise ValueError("mode is only supported in Pydantic v2") + if mode not in {"json", "python"}: + raise ValueError("mode must be either 'json' or 'python'") if round_trip != False: raise ValueError("round_trip is only supported in Pydantic v2") if warnings != True: raise ValueError("warnings is only supported in Pydantic v2") - return super().dict( # pyright: ignore[reportDeprecated] + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") + dumped = super().dict( # pyright: ignore[reportDeprecated] include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, ) + return cast("dict[str, Any]", json_safe(dumped)) if mode == "json" else dumped + @override def model_dump_json( self, *, indent: int | None = None, - include: IncEx = None, - exclude: IncEx = None, - by_alias: bool = False, + ensure_ascii: bool = False, + include: IncEx | None = None, + exclude: IncEx | None = None, + context: Any | None = None, + by_alias: bool | None = None, exclude_unset: bool = False, exclude_defaults: bool = False, exclude_none: bool = False, + exclude_computed_fields: bool = False, round_trip: bool = False, - warnings: bool = True, + warnings: bool | Literal["none", "warn", "error"] = True, + fallback: Callable[[Any], Any] | None = None, + serialize_as_any: bool = False, ) -> str: """Usage docs: https://docs.pydantic.dev/2.4/concepts/serialization/#modelmodel_dump_json @@ -247,11 +375,21 @@ def model_dump_json( raise ValueError("round_trip is only supported in Pydantic v2") if warnings != True: raise ValueError("warnings is only supported in Pydantic v2") + if context is not None: + raise ValueError("context is only supported in Pydantic v2") + if serialize_as_any != False: + raise ValueError("serialize_as_any is only supported in Pydantic v2") + if fallback is not None: + raise ValueError("fallback is only supported in Pydantic v2") + if ensure_ascii != False: + raise ValueError("ensure_ascii is only supported in Pydantic v2") + if exclude_computed_fields != False: + raise ValueError("exclude_computed_fields is only supported in Pydantic v2") return super().json( # type: ignore[reportDeprecated] indent=indent, include=include, exclude=exclude, - by_alias=by_alias, + by_alias=by_alias if by_alias is not None else False, exclude_unset=exclude_unset, exclude_defaults=exclude_defaults, exclude_none=exclude_none, @@ -262,15 +400,32 @@ def _construct_field(value: object, field: FieldInfo, key: str) -> object: if value is None: return field_get_default(field) - if PYDANTIC_V2: - type_ = field.annotation - else: + if PYDANTIC_V1: type_ = cast(type, field.outer_type_) # type: ignore + else: + type_ = field.annotation # type: ignore if type_ is None: raise RuntimeError(f"Unexpected field type is None for {key}") - return construct_type(value=value, type_=type_) + return construct_type(value=value, type_=type_, metadata=getattr(field, "metadata", None)) + + +def _get_extra_fields_type(cls: type[pydantic.BaseModel]) -> type | None: + if PYDANTIC_V1: + # TODO + return None + + schema = cls.__pydantic_core_schema__ + if schema["type"] == "model": + fields = schema["schema"] + if fields["type"] == "model-fields": + extras = fields.get("extras_schema") + if extras and "cls" in extras: + # mypy can't narrow the type + return extras["cls"] # type: ignore[no-any-return] + + return None def is_basemodel(type_: type) -> bool: @@ -287,20 +442,64 @@ def is_basemodel(type_: type) -> bool: def is_basemodel_type(type_: type) -> TypeGuard[type[BaseModel] | type[GenericModel]]: origin = get_origin(type_) or type_ + if not inspect.isclass(origin): + return False return issubclass(origin, BaseModel) or issubclass(origin, GenericModel) -def construct_type(*, value: object, type_: object) -> object: +def build( + base_model_cls: Callable[P, _BaseModelT], + *args: P.args, + **kwargs: P.kwargs, +) -> _BaseModelT: + """Construct a BaseModel class without validation. + + This is useful for cases where you need to instantiate a `BaseModel` + from an API response as this provides type-safe params which isn't supported + by helpers like `construct_type()`. + + ```py + build(MyModel, my_field_a="foo", my_field_b=123) + ``` + """ + if args: + raise TypeError( + "Received positional arguments which are not supported; Keyword arguments must be used instead", + ) + + return cast(_BaseModelT, construct_type(type_=base_model_cls, value=kwargs)) + + +def construct_type_unchecked(*, value: object, type_: type[_T]) -> _T: + """Loose coercion to the expected type with construction of nested values. + + Note: the returned value from this function is not guaranteed to match the + given type. + """ + return cast(_T, construct_type(value=value, type_=type_)) + + +def construct_type(*, value: object, type_: object, metadata: Optional[List[Any]] = None) -> object: """Loose coercion to the expected type with construction of nested values. If the given value does not match the expected type then it is returned as-is. """ + + # store a reference to the original type we were given before we extract any inner + # types so that we can properly resolve forward references in `TypeAliasType` annotations + original_type = None + # 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_): + original_type = type_ # type: ignore[unreachable] + type_ = type_.__value__ # type: ignore[unreachable] # unwrap `Annotated[T, ...]` -> `T` - if is_annotated_type(type_): + if metadata is not None and len(metadata) > 0: + meta: tuple[Any, ...] = tuple(metadata) + elif is_annotated_type(type_): meta = get_args(type_)[1:] type_ = extract_type_arg(type_, 0) else: @@ -313,7 +512,7 @@ def construct_type(*, value: object, type_: object) -> object: if is_union(origin): try: - return validate_type(type_=cast("type[object]", type_), value=value) + return validate_type(type_=cast("type[object]", original_type or type_), value=value) except Exception: pass @@ -355,7 +554,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] @@ -401,6 +604,9 @@ class CachedDiscriminatorType(Protocol): __discriminator__: DiscriminatorDetails +DISCRIMINATOR_CACHE: weakref.WeakKeyDictionary[type, DiscriminatorDetails] = weakref.WeakKeyDictionary() + + class DiscriminatorDetails: field_name: str """The name of the discriminator field in the variant class, e.g. @@ -443,8 +649,9 @@ def __init__( def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, ...]) -> DiscriminatorDetails | None: - if isinstance(union, CachedDiscriminatorType): - return union.__discriminator__ + cached = DISCRIMINATOR_CACHE.get(union) + if cached is not None: + return cached discriminator_field_name: str | None = None @@ -462,30 +669,30 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, for variant in get_args(union): variant = strip_annotated_type(variant) if is_basemodel_type(variant): - if PYDANTIC_V2: - field = _extract_field_schema_pv2(variant, discriminator_field_name) - if not field: + if PYDANTIC_V1: + field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] + if not field_info: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field.get("serialization_alias") - - field_schema = field["schema"] + discriminator_alias = field_info.alias - if field_schema["type"] == "literal": - for entry in field_schema["expected"]: + if (annotation := getattr(field_info, "annotation", None)) and is_literal_type(annotation): + for entry in get_args(annotation): if isinstance(entry, str): mapping[entry] = variant else: - field_info = cast("dict[str, FieldInfo]", variant.__fields__).get(discriminator_field_name) # pyright: ignore[reportDeprecated, reportUnnecessaryCast] - if not field_info: + field = _extract_field_schema_pv2(variant, discriminator_field_name) + if not field: continue # Note: if one variant defines an alias then they all should - discriminator_alias = field_info.alias + discriminator_alias = field.get("serialization_alias") - if field_info.annotation and is_literal_type(field_info.annotation): - for entry in get_args(field_info.annotation): + field_schema = field["schema"] + + if field_schema["type"] == "literal": + for entry in cast("LiteralSchema", field_schema)["expected"]: if isinstance(entry, str): mapping[entry] = variant @@ -497,21 +704,24 @@ def _build_discriminated_union_meta(*, union: type, meta_annotations: tuple[Any, discriminator_field=discriminator_field_name, discriminator_alias=discriminator_alias, ) - cast(CachedDiscriminatorType, union).__discriminator__ = details + DISCRIMINATOR_CACHE.setdefault(union, details) return details def _extract_field_schema_pv2(model: type[BaseModel], field_name: str) -> ModelField | None: schema = model.__pydantic_core_schema__ + if schema["type"] == "definitions": + schema = schema["schema"] + if schema["type"] != "model": return None + schema = cast("ModelSchema", schema) fields_schema = schema["schema"] if fields_schema["type"] != "model-fields": return None fields_schema = cast("ModelFieldsSchema", fields_schema) - field = fields_schema["fields"].get(field_name) if not field: return None @@ -527,7 +737,15 @@ def validate_type(*, type_: type[_T], value: object) -> _T: return cast(_T, _validate_non_model_type(type_=type_, value=value)) -# our use of subclasssing here causes weirdness for type checkers, +def set_pydantic_config(typ: Any, config: pydantic.ConfigDict) -> None: + """Add a pydantic config for the given type. + + Note: this is a no-op on Pydantic v1. + """ + setattr(typ, "__pydantic_config__", config) # noqa: B010 + + +# our use of subclassing here causes weirdness for type checkers, # so we just pretend that we don't subclass if TYPE_CHECKING: GenericModel = BaseModel @@ -537,7 +755,7 @@ class GenericModel(BaseGenericModel, BaseModel): pass -if PYDANTIC_V2: +if not PYDANTIC_V1: from pydantic import TypeAdapter as _TypeAdapter _CachedTypeAdapter = cast("TypeAdapter[object]", lru_cache(maxsize=None)(_TypeAdapter)) @@ -582,8 +800,10 @@ class FinalRequestOptionsInput(TypedDict, total=False): timeout: float | Timeout | None files: HttpxRequestFiles | None idempotency_key: str + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] json_data: Body extra_json: AnyMapping + follow_redirects: bool @final @@ -597,18 +817,20 @@ class FinalRequestOptions(pydantic.BaseModel): files: Union[HttpxRequestFiles, None] = None idempotency_key: Union[str, None] = None post_parser: Union[Callable[[Any], Any], NotGiven] = NotGiven() + follow_redirects: Union[bool, None] = None + content: Union[bytes, bytearray, IO[bytes], Iterable[bytes], AsyncIterable[bytes], None] = None # It should be noted that we cannot use `json` here as that would override # a BaseModel method in an incompatible fashion. json_data: Union[Body, None] = None extra_json: Union[AnyMapping, None] = None - if PYDANTIC_V2: - model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) - else: + if PYDANTIC_V1: class Config(pydantic.BaseConfig): # pyright: ignore[reportDeprecated] arbitrary_types_allowed: bool = True + else: + model_config: ClassVar[ConfigDict] = ConfigDict(arbitrary_types_allowed=True) def get_max_retries(self, max_retries: int) -> int: if isinstance(self.max_retries, NotGiven): @@ -641,9 +863,9 @@ def construct( # type: ignore key: strip_not_given(value) for key, value in values.items() } - if PYDANTIC_V2: - return super().model_construct(_fields_set, **kwargs) - return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + if PYDANTIC_V1: + return cast(FinalRequestOptions, super().construct(_fields_set, **kwargs)) # pyright: ignore[reportDeprecated] + return super().model_construct(_fields_set, **kwargs) if not TYPE_CHECKING: # type checkers incorrectly complain about this assignment diff --git a/src/increase/_qs.py b/src/increase/_qs.py index 274320ca5..de8c99bc6 100644 --- a/src/increase/_qs.py +++ b/src/increase/_qs.py @@ -4,7 +4,7 @@ from urllib.parse import parse_qs, urlencode from typing_extensions import Literal, get_args -from ._types import NOT_GIVEN, NotGiven, NotGivenOr +from ._types import NotGiven, not_given from ._utils import flatten _T = TypeVar("_T") @@ -41,8 +41,8 @@ def stringify( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> str: return urlencode( self.stringify_items( @@ -56,8 +56,8 @@ def stringify_items( self, params: Params, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> list[tuple[str, str]]: opts = Options( qs=self, @@ -101,7 +101,10 @@ def _stringify_item( items.extend(self._stringify_item(key, item, opts)) return items elif array_format == "indices": - raise NotImplementedError("The array indices format is not supported yet") + items = [] + for i, item in enumerate(value): + items.extend(self._stringify_item(f"{key}[{i}]", item, opts)) + return items elif array_format == "brackets": items = [] key = key + "[]" @@ -143,8 +146,8 @@ def __init__( self, qs: Querystring = _qs, *, - array_format: NotGivenOr[ArrayFormat] = NOT_GIVEN, - nested_format: NotGivenOr[NestedFormat] = NOT_GIVEN, + array_format: ArrayFormat | NotGiven = not_given, + nested_format: NestedFormat | NotGiven = not_given, ) -> None: self.array_format = qs.array_format if isinstance(array_format, NotGiven) else array_format self.nested_format = qs.nested_format if isinstance(nested_format, NotGiven) else nested_format diff --git a/src/increase/_response.py b/src/increase/_response.py index 9cb0a9769..b64b589d6 100644 --- a/src/increase/_response.py +++ b/src/increase/_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 @@ -55,6 +55,9 @@ class BaseAPIResponse(Generic[R]): http_response: httpx.Response + retries_taken: int + """The number of retries made. If no retries happened this will be `0`""" + def __init__( self, *, @@ -64,6 +67,7 @@ def __init__( stream: bool, stream_cls: type[Stream[Any]] | type[AsyncStream[Any]] | None, options: FinalRequestOptions, + retries_taken: int = 0, ) -> None: self._cast_to = cast_to self._client = client @@ -72,6 +76,7 @@ def __init__( self._stream_cls = stream_cls self._options = options self.http_response = raw + self.retries_taken = retries_taken @property def headers(self) -> httpx.Headers: @@ -121,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: @@ -139,6 +152,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: ), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -149,6 +163,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: cast_to=extract_stream_chunk_type(self._stream_cls), response=self.http_response, client=cast(Any, self._client), + options=self._options, ), ) @@ -159,18 +174,13 @@ 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), + options=self._options, ), ) - 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) @@ -187,11 +197,8 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: if cast_to == float: return cast(R, float(response.text)) - 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 + if cast_to == bool: + return cast(R, response.text.lower() == "true") if origin == APIResponse: raise RuntimeError("Unexpected state - cast_to is `APIResponse`") @@ -206,7 +213,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 increase import BaseModel`") if ( @@ -223,7 +236,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: # split is required to handle cases where additional information is included # in the response, e.g. application/json; charset=utf-8 content_type, *_ = response.headers.get("content-type", "*").split(";") - if content_type != "application/json": + if not content_type.endswith("json"): if is_basemodel(cast_to): try: data = response.json() @@ -258,13 +271,15 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T: class APIResponse(BaseAPIResponse[R]): + @property + def idempotent_replayed(self) -> str | None: + return self.http_response.headers.get("Idempotent-Replayed") # type: ignore[no-any-return] + @overload - def parse(self, *, to: type[_T]) -> _T: - ... + def parse(self, *, to: type[_T]) -> _T: ... @overload - def parse(self) -> R: - ... + def parse(self) -> R: ... def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. @@ -362,13 +377,15 @@ def iter_lines(self) -> Iterator[str]: class AsyncAPIResponse(BaseAPIResponse[R]): + @property + def idempotent_replayed(self) -> str | None: + return self.http_response.headers.get("Idempotent-Replayed") # type: ignore[no-any-return] + @overload - async def parse(self, *, to: type[_T]) -> _T: - ... + async def parse(self, *, to: type[_T]) -> _T: ... @overload - async def parse(self) -> R: - ... + async def parse(self) -> R: ... async def parse(self, *, to: type[_T] | None = None) -> R | _T: """Returns the rich python representation of this response's data. diff --git a/src/increase/_streaming.py b/src/increase/_streaming.py index c8398ad42..93e15346d 100644 --- a/src/increase/_streaming.py +++ b/src/increase/_streaming.py @@ -4,7 +4,7 @@ import json import inspect from types import TracebackType -from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, AsyncIterator, cast +from typing import TYPE_CHECKING, Any, Generic, TypeVar, Iterator, Optional, AsyncIterator, cast from typing_extensions import Self, Protocol, TypeGuard, override, get_origin, runtime_checkable import httpx @@ -13,6 +13,7 @@ if TYPE_CHECKING: from ._client import Increase, AsyncIncrease + from ._models import FinalRequestOptions _T = TypeVar("_T") @@ -22,8 +23,8 @@ class Stream(Generic[_T]): """Provides the core interface to iterate over a synchronous stream response.""" response: httpx.Response - - _decoder: SSEDecoder | SSEBytesDecoder + _options: Optional[FinalRequestOptions] = None + _decoder: SSEBytesDecoder def __init__( self, @@ -31,10 +32,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: Increase, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() @@ -46,10 +49,7 @@ def __iter__(self) -> Iterator[_T]: yield item def _iter_events(self) -> Iterator[ServerSentEvent]: - if isinstance(self._decoder, SSEBytesDecoder): - yield from self._decoder.iter_bytes(self.response.iter_bytes()) - else: - yield from self._decoder.iter(self.response.iter_lines()) + yield from self._decoder.iter_bytes(self.response.iter_bytes()) def __stream__(self) -> Iterator[_T]: cast_to = cast(Any, self._cast_to) @@ -57,12 +57,12 @@ def __stream__(self) -> Iterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # Ensure the entire stream is consumed - for _sse in iterator: - ... + try: + for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + response.close() def __enter__(self) -> Self: return self @@ -88,7 +88,7 @@ class AsyncStream(Generic[_T]): """Provides the core interface to iterate over an asynchronous stream response.""" response: httpx.Response - + _options: Optional[FinalRequestOptions] = None _decoder: SSEDecoder | SSEBytesDecoder def __init__( @@ -97,10 +97,12 @@ def __init__( cast_to: type[_T], response: httpx.Response, client: AsyncIncrease, + options: Optional[FinalRequestOptions] = None, ) -> None: self.response = response self._cast_to = cast_to self._client = client + self._options = options self._decoder = client._make_sse_decoder() self._iterator = self.__stream__() @@ -112,12 +114,8 @@ async def __aiter__(self) -> AsyncIterator[_T]: yield item async def _iter_events(self) -> AsyncIterator[ServerSentEvent]: - if isinstance(self._decoder, SSEBytesDecoder): - async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()): - yield sse - else: - async for sse in self._decoder.aiter(self.response.aiter_lines()): - yield sse + async for sse in self._decoder.aiter_bytes(self.response.aiter_bytes()): + yield sse async def __stream__(self) -> AsyncIterator[_T]: cast_to = cast(Any, self._cast_to) @@ -125,12 +123,12 @@ async def __stream__(self) -> AsyncIterator[_T]: process_data = self._client._process_response_data iterator = self._iter_events() - async for sse in iterator: - yield process_data(data=sse.json(), cast_to=cast_to, response=response) - - # Ensure the entire stream is consumed - async for _sse in iterator: - ... + try: + async for sse in iterator: + yield process_data(data=sse.json(), cast_to=cast_to, response=response) + finally: + # Ensure the response is closed even if the consumer doesn't read all data + await response.aclose() async def __aenter__(self) -> Self: return self @@ -205,21 +203,49 @@ def __init__(self) -> None: self._last_event_id = None self._retry = None - def iter(self, iterator: Iterator[str]) -> Iterator[ServerSentEvent]: - """Given an iterator that yields lines, iterate over it & yield every event encountered""" - for line in iterator: - line = line.rstrip("\n") - sse = self.decode(line) - if sse is not None: - yield sse - - async def aiter(self, iterator: AsyncIterator[str]) -> AsyncIterator[ServerSentEvent]: - """Given an async iterator that yields lines, iterate over it & yield every event encountered""" - async for line in iterator: - line = line.rstrip("\n") - sse = self.decode(line) - if sse is not None: - yield sse + def iter_bytes(self, iterator: Iterator[bytes]) -> Iterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + for chunk in self._iter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + def _iter_chunks(self, iterator: Iterator[bytes]) -> Iterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data + + async def aiter_bytes(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[ServerSentEvent]: + """Given an iterator that yields raw binary data, iterate over it & yield every event encountered""" + async for chunk in self._aiter_chunks(iterator): + # Split before decoding so splitlines() only uses \r and \n + for raw_line in chunk.splitlines(): + line = raw_line.decode("utf-8") + sse = self.decode(line) + if sse: + yield sse + + async def _aiter_chunks(self, iterator: AsyncIterator[bytes]) -> AsyncIterator[bytes]: + """Given an iterator that yields raw binary data, iterate over it and yield individual SSE chunks""" + data = b"" + async for chunk in iterator: + for line in chunk.splitlines(keepends=True): + data += line + if data.endswith((b"\r\r", b"\n\n", b"\r\n\r\n")): + yield data + data = b"" + if data: + yield data def decode(self, line: str) -> ServerSentEvent | None: # See: https://html.spec.whatwg.org/multipage/server-sent-events.html#event-stream-interpretation # noqa: E501 diff --git a/src/increase/_types.py b/src/increase/_types.py index e85f284ea..41865091f 100644 --- a/src/increase/_types.py +++ b/src/increase/_types.py @@ -13,10 +13,23 @@ Mapping, TypeVar, Callable, + Iterable, + Iterator, Optional, Sequence, + AsyncIterable, +) +from typing_extensions import ( + Set, + Literal, + Protocol, + TypeAlias, + TypedDict, + SupportsIndex, + overload, + override, + runtime_checkable, ) -from typing_extensions import Literal, Protocol, TypeAlias, TypedDict, override, runtime_checkable import httpx import pydantic @@ -25,7 +38,6 @@ if TYPE_CHECKING: from ._models import BaseModel from ._response import APIResponse, AsyncAPIResponse - from ._legacy_response import HttpxBinaryResponseContent Transport = BaseTransport AsyncTransport = AsyncBaseTransport @@ -46,6 +58,13 @@ else: Base64FileInput = Union[IO[bytes], PathLike] FileContent = Union[IO[bytes], bytes, PathLike] # PathLike is not subscriptable in Python 3.8. + + +# Used for sending raw binary data / streaming data in request bodies +# e.g. for file uploads without multipart encoding +BinaryTypes = Union[bytes, bytearray, IO[bytes], Iterable[bytes]] +AsyncBinaryTypes = Union[bytes, bytearray, IO[bytes], AsyncIterable[bytes]] + FileTypes = Union[ # file (or bytes) FileContent, @@ -101,24 +120,27 @@ class RequestOptions(TypedDict, total=False): params: Query extra_json: AnyMapping idempotency_key: str + follow_redirects: bool # Sentinel class used until PEP 0661 is accepted class NotGiven: """ - A sentinel singleton class used to distinguish omitted keyword arguments - from those passed in with the value None (which may have different behavior). + For parameters with a meaningful None value, we need to distinguish between + the user explicitly passing None, and the user not passing the parameter at + all. + + User code shouldn't need to use not_given directly. For example: ```py - def get(timeout: Union[int, NotGiven, None] = NotGiven()) -> Response: - ... + def create(timeout: Timeout | None | NotGiven = not_given): ... - get(timeout=1) # 1s timeout - get(timeout=None) # No timeout - get() # Default timeout behavior, which may not be statically known at the method definition. + create(timeout=1) # 1s timeout + create(timeout=None) # No timeout + create() # Default timeout behavior ``` """ @@ -130,13 +152,14 @@ def __repr__(self) -> str: return "NOT_GIVEN" -NotGivenOr = Union[_T, NotGiven] +not_given = NotGiven() +# for backwards compatibility: NOT_GIVEN = NotGiven() class Omit: - """In certain situations you need to be able to represent a case where a default value has - to be explicitly removed and `None` is not an appropriate substitute, for example: + """ + To explicitly omit something from being sent in a request, use `omit`. ```py # as the default `Content-Type` header is `application/json` that will be sent @@ -146,8 +169,8 @@ class Omit: # to look something like: 'multipart/form-data; boundary=0d8382fcf5f8c3be01ca2e11002d2983' client.post(..., headers={"Content-Type": "multipart/form-data"}) - # instead you can remove the default `application/json` header by passing Omit - client.post(..., headers={"Content-Type": Omit()}) + # instead you can remove the default `application/json` header by passing omit + client.post(..., headers={"Content-Type": omit}) ``` """ @@ -155,6 +178,9 @@ def __bool__(self) -> Literal[False]: return False +omit = Omit() + + @runtime_checkable class ModelBuilderProtocol(Protocol): @classmethod @@ -163,16 +189,14 @@ def build( *, response: Response, data: object, - ) -> _T: - ... + ) -> _T: ... Headers = Mapping[str, Union[str, Omit]] class HeadersLikeProtocol(Protocol): - def get(self, __key: str) -> str | None: - ... + def get(self, __key: str) -> str | None: ... HeadersLike = Union[Headers, HeadersLikeProtocol] @@ -190,15 +214,14 @@ def get(self, __key: str) -> str | None: ModelBuilderProtocol, "APIResponse[Any]", "AsyncAPIResponse[Any]", - "HttpxBinaryResponseContent", ], ) StrBytesIntFloat = Union[str, bytes, int, float] # Note: copied from Pydantic -# https://github.com/pydantic/pydantic/blob/32ea570bf96e84234d2992e1ddf40ab8a565925a/pydantic/main.py#L49 -IncEx: TypeAlias = "set[int] | set[str] | dict[int, Any] | dict[str, Any] | None" +# https://github.com/pydantic/pydantic/blob/6f31f8f68ef011f84357330186f603ff295312fd/pydantic/main.py#L79 +IncEx: TypeAlias = Union[Set[int], Set[str], Mapping[int, Union["IncEx", bool]], Mapping[str, Union["IncEx", bool]]] PostParser = Callable[[Any], Any] @@ -220,3 +243,28 @@ class _GenericAlias(Protocol): class HttpxSendArgs(TypedDict, total=False): auth: httpx.Auth + follow_redirects: bool + + +_T_co = TypeVar("_T_co", covariant=True) + + +if TYPE_CHECKING: + # This works because str.__contains__ does not accept object (either in typeshed or at runtime) + # https://github.com/hauntsaninja/useful_types/blob/5e9710f3875107d068e7679fd7fec9cfab0eff3b/useful_types/__init__.py#L285 + # + # Note: index() and count() methods are intentionally omitted to allow pyright to properly + # infer TypedDict types when dict literals are used in lists assigned to SequenceNotStr. + class SequenceNotStr(Protocol[_T_co]): + @overload + def __getitem__(self, index: SupportsIndex, /) -> _T_co: ... + @overload + def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ... + def __contains__(self, value: object, /) -> bool: ... + def __len__(self) -> int: ... + def __iter__(self) -> Iterator[_T_co]: ... + def __reversed__(self) -> Iterator[_T_co]: ... +else: + # just point this to a normal `Sequence` at runtime to avoid having to special case + # deserializing our custom sequence type + SequenceNotStr = Sequence diff --git a/src/increase/_utils/__init__.py b/src/increase/_utils/__init__.py index 569789419..10cb66d2d 100644 --- a/src/increase/_utils/__init__.py +++ b/src/increase/_utils/__init__.py @@ -1,3 +1,4 @@ +from ._path import path_template as path_template from ._sync import asyncify as asyncify from ._proxy import LazyProxy as LazyProxy from ._utils import ( @@ -6,9 +7,10 @@ is_list as is_list, is_given as is_given, is_tuple as is_tuple, + json_safe as json_safe, + lru_cache as lru_cache, is_mapping as is_mapping, is_tuple_t as is_tuple_t, - parse_date as parse_date, is_iterable as is_iterable, is_sequence as is_sequence, coerce_float as coerce_float, @@ -21,7 +23,6 @@ coerce_boolean as coerce_boolean, coerce_integer as coerce_integer, file_from_path as file_from_path, - parse_datetime as parse_datetime, strip_not_given as strip_not_given, deepcopy_minimal as deepcopy_minimal, get_async_library as get_async_library, @@ -30,13 +31,22 @@ maybe_coerce_boolean as maybe_coerce_boolean, maybe_coerce_integer as maybe_coerce_integer, ) +from ._compat import ( + get_args as get_args, + is_union as is_union, + get_origin as get_origin, + is_typeddict as is_typeddict, + is_literal_type as is_literal_type, +) from ._typing import ( is_list_type as is_list_type, is_union_type as is_union_type, extract_type_arg as extract_type_arg, is_iterable_type as is_iterable_type, is_required_type as is_required_type, + is_sequence_type as is_sequence_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, ) @@ -48,3 +58,8 @@ maybe_transform as maybe_transform, async_maybe_transform as async_maybe_transform, ) +from ._reflection import ( + function_has_argument as function_has_argument, + assert_signatures_in_sync as assert_signatures_in_sync, +) +from ._datetime_parse import parse_date as parse_date, parse_datetime as parse_datetime diff --git a/src/increase/_utils/_compat.py b/src/increase/_utils/_compat.py new file mode 100644 index 000000000..2c70b299c --- /dev/null +++ b/src/increase/_utils/_compat.py @@ -0,0 +1,45 @@ +from __future__ import annotations + +import sys +import typing_extensions +from typing import Any, Type, Union, Literal, Optional +from datetime import date, datetime +from typing_extensions import get_args as _get_args, get_origin as _get_origin + +from .._types import StrBytesIntFloat +from ._datetime_parse import parse_date as _parse_date, parse_datetime as _parse_datetime + +_LITERAL_TYPES = {Literal, typing_extensions.Literal} + + +def get_args(tp: type[Any]) -> tuple[Any, ...]: + return _get_args(tp) + + +def get_origin(tp: type[Any]) -> type[Any] | None: + return _get_origin(tp) + + +def is_union(tp: Optional[Type[Any]]) -> bool: + if sys.version_info < (3, 10): + return tp is Union # type: ignore[comparison-overlap] + else: + import types + + return tp is Union or tp is types.UnionType # type: ignore[comparison-overlap] + + +def is_typeddict(tp: Type[Any]) -> bool: + return typing_extensions.is_typeddict(tp) + + +def is_literal_type(tp: Type[Any]) -> bool: + return get_origin(tp) in _LITERAL_TYPES + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + return _parse_date(value) + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + return _parse_datetime(value) diff --git a/src/increase/_utils/_datetime_parse.py b/src/increase/_utils/_datetime_parse.py new file mode 100644 index 000000000..7cb9d9e66 --- /dev/null +++ b/src/increase/_utils/_datetime_parse.py @@ -0,0 +1,136 @@ +""" +This file contains code from https://github.com/pydantic/pydantic/blob/main/pydantic/v1/datetime_parse.py +without the Pydantic v1 specific errors. +""" + +from __future__ import annotations + +import re +from typing import Dict, Union, Optional +from datetime import date, datetime, timezone, timedelta + +from .._types import StrBytesIntFloat + +date_expr = r"(?P\d{4})-(?P\d{1,2})-(?P\d{1,2})" +time_expr = ( + r"(?P\d{1,2}):(?P\d{1,2})" + r"(?::(?P\d{1,2})(?:\.(?P\d{1,6})\d{0,6})?)?" + r"(?PZ|[+-]\d{2}(?::?\d{2})?)?$" +) + +date_re = re.compile(f"{date_expr}$") +datetime_re = re.compile(f"{date_expr}[T ]{time_expr}") + + +EPOCH = datetime(1970, 1, 1) +# if greater than this, the number is in ms, if less than or equal it's in seconds +# (in seconds this is 11th October 2603, in ms it's 20th August 1970) +MS_WATERSHED = int(2e10) +# slightly more than datetime.max in ns - (datetime.max - EPOCH).total_seconds() * 1e9 +MAX_NUMBER = int(3e20) + + +def _get_numeric(value: StrBytesIntFloat, native_expected_type: str) -> Union[None, int, float]: + if isinstance(value, (int, float)): + return value + try: + return float(value) + except ValueError: + return None + except TypeError: + raise TypeError(f"invalid type; expected {native_expected_type}, string, bytes, int or float") from None + + +def _from_unix_seconds(seconds: Union[int, float]) -> datetime: + if seconds > MAX_NUMBER: + return datetime.max + elif seconds < -MAX_NUMBER: + return datetime.min + + while abs(seconds) > MS_WATERSHED: + seconds /= 1000 + dt = EPOCH + timedelta(seconds=seconds) + return dt.replace(tzinfo=timezone.utc) + + +def _parse_timezone(value: Optional[str]) -> Union[None, int, timezone]: + if value == "Z": + return timezone.utc + elif value is not None: + offset_mins = int(value[-2:]) if len(value) > 3 else 0 + offset = 60 * int(value[1:3]) + offset_mins + if value[0] == "-": + offset = -offset + return timezone(timedelta(minutes=offset)) + else: + return None + + +def parse_datetime(value: Union[datetime, StrBytesIntFloat]) -> datetime: + """ + Parse a datetime/int/float/string and return a datetime.datetime. + + This function supports time zone offsets. When the input contains one, + the output uses a timezone with a fixed offset from UTC. + + Raise ValueError if the input is well formatted but not a valid datetime. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, datetime): + return value + + number = _get_numeric(value, "datetime") + if number is not None: + return _from_unix_seconds(number) + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + + match = datetime_re.match(value) + if match is None: + raise ValueError("invalid datetime format") + + kw = match.groupdict() + if kw["microsecond"]: + kw["microsecond"] = kw["microsecond"].ljust(6, "0") + + tzinfo = _parse_timezone(kw.pop("tzinfo")) + kw_: Dict[str, Union[None, int, timezone]] = {k: int(v) for k, v in kw.items() if v is not None} + kw_["tzinfo"] = tzinfo + + return datetime(**kw_) # type: ignore + + +def parse_date(value: Union[date, StrBytesIntFloat]) -> date: + """ + Parse a date/int/float/string and return a datetime.date. + + Raise ValueError if the input is well formatted but not a valid date. + Raise ValueError if the input isn't well formatted. + """ + if isinstance(value, date): + if isinstance(value, datetime): + return value.date() + else: + return value + + number = _get_numeric(value, "date") + if number is not None: + return _from_unix_seconds(number).date() + + if isinstance(value, bytes): + value = value.decode() + + assert not isinstance(value, (float, int)) + match = date_re.match(value) + if match is None: + raise ValueError("invalid date format") + + kw = {k: int(v) for k, v in match.groupdict().items()} + + try: + return date(**kw) + except ValueError: + raise ValueError("invalid date format") from None diff --git a/src/increase/_utils/_json.py b/src/increase/_utils/_json.py new file mode 100644 index 000000000..60584214a --- /dev/null +++ b/src/increase/_utils/_json.py @@ -0,0 +1,35 @@ +import json +from typing import Any +from datetime import datetime +from typing_extensions import override + +import pydantic + +from .._compat import model_dump + + +def openapi_dumps(obj: Any) -> bytes: + """ + Serialize an object to UTF-8 encoded JSON bytes. + + Extends the standard json.dumps with support for additional types + commonly used in the SDK, such as `datetime`, `pydantic.BaseModel`, etc. + """ + return json.dumps( + obj, + cls=_CustomEncoder, + # Uses the same defaults as httpx's JSON serialization + ensure_ascii=False, + separators=(",", ":"), + allow_nan=False, + ).encode() + + +class _CustomEncoder(json.JSONEncoder): + @override + def default(self, o: Any) -> Any: + if isinstance(o, datetime): + return o.isoformat() + if isinstance(o, pydantic.BaseModel): + return model_dump(o, exclude_unset=True, mode="json", by_alias=True) + return super().default(o) diff --git a/src/increase/_utils/_path.py b/src/increase/_utils/_path.py new file mode 100644 index 000000000..4d6e1e4cb --- /dev/null +++ b/src/increase/_utils/_path.py @@ -0,0 +1,127 @@ +from __future__ import annotations + +import re +from typing import ( + Any, + Mapping, + Callable, +) +from urllib.parse import quote + +# Matches '.' or '..' where each dot is either literal or percent-encoded (%2e / %2E). +_DOT_SEGMENT_RE = re.compile(r"^(?:\.|%2[eE]){1,2}$") + +_PLACEHOLDER_RE = re.compile(r"\{(\w+)\}") + + +def _quote_path_segment_part(value: str) -> str: + """Percent-encode `value` for use in a URI path segment. + + Considers characters not in `pchar` set from RFC 3986 §3.3 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.3 + """ + # quote() already treats unreserved characters (letters, digits, and -._~) + # as safe, so we only need to add sub-delims, ':', and '@'. + # Notably, unlike the default `safe` for quote(), / is unsafe and must be quoted. + return quote(value, safe="!$&'()*+,;=:@") + + +def _quote_query_part(value: str) -> str: + """Percent-encode `value` for use in a URI query string. + + Considers &, = and characters not in `query` set from RFC 3986 §3.4 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.4 + """ + return quote(value, safe="!$'()*+,;:@/?") + + +def _quote_fragment_part(value: str) -> str: + """Percent-encode `value` for use in a URI fragment. + + Considers characters not in `fragment` set from RFC 3986 §3.5 to be unsafe. + https://datatracker.ietf.org/doc/html/rfc3986#section-3.5 + """ + return quote(value, safe="!$&'()*+,;=:@/?") + + +def _interpolate( + template: str, + values: Mapping[str, Any], + quoter: Callable[[str], str], +) -> str: + """Replace {name} placeholders in `template`, quoting each value with `quoter`. + + Placeholder names are looked up in `values`. + + Raises: + KeyError: If a placeholder is not found in `values`. + """ + # re.split with a capturing group returns alternating + # [text, name, text, name, ..., text] elements. + parts = _PLACEHOLDER_RE.split(template) + + for i in range(1, len(parts), 2): + name = parts[i] + if name not in values: + raise KeyError(f"a value for placeholder {{{name}}} was not provided") + val = values[name] + if val is None: + parts[i] = "null" + elif isinstance(val, bool): + parts[i] = "true" if val else "false" + else: + parts[i] = quoter(str(values[name])) + + return "".join(parts) + + +def path_template(template: str, /, **kwargs: Any) -> str: + """Interpolate {name} placeholders in `template` from keyword arguments. + + Args: + template: The template string containing {name} placeholders. + **kwargs: Keyword arguments to interpolate into the template. + + Returns: + The template with placeholders interpolated and percent-encoded. + + Safe characters for percent-encoding are dependent on the URI component. + Placeholders in path and fragment portions are percent-encoded where the `segment` + and `fragment` sets from RFC 3986 respectively are considered safe. + Placeholders in the query portion are percent-encoded where the `query` set from + RFC 3986 §3.3 is considered safe except for = and & characters. + + Raises: + KeyError: If a placeholder is not found in `kwargs`. + ValueError: If resulting path contains /./ or /../ segments (including percent-encoded dot-segments). + """ + # Split the template into path, query, and fragment portions. + fragment_template: str | None = None + query_template: str | None = None + + rest = template + if "#" in rest: + rest, fragment_template = rest.split("#", 1) + if "?" in rest: + rest, query_template = rest.split("?", 1) + path_template = rest + + # Interpolate each portion with the appropriate quoting rules. + path_result = _interpolate(path_template, kwargs, _quote_path_segment_part) + + # Reject dot-segments (. and ..) in the final assembled path. The check + # runs after interpolation so that adjacent placeholders or a mix of static + # text and placeholders that together form a dot-segment are caught. + # Also reject percent-encoded dot-segments to protect against incorrectly + # implemented normalization in servers/proxies. + for segment in path_result.split("/"): + if _DOT_SEGMENT_RE.match(segment): + raise ValueError(f"Constructed path {path_result!r} contains dot-segment {segment!r} which is not allowed") + + result = path_result + if query_template is not None: + result += "?" + _interpolate(query_template, kwargs, _quote_query_part) + if fragment_template is not None: + result += "#" + _interpolate(fragment_template, kwargs, _quote_fragment_part) + + return result diff --git a/src/increase/_utils/_proxy.py b/src/increase/_utils/_proxy.py index b9c12dc3f..0f239a33c 100644 --- a/src/increase/_utils/_proxy.py +++ b/src/increase/_utils/_proxy.py @@ -10,7 +10,7 @@ class LazyProxy(Generic[T], ABC): """Implements data methods to pretend that an instance is another instance. - This includes forwarding attribute access and othe methods. + This includes forwarding attribute access and other methods. """ # Note: we have to special case proxies that themselves return proxies @@ -46,7 +46,10 @@ def __dir__(self) -> Iterable[str]: @property # type: ignore @override def __class__(self) -> type: # pyright: ignore - proxied = self.__get_proxied__() + try: + proxied = self.__get_proxied__() + except Exception: + return type(self) if issubclass(type(proxied), LazyProxy): return type(proxied) return proxied.__class__ @@ -59,5 +62,4 @@ def __as_proxied__(self) -> T: return cast(T, self) @abstractmethod - def __load__(self) -> T: - ... + def __load__(self) -> T: ... diff --git a/src/increase/_utils/_reflection.py b/src/increase/_utils/_reflection.py new file mode 100644 index 000000000..89aa712ac --- /dev/null +++ b/src/increase/_utils/_reflection.py @@ -0,0 +1,42 @@ +from __future__ import annotations + +import inspect +from typing import Any, Callable + + +def function_has_argument(func: Callable[..., Any], arg_name: str) -> bool: + """Returns whether or not the given function has a specific parameter""" + sig = inspect.signature(func) + return arg_name in sig.parameters + + +def assert_signatures_in_sync( + source_func: Callable[..., Any], + check_func: Callable[..., Any], + *, + exclude_params: set[str] = set(), +) -> None: + """Ensure that the signature of the second function matches the first.""" + + check_sig = inspect.signature(check_func) + source_sig = inspect.signature(source_func) + + errors: list[str] = [] + + for name, source_param in source_sig.parameters.items(): + if name in exclude_params: + continue + + custom_param = check_sig.parameters.get(name) + if not custom_param: + errors.append(f"the `{name}` param is missing") + continue + + if custom_param.annotation != source_param.annotation: + errors.append( + f"types for the `{name}` param are do not match; source={repr(source_param.annotation)} checking={repr(custom_param.annotation)}" + ) + continue + + if errors: + raise AssertionError(f"{len(errors)} errors encountered when comparing signatures:\n\n" + "\n\n".join(errors)) diff --git a/src/increase/_utils/_resources_proxy.py b/src/increase/_utils/_resources_proxy.py new file mode 100644 index 000000000..bec7a7b76 --- /dev/null +++ b/src/increase/_utils/_resources_proxy.py @@ -0,0 +1,24 @@ +from __future__ import annotations + +from typing import Any +from typing_extensions import override + +from ._proxy import LazyProxy + + +class ResourcesProxy(LazyProxy[Any]): + """A proxy for the `increase.resources` module. + + This is used so that we can lazily import `increase.resources` only when + needed *and* so that users can just import `increase` and reference `increase.resources` + """ + + @override + def __load__(self) -> Any: + import importlib + + mod = importlib.import_module("increase.resources") + return mod + + +resources = ResourcesProxy().__as_proxied__() diff --git a/src/increase/_utils/_sync.py b/src/increase/_utils/_sync.py index 595924e5b..f6027c183 100644 --- a/src/increase/_utils/_sync.py +++ b/src/increase/_utils/_sync.py @@ -1,54 +1,49 @@ from __future__ import annotations +import asyncio import functools from typing import TypeVar, Callable, Awaitable from typing_extensions import ParamSpec import anyio +import sniffio import anyio.to_thread T_Retval = TypeVar("T_Retval") T_ParamSpec = ParamSpec("T_ParamSpec") -# copied from `asyncer`, https://github.com/tiangolo/asyncer -def asyncify( - function: Callable[T_ParamSpec, T_Retval], - *, - cancellable: bool = False, - limiter: anyio.CapacityLimiter | None = None, -) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: +async def to_thread( + func: Callable[T_ParamSpec, T_Retval], /, *args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs +) -> T_Retval: + if sniffio.current_async_library() == "asyncio": + return await asyncio.to_thread(func, *args, **kwargs) + + return await anyio.to_thread.run_sync( + functools.partial(func, *args, **kwargs), + ) + + +# inspired by `asyncer`, https://github.com/tiangolo/asyncer +def asyncify(function: Callable[T_ParamSpec, T_Retval]) -> Callable[T_ParamSpec, Awaitable[T_Retval]]: """ Take a blocking function and create an async one that receives the same - positional and keyword arguments, and that when called, calls the original function - in a worker thread using `anyio.to_thread.run_sync()`. Internally, - `asyncer.asyncify()` uses the same `anyio.to_thread.run_sync()`, but it supports - keyword arguments additional to positional arguments and it adds better support for - autocompletion and inline errors for the arguments of the function called and the - return value. - - If the `cancellable` option is enabled and the task waiting for its completion is - cancelled, the thread will still run its course but its return value (or any raised - exception) will be ignored. + positional and keyword arguments. - Use it like this: + Usage: - ```Python - def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: - # Do work - return "Some result" + ```python + def blocking_func(arg1, arg2, kwarg1=None): + # blocking code + return result - result = await to_thread.asyncify(do_work)("spam", "ham", kwarg1="a", kwarg2="b") - print(result) + result = asyncify(blocking_function)(arg1, arg2, kwarg1=value1) ``` ## Arguments `function`: a blocking regular callable (e.g. a function) - `cancellable`: `True` to allow cancellation of the operation - `limiter`: capacity limiter to use to limit the total amount of threads running - (if omitted, the default limiter is used) ## Return @@ -58,7 +53,6 @@ def do_work(arg1, arg2, kwarg1="", kwarg2="") -> str: """ async def wrapper(*args: T_ParamSpec.args, **kwargs: T_ParamSpec.kwargs) -> T_Retval: - partial_f = functools.partial(function, *args, **kwargs) - return await anyio.to_thread.run_sync(partial_f, cancellable=cancellable, limiter=limiter) + return await to_thread(function, *args, **kwargs) return wrapper diff --git a/src/increase/_utils/_transform.py b/src/increase/_utils/_transform.py index 47e262a51..520754920 100644 --- a/src/increase/_utils/_transform.py +++ b/src/increase/_utils/_transform.py @@ -5,27 +5,31 @@ import pathlib from typing import Any, Mapping, TypeVar, cast from datetime import date, datetime -from typing_extensions import Literal, get_args, override, get_type_hints +from typing_extensions import Literal, get_args, override, get_type_hints as _get_type_hints import anyio import pydantic from ._utils import ( is_list, + is_given, + lru_cache, is_mapping, is_iterable, + is_sequence, ) from .._files import is_base64_file_input +from ._compat import get_origin, is_typeddict from ._typing import ( is_list_type, is_union_type, extract_type_arg, is_iterable_type, is_required_type, + is_sequence_type, is_annotated_type, strip_annotated_type, ) -from .._compat import model_dump, is_typeddict _T = TypeVar("_T") @@ -108,6 +112,7 @@ class Params(TypedDict, total=False): return cast(_T, transformed) +@lru_cache(maxsize=8096) def _get_annotated_type(type_: type) -> type | None: """If the given type is an `Annotated` type then it is returned, if not `None` is returned. @@ -126,7 +131,7 @@ def _get_annotated_type(type_: type) -> type | None: def _maybe_transform_key(key: str, type_: type) -> str: """Transform the given `data` based on the annotations provided in `type_`. - Note: this function only looks at `Annotated` types that contain `PropertInfo` metadata. + Note: this function only looks at `Annotated` types that contain `PropertyInfo` metadata. """ annotated_type = _get_annotated_type(type_) if annotated_type is None: @@ -142,6 +147,10 @@ def _maybe_transform_key(key: str, type_: type) -> str: return key +def _no_transform_needed(annotation: type) -> bool: + return annotation == float or annotation == int + + def _transform_recursive( data: object, *, @@ -160,20 +169,43 @@ def _transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return _transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -186,7 +218,7 @@ def _transform_recursive( return data if isinstance(data, pydantic.BaseModel): - return model_dump(data, exclude_unset=True) + return model_dump(data, exclude_unset=True, mode="json") annotated_type = _get_annotated_type(annotation) if annotated_type is None: @@ -235,6 +267,11 @@ def _transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include omitted values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -298,20 +335,43 @@ async def _async_transform_recursive( Defaults to the same value as the `annotation` argument. """ + from .._compat import model_dump + if inner_type is None: inner_type = annotation stripped_type = strip_annotated_type(inner_type) + origin = get_origin(stripped_type) or stripped_type if is_typeddict(stripped_type) and is_mapping(data): return await _async_transform_typeddict(data, stripped_type) + if origin == dict and is_mapping(data): + items_type = get_args(stripped_type)[1] + return {key: _transform_recursive(value, annotation=items_type) for key, value in data.items()} + if ( # List[T] (is_list_type(stripped_type) and is_list(data)) # Iterable[T] or (is_iterable_type(stripped_type) and is_iterable(data) and not isinstance(data, str)) + # Sequence[T] + or (is_sequence_type(stripped_type) and is_sequence(data) and not isinstance(data, str)) ): + # dicts are technically iterable, but it is an iterable on the keys of the dict and is not usually + # intended as an iterable, so we don't transform it. + if isinstance(data, dict): + return cast(object, data) + inner_type = extract_type_arg(stripped_type, 0) + if _no_transform_needed(inner_type): + # for some types there is no need to transform anything, so we can get a small + # perf boost from skipping that work. + # + # but we still need to convert to a list to ensure the data is json-serializable + if is_list(data): + return data + return list(data) + return [await _async_transform_recursive(d, annotation=annotation, inner_type=inner_type) for d in data] if is_union_type(stripped_type): @@ -324,7 +384,7 @@ async def _async_transform_recursive( return data if isinstance(data, pydantic.BaseModel): - return model_dump(data, exclude_unset=True) + return model_dump(data, exclude_unset=True, mode="json") annotated_type = _get_annotated_type(annotation) if annotated_type is None: @@ -373,6 +433,11 @@ async def _async_transform_typeddict( result: dict[str, object] = {} annotations = get_type_hints(expected_type, include_extras=True) for key, value in data.items(): + if not is_given(value): + # we don't need to include omitted values here as they'll + # be stripped out before the request is sent anyway + continue + type_ = annotations.get(key) if type_ is None: # we do not have a type annotation for this field, leave it as is @@ -380,3 +445,13 @@ async def _async_transform_typeddict( else: result[_maybe_transform_key(key, type_)] = await _async_transform_recursive(value, annotation=type_) return result + + +@lru_cache(maxsize=8096) +def get_type_hints( + obj: Any, + globalns: dict[str, Any] | None = None, + localns: Mapping[str, Any] | None = None, + include_extras: bool = False, +) -> dict[str, Any]: + return _get_type_hints(obj, globalns=globalns, localns=localns, include_extras=include_extras) diff --git a/src/increase/_utils/_typing.py b/src/increase/_utils/_typing.py index c036991f0..193109f3a 100644 --- a/src/increase/_utils/_typing.py +++ b/src/increase/_utils/_typing.py @@ -1,11 +1,21 @@ 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 ._utils import lru_cache from .._types import InheritsGeneric -from .._compat import is_union as _is_union +from ._compat import is_union as _is_union def is_annotated_type(typ: type) -> bool: @@ -16,6 +26,11 @@ def is_list_type(typ: type) -> bool: return (get_origin(typ) or typ) == list +def is_sequence_type(typ: type) -> bool: + origin = get_origin(typ) or typ + return origin == typing_extensions.Sequence or origin == typing.Sequence or origin == _c_abc.Sequence + + def is_iterable_type(typ: type) -> bool: """If the given type is `typing.Iterable[T]`""" origin = get_origin(typ) or typ @@ -36,7 +51,28 @@ 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, ...]] +@lru_cache(maxsize=8096) def strip_annotated_type(typ: type) -> type: if is_required_type(typ) or is_annotated_type(typ): return strip_annotated_type(cast(type, get_args(typ)[0])) @@ -79,7 +115,7 @@ class MyResponse(Foo[_T]): ``` """ cls = cast(object, get_origin(typ) or typ) - if cls in generic_bases: + if cls in generic_bases: # pyright: ignore[reportUnnecessaryContains] # we're given the class directly return extract_type_arg(typ, index) diff --git a/src/increase/_utils/_utils.py b/src/increase/_utils/_utils.py index 93c95517a..63b8cd602 100644 --- a/src/increase/_utils/_utils.py +++ b/src/increase/_utils/_utils.py @@ -16,12 +16,12 @@ overload, ) from pathlib import Path +from datetime import date, datetime from typing_extensions import TypeGuard import sniffio -from .._types import Headers, NotGiven, FileTypes, NotGivenOr, HeadersLike -from .._compat import parse_date as parse_date, parse_datetime as parse_datetime +from .._types import Omit, NotGiven, FileTypes, HeadersLike _T = TypeVar("_T") _TupleT = TypeVar("_TupleT", bound=Tuple[object, ...]) @@ -63,7 +63,7 @@ def _extract_items( try: key = path[index] except IndexError: - if isinstance(obj, NotGiven): + if not is_given(obj): # no value was provided - we can safely ignore return [] @@ -71,15 +71,24 @@ def _extract_items( from .._files import assert_is_file_content # We have exhausted the path, return the entry we found. - assert_is_file_content(obj, key=flattened_key) assert flattened_key is not None + + if is_list(obj): + files: list[tuple[str, FileTypes]] = [] + for entry in obj: + assert_is_file_content(entry, key=flattened_key + "[]" if flattened_key else "") + files.append((flattened_key + "[]", cast(FileTypes, entry))) + return files + + assert_is_file_content(obj, key=flattened_key) return [(flattened_key, cast(FileTypes, obj))] index += 1 if is_dict(obj): try: - # We are at the last entry in the path so we must remove the field - if (len(path)) == index: + # Remove the field if there are no more dict keys in the path, + # only "" traversal markers or end. + if all(p == "" for p in path[index:]): item = obj.pop(key) else: item = obj[key] @@ -118,14 +127,14 @@ def _extract_items( return [] -def is_given(obj: NotGivenOr[_T]) -> TypeGuard[_T]: - return not isinstance(obj, NotGiven) +def is_given(obj: _T | NotGiven | Omit) -> TypeGuard[_T]: + return not isinstance(obj, NotGiven) and not isinstance(obj, Omit) # Type safe methods for narrowing types with TypeVars. # The default narrowing for isinstance(obj, dict) is dict[unknown, unknown], # however this cause Pyright to rightfully report errors. As we know we don't -# care about the contained types we can safely use `object` in it's place. +# care about the contained types we can safely use `object` in its place. # # There are two separate functions defined, `is_*` and `is_*_t` for different use cases. # `is_*` is for when you're dealing with an unknown input @@ -211,20 +220,17 @@ def required_args(*variants: Sequence[str]) -> Callable[[CallableT], CallableT]: Example usage: ```py @overload - def foo(*, a: str) -> str: - ... + def foo(*, a: str) -> str: ... @overload - def foo(*, b: bool) -> str: - ... + def foo(*, b: bool) -> str: ... # This enforces the same constraints that a static type checker would # i.e. that either a or b must be passed to the function @required_args(["a"], ["b"]) - def foo(*, a: str | None = None, b: bool | None = None) -> str: - ... + def foo(*, a: str | None = None, b: bool | None = None) -> str: ... ``` """ @@ -265,6 +271,8 @@ def wrapper(*args: object, **kwargs: object) -> object: ) msg = f"Missing required arguments; Expected either {variations} arguments to be given" else: + assert len(variants) > 0 + # TODO: this error message is not deterministic missing = list(set(variants[0]) - given_params) if len(missing) > 1: @@ -284,18 +292,15 @@ def wrapper(*args: object, **kwargs: object) -> object: @overload -def strip_not_given(obj: None) -> None: - ... +def strip_not_given(obj: None) -> None: ... @overload -def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: - ... +def strip_not_given(obj: Mapping[_K, _V | NotGiven]) -> dict[_K, _V]: ... @overload -def strip_not_given(obj: object) -> object: - ... +def strip_not_given(obj: object) -> object: ... def strip_not_given(obj: object | None) -> object: @@ -367,13 +372,13 @@ def file_from_path(path: str) -> FileTypes: def get_required_header(headers: HeadersLike, header: str) -> str: lower_header = header.lower() - if isinstance(headers, Mapping): - headers = cast(Headers, headers) - for k, v in headers.items(): + if is_mapping_t(headers): + # mypy doesn't understand the type narrowing here + for k, v in headers.items(): # type: ignore if k.lower() == lower_header and isinstance(v, str): return v - """ to deal with the case where the header looks like Stainless-Event-Id """ + # to deal with the case where the header looks like Stainless-Event-Id intercaps_header = re.sub(r"([^\w])(\w)", lambda pat: pat.group(1) + pat.group(2).upper(), header.capitalize()) for normalized_header in [header, lower_header, header.upper(), intercaps_header]: @@ -389,3 +394,29 @@ def get_async_library() -> str: return sniffio.current_async_library() except Exception: return "false" + + +def lru_cache(*, maxsize: int | None = 128) -> Callable[[CallableT], CallableT]: + """A version of functools.lru_cache that retains the type signature + for the wrapped function arguments. + """ + wrapper = functools.lru_cache( # noqa: TID251 + maxsize=maxsize, + ) + return cast(Any, wrapper) # type: ignore[no-any-return] + + +def json_safe(data: object) -> object: + """Translates a mapping / sequence recursively in the same fashion + as `pydantic` v2's `model_dump(mode="json")`. + """ + if is_mapping(data): + return {json_safe(key): json_safe(value) for key, value in data.items()} + + if is_iterable(data) and not isinstance(data, (str, bytes, bytearray)): + return [json_safe(item) for item in data] + + if isinstance(data, (datetime, date)): + return data.isoformat() + + return data diff --git a/src/increase/_version.py b/src/increase/_version.py index 6c46a5847..a441cc9a6 100644 --- a/src/increase/_version.py +++ b/src/increase/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "increase" -__version__ = "0.46.0" # x-release-please-version +__version__ = "0.475.1" # x-release-please-version diff --git a/src/increase/resources/__init__.py b/src/increase/resources/__init__.py index 4636f935c..192bfb628 100644 --- a/src/increase/resources/__init__.py +++ b/src/increase/resources/__init__.py @@ -1,652 +1,831 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from .cards import ( - Cards, - AsyncCards, - CardsWithRawResponse, - AsyncCardsWithRawResponse, - CardsWithStreamingResponse, - AsyncCardsWithStreamingResponse, + CardsResource, + AsyncCardsResource, + CardsResourceWithRawResponse, + AsyncCardsResourceWithRawResponse, + CardsResourceWithStreamingResponse, + AsyncCardsResourceWithStreamingResponse, ) from .files import ( - Files, - AsyncFiles, - FilesWithRawResponse, - AsyncFilesWithRawResponse, - FilesWithStreamingResponse, - AsyncFilesWithStreamingResponse, + FilesResource, + AsyncFilesResource, + FilesResourceWithRawResponse, + AsyncFilesResourceWithRawResponse, + FilesResourceWithStreamingResponse, + AsyncFilesResourceWithStreamingResponse, ) from .events import ( - Events, - AsyncEvents, - EventsWithRawResponse, - AsyncEventsWithRawResponse, - EventsWithStreamingResponse, - AsyncEventsWithStreamingResponse, + EventsResource, + AsyncEventsResource, + EventsResourceWithRawResponse, + AsyncEventsResourceWithRawResponse, + EventsResourceWithStreamingResponse, + AsyncEventsResourceWithStreamingResponse, ) from .groups import ( - Groups, - AsyncGroups, - GroupsWithRawResponse, - AsyncGroupsWithRawResponse, - GroupsWithStreamingResponse, - AsyncGroupsWithStreamingResponse, + GroupsResource, + AsyncGroupsResource, + GroupsResourceWithRawResponse, + AsyncGroupsResourceWithRawResponse, + GroupsResourceWithStreamingResponse, + AsyncGroupsResourceWithStreamingResponse, ) from .exports import ( - Exports, - AsyncExports, - ExportsWithRawResponse, - AsyncExportsWithRawResponse, - ExportsWithStreamingResponse, - AsyncExportsWithStreamingResponse, -) -from .intrafi import ( - Intrafi, - AsyncIntrafi, - IntrafiWithRawResponse, - AsyncIntrafiWithRawResponse, - IntrafiWithStreamingResponse, - AsyncIntrafiWithStreamingResponse, + ExportsResource, + AsyncExportsResource, + ExportsResourceWithRawResponse, + AsyncExportsResourceWithRawResponse, + ExportsResourceWithStreamingResponse, + AsyncExportsResourceWithStreamingResponse, ) from .accounts import ( - Accounts, - AsyncAccounts, - AccountsWithRawResponse, - AsyncAccountsWithRawResponse, - AccountsWithStreamingResponse, - AsyncAccountsWithStreamingResponse, + AccountsResource, + AsyncAccountsResource, + AccountsResourceWithRawResponse, + AsyncAccountsResourceWithRawResponse, + AccountsResourceWithStreamingResponse, + AsyncAccountsResourceWithStreamingResponse, ) from .entities import ( - Entities, - AsyncEntities, - EntitiesWithRawResponse, - AsyncEntitiesWithRawResponse, - EntitiesWithStreamingResponse, - AsyncEntitiesWithStreamingResponse, + EntitiesResource, + AsyncEntitiesResource, + EntitiesResourceWithRawResponse, + AsyncEntitiesResourceWithRawResponse, + EntitiesResourceWithStreamingResponse, + AsyncEntitiesResourceWithStreamingResponse, ) from .programs import ( - Programs, - AsyncPrograms, - ProgramsWithRawResponse, - AsyncProgramsWithRawResponse, - ProgramsWithStreamingResponse, - AsyncProgramsWithStreamingResponse, -) -from .webhooks import Webhooks, AsyncWebhooks -from .documents import ( - Documents, - AsyncDocuments, - DocumentsWithRawResponse, - AsyncDocumentsWithRawResponse, - DocumentsWithStreamingResponse, - AsyncDocumentsWithStreamingResponse, + ProgramsResource, + AsyncProgramsResource, + ProgramsResourceWithRawResponse, + AsyncProgramsResourceWithRawResponse, + ProgramsResourceWithStreamingResponse, + AsyncProgramsResourceWithStreamingResponse, +) +from .lockboxes import ( + LockboxesResource, + AsyncLockboxesResource, + LockboxesResourceWithRawResponse, + AsyncLockboxesResourceWithRawResponse, + LockboxesResourceWithStreamingResponse, + AsyncLockboxesResourceWithStreamingResponse, +) +from .file_links import ( + FileLinksResource, + AsyncFileLinksResource, + FileLinksResourceWithRawResponse, + AsyncFileLinksResourceWithRawResponse, + FileLinksResourceWithStreamingResponse, + AsyncFileLinksResourceWithStreamingResponse, +) +from .card_tokens import ( + CardTokensResource, + AsyncCardTokensResource, + CardTokensResourceWithRawResponse, + AsyncCardTokensResourceWithRawResponse, + CardTokensResourceWithStreamingResponse, + AsyncCardTokensResourceWithStreamingResponse, ) from .simulations import ( - Simulations, - AsyncSimulations, - SimulationsWithRawResponse, - AsyncSimulationsWithRawResponse, - SimulationsWithStreamingResponse, - AsyncSimulationsWithStreamingResponse, + SimulationsResource, + AsyncSimulationsResource, + SimulationsResourceWithRawResponse, + AsyncSimulationsResourceWithRawResponse, + SimulationsResourceWithStreamingResponse, + AsyncSimulationsResourceWithStreamingResponse, ) from .oauth_tokens import ( - OAuthTokens, - AsyncOAuthTokens, - OAuthTokensWithRawResponse, - AsyncOAuthTokensWithRawResponse, - OAuthTokensWithStreamingResponse, - AsyncOAuthTokensWithStreamingResponse, + OAuthTokensResource, + AsyncOAuthTokensResource, + OAuthTokensResourceWithRawResponse, + AsyncOAuthTokensResourceWithRawResponse, + OAuthTokensResourceWithStreamingResponse, + AsyncOAuthTokensResourceWithStreamingResponse, ) from .transactions import ( - Transactions, - AsyncTransactions, - TransactionsWithRawResponse, - AsyncTransactionsWithRawResponse, - TransactionsWithStreamingResponse, - AsyncTransactionsWithStreamingResponse, + TransactionsResource, + AsyncTransactionsResource, + TransactionsResourceWithRawResponse, + AsyncTransactionsResourceWithRawResponse, + TransactionsResourceWithStreamingResponse, + AsyncTransactionsResourceWithStreamingResponse, ) from .ach_transfers import ( - ACHTransfers, - AsyncACHTransfers, - ACHTransfersWithRawResponse, - AsyncACHTransfersWithRawResponse, - ACHTransfersWithStreamingResponse, - AsyncACHTransfersWithStreamingResponse, + ACHTransfersResource, + AsyncACHTransfersResource, + ACHTransfersResourceWithRawResponse, + AsyncACHTransfersResourceWithRawResponse, + ACHTransfersResourceWithStreamingResponse, + AsyncACHTransfersResourceWithStreamingResponse, ) from .card_disputes import ( - CardDisputes, - AsyncCardDisputes, - CardDisputesWithRawResponse, - AsyncCardDisputesWithRawResponse, - CardDisputesWithStreamingResponse, - AsyncCardDisputesWithStreamingResponse, + CardDisputesResource, + AsyncCardDisputesResource, + CardDisputesResourceWithRawResponse, + AsyncCardDisputesResourceWithRawResponse, + CardDisputesResourceWithStreamingResponse, + AsyncCardDisputesResourceWithStreamingResponse, ) from .card_payments import ( - CardPayments, - AsyncCardPayments, - CardPaymentsWithRawResponse, - AsyncCardPaymentsWithRawResponse, - CardPaymentsWithStreamingResponse, - AsyncCardPaymentsWithStreamingResponse, + CardPaymentsResource, + AsyncCardPaymentsResource, + CardPaymentsResourceWithRawResponse, + AsyncCardPaymentsResourceWithRawResponse, + CardPaymentsResourceWithStreamingResponse, + AsyncCardPaymentsResourceWithStreamingResponse, ) from .check_deposits import ( - CheckDeposits, - AsyncCheckDeposits, - CheckDepositsWithRawResponse, - AsyncCheckDepositsWithRawResponse, - CheckDepositsWithStreamingResponse, - AsyncCheckDepositsWithStreamingResponse, + CheckDepositsResource, + AsyncCheckDepositsResource, + CheckDepositsResourceWithRawResponse, + AsyncCheckDepositsResourceWithRawResponse, + CheckDepositsResourceWithStreamingResponse, + AsyncCheckDepositsResourceWithStreamingResponse, ) from .physical_cards import ( - PhysicalCards, - AsyncPhysicalCards, - PhysicalCardsWithRawResponse, - AsyncPhysicalCardsWithRawResponse, - PhysicalCardsWithStreamingResponse, - AsyncPhysicalCardsWithStreamingResponse, + PhysicalCardsResource, + AsyncPhysicalCardsResource, + PhysicalCardsResourceWithRawResponse, + AsyncPhysicalCardsResourceWithRawResponse, + PhysicalCardsResourceWithStreamingResponse, + AsyncPhysicalCardsResourceWithStreamingResponse, ) from .wire_transfers import ( - WireTransfers, - AsyncWireTransfers, - WireTransfersWithRawResponse, - AsyncWireTransfersWithRawResponse, - WireTransfersWithStreamingResponse, - AsyncWireTransfersWithStreamingResponse, + WireTransfersResource, + AsyncWireTransfersResource, + WireTransfersResourceWithRawResponse, + AsyncWireTransfersResourceWithRawResponse, + WireTransfersResourceWithStreamingResponse, + AsyncWireTransfersResourceWithStreamingResponse, ) from .account_numbers import ( - AccountNumbers, - AsyncAccountNumbers, - AccountNumbersWithRawResponse, - AsyncAccountNumbersWithRawResponse, - AccountNumbersWithStreamingResponse, - AsyncAccountNumbersWithStreamingResponse, + AccountNumbersResource, + AsyncAccountNumbersResource, + AccountNumbersResourceWithRawResponse, + AsyncAccountNumbersResourceWithRawResponse, + AccountNumbersResourceWithStreamingResponse, + AsyncAccountNumbersResourceWithStreamingResponse, ) from .check_transfers import ( - CheckTransfers, - AsyncCheckTransfers, - CheckTransfersWithRawResponse, - AsyncCheckTransfersWithRawResponse, - CheckTransfersWithStreamingResponse, - AsyncCheckTransfersWithStreamingResponse, + CheckTransfersResource, + AsyncCheckTransfersResource, + CheckTransfersResourceWithRawResponse, + AsyncCheckTransfersResourceWithRawResponse, + CheckTransfersResourceWithStreamingResponse, + AsyncCheckTransfersResourceWithStreamingResponse, ) from .routing_numbers import ( - RoutingNumbers, - AsyncRoutingNumbers, - RoutingNumbersWithRawResponse, - AsyncRoutingNumbersWithRawResponse, - RoutingNumbersWithStreamingResponse, - AsyncRoutingNumbersWithStreamingResponse, + RoutingNumbersResource, + AsyncRoutingNumbersResource, + RoutingNumbersResourceWithRawResponse, + AsyncRoutingNumbersResourceWithRawResponse, + RoutingNumbersResourceWithStreamingResponse, + AsyncRoutingNumbersResourceWithStreamingResponse, +) +from .swift_transfers import ( + SwiftTransfersResource, + AsyncSwiftTransfersResource, + SwiftTransfersResourceWithRawResponse, + AsyncSwiftTransfersResourceWithRawResponse, + SwiftTransfersResourceWithStreamingResponse, + AsyncSwiftTransfersResourceWithStreamingResponse, +) +from .card_validations import ( + CardValidationsResource, + AsyncCardValidationsResource, + CardValidationsResourceWithRawResponse, + AsyncCardValidationsResourceWithRawResponse, + CardValidationsResourceWithStreamingResponse, + AsyncCardValidationsResourceWithStreamingResponse, +) +from .fednow_transfers import ( + FednowTransfersResource, + AsyncFednowTransfersResource, + FednowTransfersResourceWithRawResponse, + AsyncFednowTransfersResourceWithRawResponse, + FednowTransfersResourceWithStreamingResponse, + AsyncFednowTransfersResourceWithStreamingResponse, +) +from .intrafi_balances import ( + IntrafiBalancesResource, + AsyncIntrafiBalancesResource, + IntrafiBalancesResourceWithRawResponse, + AsyncIntrafiBalancesResourceWithRawResponse, + IntrafiBalancesResourceWithStreamingResponse, + AsyncIntrafiBalancesResourceWithStreamingResponse, ) from .account_transfers import ( - AccountTransfers, - AsyncAccountTransfers, - AccountTransfersWithRawResponse, - AsyncAccountTransfersWithRawResponse, - AccountTransfersWithStreamingResponse, - AsyncAccountTransfersWithStreamingResponse, + AccountTransfersResource, + AsyncAccountTransfersResource, + AccountTransfersResourceWithRawResponse, + AsyncAccountTransfersResourceWithRawResponse, + AccountTransfersResourceWithStreamingResponse, + AsyncAccountTransfersResourceWithStreamingResponse, +) +from .beneficial_owners import ( + BeneficialOwnersResource, + AsyncBeneficialOwnersResource, + BeneficialOwnersResourceWithRawResponse, + AsyncBeneficialOwnersResourceWithRawResponse, + BeneficialOwnersResourceWithStreamingResponse, + AsyncBeneficialOwnersResourceWithStreamingResponse, ) from .external_accounts import ( - ExternalAccounts, - AsyncExternalAccounts, - ExternalAccountsWithRawResponse, - AsyncExternalAccountsWithRawResponse, - ExternalAccountsWithStreamingResponse, - AsyncExternalAccountsWithStreamingResponse, + ExternalAccountsResource, + AsyncExternalAccountsResource, + ExternalAccountsResourceWithRawResponse, + AsyncExternalAccountsResourceWithRawResponse, + ExternalAccountsResourceWithStreamingResponse, + AsyncExternalAccountsResourceWithStreamingResponse, ) from .oauth_connections import ( - OAuthConnections, - AsyncOAuthConnections, - OAuthConnectionsWithRawResponse, - AsyncOAuthConnectionsWithRawResponse, - OAuthConnectionsWithStreamingResponse, - AsyncOAuthConnectionsWithStreamingResponse, + OAuthConnectionsResource, + AsyncOAuthConnectionsResource, + OAuthConnectionsResourceWithRawResponse, + AsyncOAuthConnectionsResourceWithRawResponse, + OAuthConnectionsResourceWithStreamingResponse, + AsyncOAuthConnectionsResourceWithStreamingResponse, ) from .account_statements import ( - AccountStatements, - AsyncAccountStatements, - AccountStatementsWithRawResponse, - AsyncAccountStatementsWithRawResponse, - AccountStatementsWithStreamingResponse, - AsyncAccountStatementsWithStreamingResponse, + AccountStatementsResource, + AsyncAccountStatementsResource, + AccountStatementsResourceWithRawResponse, + AsyncAccountStatementsResourceWithRawResponse, + AccountStatementsResourceWithStreamingResponse, + AsyncAccountStatementsResourceWithStreamingResponse, +) +from .inbound_mail_items import ( + InboundMailItemsResource, + AsyncInboundMailItemsResource, + InboundMailItemsResourceWithRawResponse, + AsyncInboundMailItemsResourceWithRawResponse, + InboundMailItemsResourceWithStreamingResponse, + AsyncInboundMailItemsResourceWithStreamingResponse, +) +from .intrafi_exclusions import ( + IntrafiExclusionsResource, + AsyncIntrafiExclusionsResource, + IntrafiExclusionsResourceWithRawResponse, + AsyncIntrafiExclusionsResourceWithRawResponse, + IntrafiExclusionsResourceWithStreamingResponse, + AsyncIntrafiExclusionsResourceWithStreamingResponse, +) +from .oauth_applications import ( + OAuthApplicationsResource, + AsyncOAuthApplicationsResource, + OAuthApplicationsResourceWithRawResponse, + AsyncOAuthApplicationsResourceWithRawResponse, + OAuthApplicationsResourceWithStreamingResponse, + AsyncOAuthApplicationsResourceWithStreamingResponse, ) from .bookkeeping_entries import ( - BookkeepingEntries, - AsyncBookkeepingEntries, - BookkeepingEntriesWithRawResponse, - AsyncBookkeepingEntriesWithRawResponse, - BookkeepingEntriesWithStreamingResponse, - AsyncBookkeepingEntriesWithStreamingResponse, + BookkeepingEntriesResource, + AsyncBookkeepingEntriesResource, + BookkeepingEntriesResourceWithRawResponse, + AsyncBookkeepingEntriesResourceWithRawResponse, + BookkeepingEntriesResourceWithStreamingResponse, + AsyncBookkeepingEntriesResourceWithStreamingResponse, +) +from .card_push_transfers import ( + CardPushTransfersResource, + AsyncCardPushTransfersResource, + CardPushTransfersResourceWithRawResponse, + AsyncCardPushTransfersResourceWithRawResponse, + CardPushTransfersResourceWithStreamingResponse, + AsyncCardPushTransfersResourceWithStreamingResponse, ) from .event_subscriptions import ( - EventSubscriptions, - AsyncEventSubscriptions, - EventSubscriptionsWithRawResponse, - AsyncEventSubscriptionsWithRawResponse, - EventSubscriptionsWithStreamingResponse, - AsyncEventSubscriptionsWithStreamingResponse, + EventSubscriptionsResource, + AsyncEventSubscriptionsResource, + EventSubscriptionsResourceWithRawResponse, + AsyncEventSubscriptionsResourceWithRawResponse, + EventSubscriptionsResourceWithStreamingResponse, + AsyncEventSubscriptionsResourceWithStreamingResponse, ) from .real_time_decisions import ( - RealTimeDecisions, - AsyncRealTimeDecisions, - RealTimeDecisionsWithRawResponse, - AsyncRealTimeDecisionsWithRawResponse, - RealTimeDecisionsWithStreamingResponse, - AsyncRealTimeDecisionsWithStreamingResponse, + RealTimeDecisionsResource, + AsyncRealTimeDecisionsResource, + RealTimeDecisionsResourceWithRawResponse, + AsyncRealTimeDecisionsResourceWithRawResponse, + RealTimeDecisionsResourceWithStreamingResponse, + AsyncRealTimeDecisionsResourceWithStreamingResponse, ) from .ach_prenotifications import ( - ACHPrenotifications, - AsyncACHPrenotifications, - ACHPrenotificationsWithRawResponse, - AsyncACHPrenotificationsWithRawResponse, - ACHPrenotificationsWithStreamingResponse, - AsyncACHPrenotificationsWithStreamingResponse, + ACHPrenotificationsResource, + AsyncACHPrenotificationsResource, + ACHPrenotificationsResourceWithRawResponse, + AsyncACHPrenotificationsResourceWithRawResponse, + ACHPrenotificationsResourceWithStreamingResponse, + AsyncACHPrenotificationsResourceWithStreamingResponse, ) from .bookkeeping_accounts import ( - BookkeepingAccounts, - AsyncBookkeepingAccounts, - BookkeepingAccountsWithRawResponse, - AsyncBookkeepingAccountsWithRawResponse, - BookkeepingAccountsWithStreamingResponse, - AsyncBookkeepingAccountsWithStreamingResponse, + BookkeepingAccountsResource, + AsyncBookkeepingAccountsResource, + BookkeepingAccountsResourceWithRawResponse, + AsyncBookkeepingAccountsResourceWithRawResponse, + BookkeepingAccountsResourceWithStreamingResponse, + AsyncBookkeepingAccountsResourceWithStreamingResponse, ) from .pending_transactions import ( - PendingTransactions, - AsyncPendingTransactions, - PendingTransactionsWithRawResponse, - AsyncPendingTransactionsWithRawResponse, - PendingTransactionsWithStreamingResponse, - AsyncPendingTransactionsWithStreamingResponse, + PendingTransactionsResource, + AsyncPendingTransactionsResource, + PendingTransactionsResourceWithRawResponse, + AsyncPendingTransactionsResourceWithRawResponse, + PendingTransactionsResourceWithStreamingResponse, + AsyncPendingTransactionsResourceWithStreamingResponse, ) from .declined_transactions import ( - DeclinedTransactions, - AsyncDeclinedTransactions, - DeclinedTransactionsWithRawResponse, - AsyncDeclinedTransactionsWithRawResponse, - DeclinedTransactionsWithStreamingResponse, - AsyncDeclinedTransactionsWithStreamingResponse, + DeclinedTransactionsResource, + AsyncDeclinedTransactionsResource, + DeclinedTransactionsResourceWithRawResponse, + AsyncDeclinedTransactionsResourceWithRawResponse, + DeclinedTransactionsResourceWithStreamingResponse, + AsyncDeclinedTransactionsResourceWithStreamingResponse, ) from .digital_card_profiles import ( - DigitalCardProfiles, - AsyncDigitalCardProfiles, - DigitalCardProfilesWithRawResponse, - AsyncDigitalCardProfilesWithRawResponse, - DigitalCardProfilesWithStreamingResponse, - AsyncDigitalCardProfilesWithStreamingResponse, + DigitalCardProfilesResource, + AsyncDigitalCardProfilesResource, + DigitalCardProfilesResourceWithRawResponse, + AsyncDigitalCardProfilesResourceWithRawResponse, + DigitalCardProfilesResourceWithStreamingResponse, + AsyncDigitalCardProfilesResourceWithStreamingResponse, ) from .digital_wallet_tokens import ( - DigitalWalletTokens, - AsyncDigitalWalletTokens, - DigitalWalletTokensWithRawResponse, - AsyncDigitalWalletTokensWithRawResponse, - DigitalWalletTokensWithStreamingResponse, - AsyncDigitalWalletTokensWithStreamingResponse, + DigitalWalletTokensResource, + AsyncDigitalWalletTokensResource, + DigitalWalletTokensResourceWithRawResponse, + AsyncDigitalWalletTokensResourceWithRawResponse, + DigitalWalletTokensResourceWithStreamingResponse, + AsyncDigitalWalletTokensResourceWithStreamingResponse, ) from .inbound_ach_transfers import ( - InboundACHTransfers, - AsyncInboundACHTransfers, - InboundACHTransfersWithRawResponse, - AsyncInboundACHTransfersWithRawResponse, - InboundACHTransfersWithStreamingResponse, - AsyncInboundACHTransfersWithStreamingResponse, + InboundACHTransfersResource, + AsyncInboundACHTransfersResource, + InboundACHTransfersResourceWithRawResponse, + AsyncInboundACHTransfersResourceWithRawResponse, + InboundACHTransfersResourceWithStreamingResponse, + AsyncInboundACHTransfersResourceWithStreamingResponse, ) from .bookkeeping_entry_sets import ( - BookkeepingEntrySets, - AsyncBookkeepingEntrySets, - BookkeepingEntrySetsWithRawResponse, - AsyncBookkeepingEntrySetsWithRawResponse, - BookkeepingEntrySetsWithStreamingResponse, - AsyncBookkeepingEntrySetsWithStreamingResponse, + BookkeepingEntrySetsResource, + AsyncBookkeepingEntrySetsResource, + BookkeepingEntrySetsResourceWithRawResponse, + AsyncBookkeepingEntrySetsResourceWithRawResponse, + BookkeepingEntrySetsResourceWithStreamingResponse, + AsyncBookkeepingEntrySetsResourceWithStreamingResponse, +) +from .inbound_check_deposits import ( + InboundCheckDepositsResource, + AsyncInboundCheckDepositsResource, + InboundCheckDepositsResourceWithRawResponse, + AsyncInboundCheckDepositsResourceWithRawResponse, + InboundCheckDepositsResourceWithStreamingResponse, + AsyncInboundCheckDepositsResourceWithStreamingResponse, ) from .inbound_wire_transfers import ( - InboundWireTransfers, - AsyncInboundWireTransfers, - InboundWireTransfersWithRawResponse, - AsyncInboundWireTransfersWithRawResponse, - InboundWireTransfersWithStreamingResponse, - AsyncInboundWireTransfersWithStreamingResponse, + InboundWireTransfersResource, + AsyncInboundWireTransfersResource, + InboundWireTransfersResourceWithRawResponse, + AsyncInboundWireTransfersResourceWithRawResponse, + InboundWireTransfersResourceWithStreamingResponse, + AsyncInboundWireTransfersResourceWithStreamingResponse, ) from .physical_card_profiles import ( - PhysicalCardProfiles, - AsyncPhysicalCardProfiles, - PhysicalCardProfilesWithRawResponse, - AsyncPhysicalCardProfilesWithRawResponse, - PhysicalCardProfilesWithStreamingResponse, - AsyncPhysicalCardProfilesWithStreamingResponse, + PhysicalCardProfilesResource, + AsyncPhysicalCardProfilesResource, + PhysicalCardProfilesResourceWithRawResponse, + AsyncPhysicalCardProfilesResourceWithRawResponse, + PhysicalCardProfilesResourceWithStreamingResponse, + AsyncPhysicalCardProfilesResourceWithStreamingResponse, +) +from .supplemental_documents import ( + SupplementalDocumentsResource, + AsyncSupplementalDocumentsResource, + SupplementalDocumentsResourceWithRawResponse, + AsyncSupplementalDocumentsResourceWithRawResponse, + SupplementalDocumentsResourceWithStreamingResponse, + AsyncSupplementalDocumentsResourceWithStreamingResponse, ) from .wire_drawdown_requests import ( - WireDrawdownRequests, - AsyncWireDrawdownRequests, - WireDrawdownRequestsWithRawResponse, - AsyncWireDrawdownRequestsWithRawResponse, - WireDrawdownRequestsWithStreamingResponse, - AsyncWireDrawdownRequestsWithStreamingResponse, + WireDrawdownRequestsResource, + AsyncWireDrawdownRequestsResource, + WireDrawdownRequestsResourceWithRawResponse, + AsyncWireDrawdownRequestsResourceWithRawResponse, + WireDrawdownRequestsResourceWithStreamingResponse, + AsyncWireDrawdownRequestsResourceWithStreamingResponse, +) +from .inbound_fednow_transfers import ( + InboundFednowTransfersResource, + AsyncInboundFednowTransfersResource, + InboundFednowTransfersResourceWithRawResponse, + AsyncInboundFednowTransfersResourceWithRawResponse, + InboundFednowTransfersResourceWithStreamingResponse, + AsyncInboundFednowTransfersResourceWithStreamingResponse, ) from .card_purchase_supplements import ( - CardPurchaseSupplements, - AsyncCardPurchaseSupplements, - CardPurchaseSupplementsWithRawResponse, - AsyncCardPurchaseSupplementsWithRawResponse, - CardPurchaseSupplementsWithStreamingResponse, - AsyncCardPurchaseSupplementsWithStreamingResponse, + CardPurchaseSupplementsResource, + AsyncCardPurchaseSupplementsResource, + CardPurchaseSupplementsResourceWithRawResponse, + AsyncCardPurchaseSupplementsResourceWithRawResponse, + CardPurchaseSupplementsResourceWithStreamingResponse, + AsyncCardPurchaseSupplementsResourceWithStreamingResponse, +) +from .entity_onboarding_sessions import ( + EntityOnboardingSessionsResource, + AsyncEntityOnboardingSessionsResource, + EntityOnboardingSessionsResourceWithRawResponse, + AsyncEntityOnboardingSessionsResourceWithRawResponse, + EntityOnboardingSessionsResourceWithStreamingResponse, + AsyncEntityOnboardingSessionsResourceWithStreamingResponse, +) +from .intrafi_account_enrollments import ( + IntrafiAccountEnrollmentsResource, + AsyncIntrafiAccountEnrollmentsResource, + IntrafiAccountEnrollmentsResourceWithRawResponse, + AsyncIntrafiAccountEnrollmentsResourceWithRawResponse, + IntrafiAccountEnrollmentsResourceWithStreamingResponse, + AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse, ) from .real_time_payments_transfers import ( - RealTimePaymentsTransfers, - AsyncRealTimePaymentsTransfers, - RealTimePaymentsTransfersWithRawResponse, - AsyncRealTimePaymentsTransfersWithRawResponse, - RealTimePaymentsTransfersWithStreamingResponse, - AsyncRealTimePaymentsTransfersWithStreamingResponse, + RealTimePaymentsTransfersResource, + AsyncRealTimePaymentsTransfersResource, + RealTimePaymentsTransfersResourceWithRawResponse, + AsyncRealTimePaymentsTransfersResourceWithRawResponse, + RealTimePaymentsTransfersResourceWithStreamingResponse, + AsyncRealTimePaymentsTransfersResourceWithStreamingResponse, ) from .inbound_wire_drawdown_requests import ( - InboundWireDrawdownRequests, - AsyncInboundWireDrawdownRequests, - InboundWireDrawdownRequestsWithRawResponse, - AsyncInboundWireDrawdownRequestsWithRawResponse, - InboundWireDrawdownRequestsWithStreamingResponse, - AsyncInboundWireDrawdownRequestsWithStreamingResponse, -) -from .proof_of_authorization_requests import ( - ProofOfAuthorizationRequests, - AsyncProofOfAuthorizationRequests, - ProofOfAuthorizationRequestsWithRawResponse, - AsyncProofOfAuthorizationRequestsWithRawResponse, - ProofOfAuthorizationRequestsWithStreamingResponse, - AsyncProofOfAuthorizationRequestsWithStreamingResponse, -) -from .real_time_payments_request_for_payments import ( - RealTimePaymentsRequestForPayments, - AsyncRealTimePaymentsRequestForPayments, - RealTimePaymentsRequestForPaymentsWithRawResponse, - AsyncRealTimePaymentsRequestForPaymentsWithRawResponse, - RealTimePaymentsRequestForPaymentsWithStreamingResponse, - AsyncRealTimePaymentsRequestForPaymentsWithStreamingResponse, -) -from .proof_of_authorization_request_submissions import ( - ProofOfAuthorizationRequestSubmissions, - AsyncProofOfAuthorizationRequestSubmissions, - ProofOfAuthorizationRequestSubmissionsWithRawResponse, - AsyncProofOfAuthorizationRequestSubmissionsWithRawResponse, - ProofOfAuthorizationRequestSubmissionsWithStreamingResponse, - AsyncProofOfAuthorizationRequestSubmissionsWithStreamingResponse, + InboundWireDrawdownRequestsResource, + AsyncInboundWireDrawdownRequestsResource, + InboundWireDrawdownRequestsResourceWithRawResponse, + AsyncInboundWireDrawdownRequestsResourceWithRawResponse, + InboundWireDrawdownRequestsResourceWithStreamingResponse, + AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse, +) +from .inbound_real_time_payments_transfers import ( + InboundRealTimePaymentsTransfersResource, + AsyncInboundRealTimePaymentsTransfersResource, + InboundRealTimePaymentsTransfersResourceWithRawResponse, + AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse, + InboundRealTimePaymentsTransfersResourceWithStreamingResponse, + AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse, ) __all__ = [ - "Accounts", - "AsyncAccounts", - "AccountsWithRawResponse", - "AsyncAccountsWithRawResponse", - "AccountsWithStreamingResponse", - "AsyncAccountsWithStreamingResponse", - "AccountNumbers", - "AsyncAccountNumbers", - "AccountNumbersWithRawResponse", - "AsyncAccountNumbersWithRawResponse", - "AccountNumbersWithStreamingResponse", - "AsyncAccountNumbersWithStreamingResponse", - "BookkeepingAccounts", - "AsyncBookkeepingAccounts", - "BookkeepingAccountsWithRawResponse", - "AsyncBookkeepingAccountsWithRawResponse", - "BookkeepingAccountsWithStreamingResponse", - "AsyncBookkeepingAccountsWithStreamingResponse", - "BookkeepingEntrySets", - "AsyncBookkeepingEntrySets", - "BookkeepingEntrySetsWithRawResponse", - "AsyncBookkeepingEntrySetsWithRawResponse", - "BookkeepingEntrySetsWithStreamingResponse", - "AsyncBookkeepingEntrySetsWithStreamingResponse", - "BookkeepingEntries", - "AsyncBookkeepingEntries", - "BookkeepingEntriesWithRawResponse", - "AsyncBookkeepingEntriesWithRawResponse", - "BookkeepingEntriesWithStreamingResponse", - "AsyncBookkeepingEntriesWithStreamingResponse", - "RealTimeDecisions", - "AsyncRealTimeDecisions", - "RealTimeDecisionsWithRawResponse", - "AsyncRealTimeDecisionsWithRawResponse", - "RealTimeDecisionsWithStreamingResponse", - "AsyncRealTimeDecisionsWithStreamingResponse", - "RealTimePaymentsTransfers", - "AsyncRealTimePaymentsTransfers", - "RealTimePaymentsTransfersWithRawResponse", - "AsyncRealTimePaymentsTransfersWithRawResponse", - "RealTimePaymentsTransfersWithStreamingResponse", - "AsyncRealTimePaymentsTransfersWithStreamingResponse", - "Cards", - "AsyncCards", - "CardsWithRawResponse", - "AsyncCardsWithRawResponse", - "CardsWithStreamingResponse", - "AsyncCardsWithStreamingResponse", - "CardDisputes", - "AsyncCardDisputes", - "CardDisputesWithRawResponse", - "AsyncCardDisputesWithRawResponse", - "CardDisputesWithStreamingResponse", - "AsyncCardDisputesWithStreamingResponse", - "CardPurchaseSupplements", - "AsyncCardPurchaseSupplements", - "CardPurchaseSupplementsWithRawResponse", - "AsyncCardPurchaseSupplementsWithRawResponse", - "CardPurchaseSupplementsWithStreamingResponse", - "AsyncCardPurchaseSupplementsWithStreamingResponse", - "ExternalAccounts", - "AsyncExternalAccounts", - "ExternalAccountsWithRawResponse", - "AsyncExternalAccountsWithRawResponse", - "ExternalAccountsWithStreamingResponse", - "AsyncExternalAccountsWithStreamingResponse", - "Exports", - "AsyncExports", - "ExportsWithRawResponse", - "AsyncExportsWithRawResponse", - "ExportsWithStreamingResponse", - "AsyncExportsWithStreamingResponse", - "DigitalWalletTokens", - "AsyncDigitalWalletTokens", - "DigitalWalletTokensWithRawResponse", - "AsyncDigitalWalletTokensWithRawResponse", - "DigitalWalletTokensWithStreamingResponse", - "AsyncDigitalWalletTokensWithStreamingResponse", - "Transactions", - "AsyncTransactions", - "TransactionsWithRawResponse", - "AsyncTransactionsWithRawResponse", - "TransactionsWithStreamingResponse", - "AsyncTransactionsWithStreamingResponse", - "PendingTransactions", - "AsyncPendingTransactions", - "PendingTransactionsWithRawResponse", - "AsyncPendingTransactionsWithRawResponse", - "PendingTransactionsWithStreamingResponse", - "AsyncPendingTransactionsWithStreamingResponse", - "Programs", - "AsyncPrograms", - "ProgramsWithRawResponse", - "AsyncProgramsWithRawResponse", - "ProgramsWithStreamingResponse", - "AsyncProgramsWithStreamingResponse", - "DeclinedTransactions", - "AsyncDeclinedTransactions", - "DeclinedTransactionsWithRawResponse", - "AsyncDeclinedTransactionsWithRawResponse", - "DeclinedTransactionsWithStreamingResponse", - "AsyncDeclinedTransactionsWithStreamingResponse", - "AccountTransfers", - "AsyncAccountTransfers", - "AccountTransfersWithRawResponse", - "AsyncAccountTransfersWithRawResponse", - "AccountTransfersWithStreamingResponse", - "AsyncAccountTransfersWithStreamingResponse", - "ACHTransfers", - "AsyncACHTransfers", - "ACHTransfersWithRawResponse", - "AsyncACHTransfersWithRawResponse", - "ACHTransfersWithStreamingResponse", - "AsyncACHTransfersWithStreamingResponse", - "ACHPrenotifications", - "AsyncACHPrenotifications", - "ACHPrenotificationsWithRawResponse", - "AsyncACHPrenotificationsWithRawResponse", - "ACHPrenotificationsWithStreamingResponse", - "AsyncACHPrenotificationsWithStreamingResponse", - "Documents", - "AsyncDocuments", - "DocumentsWithRawResponse", - "AsyncDocumentsWithRawResponse", - "DocumentsWithStreamingResponse", - "AsyncDocumentsWithStreamingResponse", - "WireTransfers", - "AsyncWireTransfers", - "WireTransfersWithRawResponse", - "AsyncWireTransfersWithRawResponse", - "WireTransfersWithStreamingResponse", - "AsyncWireTransfersWithStreamingResponse", - "CheckTransfers", - "AsyncCheckTransfers", - "CheckTransfersWithRawResponse", - "AsyncCheckTransfersWithRawResponse", - "CheckTransfersWithStreamingResponse", - "AsyncCheckTransfersWithStreamingResponse", - "Entities", - "AsyncEntities", - "EntitiesWithRawResponse", - "AsyncEntitiesWithRawResponse", - "EntitiesWithStreamingResponse", - "AsyncEntitiesWithStreamingResponse", - "InboundACHTransfers", - "AsyncInboundACHTransfers", - "InboundACHTransfersWithRawResponse", - "AsyncInboundACHTransfersWithRawResponse", - "InboundACHTransfersWithStreamingResponse", - "AsyncInboundACHTransfersWithStreamingResponse", - "InboundWireDrawdownRequests", - "AsyncInboundWireDrawdownRequests", - "InboundWireDrawdownRequestsWithRawResponse", - "AsyncInboundWireDrawdownRequestsWithRawResponse", - "InboundWireDrawdownRequestsWithStreamingResponse", - "AsyncInboundWireDrawdownRequestsWithStreamingResponse", - "WireDrawdownRequests", - "AsyncWireDrawdownRequests", - "WireDrawdownRequestsWithRawResponse", - "AsyncWireDrawdownRequestsWithRawResponse", - "WireDrawdownRequestsWithStreamingResponse", - "AsyncWireDrawdownRequestsWithStreamingResponse", - "Events", - "AsyncEvents", - "EventsWithRawResponse", - "AsyncEventsWithRawResponse", - "EventsWithStreamingResponse", - "AsyncEventsWithStreamingResponse", - "EventSubscriptions", - "AsyncEventSubscriptions", - "EventSubscriptionsWithRawResponse", - "AsyncEventSubscriptionsWithRawResponse", - "EventSubscriptionsWithStreamingResponse", - "AsyncEventSubscriptionsWithStreamingResponse", - "Files", - "AsyncFiles", - "FilesWithRawResponse", - "AsyncFilesWithRawResponse", - "FilesWithStreamingResponse", - "AsyncFilesWithStreamingResponse", - "Groups", - "AsyncGroups", - "GroupsWithRawResponse", - "AsyncGroupsWithRawResponse", - "GroupsWithStreamingResponse", - "AsyncGroupsWithStreamingResponse", - "OAuthConnections", - "AsyncOAuthConnections", - "OAuthConnectionsWithRawResponse", - "AsyncOAuthConnectionsWithRawResponse", - "OAuthConnectionsWithStreamingResponse", - "AsyncOAuthConnectionsWithStreamingResponse", - "CheckDeposits", - "AsyncCheckDeposits", - "CheckDepositsWithRawResponse", - "AsyncCheckDepositsWithRawResponse", - "CheckDepositsWithStreamingResponse", - "AsyncCheckDepositsWithStreamingResponse", - "RoutingNumbers", - "AsyncRoutingNumbers", - "RoutingNumbersWithRawResponse", - "AsyncRoutingNumbersWithRawResponse", - "RoutingNumbersWithStreamingResponse", - "AsyncRoutingNumbersWithStreamingResponse", - "AccountStatements", - "AsyncAccountStatements", - "AccountStatementsWithRawResponse", - "AsyncAccountStatementsWithRawResponse", - "AccountStatementsWithStreamingResponse", - "AsyncAccountStatementsWithStreamingResponse", - "Simulations", - "AsyncSimulations", - "SimulationsWithRawResponse", - "AsyncSimulationsWithRawResponse", - "SimulationsWithStreamingResponse", - "AsyncSimulationsWithStreamingResponse", - "PhysicalCards", - "AsyncPhysicalCards", - "PhysicalCardsWithRawResponse", - "AsyncPhysicalCardsWithRawResponse", - "PhysicalCardsWithStreamingResponse", - "AsyncPhysicalCardsWithStreamingResponse", - "CardPayments", - "AsyncCardPayments", - "CardPaymentsWithRawResponse", - "AsyncCardPaymentsWithRawResponse", - "CardPaymentsWithStreamingResponse", - "AsyncCardPaymentsWithStreamingResponse", - "ProofOfAuthorizationRequests", - "AsyncProofOfAuthorizationRequests", - "ProofOfAuthorizationRequestsWithRawResponse", - "AsyncProofOfAuthorizationRequestsWithRawResponse", - "ProofOfAuthorizationRequestsWithStreamingResponse", - "AsyncProofOfAuthorizationRequestsWithStreamingResponse", - "ProofOfAuthorizationRequestSubmissions", - "AsyncProofOfAuthorizationRequestSubmissions", - "ProofOfAuthorizationRequestSubmissionsWithRawResponse", - "AsyncProofOfAuthorizationRequestSubmissionsWithRawResponse", - "ProofOfAuthorizationRequestSubmissionsWithStreamingResponse", - "AsyncProofOfAuthorizationRequestSubmissionsWithStreamingResponse", - "Intrafi", - "AsyncIntrafi", - "IntrafiWithRawResponse", - "AsyncIntrafiWithRawResponse", - "IntrafiWithStreamingResponse", - "AsyncIntrafiWithStreamingResponse", - "RealTimePaymentsRequestForPayments", - "AsyncRealTimePaymentsRequestForPayments", - "RealTimePaymentsRequestForPaymentsWithRawResponse", - "AsyncRealTimePaymentsRequestForPaymentsWithRawResponse", - "RealTimePaymentsRequestForPaymentsWithStreamingResponse", - "AsyncRealTimePaymentsRequestForPaymentsWithStreamingResponse", - "Webhooks", - "AsyncWebhooks", - "OAuthTokens", - "AsyncOAuthTokens", - "OAuthTokensWithRawResponse", - "AsyncOAuthTokensWithRawResponse", - "OAuthTokensWithStreamingResponse", - "AsyncOAuthTokensWithStreamingResponse", - "InboundWireTransfers", - "AsyncInboundWireTransfers", - "InboundWireTransfersWithRawResponse", - "AsyncInboundWireTransfersWithRawResponse", - "InboundWireTransfersWithStreamingResponse", - "AsyncInboundWireTransfersWithStreamingResponse", - "DigitalCardProfiles", - "AsyncDigitalCardProfiles", - "DigitalCardProfilesWithRawResponse", - "AsyncDigitalCardProfilesWithRawResponse", - "DigitalCardProfilesWithStreamingResponse", - "AsyncDigitalCardProfilesWithStreamingResponse", - "PhysicalCardProfiles", - "AsyncPhysicalCardProfiles", - "PhysicalCardProfilesWithRawResponse", - "AsyncPhysicalCardProfilesWithRawResponse", - "PhysicalCardProfilesWithStreamingResponse", - "AsyncPhysicalCardProfilesWithStreamingResponse", + "AccountsResource", + "AsyncAccountsResource", + "AccountsResourceWithRawResponse", + "AsyncAccountsResourceWithRawResponse", + "AccountsResourceWithStreamingResponse", + "AsyncAccountsResourceWithStreamingResponse", + "AccountNumbersResource", + "AsyncAccountNumbersResource", + "AccountNumbersResourceWithRawResponse", + "AsyncAccountNumbersResourceWithRawResponse", + "AccountNumbersResourceWithStreamingResponse", + "AsyncAccountNumbersResourceWithStreamingResponse", + "AccountTransfersResource", + "AsyncAccountTransfersResource", + "AccountTransfersResourceWithRawResponse", + "AsyncAccountTransfersResourceWithRawResponse", + "AccountTransfersResourceWithStreamingResponse", + "AsyncAccountTransfersResourceWithStreamingResponse", + "CardsResource", + "AsyncCardsResource", + "CardsResourceWithRawResponse", + "AsyncCardsResourceWithRawResponse", + "CardsResourceWithStreamingResponse", + "AsyncCardsResourceWithStreamingResponse", + "CardPaymentsResource", + "AsyncCardPaymentsResource", + "CardPaymentsResourceWithRawResponse", + "AsyncCardPaymentsResourceWithRawResponse", + "CardPaymentsResourceWithStreamingResponse", + "AsyncCardPaymentsResourceWithStreamingResponse", + "CardPurchaseSupplementsResource", + "AsyncCardPurchaseSupplementsResource", + "CardPurchaseSupplementsResourceWithRawResponse", + "AsyncCardPurchaseSupplementsResourceWithRawResponse", + "CardPurchaseSupplementsResourceWithStreamingResponse", + "AsyncCardPurchaseSupplementsResourceWithStreamingResponse", + "CardDisputesResource", + "AsyncCardDisputesResource", + "CardDisputesResourceWithRawResponse", + "AsyncCardDisputesResourceWithRawResponse", + "CardDisputesResourceWithStreamingResponse", + "AsyncCardDisputesResourceWithStreamingResponse", + "PhysicalCardsResource", + "AsyncPhysicalCardsResource", + "PhysicalCardsResourceWithRawResponse", + "AsyncPhysicalCardsResourceWithRawResponse", + "PhysicalCardsResourceWithStreamingResponse", + "AsyncPhysicalCardsResourceWithStreamingResponse", + "DigitalCardProfilesResource", + "AsyncDigitalCardProfilesResource", + "DigitalCardProfilesResourceWithRawResponse", + "AsyncDigitalCardProfilesResourceWithRawResponse", + "DigitalCardProfilesResourceWithStreamingResponse", + "AsyncDigitalCardProfilesResourceWithStreamingResponse", + "PhysicalCardProfilesResource", + "AsyncPhysicalCardProfilesResource", + "PhysicalCardProfilesResourceWithRawResponse", + "AsyncPhysicalCardProfilesResourceWithRawResponse", + "PhysicalCardProfilesResourceWithStreamingResponse", + "AsyncPhysicalCardProfilesResourceWithStreamingResponse", + "DigitalWalletTokensResource", + "AsyncDigitalWalletTokensResource", + "DigitalWalletTokensResourceWithRawResponse", + "AsyncDigitalWalletTokensResourceWithRawResponse", + "DigitalWalletTokensResourceWithStreamingResponse", + "AsyncDigitalWalletTokensResourceWithStreamingResponse", + "TransactionsResource", + "AsyncTransactionsResource", + "TransactionsResourceWithRawResponse", + "AsyncTransactionsResourceWithRawResponse", + "TransactionsResourceWithStreamingResponse", + "AsyncTransactionsResourceWithStreamingResponse", + "PendingTransactionsResource", + "AsyncPendingTransactionsResource", + "PendingTransactionsResourceWithRawResponse", + "AsyncPendingTransactionsResourceWithRawResponse", + "PendingTransactionsResourceWithStreamingResponse", + "AsyncPendingTransactionsResourceWithStreamingResponse", + "DeclinedTransactionsResource", + "AsyncDeclinedTransactionsResource", + "DeclinedTransactionsResourceWithRawResponse", + "AsyncDeclinedTransactionsResourceWithRawResponse", + "DeclinedTransactionsResourceWithStreamingResponse", + "AsyncDeclinedTransactionsResourceWithStreamingResponse", + "ACHTransfersResource", + "AsyncACHTransfersResource", + "ACHTransfersResourceWithRawResponse", + "AsyncACHTransfersResourceWithRawResponse", + "ACHTransfersResourceWithStreamingResponse", + "AsyncACHTransfersResourceWithStreamingResponse", + "ACHPrenotificationsResource", + "AsyncACHPrenotificationsResource", + "ACHPrenotificationsResourceWithRawResponse", + "AsyncACHPrenotificationsResourceWithRawResponse", + "ACHPrenotificationsResourceWithStreamingResponse", + "AsyncACHPrenotificationsResourceWithStreamingResponse", + "InboundACHTransfersResource", + "AsyncInboundACHTransfersResource", + "InboundACHTransfersResourceWithRawResponse", + "AsyncInboundACHTransfersResourceWithRawResponse", + "InboundACHTransfersResourceWithStreamingResponse", + "AsyncInboundACHTransfersResourceWithStreamingResponse", + "WireTransfersResource", + "AsyncWireTransfersResource", + "WireTransfersResourceWithRawResponse", + "AsyncWireTransfersResourceWithRawResponse", + "WireTransfersResourceWithStreamingResponse", + "AsyncWireTransfersResourceWithStreamingResponse", + "InboundWireTransfersResource", + "AsyncInboundWireTransfersResource", + "InboundWireTransfersResourceWithRawResponse", + "AsyncInboundWireTransfersResourceWithRawResponse", + "InboundWireTransfersResourceWithStreamingResponse", + "AsyncInboundWireTransfersResourceWithStreamingResponse", + "WireDrawdownRequestsResource", + "AsyncWireDrawdownRequestsResource", + "WireDrawdownRequestsResourceWithRawResponse", + "AsyncWireDrawdownRequestsResourceWithRawResponse", + "WireDrawdownRequestsResourceWithStreamingResponse", + "AsyncWireDrawdownRequestsResourceWithStreamingResponse", + "InboundWireDrawdownRequestsResource", + "AsyncInboundWireDrawdownRequestsResource", + "InboundWireDrawdownRequestsResourceWithRawResponse", + "AsyncInboundWireDrawdownRequestsResourceWithRawResponse", + "InboundWireDrawdownRequestsResourceWithStreamingResponse", + "AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse", + "CheckTransfersResource", + "AsyncCheckTransfersResource", + "CheckTransfersResourceWithRawResponse", + "AsyncCheckTransfersResourceWithRawResponse", + "CheckTransfersResourceWithStreamingResponse", + "AsyncCheckTransfersResourceWithStreamingResponse", + "InboundCheckDepositsResource", + "AsyncInboundCheckDepositsResource", + "InboundCheckDepositsResourceWithRawResponse", + "AsyncInboundCheckDepositsResourceWithRawResponse", + "InboundCheckDepositsResourceWithStreamingResponse", + "AsyncInboundCheckDepositsResourceWithStreamingResponse", + "RealTimePaymentsTransfersResource", + "AsyncRealTimePaymentsTransfersResource", + "RealTimePaymentsTransfersResourceWithRawResponse", + "AsyncRealTimePaymentsTransfersResourceWithRawResponse", + "RealTimePaymentsTransfersResourceWithStreamingResponse", + "AsyncRealTimePaymentsTransfersResourceWithStreamingResponse", + "InboundRealTimePaymentsTransfersResource", + "AsyncInboundRealTimePaymentsTransfersResource", + "InboundRealTimePaymentsTransfersResourceWithRawResponse", + "AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse", + "InboundRealTimePaymentsTransfersResourceWithStreamingResponse", + "AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse", + "FednowTransfersResource", + "AsyncFednowTransfersResource", + "FednowTransfersResourceWithRawResponse", + "AsyncFednowTransfersResourceWithRawResponse", + "FednowTransfersResourceWithStreamingResponse", + "AsyncFednowTransfersResourceWithStreamingResponse", + "InboundFednowTransfersResource", + "AsyncInboundFednowTransfersResource", + "InboundFednowTransfersResourceWithRawResponse", + "AsyncInboundFednowTransfersResourceWithRawResponse", + "InboundFednowTransfersResourceWithStreamingResponse", + "AsyncInboundFednowTransfersResourceWithStreamingResponse", + "SwiftTransfersResource", + "AsyncSwiftTransfersResource", + "SwiftTransfersResourceWithRawResponse", + "AsyncSwiftTransfersResourceWithRawResponse", + "SwiftTransfersResourceWithStreamingResponse", + "AsyncSwiftTransfersResourceWithStreamingResponse", + "CheckDepositsResource", + "AsyncCheckDepositsResource", + "CheckDepositsResourceWithRawResponse", + "AsyncCheckDepositsResourceWithRawResponse", + "CheckDepositsResourceWithStreamingResponse", + "AsyncCheckDepositsResourceWithStreamingResponse", + "LockboxesResource", + "AsyncLockboxesResource", + "LockboxesResourceWithRawResponse", + "AsyncLockboxesResourceWithRawResponse", + "LockboxesResourceWithStreamingResponse", + "AsyncLockboxesResourceWithStreamingResponse", + "InboundMailItemsResource", + "AsyncInboundMailItemsResource", + "InboundMailItemsResourceWithRawResponse", + "AsyncInboundMailItemsResourceWithRawResponse", + "InboundMailItemsResourceWithStreamingResponse", + "AsyncInboundMailItemsResourceWithStreamingResponse", + "RoutingNumbersResource", + "AsyncRoutingNumbersResource", + "RoutingNumbersResourceWithRawResponse", + "AsyncRoutingNumbersResourceWithRawResponse", + "RoutingNumbersResourceWithStreamingResponse", + "AsyncRoutingNumbersResourceWithStreamingResponse", + "ExternalAccountsResource", + "AsyncExternalAccountsResource", + "ExternalAccountsResourceWithRawResponse", + "AsyncExternalAccountsResourceWithRawResponse", + "ExternalAccountsResourceWithStreamingResponse", + "AsyncExternalAccountsResourceWithStreamingResponse", + "EntitiesResource", + "AsyncEntitiesResource", + "EntitiesResourceWithRawResponse", + "AsyncEntitiesResourceWithRawResponse", + "EntitiesResourceWithStreamingResponse", + "AsyncEntitiesResourceWithStreamingResponse", + "BeneficialOwnersResource", + "AsyncBeneficialOwnersResource", + "BeneficialOwnersResourceWithRawResponse", + "AsyncBeneficialOwnersResourceWithRawResponse", + "BeneficialOwnersResourceWithStreamingResponse", + "AsyncBeneficialOwnersResourceWithStreamingResponse", + "SupplementalDocumentsResource", + "AsyncSupplementalDocumentsResource", + "SupplementalDocumentsResourceWithRawResponse", + "AsyncSupplementalDocumentsResourceWithRawResponse", + "SupplementalDocumentsResourceWithStreamingResponse", + "AsyncSupplementalDocumentsResourceWithStreamingResponse", + "EntityOnboardingSessionsResource", + "AsyncEntityOnboardingSessionsResource", + "EntityOnboardingSessionsResourceWithRawResponse", + "AsyncEntityOnboardingSessionsResourceWithRawResponse", + "EntityOnboardingSessionsResourceWithStreamingResponse", + "AsyncEntityOnboardingSessionsResourceWithStreamingResponse", + "ProgramsResource", + "AsyncProgramsResource", + "ProgramsResourceWithRawResponse", + "AsyncProgramsResourceWithRawResponse", + "ProgramsResourceWithStreamingResponse", + "AsyncProgramsResourceWithStreamingResponse", + "AccountStatementsResource", + "AsyncAccountStatementsResource", + "AccountStatementsResourceWithRawResponse", + "AsyncAccountStatementsResourceWithRawResponse", + "AccountStatementsResourceWithStreamingResponse", + "AsyncAccountStatementsResourceWithStreamingResponse", + "FilesResource", + "AsyncFilesResource", + "FilesResourceWithRawResponse", + "AsyncFilesResourceWithRawResponse", + "FilesResourceWithStreamingResponse", + "AsyncFilesResourceWithStreamingResponse", + "FileLinksResource", + "AsyncFileLinksResource", + "FileLinksResourceWithRawResponse", + "AsyncFileLinksResourceWithRawResponse", + "FileLinksResourceWithStreamingResponse", + "AsyncFileLinksResourceWithStreamingResponse", + "ExportsResource", + "AsyncExportsResource", + "ExportsResourceWithRawResponse", + "AsyncExportsResourceWithRawResponse", + "ExportsResourceWithStreamingResponse", + "AsyncExportsResourceWithStreamingResponse", + "EventsResource", + "AsyncEventsResource", + "EventsResourceWithRawResponse", + "AsyncEventsResourceWithRawResponse", + "EventsResourceWithStreamingResponse", + "AsyncEventsResourceWithStreamingResponse", + "EventSubscriptionsResource", + "AsyncEventSubscriptionsResource", + "EventSubscriptionsResourceWithRawResponse", + "AsyncEventSubscriptionsResourceWithRawResponse", + "EventSubscriptionsResourceWithStreamingResponse", + "AsyncEventSubscriptionsResourceWithStreamingResponse", + "RealTimeDecisionsResource", + "AsyncRealTimeDecisionsResource", + "RealTimeDecisionsResourceWithRawResponse", + "AsyncRealTimeDecisionsResourceWithRawResponse", + "RealTimeDecisionsResourceWithStreamingResponse", + "AsyncRealTimeDecisionsResourceWithStreamingResponse", + "BookkeepingAccountsResource", + "AsyncBookkeepingAccountsResource", + "BookkeepingAccountsResourceWithRawResponse", + "AsyncBookkeepingAccountsResourceWithRawResponse", + "BookkeepingAccountsResourceWithStreamingResponse", + "AsyncBookkeepingAccountsResourceWithStreamingResponse", + "BookkeepingEntrySetsResource", + "AsyncBookkeepingEntrySetsResource", + "BookkeepingEntrySetsResourceWithRawResponse", + "AsyncBookkeepingEntrySetsResourceWithRawResponse", + "BookkeepingEntrySetsResourceWithStreamingResponse", + "AsyncBookkeepingEntrySetsResourceWithStreamingResponse", + "BookkeepingEntriesResource", + "AsyncBookkeepingEntriesResource", + "BookkeepingEntriesResourceWithRawResponse", + "AsyncBookkeepingEntriesResourceWithRawResponse", + "BookkeepingEntriesResourceWithStreamingResponse", + "AsyncBookkeepingEntriesResourceWithStreamingResponse", + "GroupsResource", + "AsyncGroupsResource", + "GroupsResourceWithRawResponse", + "AsyncGroupsResourceWithRawResponse", + "GroupsResourceWithStreamingResponse", + "AsyncGroupsResourceWithStreamingResponse", + "OAuthApplicationsResource", + "AsyncOAuthApplicationsResource", + "OAuthApplicationsResourceWithRawResponse", + "AsyncOAuthApplicationsResourceWithRawResponse", + "OAuthApplicationsResourceWithStreamingResponse", + "AsyncOAuthApplicationsResourceWithStreamingResponse", + "OAuthConnectionsResource", + "AsyncOAuthConnectionsResource", + "OAuthConnectionsResourceWithRawResponse", + "AsyncOAuthConnectionsResourceWithRawResponse", + "OAuthConnectionsResourceWithStreamingResponse", + "AsyncOAuthConnectionsResourceWithStreamingResponse", + "OAuthTokensResource", + "AsyncOAuthTokensResource", + "OAuthTokensResourceWithRawResponse", + "AsyncOAuthTokensResourceWithRawResponse", + "OAuthTokensResourceWithStreamingResponse", + "AsyncOAuthTokensResourceWithStreamingResponse", + "IntrafiAccountEnrollmentsResource", + "AsyncIntrafiAccountEnrollmentsResource", + "IntrafiAccountEnrollmentsResourceWithRawResponse", + "AsyncIntrafiAccountEnrollmentsResourceWithRawResponse", + "IntrafiAccountEnrollmentsResourceWithStreamingResponse", + "AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse", + "IntrafiBalancesResource", + "AsyncIntrafiBalancesResource", + "IntrafiBalancesResourceWithRawResponse", + "AsyncIntrafiBalancesResourceWithRawResponse", + "IntrafiBalancesResourceWithStreamingResponse", + "AsyncIntrafiBalancesResourceWithStreamingResponse", + "IntrafiExclusionsResource", + "AsyncIntrafiExclusionsResource", + "IntrafiExclusionsResourceWithRawResponse", + "AsyncIntrafiExclusionsResourceWithRawResponse", + "IntrafiExclusionsResourceWithStreamingResponse", + "AsyncIntrafiExclusionsResourceWithStreamingResponse", + "CardTokensResource", + "AsyncCardTokensResource", + "CardTokensResourceWithRawResponse", + "AsyncCardTokensResourceWithRawResponse", + "CardTokensResourceWithStreamingResponse", + "AsyncCardTokensResourceWithStreamingResponse", + "CardPushTransfersResource", + "AsyncCardPushTransfersResource", + "CardPushTransfersResourceWithRawResponse", + "AsyncCardPushTransfersResourceWithRawResponse", + "CardPushTransfersResourceWithStreamingResponse", + "AsyncCardPushTransfersResourceWithStreamingResponse", + "CardValidationsResource", + "AsyncCardValidationsResource", + "CardValidationsResourceWithRawResponse", + "AsyncCardValidationsResourceWithRawResponse", + "CardValidationsResourceWithStreamingResponse", + "AsyncCardValidationsResourceWithStreamingResponse", + "SimulationsResource", + "AsyncSimulationsResource", + "SimulationsResourceWithRawResponse", + "AsyncSimulationsResourceWithRawResponse", + "SimulationsResourceWithStreamingResponse", + "AsyncSimulationsResourceWithStreamingResponse", ] diff --git a/src/increase/resources/account_numbers.py b/src/increase/resources/account_numbers.py index f41750fc9..73d8fb9db 100644 --- a/src/increase/resources/account_numbers.py +++ b/src/increase/resources/account_numbers.py @@ -6,52 +6,57 @@ import httpx -from .. import _legacy_response -from ..types import ( - AccountNumber, - account_number_list_params, - account_number_create_params, - account_number_update_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import account_number_list_params, account_number_create_params, account_number_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.account_number import AccountNumber -__all__ = ["AccountNumbers", "AsyncAccountNumbers"] +__all__ = ["AccountNumbersResource", "AsyncAccountNumbersResource"] -class AccountNumbers(SyncAPIResource): +class AccountNumbersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountNumbersWithRawResponse: - return AccountNumbersWithRawResponse(self) + def with_raw_response(self) -> AccountNumbersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AccountNumbersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountNumbersWithStreamingResponse: - return AccountNumbersWithStreamingResponse(self) + def with_streaming_response(self) -> AccountNumbersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AccountNumbersResourceWithStreamingResponse(self) def create( self, *, account_id: str, name: str, - inbound_ach: account_number_create_params.InboundACH | NotGiven = NOT_GIVEN, - inbound_checks: account_number_create_params.InboundChecks | NotGiven = NOT_GIVEN, + inbound_ach: account_number_create_params.InboundACH | Omit = omit, + inbound_checks: account_number_create_params.InboundChecks | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountNumber: """ @@ -107,7 +112,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountNumber: """ Retrieve an Account Number @@ -126,7 +131,7 @@ def retrieve( if not account_number_id: raise ValueError(f"Expected a non-empty value for `account_number_id` but received {account_number_id!r}") return self._get( - f"/account_numbers/{account_number_id}", + path_template("/account_numbers/{account_number_id}", account_number_id=account_number_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -137,16 +142,16 @@ def update( self, account_number_id: str, *, - inbound_ach: account_number_update_params.InboundACH | NotGiven = NOT_GIVEN, - inbound_checks: account_number_update_params.InboundChecks | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - status: Literal["active", "disabled", "canceled"] | NotGiven = NOT_GIVEN, + inbound_ach: account_number_update_params.InboundACH | Omit = omit, + inbound_checks: account_number_update_params.InboundChecks | Omit = omit, + name: str | Omit = omit, + status: Literal["active", "disabled", "canceled"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountNumber: """ @@ -181,7 +186,7 @@ def update( if not account_number_id: raise ValueError(f"Expected a non-empty value for `account_number_id` but received {account_number_id!r}") return self._patch( - f"/account_numbers/{account_number_id}", + path_template("/account_numbers/{account_number_id}", account_number_id=account_number_id), body=maybe_transform( { "inbound_ach": inbound_ach, @@ -204,19 +209,19 @@ def update( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - ach_debit_status: Literal["allowed", "blocked"] | NotGiven = NOT_GIVEN, - created_at: account_number_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["active", "disabled", "canceled"] | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + ach_debit_status: account_number_list_params.ACHDebitStatus | Omit = omit, + created_at: account_number_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: account_number_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[AccountNumber]: """ List Account Numbers @@ -224,11 +229,6 @@ def list( Args: account_id: Filter Account Numbers to those belonging to the specified Account. - ach_debit_status: The ACH Debit status to retrieve Account Numbers for. - - - `allowed` - ACH Debits are allowed. - - `blocked` - ACH Debits are blocked. - cursor: Return the page of entries after this one. idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for @@ -239,12 +239,6 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: The status to retrieve Account Numbers for. - - - `active` - The account number is active. - - `disabled` - The account number is temporarily disabled. - - `canceled` - The account number is permanently disabled. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -278,28 +272,39 @@ def list( ) -class AsyncAccountNumbers(AsyncAPIResource): +class AsyncAccountNumbersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountNumbersWithRawResponse: - return AsyncAccountNumbersWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountNumbersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountNumbersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountNumbersWithStreamingResponse: - return AsyncAccountNumbersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountNumbersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncAccountNumbersResourceWithStreamingResponse(self) async def create( self, *, account_id: str, name: str, - inbound_ach: account_number_create_params.InboundACH | NotGiven = NOT_GIVEN, - inbound_checks: account_number_create_params.InboundChecks | NotGiven = NOT_GIVEN, + inbound_ach: account_number_create_params.InboundACH | Omit = omit, + inbound_checks: account_number_create_params.InboundChecks | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountNumber: """ @@ -355,7 +360,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountNumber: """ Retrieve an Account Number @@ -374,7 +379,7 @@ async def retrieve( if not account_number_id: raise ValueError(f"Expected a non-empty value for `account_number_id` but received {account_number_id!r}") return await self._get( - f"/account_numbers/{account_number_id}", + path_template("/account_numbers/{account_number_id}", account_number_id=account_number_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,16 +390,16 @@ async def update( self, account_number_id: str, *, - inbound_ach: account_number_update_params.InboundACH | NotGiven = NOT_GIVEN, - inbound_checks: account_number_update_params.InboundChecks | NotGiven = NOT_GIVEN, - name: str | NotGiven = NOT_GIVEN, - status: Literal["active", "disabled", "canceled"] | NotGiven = NOT_GIVEN, + inbound_ach: account_number_update_params.InboundACH | Omit = omit, + inbound_checks: account_number_update_params.InboundChecks | Omit = omit, + name: str | Omit = omit, + status: Literal["active", "disabled", "canceled"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountNumber: """ @@ -429,7 +434,7 @@ async def update( if not account_number_id: raise ValueError(f"Expected a non-empty value for `account_number_id` but received {account_number_id!r}") return await self._patch( - f"/account_numbers/{account_number_id}", + path_template("/account_numbers/{account_number_id}", account_number_id=account_number_id), body=await async_maybe_transform( { "inbound_ach": inbound_ach, @@ -452,19 +457,19 @@ async def update( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - ach_debit_status: Literal["allowed", "blocked"] | NotGiven = NOT_GIVEN, - created_at: account_number_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["active", "disabled", "canceled"] | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + ach_debit_status: account_number_list_params.ACHDebitStatus | Omit = omit, + created_at: account_number_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: account_number_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AccountNumber, AsyncPage[AccountNumber]]: """ List Account Numbers @@ -472,11 +477,6 @@ def list( Args: account_id: Filter Account Numbers to those belonging to the specified Account. - ach_debit_status: The ACH Debit status to retrieve Account Numbers for. - - - `allowed` - ACH Debits are allowed. - - `blocked` - ACH Debits are blocked. - cursor: Return the page of entries after this one. idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for @@ -487,12 +487,6 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: The status to retrieve Account Numbers for. - - - `active` - The account number is active. - - `disabled` - The account number is temporarily disabled. - - `canceled` - The account number is permanently disabled. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -526,44 +520,44 @@ def list( ) -class AccountNumbersWithRawResponse: - def __init__(self, account_numbers: AccountNumbers) -> None: +class AccountNumbersResourceWithRawResponse: + def __init__(self, account_numbers: AccountNumbersResource) -> None: self._account_numbers = account_numbers - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( account_numbers.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( account_numbers.retrieve, ) - self.update = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( account_numbers.update, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( account_numbers.list, ) -class AsyncAccountNumbersWithRawResponse: - def __init__(self, account_numbers: AsyncAccountNumbers) -> None: +class AsyncAccountNumbersResourceWithRawResponse: + def __init__(self, account_numbers: AsyncAccountNumbersResource) -> None: self._account_numbers = account_numbers - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( account_numbers.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( account_numbers.retrieve, ) - self.update = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( account_numbers.update, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( account_numbers.list, ) -class AccountNumbersWithStreamingResponse: - def __init__(self, account_numbers: AccountNumbers) -> None: +class AccountNumbersResourceWithStreamingResponse: + def __init__(self, account_numbers: AccountNumbersResource) -> None: self._account_numbers = account_numbers self.create = to_streamed_response_wrapper( @@ -580,8 +574,8 @@ def __init__(self, account_numbers: AccountNumbers) -> None: ) -class AsyncAccountNumbersWithStreamingResponse: - def __init__(self, account_numbers: AsyncAccountNumbers) -> None: +class AsyncAccountNumbersResourceWithStreamingResponse: + def __init__(self, account_numbers: AsyncAccountNumbersResource) -> None: self._account_numbers = account_numbers self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/account_statements.py b/src/increase/resources/account_statements.py index 73ca0f415..5812d40f2 100644 --- a/src/increase/resources/account_statements.py +++ b/src/increase/resources/account_statements.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import AccountStatement, account_statement_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import account_statement_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.account_statement import AccountStatement -__all__ = ["AccountStatements", "AsyncAccountStatements"] +__all__ = ["AccountStatementsResource", "AsyncAccountStatementsResource"] -class AccountStatements(SyncAPIResource): +class AccountStatementsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountStatementsWithRawResponse: - return AccountStatementsWithRawResponse(self) + def with_raw_response(self) -> AccountStatementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AccountStatementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountStatementsWithStreamingResponse: - return AccountStatementsWithStreamingResponse(self) + def with_streaming_response(self) -> AccountStatementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AccountStatementsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountStatement: """ Retrieve an Account Statement @@ -59,7 +72,7 @@ def retrieve( f"Expected a non-empty value for `account_statement_id` but received {account_statement_id!r}" ) return self._get( - f"/account_statements/{account_statement_id}", + path_template("/account_statements/{account_statement_id}", account_statement_id=account_statement_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,16 +82,16 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - statement_period_start: account_statement_list_params.StatementPeriodStart | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + statement_period_start: account_statement_list_params.StatementPeriodStart | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[AccountStatement]: """ List Account Statements @@ -121,14 +134,25 @@ def list( ) -class AsyncAccountStatements(AsyncAPIResource): +class AsyncAccountStatementsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountStatementsWithRawResponse: - return AsyncAccountStatementsWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountStatementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountStatementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountStatementsWithStreamingResponse: - return AsyncAccountStatementsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountStatementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncAccountStatementsResourceWithStreamingResponse(self) async def retrieve( self, @@ -139,7 +163,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountStatement: """ Retrieve an Account Statement @@ -160,7 +184,7 @@ async def retrieve( f"Expected a non-empty value for `account_statement_id` but received {account_statement_id!r}" ) return await self._get( - f"/account_statements/{account_statement_id}", + path_template("/account_statements/{account_statement_id}", account_statement_id=account_statement_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,16 +194,16 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - statement_period_start: account_statement_list_params.StatementPeriodStart | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + statement_period_start: account_statement_list_params.StatementPeriodStart | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AccountStatement, AsyncPage[AccountStatement]]: """ List Account Statements @@ -222,32 +246,32 @@ def list( ) -class AccountStatementsWithRawResponse: - def __init__(self, account_statements: AccountStatements) -> None: +class AccountStatementsResourceWithRawResponse: + def __init__(self, account_statements: AccountStatementsResource) -> None: self._account_statements = account_statements - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( account_statements.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( account_statements.list, ) -class AsyncAccountStatementsWithRawResponse: - def __init__(self, account_statements: AsyncAccountStatements) -> None: +class AsyncAccountStatementsResourceWithRawResponse: + def __init__(self, account_statements: AsyncAccountStatementsResource) -> None: self._account_statements = account_statements - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( account_statements.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( account_statements.list, ) -class AccountStatementsWithStreamingResponse: - def __init__(self, account_statements: AccountStatements) -> None: +class AccountStatementsResourceWithStreamingResponse: + def __init__(self, account_statements: AccountStatementsResource) -> None: self._account_statements = account_statements self.retrieve = to_streamed_response_wrapper( @@ -258,8 +282,8 @@ def __init__(self, account_statements: AccountStatements) -> None: ) -class AsyncAccountStatementsWithStreamingResponse: - def __init__(self, account_statements: AsyncAccountStatements) -> None: +class AsyncAccountStatementsResourceWithStreamingResponse: + def __init__(self, account_statements: AsyncAccountStatementsResource) -> None: self._account_statements = account_statements self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/account_transfers.py b/src/increase/resources/account_transfers.py index 1669dbcdb..df0901fcf 100644 --- a/src/increase/resources/account_transfers.py +++ b/src/increase/resources/account_transfers.py @@ -4,33 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import AccountTransfer, account_transfer_list_params, account_transfer_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import account_transfer_list_params, account_transfer_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.account_transfer import AccountTransfer -__all__ = ["AccountTransfers", "AsyncAccountTransfers"] +__all__ = ["AccountTransfersResource", "AsyncAccountTransfersResource"] -class AccountTransfers(SyncAPIResource): +class AccountTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountTransfersWithRawResponse: - return AccountTransfersWithRawResponse(self) + def with_raw_response(self) -> AccountTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AccountTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountTransfersWithStreamingResponse: - return AccountTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AccountTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AccountTransfersResourceWithStreamingResponse(self) def create( self, @@ -39,29 +49,32 @@ def create( amount: int, description: str, destination_account_id: str, - require_approval: bool | NotGiven = NOT_GIVEN, + require_approval: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ Create an Account Transfer Args: - account_id: The identifier for the account that will send the transfer. + account_id: The identifier for the originating Account that will send the transfer. amount: The transfer amount in the minor unit of the account currency. For dollars, for example, this is cents. - description: The description you choose to give the transfer. + description: An internal-facing description for the transfer for display in the API and + dashboard. This will also show in the description of the created Transactions. - destination_account_id: The identifier for the account that will receive the transfer. + destination_account_id: The identifier for the destination Account that will receive the transfer. - require_approval: Whether the transfer requires explicit approval via the dashboard or API. + require_approval: Whether the transfer should require explicit approval via the dashboard or API. + For more information, see + [Transfer Approvals](/documentation/transfer-approvals). extra_headers: Send extra headers @@ -104,7 +117,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountTransfer: """ Retrieve an Account Transfer @@ -125,7 +138,7 @@ def retrieve( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return self._get( - f"/account_transfers/{account_transfer_id}", + path_template("/account_transfers/{account_transfer_id}", account_transfer_id=account_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -135,17 +148,17 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: account_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: account_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[AccountTransfer]: """ List Account Transfers @@ -202,11 +215,11 @@ def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ - Approve an Account Transfer + Approves an Account Transfer in status `pending_approval`. Args: account_transfer_id: The identifier of the Account Transfer to approve. @@ -226,7 +239,7 @@ def approve( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return self._post( - f"/account_transfers/{account_transfer_id}/approve", + path_template("/account_transfers/{account_transfer_id}/approve", account_transfer_id=account_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -246,11 +259,11 @@ def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ - Cancel an Account Transfer + Cancels an Account Transfer in status `pending_approval`. Args: account_transfer_id: The identifier of the pending Account Transfer to cancel. @@ -270,7 +283,7 @@ def cancel( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return self._post( - f"/account_transfers/{account_transfer_id}/cancel", + path_template("/account_transfers/{account_transfer_id}/cancel", account_transfer_id=account_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -282,14 +295,25 @@ def cancel( ) -class AsyncAccountTransfers(AsyncAPIResource): +class AsyncAccountTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountTransfersWithRawResponse: - return AsyncAccountTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountTransfersWithStreamingResponse: - return AsyncAccountTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncAccountTransfersResourceWithStreamingResponse(self) async def create( self, @@ -298,29 +322,32 @@ async def create( amount: int, description: str, destination_account_id: str, - require_approval: bool | NotGiven = NOT_GIVEN, + require_approval: bool | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ Create an Account Transfer Args: - account_id: The identifier for the account that will send the transfer. + account_id: The identifier for the originating Account that will send the transfer. amount: The transfer amount in the minor unit of the account currency. For dollars, for example, this is cents. - description: The description you choose to give the transfer. + description: An internal-facing description for the transfer for display in the API and + dashboard. This will also show in the description of the created Transactions. - destination_account_id: The identifier for the account that will receive the transfer. + destination_account_id: The identifier for the destination Account that will receive the transfer. - require_approval: Whether the transfer requires explicit approval via the dashboard or API. + require_approval: Whether the transfer should require explicit approval via the dashboard or API. + For more information, see + [Transfer Approvals](/documentation/transfer-approvals). extra_headers: Send extra headers @@ -363,7 +390,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AccountTransfer: """ Retrieve an Account Transfer @@ -384,7 +411,7 @@ async def retrieve( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return await self._get( - f"/account_transfers/{account_transfer_id}", + path_template("/account_transfers/{account_transfer_id}", account_transfer_id=account_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -394,17 +421,17 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: account_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: account_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[AccountTransfer, AsyncPage[AccountTransfer]]: """ List Account Transfers @@ -461,11 +488,11 @@ async def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ - Approve an Account Transfer + Approves an Account Transfer in status `pending_approval`. Args: account_transfer_id: The identifier of the Account Transfer to approve. @@ -485,7 +512,7 @@ async def approve( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return await self._post( - f"/account_transfers/{account_transfer_id}/approve", + path_template("/account_transfers/{account_transfer_id}/approve", account_transfer_id=account_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -505,11 +532,11 @@ async def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ - Cancel an Account Transfer + Cancels an Account Transfer in status `pending_approval`. Args: account_transfer_id: The identifier of the pending Account Transfer to cancel. @@ -529,7 +556,7 @@ async def cancel( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return await self._post( - f"/account_transfers/{account_transfer_id}/cancel", + path_template("/account_transfers/{account_transfer_id}/cancel", account_transfer_id=account_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -541,50 +568,50 @@ async def cancel( ) -class AccountTransfersWithRawResponse: - def __init__(self, account_transfers: AccountTransfers) -> None: +class AccountTransfersResourceWithRawResponse: + def __init__(self, account_transfers: AccountTransfersResource) -> None: self._account_transfers = account_transfers - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( account_transfers.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( account_transfers.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( account_transfers.list, ) - self.approve = _legacy_response.to_raw_response_wrapper( + self.approve = to_raw_response_wrapper( account_transfers.approve, ) - self.cancel = _legacy_response.to_raw_response_wrapper( + self.cancel = to_raw_response_wrapper( account_transfers.cancel, ) -class AsyncAccountTransfersWithRawResponse: - def __init__(self, account_transfers: AsyncAccountTransfers) -> None: +class AsyncAccountTransfersResourceWithRawResponse: + def __init__(self, account_transfers: AsyncAccountTransfersResource) -> None: self._account_transfers = account_transfers - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( account_transfers.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( account_transfers.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( account_transfers.list, ) - self.approve = _legacy_response.async_to_raw_response_wrapper( + self.approve = async_to_raw_response_wrapper( account_transfers.approve, ) - self.cancel = _legacy_response.async_to_raw_response_wrapper( + self.cancel = async_to_raw_response_wrapper( account_transfers.cancel, ) -class AccountTransfersWithStreamingResponse: - def __init__(self, account_transfers: AccountTransfers) -> None: +class AccountTransfersResourceWithStreamingResponse: + def __init__(self, account_transfers: AccountTransfersResource) -> None: self._account_transfers = account_transfers self.create = to_streamed_response_wrapper( @@ -604,8 +631,8 @@ def __init__(self, account_transfers: AccountTransfers) -> None: ) -class AsyncAccountTransfersWithStreamingResponse: - def __init__(self, account_transfers: AsyncAccountTransfers) -> None: +class AsyncAccountTransfersResourceWithStreamingResponse: + def __init__(self, account_transfers: AsyncAccountTransfersResource) -> None: self._account_transfers = account_transfers self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/accounts.py b/src/increase/resources/accounts.py index 37b68a129..8d72838a7 100644 --- a/src/increase/resources/accounts.py +++ b/src/increase/resources/accounts.py @@ -8,54 +8,60 @@ import httpx -from .. import _legacy_response -from ..types import ( - Account, - BalanceLookup, - account_list_params, - account_create_params, - account_update_params, - account_balance_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import account_list_params, account_create_params, account_update_params, account_balance_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.account import Account +from ..types.balance_lookup import BalanceLookup -__all__ = ["Accounts", "AsyncAccounts"] +__all__ = ["AccountsResource", "AsyncAccountsResource"] -class Accounts(SyncAPIResource): +class AccountsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountsWithRawResponse: - return AccountsWithRawResponse(self) + def with_raw_response(self) -> AccountsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountsWithStreamingResponse: - return AccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AccountsResourceWithStreamingResponse(self) def create( self, *, name: str, - entity_id: str | NotGiven = NOT_GIVEN, - informational_entity_id: str | NotGiven = NOT_GIVEN, - program_id: str | NotGiven = NOT_GIVEN, + entity_id: str | Omit = omit, + funding: Literal["loan", "deposits"] | Omit = omit, + informational_entity_id: str | Omit = omit, + loan: account_create_params.Loan | Omit = omit, + program_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Account: """ @@ -66,8 +72,16 @@ def create( entity_id: The identifier for the Entity that will own the Account. + funding: Whether the Account is funded by a loan or by deposits. + + - `loan` - An account funded by a loan. Before opening a loan account, contact + support@increase.com to set up a loan program. + - `deposits` - An account funded by deposits. + informational_entity_id: The identifier of an Entity that, while not owning the Account, is associated - with its activity. Its relationship to your group must be `informational`. + with its activity. This is generally the beneficiary of the funds. + + loan: The loan details for the account. program_id: The identifier for the Program that this Account falls under. Required if you operate more than one Program. @@ -88,7 +102,9 @@ def create( { "name": name, "entity_id": entity_id, + "funding": funding, "informational_entity_id": informational_entity_id, + "loan": loan, "program_id": program_id, }, account_create_params.AccountCreateParams, @@ -112,7 +128,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Account: """ Retrieve an Account @@ -131,7 +147,7 @@ def retrieve( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/accounts/{account_id}", + path_template("/accounts/{account_id}", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -142,13 +158,14 @@ def update( self, account_id: str, *, - name: str | NotGiven = NOT_GIVEN, + loan: account_update_params.Loan | Omit = omit, + name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Account: """ @@ -157,6 +174,8 @@ def update( Args: account_id: The identifier of the Account to update. + loan: The loan details for the account. + name: The new name of the Account. extra_headers: Send extra headers @@ -172,8 +191,14 @@ def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._patch( - f"/accounts/{account_id}", - body=maybe_transform({"name": name}, account_update_params.AccountUpdateParams), + path_template("/accounts/{account_id}", account_id=account_id), + body=maybe_transform( + { + "loan": loan, + "name": name, + }, + account_update_params.AccountUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -187,19 +212,20 @@ def update( def list( self, *, - created_at: account_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - informational_entity_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["open", "closed"] | NotGiven = NOT_GIVEN, + created_at: account_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + entity_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + informational_entity_id: str | Omit = omit, + limit: int | Omit = omit, + program_id: str | Omit = omit, + status: account_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Account]: """ List Accounts @@ -219,10 +245,7 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: Filter Accounts for those with the specified status. - - - `open` - Open Accounts that are ready to use. - - `closed` - Closed Accounts on which no new activity can occur. + program_id: Filter Accounts for those in a specific Program. extra_headers: Send extra headers @@ -248,6 +271,7 @@ def list( "idempotency_key": idempotency_key, "informational_entity_id": informational_entity_id, "limit": limit, + "program_id": program_id, "status": status, }, account_list_params.AccountListParams, @@ -260,16 +284,17 @@ def balance( self, account_id: str, *, - at_time: Union[str, datetime] | NotGiven = NOT_GIVEN, + at_time: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BalanceLookup: """ - Retrieve an Account Balance + Retrieve the current and available balances for an account in minor units of the + account's currency. Learn more about [account balances](/documentation/balance). Args: account_id: The identifier of the Account to retrieve. @@ -287,7 +312,7 @@ def balance( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._get( - f"/accounts/{account_id}/balance", + path_template("/accounts/{account_id}/balance", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -307,7 +332,7 @@ def close( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Account: """Close an Account @@ -330,7 +355,7 @@ def close( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return self._post( - f"/accounts/{account_id}/close", + path_template("/accounts/{account_id}/close", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -342,28 +367,41 @@ def close( ) -class AsyncAccounts(AsyncAPIResource): +class AsyncAccountsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountsWithRawResponse: - return AsyncAccountsWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountsWithStreamingResponse: - return AsyncAccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncAccountsResourceWithStreamingResponse(self) async def create( self, *, name: str, - entity_id: str | NotGiven = NOT_GIVEN, - informational_entity_id: str | NotGiven = NOT_GIVEN, - program_id: str | NotGiven = NOT_GIVEN, + entity_id: str | Omit = omit, + funding: Literal["loan", "deposits"] | Omit = omit, + informational_entity_id: str | Omit = omit, + loan: account_create_params.Loan | Omit = omit, + program_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Account: """ @@ -374,8 +412,16 @@ async def create( entity_id: The identifier for the Entity that will own the Account. + funding: Whether the Account is funded by a loan or by deposits. + + - `loan` - An account funded by a loan. Before opening a loan account, contact + support@increase.com to set up a loan program. + - `deposits` - An account funded by deposits. + informational_entity_id: The identifier of an Entity that, while not owning the Account, is associated - with its activity. Its relationship to your group must be `informational`. + with its activity. This is generally the beneficiary of the funds. + + loan: The loan details for the account. program_id: The identifier for the Program that this Account falls under. Required if you operate more than one Program. @@ -396,7 +442,9 @@ async def create( { "name": name, "entity_id": entity_id, + "funding": funding, "informational_entity_id": informational_entity_id, + "loan": loan, "program_id": program_id, }, account_create_params.AccountCreateParams, @@ -420,7 +468,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Account: """ Retrieve an Account @@ -439,7 +487,7 @@ async def retrieve( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/accounts/{account_id}", + path_template("/accounts/{account_id}", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -450,13 +498,14 @@ async def update( self, account_id: str, *, - name: str | NotGiven = NOT_GIVEN, + loan: account_update_params.Loan | Omit = omit, + name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Account: """ @@ -465,6 +514,8 @@ async def update( Args: account_id: The identifier of the Account to update. + loan: The loan details for the account. + name: The new name of the Account. extra_headers: Send extra headers @@ -480,8 +531,14 @@ async def update( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._patch( - f"/accounts/{account_id}", - body=await async_maybe_transform({"name": name}, account_update_params.AccountUpdateParams), + path_template("/accounts/{account_id}", account_id=account_id), + body=await async_maybe_transform( + { + "loan": loan, + "name": name, + }, + account_update_params.AccountUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -495,19 +552,20 @@ async def update( def list( self, *, - created_at: account_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - informational_entity_id: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["open", "closed"] | NotGiven = NOT_GIVEN, + created_at: account_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + entity_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + informational_entity_id: str | Omit = omit, + limit: int | Omit = omit, + program_id: str | Omit = omit, + status: account_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Account, AsyncPage[Account]]: """ List Accounts @@ -527,10 +585,7 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: Filter Accounts for those with the specified status. - - - `open` - Open Accounts that are ready to use. - - `closed` - Closed Accounts on which no new activity can occur. + program_id: Filter Accounts for those in a specific Program. extra_headers: Send extra headers @@ -556,6 +611,7 @@ def list( "idempotency_key": idempotency_key, "informational_entity_id": informational_entity_id, "limit": limit, + "program_id": program_id, "status": status, }, account_list_params.AccountListParams, @@ -568,16 +624,17 @@ async def balance( self, account_id: str, *, - at_time: Union[str, datetime] | NotGiven = NOT_GIVEN, + at_time: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BalanceLookup: """ - Retrieve an Account Balance + Retrieve the current and available balances for an account in minor units of the + account's currency. Learn more about [account balances](/documentation/balance). Args: account_id: The identifier of the Account to retrieve. @@ -595,7 +652,7 @@ async def balance( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._get( - f"/accounts/{account_id}/balance", + path_template("/accounts/{account_id}/balance", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -615,7 +672,7 @@ async def close( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Account: """Close an Account @@ -638,7 +695,7 @@ async def close( if not account_id: raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") return await self._post( - f"/accounts/{account_id}/close", + path_template("/accounts/{account_id}/close", account_id=account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -650,56 +707,56 @@ async def close( ) -class AccountsWithRawResponse: - def __init__(self, accounts: Accounts) -> None: +class AccountsResourceWithRawResponse: + def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( accounts.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( accounts.retrieve, ) - self.update = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( accounts.update, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( accounts.list, ) - self.balance = _legacy_response.to_raw_response_wrapper( + self.balance = to_raw_response_wrapper( accounts.balance, ) - self.close = _legacy_response.to_raw_response_wrapper( + self.close = to_raw_response_wrapper( accounts.close, ) -class AsyncAccountsWithRawResponse: - def __init__(self, accounts: AsyncAccounts) -> None: +class AsyncAccountsResourceWithRawResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( accounts.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( accounts.retrieve, ) - self.update = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( accounts.update, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( accounts.list, ) - self.balance = _legacy_response.async_to_raw_response_wrapper( + self.balance = async_to_raw_response_wrapper( accounts.balance, ) - self.close = _legacy_response.async_to_raw_response_wrapper( + self.close = async_to_raw_response_wrapper( accounts.close, ) -class AccountsWithStreamingResponse: - def __init__(self, accounts: Accounts) -> None: +class AccountsResourceWithStreamingResponse: + def __init__(self, accounts: AccountsResource) -> None: self._accounts = accounts self.create = to_streamed_response_wrapper( @@ -722,8 +779,8 @@ def __init__(self, accounts: Accounts) -> None: ) -class AsyncAccountsWithStreamingResponse: - def __init__(self, accounts: AsyncAccounts) -> None: +class AsyncAccountsResourceWithStreamingResponse: + def __init__(self, accounts: AsyncAccountsResource) -> None: self._accounts = accounts self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/ach_prenotifications.py b/src/increase/resources/ach_prenotifications.py index 14805fdca..519363f54 100644 --- a/src/increase/resources/ach_prenotifications.py +++ b/src/increase/resources/ach_prenotifications.py @@ -8,71 +8,80 @@ import httpx -from .. import _legacy_response -from ..types import ( - ACHPrenotification, - ach_prenotification_list_params, - ach_prenotification_create_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import ach_prenotification_list_params, ach_prenotification_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.ach_prenotification import ACHPrenotification -__all__ = ["ACHPrenotifications", "AsyncACHPrenotifications"] +__all__ = ["ACHPrenotificationsResource", "AsyncACHPrenotificationsResource"] -class ACHPrenotifications(SyncAPIResource): +class ACHPrenotificationsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ACHPrenotificationsWithRawResponse: - return ACHPrenotificationsWithRawResponse(self) + def with_raw_response(self) -> ACHPrenotificationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ACHPrenotificationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ACHPrenotificationsWithStreamingResponse: - return ACHPrenotificationsWithStreamingResponse(self) + def with_streaming_response(self) -> ACHPrenotificationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ACHPrenotificationsResourceWithStreamingResponse(self) def create( self, *, + account_id: str, account_number: str, routing_number: str, - addendum: str | NotGiven = NOT_GIVEN, - company_descriptive_date: str | NotGiven = NOT_GIVEN, - company_discretionary_data: str | NotGiven = NOT_GIVEN, - company_entry_description: str | NotGiven = NOT_GIVEN, - company_name: str | NotGiven = NOT_GIVEN, - credit_debit_indicator: Literal["credit", "debit"] | NotGiven = NOT_GIVEN, - effective_date: Union[str, date] | NotGiven = NOT_GIVEN, - individual_id: str | NotGiven = NOT_GIVEN, - individual_name: str | NotGiven = NOT_GIVEN, + addendum: str | Omit = omit, + company_descriptive_date: str | Omit = omit, + company_discretionary_data: str | Omit = omit, + company_entry_description: str | Omit = omit, + company_name: str | Omit = omit, + credit_debit_indicator: Literal["credit", "debit"] | Omit = omit, + effective_date: Union[str, date] | Omit = omit, + individual_id: str | Omit = omit, + individual_name: str | Omit = omit, standard_entry_class_code: Literal[ "corporate_credit_or_debit", "corporate_trade_exchange", "prearranged_payments_and_deposit", "internet_initiated", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHPrenotification: """ Create an ACH Prenotification Args: + account_id: The Increase identifier for the account that will send the ACH Prenotification. + account_number: The account number for the destination account. routing_number: The American Bankers' Association (ABA) Routing Transit Number (RTN) for the @@ -80,11 +89,11 @@ def create( addendum: Additional information that will be sent to the recipient. - company_descriptive_date: The description of the date of the transfer. + company_descriptive_date: The description of the date of the ACH Prenotification. - company_discretionary_data: The data you choose to associate with the transfer. + company_discretionary_data: The data you choose to associate with the ACH Prenotification. - company_entry_description: The description of the transfer you wish to be shown to the recipient. + company_entry_description: The description you wish to be shown to the recipient. company_name: The name by which the recipient knows you. @@ -93,20 +102,29 @@ def create( - `credit` - The Prenotification is for an anticipated credit. - `debit` - The Prenotification is for an anticipated debit. - effective_date: The transfer effective date in + effective_date: The ACH Prenotification effective date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - individual_id: Your identifier for the transfer recipient. + individual_id: Your identifier for the recipient. - individual_name: The name of the transfer recipient. This value is information and not verified - by the recipient's bank. + individual_name: The name of therecipient. This value is informational and not verified by the + recipient's bank. - standard_entry_class_code: The Standard Entry Class (SEC) code to use for the ACH Prenotification. + standard_entry_class_code: The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the ACH Prenotification. - - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). - - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). - - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). - - `internet_initiated` - Internet Initiated (WEB). + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. extra_headers: Send extra headers @@ -122,6 +140,7 @@ def create( "/ach_prenotifications", body=maybe_transform( { + "account_id": account_id, "account_number": account_number, "routing_number": routing_number, "addendum": addendum, @@ -156,7 +175,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ACHPrenotification: """ Retrieve an ACH Prenotification @@ -177,7 +196,9 @@ def retrieve( f"Expected a non-empty value for `ach_prenotification_id` but received {ach_prenotification_id!r}" ) return self._get( - f"/ach_prenotifications/{ach_prenotification_id}", + path_template( + "/ach_prenotifications/{ach_prenotification_id}", ach_prenotification_id=ach_prenotification_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -187,16 +208,16 @@ def retrieve( def list( self, *, - created_at: ach_prenotification_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + created_at: ach_prenotification_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[ACHPrenotification]: """ List ACH Prenotifications @@ -242,48 +263,62 @@ def list( ) -class AsyncACHPrenotifications(AsyncAPIResource): +class AsyncACHPrenotificationsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncACHPrenotificationsWithRawResponse: - return AsyncACHPrenotificationsWithRawResponse(self) + def with_raw_response(self) -> AsyncACHPrenotificationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncACHPrenotificationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncACHPrenotificationsWithStreamingResponse: - return AsyncACHPrenotificationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncACHPrenotificationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncACHPrenotificationsResourceWithStreamingResponse(self) async def create( self, *, + account_id: str, account_number: str, routing_number: str, - addendum: str | NotGiven = NOT_GIVEN, - company_descriptive_date: str | NotGiven = NOT_GIVEN, - company_discretionary_data: str | NotGiven = NOT_GIVEN, - company_entry_description: str | NotGiven = NOT_GIVEN, - company_name: str | NotGiven = NOT_GIVEN, - credit_debit_indicator: Literal["credit", "debit"] | NotGiven = NOT_GIVEN, - effective_date: Union[str, date] | NotGiven = NOT_GIVEN, - individual_id: str | NotGiven = NOT_GIVEN, - individual_name: str | NotGiven = NOT_GIVEN, + addendum: str | Omit = omit, + company_descriptive_date: str | Omit = omit, + company_discretionary_data: str | Omit = omit, + company_entry_description: str | Omit = omit, + company_name: str | Omit = omit, + credit_debit_indicator: Literal["credit", "debit"] | Omit = omit, + effective_date: Union[str, date] | Omit = omit, + individual_id: str | Omit = omit, + individual_name: str | Omit = omit, standard_entry_class_code: Literal[ "corporate_credit_or_debit", "corporate_trade_exchange", "prearranged_payments_and_deposit", "internet_initiated", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHPrenotification: """ Create an ACH Prenotification Args: + account_id: The Increase identifier for the account that will send the ACH Prenotification. + account_number: The account number for the destination account. routing_number: The American Bankers' Association (ABA) Routing Transit Number (RTN) for the @@ -291,11 +326,11 @@ async def create( addendum: Additional information that will be sent to the recipient. - company_descriptive_date: The description of the date of the transfer. + company_descriptive_date: The description of the date of the ACH Prenotification. - company_discretionary_data: The data you choose to associate with the transfer. + company_discretionary_data: The data you choose to associate with the ACH Prenotification. - company_entry_description: The description of the transfer you wish to be shown to the recipient. + company_entry_description: The description you wish to be shown to the recipient. company_name: The name by which the recipient knows you. @@ -304,20 +339,29 @@ async def create( - `credit` - The Prenotification is for an anticipated credit. - `debit` - The Prenotification is for an anticipated debit. - effective_date: The transfer effective date in + effective_date: The ACH Prenotification effective date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - individual_id: Your identifier for the transfer recipient. + individual_id: Your identifier for the recipient. - individual_name: The name of the transfer recipient. This value is information and not verified - by the recipient's bank. + individual_name: The name of therecipient. This value is informational and not verified by the + recipient's bank. - standard_entry_class_code: The Standard Entry Class (SEC) code to use for the ACH Prenotification. + standard_entry_class_code: The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the ACH Prenotification. - - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). - - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). - - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). - - `internet_initiated` - Internet Initiated (WEB). + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. extra_headers: Send extra headers @@ -333,6 +377,7 @@ async def create( "/ach_prenotifications", body=await async_maybe_transform( { + "account_id": account_id, "account_number": account_number, "routing_number": routing_number, "addendum": addendum, @@ -367,7 +412,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ACHPrenotification: """ Retrieve an ACH Prenotification @@ -388,7 +433,9 @@ async def retrieve( f"Expected a non-empty value for `ach_prenotification_id` but received {ach_prenotification_id!r}" ) return await self._get( - f"/ach_prenotifications/{ach_prenotification_id}", + path_template( + "/ach_prenotifications/{ach_prenotification_id}", ach_prenotification_id=ach_prenotification_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -398,16 +445,16 @@ async def retrieve( def list( self, *, - created_at: ach_prenotification_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + created_at: ach_prenotification_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ACHPrenotification, AsyncPage[ACHPrenotification]]: """ List ACH Prenotifications @@ -453,38 +500,38 @@ def list( ) -class ACHPrenotificationsWithRawResponse: - def __init__(self, ach_prenotifications: ACHPrenotifications) -> None: +class ACHPrenotificationsResourceWithRawResponse: + def __init__(self, ach_prenotifications: ACHPrenotificationsResource) -> None: self._ach_prenotifications = ach_prenotifications - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( ach_prenotifications.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( ach_prenotifications.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( ach_prenotifications.list, ) -class AsyncACHPrenotificationsWithRawResponse: - def __init__(self, ach_prenotifications: AsyncACHPrenotifications) -> None: +class AsyncACHPrenotificationsResourceWithRawResponse: + def __init__(self, ach_prenotifications: AsyncACHPrenotificationsResource) -> None: self._ach_prenotifications = ach_prenotifications - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( ach_prenotifications.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( ach_prenotifications.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( ach_prenotifications.list, ) -class ACHPrenotificationsWithStreamingResponse: - def __init__(self, ach_prenotifications: ACHPrenotifications) -> None: +class ACHPrenotificationsResourceWithStreamingResponse: + def __init__(self, ach_prenotifications: ACHPrenotificationsResource) -> None: self._ach_prenotifications = ach_prenotifications self.create = to_streamed_response_wrapper( @@ -498,8 +545,8 @@ def __init__(self, ach_prenotifications: ACHPrenotifications) -> None: ) -class AsyncACHPrenotificationsWithStreamingResponse: - def __init__(self, ach_prenotifications: AsyncACHPrenotifications) -> None: +class AsyncACHPrenotificationsResourceWithStreamingResponse: + def __init__(self, ach_prenotifications: AsyncACHPrenotificationsResource) -> None: self._ach_prenotifications = ach_prenotifications self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/ach_transfers.py b/src/increase/resources/ach_transfers.py index 129e5704a..a8611e0e9 100644 --- a/src/increase/resources/ach_transfers.py +++ b/src/increase/resources/ach_transfers.py @@ -2,39 +2,47 @@ from __future__ import annotations -from typing import Union -from datetime import date from typing_extensions import Literal import httpx -from .. import _legacy_response -from ..types import ACHTransfer, ach_transfer_list_params, ach_transfer_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import ach_transfer_list_params, ach_transfer_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.ach_transfer import ACHTransfer -__all__ = ["ACHTransfers", "AsyncACHTransfers"] +__all__ = ["ACHTransfersResource", "AsyncACHTransfersResource"] -class ACHTransfers(SyncAPIResource): +class ACHTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ACHTransfersWithRawResponse: - return ACHTransfersWithRawResponse(self) + def with_raw_response(self) -> ACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ACHTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ACHTransfersWithStreamingResponse: - return ACHTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> ACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ACHTransfersResourceWithStreamingResponse(self) def create( self, @@ -42,33 +50,34 @@ def create( account_id: str, amount: int, statement_descriptor: str, - account_number: str | NotGiven = NOT_GIVEN, - addenda: ach_transfer_create_params.Addenda | NotGiven = NOT_GIVEN, - company_descriptive_date: str | NotGiven = NOT_GIVEN, - company_discretionary_data: str | NotGiven = NOT_GIVEN, - company_entry_description: str | NotGiven = NOT_GIVEN, - company_name: str | NotGiven = NOT_GIVEN, - destination_account_holder: Literal["business", "individual", "unknown"] | NotGiven = NOT_GIVEN, - effective_date: Union[str, date] | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - funding: Literal["checking", "savings"] | NotGiven = NOT_GIVEN, - individual_id: str | NotGiven = NOT_GIVEN, - individual_name: str | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, - routing_number: str | NotGiven = NOT_GIVEN, + account_number: str | Omit = omit, + addenda: ach_transfer_create_params.Addenda | Omit = omit, + company_descriptive_date: str | Omit = omit, + company_discretionary_data: str | Omit = omit, + company_entry_description: str | Omit = omit, + company_name: str | Omit = omit, + destination_account_holder: Literal["business", "individual", "unknown"] | Omit = omit, + external_account_id: str | Omit = omit, + funding: Literal["checking", "savings", "general_ledger"] | Omit = omit, + individual_id: str | Omit = omit, + individual_name: str | Omit = omit, + preferred_effective_date: ach_transfer_create_params.PreferredEffectiveDate | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, standard_entry_class_code: Literal[ "corporate_credit_or_debit", "corporate_trade_exchange", "prearranged_payments_and_deposit", "internet_initiated", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, + transaction_timing: Literal["synchronous", "asynchronous"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -77,7 +86,7 @@ def create( Args: account_id: The Increase identifier for the account that will send the transfer. - amount: The transfer amount in cents. A positive amount originates a credit transfer + amount: The transfer amount in USD cents. A positive amount originates a credit transfer pushing funds to the receiving account. A negative amount originates a debit transfer pulling funds from the receiving account. @@ -99,8 +108,9 @@ def create( company_discretionary_data: The data you choose to associate with the transfer. This is included in the transfer data sent to the receiving bank. - company_entry_description: A description of the transfer. This is included in the transfer data sent to the - receiving bank. + company_entry_description: A description of the transfer, included in the transfer data sent to the + receiving bank. Standardized formatting may be required, for example `PAYROLL` + for payroll-related Prearranged Payments and Deposits (PPD) credit transfers. company_name: The name by which the recipient knows you. This is included in the transfer data sent to the receiving bank. @@ -112,9 +122,6 @@ def create( - `individual` - The External Account is owned by an individual. - `unknown` - It's unknown what kind of entity owns the External Account. - effective_date: The transfer effective date in - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is provided, `account_number`, `routing_number`, and `funding` must be absent. @@ -122,23 +129,44 @@ def create( - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A bank's general ledger. Uncommon. individual_id: Your identifier for the transfer recipient. individual_name: The name of the transfer recipient. This value is informational and not verified by the recipient's bank. + preferred_effective_date: Configuration for how the effective date of the transfer will be set. This + determines same-day vs future-dated settlement timing. If not set, defaults to a + `settlement_schedule` of `same_day`. If set, exactly one of the child attributes + must be set. + require_approval: Whether the transfer requires explicit approval via the dashboard or API. routing_number: The American Bankers' Association (ABA) Routing Transit Number (RTN) for the destination account. - standard_entry_class_code: The Standard Entry Class (SEC) code to use for the transfer. + standard_entry_class_code: The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the transfer. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. - - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). - - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). - - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). - - `internet_initiated` - Internet Initiated (WEB). + transaction_timing: The timing of the transaction. + + - `synchronous` - A Transaction will be created immediately. + - `asynchronous` - A Transaction will be created when the funds settle at the + Federal Reserve. extra_headers: Send extra headers @@ -164,14 +192,15 @@ def create( "company_entry_description": company_entry_description, "company_name": company_name, "destination_account_holder": destination_account_holder, - "effective_date": effective_date, "external_account_id": external_account_id, "funding": funding, "individual_id": individual_id, "individual_name": individual_name, + "preferred_effective_date": preferred_effective_date, "require_approval": require_approval, "routing_number": routing_number, "standard_entry_class_code": standard_entry_class_code, + "transaction_timing": transaction_timing, }, ach_transfer_create_params.ACHTransferCreateParams, ), @@ -194,7 +223,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ACHTransfer: """ Retrieve an ACH Transfer @@ -213,7 +242,7 @@ def retrieve( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return self._get( - f"/ach_transfers/{ach_transfer_id}", + path_template("/ach_transfers/{ach_transfer_id}", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -223,18 +252,19 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: ach_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: ach_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: ach_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[ACHTransfer]: """ List ACH Transfers @@ -278,6 +308,7 @@ def list( "external_account_id": external_account_id, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, ach_transfer_list_params.ACHTransferListParams, ), @@ -294,7 +325,7 @@ def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -316,7 +347,7 @@ def approve( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return self._post( - f"/ach_transfers/{ach_transfer_id}/approve", + path_template("/ach_transfers/{ach_transfer_id}/approve", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -336,7 +367,7 @@ def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -358,7 +389,7 @@ def cancel( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return self._post( - f"/ach_transfers/{ach_transfer_id}/cancel", + path_template("/ach_transfers/{ach_transfer_id}/cancel", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -370,14 +401,25 @@ def cancel( ) -class AsyncACHTransfers(AsyncAPIResource): +class AsyncACHTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncACHTransfersWithRawResponse: - return AsyncACHTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncACHTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncACHTransfersWithStreamingResponse: - return AsyncACHTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncACHTransfersResourceWithStreamingResponse(self) async def create( self, @@ -385,33 +427,34 @@ async def create( account_id: str, amount: int, statement_descriptor: str, - account_number: str | NotGiven = NOT_GIVEN, - addenda: ach_transfer_create_params.Addenda | NotGiven = NOT_GIVEN, - company_descriptive_date: str | NotGiven = NOT_GIVEN, - company_discretionary_data: str | NotGiven = NOT_GIVEN, - company_entry_description: str | NotGiven = NOT_GIVEN, - company_name: str | NotGiven = NOT_GIVEN, - destination_account_holder: Literal["business", "individual", "unknown"] | NotGiven = NOT_GIVEN, - effective_date: Union[str, date] | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - funding: Literal["checking", "savings"] | NotGiven = NOT_GIVEN, - individual_id: str | NotGiven = NOT_GIVEN, - individual_name: str | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, - routing_number: str | NotGiven = NOT_GIVEN, + account_number: str | Omit = omit, + addenda: ach_transfer_create_params.Addenda | Omit = omit, + company_descriptive_date: str | Omit = omit, + company_discretionary_data: str | Omit = omit, + company_entry_description: str | Omit = omit, + company_name: str | Omit = omit, + destination_account_holder: Literal["business", "individual", "unknown"] | Omit = omit, + external_account_id: str | Omit = omit, + funding: Literal["checking", "savings", "general_ledger"] | Omit = omit, + individual_id: str | Omit = omit, + individual_name: str | Omit = omit, + preferred_effective_date: ach_transfer_create_params.PreferredEffectiveDate | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, standard_entry_class_code: Literal[ "corporate_credit_or_debit", "corporate_trade_exchange", "prearranged_payments_and_deposit", "internet_initiated", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, + transaction_timing: Literal["synchronous", "asynchronous"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -420,7 +463,7 @@ async def create( Args: account_id: The Increase identifier for the account that will send the transfer. - amount: The transfer amount in cents. A positive amount originates a credit transfer + amount: The transfer amount in USD cents. A positive amount originates a credit transfer pushing funds to the receiving account. A negative amount originates a debit transfer pulling funds from the receiving account. @@ -442,8 +485,9 @@ async def create( company_discretionary_data: The data you choose to associate with the transfer. This is included in the transfer data sent to the receiving bank. - company_entry_description: A description of the transfer. This is included in the transfer data sent to the - receiving bank. + company_entry_description: A description of the transfer, included in the transfer data sent to the + receiving bank. Standardized formatting may be required, for example `PAYROLL` + for payroll-related Prearranged Payments and Deposits (PPD) credit transfers. company_name: The name by which the recipient knows you. This is included in the transfer data sent to the receiving bank. @@ -455,9 +499,6 @@ async def create( - `individual` - The External Account is owned by an individual. - `unknown` - It's unknown what kind of entity owns the External Account. - effective_date: The transfer effective date in - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is provided, `account_number`, `routing_number`, and `funding` must be absent. @@ -465,23 +506,44 @@ async def create( - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A bank's general ledger. Uncommon. individual_id: Your identifier for the transfer recipient. individual_name: The name of the transfer recipient. This value is informational and not verified by the recipient's bank. + preferred_effective_date: Configuration for how the effective date of the transfer will be set. This + determines same-day vs future-dated settlement timing. If not set, defaults to a + `settlement_schedule` of `same_day`. If set, exactly one of the child attributes + must be set. + require_approval: Whether the transfer requires explicit approval via the dashboard or API. routing_number: The American Bankers' Association (ABA) Routing Transit Number (RTN) for the destination account. - standard_entry_class_code: The Standard Entry Class (SEC) code to use for the transfer. + standard_entry_class_code: The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the transfer. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. + + transaction_timing: The timing of the transaction. - - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). - - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). - - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). - - `internet_initiated` - Internet Initiated (WEB). + - `synchronous` - A Transaction will be created immediately. + - `asynchronous` - A Transaction will be created when the funds settle at the + Federal Reserve. extra_headers: Send extra headers @@ -507,14 +569,15 @@ async def create( "company_entry_description": company_entry_description, "company_name": company_name, "destination_account_holder": destination_account_holder, - "effective_date": effective_date, "external_account_id": external_account_id, "funding": funding, "individual_id": individual_id, "individual_name": individual_name, + "preferred_effective_date": preferred_effective_date, "require_approval": require_approval, "routing_number": routing_number, "standard_entry_class_code": standard_entry_class_code, + "transaction_timing": transaction_timing, }, ach_transfer_create_params.ACHTransferCreateParams, ), @@ -537,7 +600,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ACHTransfer: """ Retrieve an ACH Transfer @@ -556,7 +619,7 @@ async def retrieve( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return await self._get( - f"/ach_transfers/{ach_transfer_id}", + path_template("/ach_transfers/{ach_transfer_id}", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -566,18 +629,19 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: ach_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: ach_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: ach_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ACHTransfer, AsyncPage[ACHTransfer]]: """ List ACH Transfers @@ -621,6 +685,7 @@ def list( "external_account_id": external_account_id, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, ach_transfer_list_params.ACHTransferListParams, ), @@ -637,7 +702,7 @@ async def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -659,7 +724,7 @@ async def approve( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return await self._post( - f"/ach_transfers/{ach_transfer_id}/approve", + path_template("/ach_transfers/{ach_transfer_id}/approve", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -679,7 +744,7 @@ async def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -701,7 +766,7 @@ async def cancel( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return await self._post( - f"/ach_transfers/{ach_transfer_id}/cancel", + path_template("/ach_transfers/{ach_transfer_id}/cancel", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -713,50 +778,50 @@ async def cancel( ) -class ACHTransfersWithRawResponse: - def __init__(self, ach_transfers: ACHTransfers) -> None: +class ACHTransfersResourceWithRawResponse: + def __init__(self, ach_transfers: ACHTransfersResource) -> None: self._ach_transfers = ach_transfers - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( ach_transfers.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( ach_transfers.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( ach_transfers.list, ) - self.approve = _legacy_response.to_raw_response_wrapper( + self.approve = to_raw_response_wrapper( ach_transfers.approve, ) - self.cancel = _legacy_response.to_raw_response_wrapper( + self.cancel = to_raw_response_wrapper( ach_transfers.cancel, ) -class AsyncACHTransfersWithRawResponse: - def __init__(self, ach_transfers: AsyncACHTransfers) -> None: +class AsyncACHTransfersResourceWithRawResponse: + def __init__(self, ach_transfers: AsyncACHTransfersResource) -> None: self._ach_transfers = ach_transfers - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( ach_transfers.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( ach_transfers.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( ach_transfers.list, ) - self.approve = _legacy_response.async_to_raw_response_wrapper( + self.approve = async_to_raw_response_wrapper( ach_transfers.approve, ) - self.cancel = _legacy_response.async_to_raw_response_wrapper( + self.cancel = async_to_raw_response_wrapper( ach_transfers.cancel, ) -class ACHTransfersWithStreamingResponse: - def __init__(self, ach_transfers: ACHTransfers) -> None: +class ACHTransfersResourceWithStreamingResponse: + def __init__(self, ach_transfers: ACHTransfersResource) -> None: self._ach_transfers = ach_transfers self.create = to_streamed_response_wrapper( @@ -776,8 +841,8 @@ def __init__(self, ach_transfers: ACHTransfers) -> None: ) -class AsyncACHTransfersWithStreamingResponse: - def __init__(self, ach_transfers: AsyncACHTransfers) -> None: +class AsyncACHTransfersResourceWithStreamingResponse: + def __init__(self, ach_transfers: AsyncACHTransfersResource) -> None: self._ach_transfers = ach_transfers self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/beneficial_owners.py b/src/increase/resources/beneficial_owners.py new file mode 100644 index 000000000..f7142ea39 --- /dev/null +++ b/src/increase/resources/beneficial_owners.py @@ -0,0 +1,709 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal + +import httpx + +from ..types import beneficial_owner_list_params, beneficial_owner_create_params, beneficial_owner_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.entity_beneficial_owner import EntityBeneficialOwner + +__all__ = ["BeneficialOwnersResource", "AsyncBeneficialOwnersResource"] + + +class BeneficialOwnersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> BeneficialOwnersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return BeneficialOwnersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> BeneficialOwnersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return BeneficialOwnersResourceWithStreamingResponse(self) + + def create( + self, + *, + entity_id: str, + individual: beneficial_owner_create_params.Individual, + prongs: List[Literal["ownership", "control"]], + company_title: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityBeneficialOwner: + """ + Create a beneficial owner + + Args: + entity_id: The identifier of the Entity to associate with the new Beneficial Owner. + + individual: Personal details for the beneficial owner. + + prongs: Why this person is considered a beneficial owner of the entity. At least one + option is required, if a person is both a control person and owner, submit an + array containing both. + + company_title: This person's role or title within the entity. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/entity_beneficial_owners", + body=maybe_transform( + { + "entity_id": entity_id, + "individual": individual, + "prongs": prongs, + "company_title": company_title, + }, + beneficial_owner_create_params.BeneficialOwnerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityBeneficialOwner, + ) + + def retrieve( + self, + entity_beneficial_owner_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> EntityBeneficialOwner: + """ + Retrieve a Beneficial Owner + + Args: + entity_beneficial_owner_id: The identifier of the Beneficial Owner to retrieve. + + 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 entity_beneficial_owner_id: + raise ValueError( + f"Expected a non-empty value for `entity_beneficial_owner_id` but received {entity_beneficial_owner_id!r}" + ) + return self._get( + path_template( + "/entity_beneficial_owners/{entity_beneficial_owner_id}", + entity_beneficial_owner_id=entity_beneficial_owner_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EntityBeneficialOwner, + ) + + def update( + self, + entity_beneficial_owner_id: str, + *, + address: beneficial_owner_update_params.Address | Omit = omit, + confirmed_no_us_tax_id: bool | Omit = omit, + identification: beneficial_owner_update_params.Identification | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityBeneficialOwner: + """ + Update a Beneficial Owner + + Args: + entity_beneficial_owner_id: The identifier of the Beneficial Owner to update. + + address: The individual's physical address. Mail receiving locations like PO Boxes and + PMB's are disallowed. + + confirmed_no_us_tax_id: The identification method for an individual can only be a passport, driver's + license, or other document if you've confirmed the individual does not have a US + tax id (either a Social Security Number or Individual Taxpayer Identification + Number). + + identification: A means of verifying the person's identity. + + name: The individual's legal name. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_beneficial_owner_id: + raise ValueError( + f"Expected a non-empty value for `entity_beneficial_owner_id` but received {entity_beneficial_owner_id!r}" + ) + return self._patch( + path_template( + "/entity_beneficial_owners/{entity_beneficial_owner_id}", + entity_beneficial_owner_id=entity_beneficial_owner_id, + ), + body=maybe_transform( + { + "address": address, + "confirmed_no_us_tax_id": confirmed_no_us_tax_id, + "identification": identification, + "name": name, + }, + beneficial_owner_update_params.BeneficialOwnerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityBeneficialOwner, + ) + + def list( + self, + *, + entity_id: str, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[EntityBeneficialOwner]: + """ + List Beneficial Owners + + Args: + entity_id: The identifier of the Entity to list beneficial owners for. Only `corporation` + entities have beneficial owners. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/entity_beneficial_owners", + page=SyncPage[EntityBeneficialOwner], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "entity_id": entity_id, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + }, + beneficial_owner_list_params.BeneficialOwnerListParams, + ), + ), + model=EntityBeneficialOwner, + ) + + def archive( + self, + entity_beneficial_owner_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityBeneficialOwner: + """ + Archive a Beneficial Owner + + Args: + entity_beneficial_owner_id: The identifier of the Beneficial Owner to archive. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_beneficial_owner_id: + raise ValueError( + f"Expected a non-empty value for `entity_beneficial_owner_id` but received {entity_beneficial_owner_id!r}" + ) + return self._post( + path_template( + "/entity_beneficial_owners/{entity_beneficial_owner_id}/archive", + entity_beneficial_owner_id=entity_beneficial_owner_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityBeneficialOwner, + ) + + +class AsyncBeneficialOwnersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncBeneficialOwnersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncBeneficialOwnersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncBeneficialOwnersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncBeneficialOwnersResourceWithStreamingResponse(self) + + async def create( + self, + *, + entity_id: str, + individual: beneficial_owner_create_params.Individual, + prongs: List[Literal["ownership", "control"]], + company_title: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityBeneficialOwner: + """ + Create a beneficial owner + + Args: + entity_id: The identifier of the Entity to associate with the new Beneficial Owner. + + individual: Personal details for the beneficial owner. + + prongs: Why this person is considered a beneficial owner of the entity. At least one + option is required, if a person is both a control person and owner, submit an + array containing both. + + company_title: This person's role or title within the entity. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/entity_beneficial_owners", + body=await async_maybe_transform( + { + "entity_id": entity_id, + "individual": individual, + "prongs": prongs, + "company_title": company_title, + }, + beneficial_owner_create_params.BeneficialOwnerCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityBeneficialOwner, + ) + + async def retrieve( + self, + entity_beneficial_owner_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> EntityBeneficialOwner: + """ + Retrieve a Beneficial Owner + + Args: + entity_beneficial_owner_id: The identifier of the Beneficial Owner to retrieve. + + 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 entity_beneficial_owner_id: + raise ValueError( + f"Expected a non-empty value for `entity_beneficial_owner_id` but received {entity_beneficial_owner_id!r}" + ) + return await self._get( + path_template( + "/entity_beneficial_owners/{entity_beneficial_owner_id}", + entity_beneficial_owner_id=entity_beneficial_owner_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EntityBeneficialOwner, + ) + + async def update( + self, + entity_beneficial_owner_id: str, + *, + address: beneficial_owner_update_params.Address | Omit = omit, + confirmed_no_us_tax_id: bool | Omit = omit, + identification: beneficial_owner_update_params.Identification | Omit = omit, + name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityBeneficialOwner: + """ + Update a Beneficial Owner + + Args: + entity_beneficial_owner_id: The identifier of the Beneficial Owner to update. + + address: The individual's physical address. Mail receiving locations like PO Boxes and + PMB's are disallowed. + + confirmed_no_us_tax_id: The identification method for an individual can only be a passport, driver's + license, or other document if you've confirmed the individual does not have a US + tax id (either a Social Security Number or Individual Taxpayer Identification + Number). + + identification: A means of verifying the person's identity. + + name: The individual's legal name. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_beneficial_owner_id: + raise ValueError( + f"Expected a non-empty value for `entity_beneficial_owner_id` but received {entity_beneficial_owner_id!r}" + ) + return await self._patch( + path_template( + "/entity_beneficial_owners/{entity_beneficial_owner_id}", + entity_beneficial_owner_id=entity_beneficial_owner_id, + ), + body=await async_maybe_transform( + { + "address": address, + "confirmed_no_us_tax_id": confirmed_no_us_tax_id, + "identification": identification, + "name": name, + }, + beneficial_owner_update_params.BeneficialOwnerUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityBeneficialOwner, + ) + + def list( + self, + *, + entity_id: str, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[EntityBeneficialOwner, AsyncPage[EntityBeneficialOwner]]: + """ + List Beneficial Owners + + Args: + entity_id: The identifier of the Entity to list beneficial owners for. Only `corporation` + entities have beneficial owners. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/entity_beneficial_owners", + page=AsyncPage[EntityBeneficialOwner], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "entity_id": entity_id, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + }, + beneficial_owner_list_params.BeneficialOwnerListParams, + ), + ), + model=EntityBeneficialOwner, + ) + + async def archive( + self, + entity_beneficial_owner_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityBeneficialOwner: + """ + Archive a Beneficial Owner + + Args: + entity_beneficial_owner_id: The identifier of the Beneficial Owner to archive. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_beneficial_owner_id: + raise ValueError( + f"Expected a non-empty value for `entity_beneficial_owner_id` but received {entity_beneficial_owner_id!r}" + ) + return await self._post( + path_template( + "/entity_beneficial_owners/{entity_beneficial_owner_id}/archive", + entity_beneficial_owner_id=entity_beneficial_owner_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityBeneficialOwner, + ) + + +class BeneficialOwnersResourceWithRawResponse: + def __init__(self, beneficial_owners: BeneficialOwnersResource) -> None: + self._beneficial_owners = beneficial_owners + + self.create = to_raw_response_wrapper( + beneficial_owners.create, + ) + self.retrieve = to_raw_response_wrapper( + beneficial_owners.retrieve, + ) + self.update = to_raw_response_wrapper( + beneficial_owners.update, + ) + self.list = to_raw_response_wrapper( + beneficial_owners.list, + ) + self.archive = to_raw_response_wrapper( + beneficial_owners.archive, + ) + + +class AsyncBeneficialOwnersResourceWithRawResponse: + def __init__(self, beneficial_owners: AsyncBeneficialOwnersResource) -> None: + self._beneficial_owners = beneficial_owners + + self.create = async_to_raw_response_wrapper( + beneficial_owners.create, + ) + self.retrieve = async_to_raw_response_wrapper( + beneficial_owners.retrieve, + ) + self.update = async_to_raw_response_wrapper( + beneficial_owners.update, + ) + self.list = async_to_raw_response_wrapper( + beneficial_owners.list, + ) + self.archive = async_to_raw_response_wrapper( + beneficial_owners.archive, + ) + + +class BeneficialOwnersResourceWithStreamingResponse: + def __init__(self, beneficial_owners: BeneficialOwnersResource) -> None: + self._beneficial_owners = beneficial_owners + + self.create = to_streamed_response_wrapper( + beneficial_owners.create, + ) + self.retrieve = to_streamed_response_wrapper( + beneficial_owners.retrieve, + ) + self.update = to_streamed_response_wrapper( + beneficial_owners.update, + ) + self.list = to_streamed_response_wrapper( + beneficial_owners.list, + ) + self.archive = to_streamed_response_wrapper( + beneficial_owners.archive, + ) + + +class AsyncBeneficialOwnersResourceWithStreamingResponse: + def __init__(self, beneficial_owners: AsyncBeneficialOwnersResource) -> None: + self._beneficial_owners = beneficial_owners + + self.create = async_to_streamed_response_wrapper( + beneficial_owners.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + beneficial_owners.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + beneficial_owners.update, + ) + self.list = async_to_streamed_response_wrapper( + beneficial_owners.list, + ) + self.archive = async_to_streamed_response_wrapper( + beneficial_owners.archive, + ) diff --git a/src/increase/resources/bookkeeping_accounts.py b/src/increase/resources/bookkeeping_accounts.py index cfefef979..3221f85ce 100644 --- a/src/increase/resources/bookkeeping_accounts.py +++ b/src/increase/resources/bookkeeping_accounts.py @@ -8,54 +8,63 @@ import httpx -from .. import _legacy_response from ..types import ( - BookkeepingAccount, - BookkeepingBalanceLookup, bookkeeping_account_list_params, bookkeeping_account_create_params, bookkeeping_account_update_params, bookkeeping_account_balance_params, ) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.bookkeeping_account import BookkeepingAccount +from ..types.bookkeeping_balance_lookup import BookkeepingBalanceLookup -__all__ = ["BookkeepingAccounts", "AsyncBookkeepingAccounts"] +__all__ = ["BookkeepingAccountsResource", "AsyncBookkeepingAccountsResource"] -class BookkeepingAccounts(SyncAPIResource): +class BookkeepingAccountsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BookkeepingAccountsWithRawResponse: - return BookkeepingAccountsWithRawResponse(self) + def with_raw_response(self) -> BookkeepingAccountsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return BookkeepingAccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BookkeepingAccountsWithStreamingResponse: - return BookkeepingAccountsWithStreamingResponse(self) + def with_streaming_response(self) -> BookkeepingAccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return BookkeepingAccountsResourceWithStreamingResponse(self) def create( self, *, name: str, - account_id: str | NotGiven = NOT_GIVEN, - compliance_category: Literal["commingled_cash", "customer_balance"] | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + compliance_category: Literal["commingled_cash", "customer_balance"] | Omit = omit, + entity_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> BookkeepingAccount: """ @@ -64,7 +73,7 @@ def create( Args: name: The name you choose for the account. - account_id: The entity, if `compliance_category` is `commingled_cash`. + account_id: The account, if `compliance_category` is `commingled_cash`. compliance_category: The account compliance category. @@ -114,7 +123,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> BookkeepingAccount: """ @@ -140,7 +149,9 @@ def update( f"Expected a non-empty value for `bookkeeping_account_id` but received {bookkeeping_account_id!r}" ) return self._patch( - f"/bookkeeping_accounts/{bookkeeping_account_id}", + path_template( + "/bookkeeping_accounts/{bookkeeping_account_id}", bookkeeping_account_id=bookkeeping_account_id + ), body=maybe_transform({"name": name}, bookkeeping_account_update_params.BookkeepingAccountUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -155,15 +166,15 @@ def update( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[BookkeepingAccount]: """ List Bookkeeping Accounts @@ -211,13 +222,13 @@ def balance( self, bookkeeping_account_id: str, *, - at_time: Union[str, datetime] | NotGiven = NOT_GIVEN, + at_time: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BookkeepingBalanceLookup: """ Retrieve a Bookkeeping Account Balance @@ -240,7 +251,9 @@ def balance( f"Expected a non-empty value for `bookkeeping_account_id` but received {bookkeeping_account_id!r}" ) return self._get( - f"/bookkeeping_accounts/{bookkeeping_account_id}/balance", + path_template( + "/bookkeeping_accounts/{bookkeeping_account_id}/balance", bookkeeping_account_id=bookkeeping_account_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -254,28 +267,39 @@ def balance( ) -class AsyncBookkeepingAccounts(AsyncAPIResource): +class AsyncBookkeepingAccountsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBookkeepingAccountsWithRawResponse: - return AsyncBookkeepingAccountsWithRawResponse(self) + def with_raw_response(self) -> AsyncBookkeepingAccountsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncBookkeepingAccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBookkeepingAccountsWithStreamingResponse: - return AsyncBookkeepingAccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBookkeepingAccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncBookkeepingAccountsResourceWithStreamingResponse(self) async def create( self, *, name: str, - account_id: str | NotGiven = NOT_GIVEN, - compliance_category: Literal["commingled_cash", "customer_balance"] | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + compliance_category: Literal["commingled_cash", "customer_balance"] | Omit = omit, + entity_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> BookkeepingAccount: """ @@ -284,7 +308,7 @@ async def create( Args: name: The name you choose for the account. - account_id: The entity, if `compliance_category` is `commingled_cash`. + account_id: The account, if `compliance_category` is `commingled_cash`. compliance_category: The account compliance category. @@ -334,7 +358,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> BookkeepingAccount: """ @@ -360,7 +384,9 @@ async def update( f"Expected a non-empty value for `bookkeeping_account_id` but received {bookkeeping_account_id!r}" ) return await self._patch( - f"/bookkeeping_accounts/{bookkeeping_account_id}", + path_template( + "/bookkeeping_accounts/{bookkeeping_account_id}", bookkeeping_account_id=bookkeeping_account_id + ), body=await async_maybe_transform( {"name": name}, bookkeeping_account_update_params.BookkeepingAccountUpdateParams ), @@ -377,15 +403,15 @@ async def update( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BookkeepingAccount, AsyncPage[BookkeepingAccount]]: """ List Bookkeeping Accounts @@ -433,13 +459,13 @@ async def balance( self, bookkeeping_account_id: str, *, - at_time: Union[str, datetime] | NotGiven = NOT_GIVEN, + at_time: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BookkeepingBalanceLookup: """ Retrieve a Bookkeeping Account Balance @@ -462,7 +488,9 @@ async def balance( f"Expected a non-empty value for `bookkeeping_account_id` but received {bookkeeping_account_id!r}" ) return await self._get( - f"/bookkeeping_accounts/{bookkeeping_account_id}/balance", + path_template( + "/bookkeeping_accounts/{bookkeeping_account_id}/balance", bookkeeping_account_id=bookkeeping_account_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -476,44 +504,44 @@ async def balance( ) -class BookkeepingAccountsWithRawResponse: - def __init__(self, bookkeeping_accounts: BookkeepingAccounts) -> None: +class BookkeepingAccountsResourceWithRawResponse: + def __init__(self, bookkeeping_accounts: BookkeepingAccountsResource) -> None: self._bookkeeping_accounts = bookkeeping_accounts - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( bookkeeping_accounts.create, ) - self.update = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( bookkeeping_accounts.update, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( bookkeeping_accounts.list, ) - self.balance = _legacy_response.to_raw_response_wrapper( + self.balance = to_raw_response_wrapper( bookkeeping_accounts.balance, ) -class AsyncBookkeepingAccountsWithRawResponse: - def __init__(self, bookkeeping_accounts: AsyncBookkeepingAccounts) -> None: +class AsyncBookkeepingAccountsResourceWithRawResponse: + def __init__(self, bookkeeping_accounts: AsyncBookkeepingAccountsResource) -> None: self._bookkeeping_accounts = bookkeeping_accounts - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( bookkeeping_accounts.create, ) - self.update = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( bookkeeping_accounts.update, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( bookkeeping_accounts.list, ) - self.balance = _legacy_response.async_to_raw_response_wrapper( + self.balance = async_to_raw_response_wrapper( bookkeeping_accounts.balance, ) -class BookkeepingAccountsWithStreamingResponse: - def __init__(self, bookkeeping_accounts: BookkeepingAccounts) -> None: +class BookkeepingAccountsResourceWithStreamingResponse: + def __init__(self, bookkeeping_accounts: BookkeepingAccountsResource) -> None: self._bookkeeping_accounts = bookkeeping_accounts self.create = to_streamed_response_wrapper( @@ -530,8 +558,8 @@ def __init__(self, bookkeeping_accounts: BookkeepingAccounts) -> None: ) -class AsyncBookkeepingAccountsWithStreamingResponse: - def __init__(self, bookkeeping_accounts: AsyncBookkeepingAccounts) -> None: +class AsyncBookkeepingAccountsResourceWithStreamingResponse: + def __init__(self, bookkeeping_accounts: AsyncBookkeepingAccountsResource) -> None: self._bookkeeping_accounts = bookkeeping_accounts self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/bookkeeping_entries.py b/src/increase/resources/bookkeeping_entries.py index a0fd52f97..906f6f9dd 100644 --- a/src/increase/resources/bookkeeping_entries.py +++ b/src/increase/resources/bookkeeping_entries.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import BookkeepingEntry, bookkeeping_entry_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import bookkeeping_entry_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.bookkeeping_entry import BookkeepingEntry -__all__ = ["BookkeepingEntries", "AsyncBookkeepingEntries"] +__all__ = ["BookkeepingEntriesResource", "AsyncBookkeepingEntriesResource"] -class BookkeepingEntries(SyncAPIResource): +class BookkeepingEntriesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BookkeepingEntriesWithRawResponse: - return BookkeepingEntriesWithRawResponse(self) + def with_raw_response(self) -> BookkeepingEntriesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return BookkeepingEntriesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BookkeepingEntriesWithStreamingResponse: - return BookkeepingEntriesWithStreamingResponse(self) + def with_streaming_response(self) -> BookkeepingEntriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return BookkeepingEntriesResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BookkeepingEntry: """ Retrieve a Bookkeeping Entry @@ -59,7 +72,7 @@ def retrieve( f"Expected a non-empty value for `bookkeeping_entry_id` but received {bookkeeping_entry_id!r}" ) return self._get( - f"/bookkeeping_entries/{bookkeeping_entry_id}", + path_template("/bookkeeping_entries/{bookkeeping_entry_id}", bookkeeping_entry_id=bookkeeping_entry_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,19 +82,22 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[BookkeepingEntry]: """ List Bookkeeping Entries Args: + account_id: The identifier for the Bookkeeping Account to filter by. + cursor: Return the page of entries after this one. limit: Limit the size of the list that is returned. The default (and maximum) is 100 @@ -105,6 +121,7 @@ def list( timeout=timeout, query=maybe_transform( { + "account_id": account_id, "cursor": cursor, "limit": limit, }, @@ -115,14 +132,25 @@ def list( ) -class AsyncBookkeepingEntries(AsyncAPIResource): +class AsyncBookkeepingEntriesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBookkeepingEntriesWithRawResponse: - return AsyncBookkeepingEntriesWithRawResponse(self) + def with_raw_response(self) -> AsyncBookkeepingEntriesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncBookkeepingEntriesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBookkeepingEntriesWithStreamingResponse: - return AsyncBookkeepingEntriesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBookkeepingEntriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncBookkeepingEntriesResourceWithStreamingResponse(self) async def retrieve( self, @@ -133,7 +161,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BookkeepingEntry: """ Retrieve a Bookkeeping Entry @@ -154,7 +182,7 @@ async def retrieve( f"Expected a non-empty value for `bookkeeping_entry_id` but received {bookkeeping_entry_id!r}" ) return await self._get( - f"/bookkeeping_entries/{bookkeeping_entry_id}", + path_template("/bookkeeping_entries/{bookkeeping_entry_id}", bookkeeping_entry_id=bookkeeping_entry_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,19 +192,22 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BookkeepingEntry, AsyncPage[BookkeepingEntry]]: """ List Bookkeeping Entries Args: + account_id: The identifier for the Bookkeeping Account to filter by. + cursor: Return the page of entries after this one. limit: Limit the size of the list that is returned. The default (and maximum) is 100 @@ -200,6 +231,7 @@ def list( timeout=timeout, query=maybe_transform( { + "account_id": account_id, "cursor": cursor, "limit": limit, }, @@ -210,32 +242,32 @@ def list( ) -class BookkeepingEntriesWithRawResponse: - def __init__(self, bookkeeping_entries: BookkeepingEntries) -> None: +class BookkeepingEntriesResourceWithRawResponse: + def __init__(self, bookkeeping_entries: BookkeepingEntriesResource) -> None: self._bookkeeping_entries = bookkeeping_entries - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( bookkeeping_entries.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( bookkeeping_entries.list, ) -class AsyncBookkeepingEntriesWithRawResponse: - def __init__(self, bookkeeping_entries: AsyncBookkeepingEntries) -> None: +class AsyncBookkeepingEntriesResourceWithRawResponse: + def __init__(self, bookkeeping_entries: AsyncBookkeepingEntriesResource) -> None: self._bookkeeping_entries = bookkeeping_entries - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( bookkeeping_entries.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( bookkeeping_entries.list, ) -class BookkeepingEntriesWithStreamingResponse: - def __init__(self, bookkeeping_entries: BookkeepingEntries) -> None: +class BookkeepingEntriesResourceWithStreamingResponse: + def __init__(self, bookkeeping_entries: BookkeepingEntriesResource) -> None: self._bookkeeping_entries = bookkeeping_entries self.retrieve = to_streamed_response_wrapper( @@ -246,8 +278,8 @@ def __init__(self, bookkeeping_entries: BookkeepingEntries) -> None: ) -class AsyncBookkeepingEntriesWithStreamingResponse: - def __init__(self, bookkeeping_entries: AsyncBookkeepingEntries) -> None: +class AsyncBookkeepingEntriesResourceWithStreamingResponse: + def __init__(self, bookkeeping_entries: AsyncBookkeepingEntriesResource) -> None: self._bookkeeping_entries = bookkeeping_entries self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/bookkeeping_entry_sets.py b/src/increase/resources/bookkeeping_entry_sets.py index 6931eba74..ad50df6a3 100644 --- a/src/increase/resources/bookkeeping_entry_sets.py +++ b/src/increase/resources/bookkeeping_entry_sets.py @@ -7,50 +7,56 @@ import httpx -from .. import _legacy_response -from ..types import ( - BookkeepingEntrySet, - bookkeeping_entry_set_list_params, - bookkeeping_entry_set_create_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import bookkeeping_entry_set_list_params, bookkeeping_entry_set_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.bookkeeping_entry_set import BookkeepingEntrySet -__all__ = ["BookkeepingEntrySets", "AsyncBookkeepingEntrySets"] +__all__ = ["BookkeepingEntrySetsResource", "AsyncBookkeepingEntrySetsResource"] -class BookkeepingEntrySets(SyncAPIResource): +class BookkeepingEntrySetsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> BookkeepingEntrySetsWithRawResponse: - return BookkeepingEntrySetsWithRawResponse(self) + def with_raw_response(self) -> BookkeepingEntrySetsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return BookkeepingEntrySetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> BookkeepingEntrySetsWithStreamingResponse: - return BookkeepingEntrySetsWithStreamingResponse(self) + def with_streaming_response(self) -> BookkeepingEntrySetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return BookkeepingEntrySetsResourceWithStreamingResponse(self) def create( self, *, entries: Iterable[bookkeeping_entry_set_create_params.Entry], - date: Union[str, datetime] | NotGiven = NOT_GIVEN, - transaction_id: str | NotGiven = NOT_GIVEN, + date: Union[str, datetime] | Omit = omit, + transaction_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> BookkeepingEntrySet: """ @@ -103,7 +109,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BookkeepingEntrySet: """ Retrieve a Bookkeeping Entry Set @@ -124,7 +130,9 @@ def retrieve( f"Expected a non-empty value for `bookkeeping_entry_set_id` but received {bookkeeping_entry_set_id!r}" ) return self._get( - f"/bookkeeping_entry_sets/{bookkeeping_entry_set_id}", + path_template( + "/bookkeeping_entry_sets/{bookkeeping_entry_set_id}", bookkeeping_entry_set_id=bookkeeping_entry_set_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -134,16 +142,16 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - transaction_id: str | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + transaction_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[BookkeepingEntrySet]: """ List Bookkeeping Entry Sets @@ -191,27 +199,38 @@ def list( ) -class AsyncBookkeepingEntrySets(AsyncAPIResource): +class AsyncBookkeepingEntrySetsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncBookkeepingEntrySetsWithRawResponse: - return AsyncBookkeepingEntrySetsWithRawResponse(self) + def with_raw_response(self) -> AsyncBookkeepingEntrySetsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncBookkeepingEntrySetsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncBookkeepingEntrySetsWithStreamingResponse: - return AsyncBookkeepingEntrySetsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncBookkeepingEntrySetsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncBookkeepingEntrySetsResourceWithStreamingResponse(self) async def create( self, *, entries: Iterable[bookkeeping_entry_set_create_params.Entry], - date: Union[str, datetime] | NotGiven = NOT_GIVEN, - transaction_id: str | NotGiven = NOT_GIVEN, + date: Union[str, datetime] | Omit = omit, + transaction_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> BookkeepingEntrySet: """ @@ -264,7 +283,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> BookkeepingEntrySet: """ Retrieve a Bookkeeping Entry Set @@ -285,7 +304,9 @@ async def retrieve( f"Expected a non-empty value for `bookkeeping_entry_set_id` but received {bookkeeping_entry_set_id!r}" ) return await self._get( - f"/bookkeeping_entry_sets/{bookkeeping_entry_set_id}", + path_template( + "/bookkeeping_entry_sets/{bookkeeping_entry_set_id}", bookkeeping_entry_set_id=bookkeeping_entry_set_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -295,16 +316,16 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - transaction_id: str | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + transaction_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[BookkeepingEntrySet, AsyncPage[BookkeepingEntrySet]]: """ List Bookkeeping Entry Sets @@ -352,38 +373,38 @@ def list( ) -class BookkeepingEntrySetsWithRawResponse: - def __init__(self, bookkeeping_entry_sets: BookkeepingEntrySets) -> None: +class BookkeepingEntrySetsResourceWithRawResponse: + def __init__(self, bookkeeping_entry_sets: BookkeepingEntrySetsResource) -> None: self._bookkeeping_entry_sets = bookkeeping_entry_sets - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( bookkeeping_entry_sets.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( bookkeeping_entry_sets.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( bookkeeping_entry_sets.list, ) -class AsyncBookkeepingEntrySetsWithRawResponse: - def __init__(self, bookkeeping_entry_sets: AsyncBookkeepingEntrySets) -> None: +class AsyncBookkeepingEntrySetsResourceWithRawResponse: + def __init__(self, bookkeeping_entry_sets: AsyncBookkeepingEntrySetsResource) -> None: self._bookkeeping_entry_sets = bookkeeping_entry_sets - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( bookkeeping_entry_sets.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( bookkeeping_entry_sets.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( bookkeeping_entry_sets.list, ) -class BookkeepingEntrySetsWithStreamingResponse: - def __init__(self, bookkeeping_entry_sets: BookkeepingEntrySets) -> None: +class BookkeepingEntrySetsResourceWithStreamingResponse: + def __init__(self, bookkeeping_entry_sets: BookkeepingEntrySetsResource) -> None: self._bookkeeping_entry_sets = bookkeeping_entry_sets self.create = to_streamed_response_wrapper( @@ -397,8 +418,8 @@ def __init__(self, bookkeeping_entry_sets: BookkeepingEntrySets) -> None: ) -class AsyncBookkeepingEntrySetsWithStreamingResponse: - def __init__(self, bookkeeping_entry_sets: AsyncBookkeepingEntrySets) -> None: +class AsyncBookkeepingEntrySetsResourceWithStreamingResponse: + def __init__(self, bookkeeping_entry_sets: AsyncBookkeepingEntrySetsResource) -> None: self._bookkeeping_entry_sets = bookkeeping_entry_sets self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/card_disputes.py b/src/increase/resources/card_disputes.py index c32a38669..7e661452b 100644 --- a/src/increase/resources/card_disputes.py +++ b/src/increase/resources/card_disputes.py @@ -2,47 +2,69 @@ from __future__ import annotations +from typing import Iterable +from typing_extensions import Literal + import httpx -from .. import _legacy_response -from ..types import CardDispute, card_dispute_list_params, card_dispute_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, +from ..types import ( + card_dispute_list_params, + card_dispute_create_params, + card_dispute_withdraw_params, + card_dispute_submit_user_submission_params, ) +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_dispute import CardDispute -__all__ = ["CardDisputes", "AsyncCardDisputes"] +__all__ = ["CardDisputesResource", "AsyncCardDisputesResource"] -class CardDisputes(SyncAPIResource): +class CardDisputesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CardDisputesWithRawResponse: - return CardDisputesWithRawResponse(self) + def with_raw_response(self) -> CardDisputesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardDisputesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CardDisputesWithStreamingResponse: - return CardDisputesWithStreamingResponse(self) + def with_streaming_response(self) -> CardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardDisputesResourceWithStreamingResponse(self) def create( self, *, disputed_transaction_id: str, - explanation: str, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_create_params.AttachmentFile] | Omit = omit, + explanation: str | Omit = omit, + visa: card_dispute_create_params.Visa | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CardDispute: """ @@ -52,7 +74,23 @@ def create( disputed_transaction_id: The Transaction you wish to dispute. This Transaction must have a `source_type` of `card_settlement`. - explanation: Why you are disputing this Transaction. + network: The network of the disputed transaction. Details specific to the network are + required under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The monetary amount of the part of the transaction that is being disputed. This + is optional and will default to the full amount of the transaction if not + provided. If provided, the amount must be less than or equal to the amount of + the transaction. + + attachment_files: The files to be attached to the initial dispute submission. + + explanation: The free-form explanation provided to Increase to provide more context for the + user submission. This field is not sent directly to the card networks. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. extra_headers: Send extra headers @@ -69,7 +107,11 @@ def create( body=maybe_transform( { "disputed_transaction_id": disputed_transaction_id, + "network": network, + "amount": amount, + "attachment_files": attachment_files, "explanation": explanation, + "visa": visa, }, card_dispute_create_params.CardDisputeCreateParams, ), @@ -92,7 +134,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardDispute: """ Retrieve a Card Dispute @@ -111,7 +153,7 @@ def retrieve( if not card_dispute_id: raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") return self._get( - f"/card_disputes/{card_dispute_id}", + path_template("/card_disputes/{card_dispute_id}", card_dispute_id=card_dispute_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -121,17 +163,17 @@ def retrieve( def list( self, *, - created_at: card_dispute_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: card_dispute_list_params.Status | NotGiven = NOT_GIVEN, + created_at: card_dispute_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_dispute_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[CardDispute]: """ List Card Disputes @@ -177,27 +219,163 @@ def list( model=CardDispute, ) + def submit_user_submission( + self, + card_dispute_id: str, + *, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_submit_user_submission_params.AttachmentFile] | Omit = omit, + explanation: str | Omit = omit, + visa: card_dispute_submit_user_submission_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Submit a User Submission for a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to submit a user submission for. + + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The adjusted monetary amount of the part of the transaction that is being + disputed. This is optional and will default to the most recent amount provided. + If provided, the amount must be less than or equal to the amount of the + transaction. + + attachment_files: The files to be attached to the user submission. + + explanation: The free-form explanation provided to Increase to provide more context for the + user submission. This field is not sent directly to the card networks. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return self._post( + path_template("/card_disputes/{card_dispute_id}/submit_user_submission", card_dispute_id=card_dispute_id), + body=maybe_transform( + { + "network": network, + "amount": amount, + "attachment_files": attachment_files, + "explanation": explanation, + "visa": visa, + }, + card_dispute_submit_user_submission_params.CardDisputeSubmitUserSubmissionParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + def withdraw( + self, + card_dispute_id: str, + *, + explanation: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Withdraw a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to withdraw. + + explanation: The explanation for withdrawing the Card Dispute. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return self._post( + path_template("/card_disputes/{card_dispute_id}/withdraw", card_dispute_id=card_dispute_id), + body=maybe_transform({"explanation": explanation}, card_dispute_withdraw_params.CardDisputeWithdrawParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + -class AsyncCardDisputes(AsyncAPIResource): +class AsyncCardDisputesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCardDisputesWithRawResponse: - return AsyncCardDisputesWithRawResponse(self) + def with_raw_response(self) -> AsyncCardDisputesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardDisputesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCardDisputesWithStreamingResponse: - return AsyncCardDisputesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardDisputesResourceWithStreamingResponse(self) async def create( self, *, disputed_transaction_id: str, - explanation: str, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_create_params.AttachmentFile] | Omit = omit, + explanation: str | Omit = omit, + visa: card_dispute_create_params.Visa | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CardDispute: """ @@ -207,7 +385,23 @@ async def create( disputed_transaction_id: The Transaction you wish to dispute. This Transaction must have a `source_type` of `card_settlement`. - explanation: Why you are disputing this Transaction. + network: The network of the disputed transaction. Details specific to the network are + required under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The monetary amount of the part of the transaction that is being disputed. This + is optional and will default to the full amount of the transaction if not + provided. If provided, the amount must be less than or equal to the amount of + the transaction. + + attachment_files: The files to be attached to the initial dispute submission. + + explanation: The free-form explanation provided to Increase to provide more context for the + user submission. This field is not sent directly to the card networks. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. extra_headers: Send extra headers @@ -224,7 +418,11 @@ async def create( body=await async_maybe_transform( { "disputed_transaction_id": disputed_transaction_id, + "network": network, + "amount": amount, + "attachment_files": attachment_files, "explanation": explanation, + "visa": visa, }, card_dispute_create_params.CardDisputeCreateParams, ), @@ -247,7 +445,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardDispute: """ Retrieve a Card Dispute @@ -266,7 +464,7 @@ async def retrieve( if not card_dispute_id: raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") return await self._get( - f"/card_disputes/{card_dispute_id}", + path_template("/card_disputes/{card_dispute_id}", card_dispute_id=card_dispute_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -276,17 +474,17 @@ async def retrieve( def list( self, *, - created_at: card_dispute_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: card_dispute_list_params.Status | NotGiven = NOT_GIVEN, + created_at: card_dispute_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_dispute_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[CardDispute, AsyncPage[CardDispute]]: """ List Card Disputes @@ -332,39 +530,174 @@ def list( model=CardDispute, ) + async def submit_user_submission( + self, + card_dispute_id: str, + *, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_submit_user_submission_params.AttachmentFile] | Omit = omit, + explanation: str | Omit = omit, + visa: card_dispute_submit_user_submission_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Submit a User Submission for a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to submit a user submission for. + + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The adjusted monetary amount of the part of the transaction that is being + disputed. This is optional and will default to the most recent amount provided. + If provided, the amount must be less than or equal to the amount of the + transaction. + + attachment_files: The files to be attached to the user submission. + + explanation: The free-form explanation provided to Increase to provide more context for the + user submission. This field is not sent directly to the card networks. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. -class CardDisputesWithRawResponse: - def __init__(self, card_disputes: CardDisputes) -> None: + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return await self._post( + path_template("/card_disputes/{card_dispute_id}/submit_user_submission", card_dispute_id=card_dispute_id), + body=await async_maybe_transform( + { + "network": network, + "amount": amount, + "attachment_files": attachment_files, + "explanation": explanation, + "visa": visa, + }, + card_dispute_submit_user_submission_params.CardDisputeSubmitUserSubmissionParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + async def withdraw( + self, + card_dispute_id: str, + *, + explanation: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Withdraw a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to withdraw. + + explanation: The explanation for withdrawing the Card Dispute. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return await self._post( + path_template("/card_disputes/{card_dispute_id}/withdraw", card_dispute_id=card_dispute_id), + body=await async_maybe_transform( + {"explanation": explanation}, card_dispute_withdraw_params.CardDisputeWithdrawParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + +class CardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: self._card_disputes = card_disputes - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( card_disputes.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( card_disputes.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( card_disputes.list, ) + self.submit_user_submission = to_raw_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = to_raw_response_wrapper( + card_disputes.withdraw, + ) -class AsyncCardDisputesWithRawResponse: - def __init__(self, card_disputes: AsyncCardDisputes) -> None: +class AsyncCardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: self._card_disputes = card_disputes - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( card_disputes.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( card_disputes.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( card_disputes.list, ) + self.submit_user_submission = async_to_raw_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = async_to_raw_response_wrapper( + card_disputes.withdraw, + ) -class CardDisputesWithStreamingResponse: - def __init__(self, card_disputes: CardDisputes) -> None: +class CardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: self._card_disputes = card_disputes self.create = to_streamed_response_wrapper( @@ -376,10 +709,16 @@ def __init__(self, card_disputes: CardDisputes) -> None: self.list = to_streamed_response_wrapper( card_disputes.list, ) + self.submit_user_submission = to_streamed_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = to_streamed_response_wrapper( + card_disputes.withdraw, + ) -class AsyncCardDisputesWithStreamingResponse: - def __init__(self, card_disputes: AsyncCardDisputes) -> None: +class AsyncCardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: self._card_disputes = card_disputes self.create = async_to_streamed_response_wrapper( @@ -391,3 +730,9 @@ def __init__(self, card_disputes: AsyncCardDisputes) -> None: self.list = async_to_streamed_response_wrapper( card_disputes.list, ) + self.submit_user_submission = async_to_streamed_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = async_to_streamed_response_wrapper( + card_disputes.withdraw, + ) diff --git a/src/increase/resources/card_payments.py b/src/increase/resources/card_payments.py index 0b9eb221f..bfcfb162b 100644 --- a/src/increase/resources/card_payments.py +++ b/src/increase/resources/card_payments.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import CardPayment, card_payment_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import card_payment_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_payment import CardPayment -__all__ = ["CardPayments", "AsyncCardPayments"] +__all__ = ["CardPaymentsResource", "AsyncCardPaymentsResource"] -class CardPayments(SyncAPIResource): +class CardPaymentsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CardPaymentsWithRawResponse: - return CardPaymentsWithRawResponse(self) + def with_raw_response(self) -> CardPaymentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardPaymentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CardPaymentsWithStreamingResponse: - return CardPaymentsWithStreamingResponse(self) + def with_streaming_response(self) -> CardPaymentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardPaymentsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardPayment: """ Retrieve a Card Payment @@ -57,7 +70,7 @@ def retrieve( if not card_payment_id: raise ValueError(f"Expected a non-empty value for `card_payment_id` but received {card_payment_id!r}") return self._get( - f"/card_payments/{card_payment_id}", + path_template("/card_payments/{card_payment_id}", card_payment_id=card_payment_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -67,17 +80,17 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - card_id: str | NotGiven = NOT_GIVEN, - created_at: card_payment_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + card_id: str | Omit = omit, + created_at: card_payment_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[CardPayment]: """ List Card Payments @@ -123,14 +136,25 @@ def list( ) -class AsyncCardPayments(AsyncAPIResource): +class AsyncCardPaymentsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCardPaymentsWithRawResponse: - return AsyncCardPaymentsWithRawResponse(self) + def with_raw_response(self) -> AsyncCardPaymentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardPaymentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCardPaymentsWithStreamingResponse: - return AsyncCardPaymentsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCardPaymentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardPaymentsResourceWithStreamingResponse(self) async def retrieve( self, @@ -141,7 +165,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardPayment: """ Retrieve a Card Payment @@ -160,7 +184,7 @@ async def retrieve( if not card_payment_id: raise ValueError(f"Expected a non-empty value for `card_payment_id` but received {card_payment_id!r}") return await self._get( - f"/card_payments/{card_payment_id}", + path_template("/card_payments/{card_payment_id}", card_payment_id=card_payment_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,17 +194,17 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - card_id: str | NotGiven = NOT_GIVEN, - created_at: card_payment_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + card_id: str | Omit = omit, + created_at: card_payment_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[CardPayment, AsyncPage[CardPayment]]: """ List Card Payments @@ -226,32 +250,32 @@ def list( ) -class CardPaymentsWithRawResponse: - def __init__(self, card_payments: CardPayments) -> None: +class CardPaymentsResourceWithRawResponse: + def __init__(self, card_payments: CardPaymentsResource) -> None: self._card_payments = card_payments - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( card_payments.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( card_payments.list, ) -class AsyncCardPaymentsWithRawResponse: - def __init__(self, card_payments: AsyncCardPayments) -> None: +class AsyncCardPaymentsResourceWithRawResponse: + def __init__(self, card_payments: AsyncCardPaymentsResource) -> None: self._card_payments = card_payments - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( card_payments.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( card_payments.list, ) -class CardPaymentsWithStreamingResponse: - def __init__(self, card_payments: CardPayments) -> None: +class CardPaymentsResourceWithStreamingResponse: + def __init__(self, card_payments: CardPaymentsResource) -> None: self._card_payments = card_payments self.retrieve = to_streamed_response_wrapper( @@ -262,8 +286,8 @@ def __init__(self, card_payments: CardPayments) -> None: ) -class AsyncCardPaymentsWithStreamingResponse: - def __init__(self, card_payments: AsyncCardPayments) -> None: +class AsyncCardPaymentsResourceWithStreamingResponse: + def __init__(self, card_payments: AsyncCardPaymentsResource) -> None: self._card_payments = card_payments self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/card_purchase_supplements.py b/src/increase/resources/card_purchase_supplements.py index 3cffd4666..a2d954b80 100644 --- a/src/increase/resources/card_purchase_supplements.py +++ b/src/increase/resources/card_purchase_supplements.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import CardPurchaseSupplement, card_purchase_supplement_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import card_purchase_supplement_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_purchase_supplement import CardPurchaseSupplement -__all__ = ["CardPurchaseSupplements", "AsyncCardPurchaseSupplements"] +__all__ = ["CardPurchaseSupplementsResource", "AsyncCardPurchaseSupplementsResource"] -class CardPurchaseSupplements(SyncAPIResource): +class CardPurchaseSupplementsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CardPurchaseSupplementsWithRawResponse: - return CardPurchaseSupplementsWithRawResponse(self) + def with_raw_response(self) -> CardPurchaseSupplementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardPurchaseSupplementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CardPurchaseSupplementsWithStreamingResponse: - return CardPurchaseSupplementsWithStreamingResponse(self) + def with_streaming_response(self) -> CardPurchaseSupplementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardPurchaseSupplementsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardPurchaseSupplement: """ Retrieve a Card Purchase Supplement @@ -59,7 +72,10 @@ def retrieve( f"Expected a non-empty value for `card_purchase_supplement_id` but received {card_purchase_supplement_id!r}" ) return self._get( - f"/card_purchase_supplements/{card_purchase_supplement_id}", + path_template( + "/card_purchase_supplements/{card_purchase_supplement_id}", + card_purchase_supplement_id=card_purchase_supplement_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,16 +85,16 @@ def retrieve( def list( self, *, - card_payment_id: str | NotGiven = NOT_GIVEN, - created_at: card_purchase_supplement_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + card_payment_id: str | Omit = omit, + created_at: card_purchase_supplement_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[CardPurchaseSupplement]: """ List Card Purchase Supplements @@ -122,14 +138,25 @@ def list( ) -class AsyncCardPurchaseSupplements(AsyncAPIResource): +class AsyncCardPurchaseSupplementsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCardPurchaseSupplementsWithRawResponse: - return AsyncCardPurchaseSupplementsWithRawResponse(self) + def with_raw_response(self) -> AsyncCardPurchaseSupplementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardPurchaseSupplementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCardPurchaseSupplementsWithStreamingResponse: - return AsyncCardPurchaseSupplementsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCardPurchaseSupplementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardPurchaseSupplementsResourceWithStreamingResponse(self) async def retrieve( self, @@ -140,7 +167,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardPurchaseSupplement: """ Retrieve a Card Purchase Supplement @@ -161,7 +188,10 @@ async def retrieve( f"Expected a non-empty value for `card_purchase_supplement_id` but received {card_purchase_supplement_id!r}" ) return await self._get( - f"/card_purchase_supplements/{card_purchase_supplement_id}", + path_template( + "/card_purchase_supplements/{card_purchase_supplement_id}", + card_purchase_supplement_id=card_purchase_supplement_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -171,16 +201,16 @@ async def retrieve( def list( self, *, - card_payment_id: str | NotGiven = NOT_GIVEN, - created_at: card_purchase_supplement_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + card_payment_id: str | Omit = omit, + created_at: card_purchase_supplement_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[CardPurchaseSupplement, AsyncPage[CardPurchaseSupplement]]: """ List Card Purchase Supplements @@ -224,32 +254,32 @@ def list( ) -class CardPurchaseSupplementsWithRawResponse: - def __init__(self, card_purchase_supplements: CardPurchaseSupplements) -> None: +class CardPurchaseSupplementsResourceWithRawResponse: + def __init__(self, card_purchase_supplements: CardPurchaseSupplementsResource) -> None: self._card_purchase_supplements = card_purchase_supplements - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( card_purchase_supplements.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( card_purchase_supplements.list, ) -class AsyncCardPurchaseSupplementsWithRawResponse: - def __init__(self, card_purchase_supplements: AsyncCardPurchaseSupplements) -> None: +class AsyncCardPurchaseSupplementsResourceWithRawResponse: + def __init__(self, card_purchase_supplements: AsyncCardPurchaseSupplementsResource) -> None: self._card_purchase_supplements = card_purchase_supplements - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( card_purchase_supplements.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( card_purchase_supplements.list, ) -class CardPurchaseSupplementsWithStreamingResponse: - def __init__(self, card_purchase_supplements: CardPurchaseSupplements) -> None: +class CardPurchaseSupplementsResourceWithStreamingResponse: + def __init__(self, card_purchase_supplements: CardPurchaseSupplementsResource) -> None: self._card_purchase_supplements = card_purchase_supplements self.retrieve = to_streamed_response_wrapper( @@ -260,8 +290,8 @@ def __init__(self, card_purchase_supplements: CardPurchaseSupplements) -> None: ) -class AsyncCardPurchaseSupplementsWithStreamingResponse: - def __init__(self, card_purchase_supplements: AsyncCardPurchaseSupplements) -> None: +class AsyncCardPurchaseSupplementsResourceWithStreamingResponse: + def __init__(self, card_purchase_supplements: AsyncCardPurchaseSupplementsResource) -> None: self._card_purchase_supplements = card_purchase_supplements self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/card_push_transfers.py b/src/increase/resources/card_push_transfers.py new file mode 100644 index 000000000..3dc28da1b --- /dev/null +++ b/src/increase/resources/card_push_transfers.py @@ -0,0 +1,892 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..types import card_push_transfer_list_params, card_push_transfer_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_push_transfer import CardPushTransfer + +__all__ = ["CardPushTransfersResource", "AsyncCardPushTransfersResource"] + + +class CardPushTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardPushTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardPushTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardPushTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardPushTransfersResourceWithStreamingResponse(self) + + def create( + self, + *, + business_application_identifier: Literal[ + "account_to_account", + "business_to_business", + "money_transfer_bank_initiated", + "non_card_bill_payment", + "consumer_bill_payment", + "card_bill_payment", + "funds_disbursement", + "funds_transfer", + "loyalty_and_offers", + "merchant_disbursement", + "merchant_payment", + "person_to_person", + "top_up", + "wallet_transfer", + ], + card_token_id: str, + merchant_category_code: str, + merchant_city_name: str, + merchant_name: str, + merchant_name_prefix: str, + merchant_postal_code: str, + merchant_state: str, + presentment_amount: card_push_transfer_create_params.PresentmentAmount, + recipient_name: str, + sender_address_city: str, + sender_address_line1: str, + sender_address_postal_code: str, + sender_address_state: str, + sender_name: str, + source_account_number_id: str, + merchant_legal_business_name: str | Omit = omit, + merchant_street_address: str | Omit = omit, + recipient_address_city: str | Omit = omit, + recipient_address_line1: str | Omit = omit, + recipient_address_postal_code: str | Omit = omit, + recipient_address_state: str | Omit = omit, + require_approval: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPushTransfer: + """ + Create a Card Push Transfer + + Args: + business_application_identifier: The Business Application Identifier describes the type of transaction being + performed. Your program must be approved for the specified Business Application + Identifier in order to use it. + + - `account_to_account` - Account to Account + - `business_to_business` - Business to Business + - `money_transfer_bank_initiated` - Money Transfer Bank Initiated + - `non_card_bill_payment` - Non-Card Bill Payment + - `consumer_bill_payment` - Consumer Bill Payment + - `card_bill_payment` - Card Bill Payment + - `funds_disbursement` - Funds Disbursement + - `funds_transfer` - Funds Transfer + - `loyalty_and_offers` - Loyalty and Offers + - `merchant_disbursement` - Merchant Disbursement + - `merchant_payment` - Merchant Payment + - `person_to_person` - Person to Person + - `top_up` - Top Up + - `wallet_transfer` - Wallet Transfer + + card_token_id: The Increase identifier for the Card Token that represents the card number + you're pushing funds to. + + merchant_category_code: The merchant category code (MCC) of the merchant (generally your business) + sending the transfer. This is a four-digit code that describes the type of + business or service provided by the merchant. Your program must be approved for + the specified MCC in order to use it. + + merchant_city_name: The city name of the merchant (generally your business) sending the transfer. + + merchant_name: The merchant name shows up as the statement descriptor for the transfer. This is + typically the name of your business or organization. + + merchant_name_prefix: For certain Business Application Identifiers, the statement descriptor is + `merchant_name_prefix*sender_name`, where the `merchant_name_prefix` is a one to + four character prefix that identifies the merchant. + + merchant_postal_code: The postal code of the merchant (generally your business) sending the transfer. + + merchant_state: The state of the merchant (generally your business) sending the transfer. + + presentment_amount: The amount to transfer. The receiving bank will convert this to the cardholder's + currency. The amount that is applied to your Increase account matches the + currency of your account. + + recipient_name: The name of the funds recipient. + + sender_address_city: The city of the sender. + + sender_address_line1: The address line 1 of the sender. + + sender_address_postal_code: The postal code of the sender. + + sender_address_state: The state of the sender. + + sender_name: The name of the funds originator. + + source_account_number_id: The identifier of the Account Number from which to send the transfer. + + merchant_legal_business_name: The legal business name of the merchant (generally your business) sending the + transfer. Required if the card is issued in Canada. + + merchant_street_address: The street address of the merchant (generally your business) sending the + transfer. Required if the card is issued in Canada. + + recipient_address_city: The city of the recipient. Required if the card is issued in Canada. + + recipient_address_line1: The first line of the recipient's address. Required if the card is issued in + Canada. + + recipient_address_postal_code: The postal code of the recipient. Required if the card is issued in Canada. + + recipient_address_state: The state or province of the recipient. Required if the card is issued in + Canada. + + require_approval: Whether the transfer requires explicit approval via the dashboard or API. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/card_push_transfers", + body=maybe_transform( + { + "business_application_identifier": business_application_identifier, + "card_token_id": card_token_id, + "merchant_category_code": merchant_category_code, + "merchant_city_name": merchant_city_name, + "merchant_name": merchant_name, + "merchant_name_prefix": merchant_name_prefix, + "merchant_postal_code": merchant_postal_code, + "merchant_state": merchant_state, + "presentment_amount": presentment_amount, + "recipient_name": recipient_name, + "sender_address_city": sender_address_city, + "sender_address_line1": sender_address_line1, + "sender_address_postal_code": sender_address_postal_code, + "sender_address_state": sender_address_state, + "sender_name": sender_name, + "source_account_number_id": source_account_number_id, + "merchant_legal_business_name": merchant_legal_business_name, + "merchant_street_address": merchant_street_address, + "recipient_address_city": recipient_address_city, + "recipient_address_line1": recipient_address_line1, + "recipient_address_postal_code": recipient_address_postal_code, + "recipient_address_state": recipient_address_state, + "require_approval": require_approval, + }, + card_push_transfer_create_params.CardPushTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPushTransfer, + ) + + def retrieve( + self, + card_push_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardPushTransfer: + """ + Retrieve a Card Push Transfer + + Args: + card_push_transfer_id: The identifier of the Card Push Transfer. + + 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_push_transfer_id: + raise ValueError( + f"Expected a non-empty value for `card_push_transfer_id` but received {card_push_transfer_id!r}" + ) + return self._get( + path_template("/card_push_transfers/{card_push_transfer_id}", card_push_transfer_id=card_push_transfer_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardPushTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: card_push_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_push_transfer_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[CardPushTransfer]: + """ + List Card Push Transfers + + Args: + account_id: Filter Card Push Transfers to ones belonging to the specified Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/card_push_transfers", + page=SyncPage[CardPushTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + card_push_transfer_list_params.CardPushTransferListParams, + ), + ), + model=CardPushTransfer, + ) + + def approve( + self, + card_push_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPushTransfer: + """ + Approves a Card Push Transfer in a pending_approval state. + + Args: + card_push_transfer_id: The identifier of the Card Push Transfer to approve. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_push_transfer_id: + raise ValueError( + f"Expected a non-empty value for `card_push_transfer_id` but received {card_push_transfer_id!r}" + ) + return self._post( + path_template( + "/card_push_transfers/{card_push_transfer_id}/approve", card_push_transfer_id=card_push_transfer_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPushTransfer, + ) + + def cancel( + self, + card_push_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPushTransfer: + """ + Cancels a Card Push Transfer in a pending_approval state. + + Args: + card_push_transfer_id: The identifier of the pending Card Push Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_push_transfer_id: + raise ValueError( + f"Expected a non-empty value for `card_push_transfer_id` but received {card_push_transfer_id!r}" + ) + return self._post( + path_template( + "/card_push_transfers/{card_push_transfer_id}/cancel", card_push_transfer_id=card_push_transfer_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPushTransfer, + ) + + +class AsyncCardPushTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardPushTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardPushTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardPushTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardPushTransfersResourceWithStreamingResponse(self) + + async def create( + self, + *, + business_application_identifier: Literal[ + "account_to_account", + "business_to_business", + "money_transfer_bank_initiated", + "non_card_bill_payment", + "consumer_bill_payment", + "card_bill_payment", + "funds_disbursement", + "funds_transfer", + "loyalty_and_offers", + "merchant_disbursement", + "merchant_payment", + "person_to_person", + "top_up", + "wallet_transfer", + ], + card_token_id: str, + merchant_category_code: str, + merchant_city_name: str, + merchant_name: str, + merchant_name_prefix: str, + merchant_postal_code: str, + merchant_state: str, + presentment_amount: card_push_transfer_create_params.PresentmentAmount, + recipient_name: str, + sender_address_city: str, + sender_address_line1: str, + sender_address_postal_code: str, + sender_address_state: str, + sender_name: str, + source_account_number_id: str, + merchant_legal_business_name: str | Omit = omit, + merchant_street_address: str | Omit = omit, + recipient_address_city: str | Omit = omit, + recipient_address_line1: str | Omit = omit, + recipient_address_postal_code: str | Omit = omit, + recipient_address_state: str | Omit = omit, + require_approval: bool | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPushTransfer: + """ + Create a Card Push Transfer + + Args: + business_application_identifier: The Business Application Identifier describes the type of transaction being + performed. Your program must be approved for the specified Business Application + Identifier in order to use it. + + - `account_to_account` - Account to Account + - `business_to_business` - Business to Business + - `money_transfer_bank_initiated` - Money Transfer Bank Initiated + - `non_card_bill_payment` - Non-Card Bill Payment + - `consumer_bill_payment` - Consumer Bill Payment + - `card_bill_payment` - Card Bill Payment + - `funds_disbursement` - Funds Disbursement + - `funds_transfer` - Funds Transfer + - `loyalty_and_offers` - Loyalty and Offers + - `merchant_disbursement` - Merchant Disbursement + - `merchant_payment` - Merchant Payment + - `person_to_person` - Person to Person + - `top_up` - Top Up + - `wallet_transfer` - Wallet Transfer + + card_token_id: The Increase identifier for the Card Token that represents the card number + you're pushing funds to. + + merchant_category_code: The merchant category code (MCC) of the merchant (generally your business) + sending the transfer. This is a four-digit code that describes the type of + business or service provided by the merchant. Your program must be approved for + the specified MCC in order to use it. + + merchant_city_name: The city name of the merchant (generally your business) sending the transfer. + + merchant_name: The merchant name shows up as the statement descriptor for the transfer. This is + typically the name of your business or organization. + + merchant_name_prefix: For certain Business Application Identifiers, the statement descriptor is + `merchant_name_prefix*sender_name`, where the `merchant_name_prefix` is a one to + four character prefix that identifies the merchant. + + merchant_postal_code: The postal code of the merchant (generally your business) sending the transfer. + + merchant_state: The state of the merchant (generally your business) sending the transfer. + + presentment_amount: The amount to transfer. The receiving bank will convert this to the cardholder's + currency. The amount that is applied to your Increase account matches the + currency of your account. + + recipient_name: The name of the funds recipient. + + sender_address_city: The city of the sender. + + sender_address_line1: The address line 1 of the sender. + + sender_address_postal_code: The postal code of the sender. + + sender_address_state: The state of the sender. + + sender_name: The name of the funds originator. + + source_account_number_id: The identifier of the Account Number from which to send the transfer. + + merchant_legal_business_name: The legal business name of the merchant (generally your business) sending the + transfer. Required if the card is issued in Canada. + + merchant_street_address: The street address of the merchant (generally your business) sending the + transfer. Required if the card is issued in Canada. + + recipient_address_city: The city of the recipient. Required if the card is issued in Canada. + + recipient_address_line1: The first line of the recipient's address. Required if the card is issued in + Canada. + + recipient_address_postal_code: The postal code of the recipient. Required if the card is issued in Canada. + + recipient_address_state: The state or province of the recipient. Required if the card is issued in + Canada. + + require_approval: Whether the transfer requires explicit approval via the dashboard or API. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/card_push_transfers", + body=await async_maybe_transform( + { + "business_application_identifier": business_application_identifier, + "card_token_id": card_token_id, + "merchant_category_code": merchant_category_code, + "merchant_city_name": merchant_city_name, + "merchant_name": merchant_name, + "merchant_name_prefix": merchant_name_prefix, + "merchant_postal_code": merchant_postal_code, + "merchant_state": merchant_state, + "presentment_amount": presentment_amount, + "recipient_name": recipient_name, + "sender_address_city": sender_address_city, + "sender_address_line1": sender_address_line1, + "sender_address_postal_code": sender_address_postal_code, + "sender_address_state": sender_address_state, + "sender_name": sender_name, + "source_account_number_id": source_account_number_id, + "merchant_legal_business_name": merchant_legal_business_name, + "merchant_street_address": merchant_street_address, + "recipient_address_city": recipient_address_city, + "recipient_address_line1": recipient_address_line1, + "recipient_address_postal_code": recipient_address_postal_code, + "recipient_address_state": recipient_address_state, + "require_approval": require_approval, + }, + card_push_transfer_create_params.CardPushTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPushTransfer, + ) + + async def retrieve( + self, + card_push_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardPushTransfer: + """ + Retrieve a Card Push Transfer + + Args: + card_push_transfer_id: The identifier of the Card Push Transfer. + + 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_push_transfer_id: + raise ValueError( + f"Expected a non-empty value for `card_push_transfer_id` but received {card_push_transfer_id!r}" + ) + return await self._get( + path_template("/card_push_transfers/{card_push_transfer_id}", card_push_transfer_id=card_push_transfer_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardPushTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: card_push_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_push_transfer_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[CardPushTransfer, AsyncPage[CardPushTransfer]]: + """ + List Card Push Transfers + + Args: + account_id: Filter Card Push Transfers to ones belonging to the specified Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/card_push_transfers", + page=AsyncPage[CardPushTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + card_push_transfer_list_params.CardPushTransferListParams, + ), + ), + model=CardPushTransfer, + ) + + async def approve( + self, + card_push_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPushTransfer: + """ + Approves a Card Push Transfer in a pending_approval state. + + Args: + card_push_transfer_id: The identifier of the Card Push Transfer to approve. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_push_transfer_id: + raise ValueError( + f"Expected a non-empty value for `card_push_transfer_id` but received {card_push_transfer_id!r}" + ) + return await self._post( + path_template( + "/card_push_transfers/{card_push_transfer_id}/approve", card_push_transfer_id=card_push_transfer_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPushTransfer, + ) + + async def cancel( + self, + card_push_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPushTransfer: + """ + Cancels a Card Push Transfer in a pending_approval state. + + Args: + card_push_transfer_id: The identifier of the pending Card Push Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_push_transfer_id: + raise ValueError( + f"Expected a non-empty value for `card_push_transfer_id` but received {card_push_transfer_id!r}" + ) + return await self._post( + path_template( + "/card_push_transfers/{card_push_transfer_id}/cancel", card_push_transfer_id=card_push_transfer_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPushTransfer, + ) + + +class CardPushTransfersResourceWithRawResponse: + def __init__(self, card_push_transfers: CardPushTransfersResource) -> None: + self._card_push_transfers = card_push_transfers + + self.create = to_raw_response_wrapper( + card_push_transfers.create, + ) + self.retrieve = to_raw_response_wrapper( + card_push_transfers.retrieve, + ) + self.list = to_raw_response_wrapper( + card_push_transfers.list, + ) + self.approve = to_raw_response_wrapper( + card_push_transfers.approve, + ) + self.cancel = to_raw_response_wrapper( + card_push_transfers.cancel, + ) + + +class AsyncCardPushTransfersResourceWithRawResponse: + def __init__(self, card_push_transfers: AsyncCardPushTransfersResource) -> None: + self._card_push_transfers = card_push_transfers + + self.create = async_to_raw_response_wrapper( + card_push_transfers.create, + ) + self.retrieve = async_to_raw_response_wrapper( + card_push_transfers.retrieve, + ) + self.list = async_to_raw_response_wrapper( + card_push_transfers.list, + ) + self.approve = async_to_raw_response_wrapper( + card_push_transfers.approve, + ) + self.cancel = async_to_raw_response_wrapper( + card_push_transfers.cancel, + ) + + +class CardPushTransfersResourceWithStreamingResponse: + def __init__(self, card_push_transfers: CardPushTransfersResource) -> None: + self._card_push_transfers = card_push_transfers + + self.create = to_streamed_response_wrapper( + card_push_transfers.create, + ) + self.retrieve = to_streamed_response_wrapper( + card_push_transfers.retrieve, + ) + self.list = to_streamed_response_wrapper( + card_push_transfers.list, + ) + self.approve = to_streamed_response_wrapper( + card_push_transfers.approve, + ) + self.cancel = to_streamed_response_wrapper( + card_push_transfers.cancel, + ) + + +class AsyncCardPushTransfersResourceWithStreamingResponse: + def __init__(self, card_push_transfers: AsyncCardPushTransfersResource) -> None: + self._card_push_transfers = card_push_transfers + + self.create = async_to_streamed_response_wrapper( + card_push_transfers.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + card_push_transfers.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + card_push_transfers.list, + ) + self.approve = async_to_streamed_response_wrapper( + card_push_transfers.approve, + ) + self.cancel = async_to_streamed_response_wrapper( + card_push_transfers.cancel, + ) diff --git a/src/increase/resources/card_tokens.py b/src/increase/resources/card_tokens.py new file mode 100644 index 000000000..4ff453b5e --- /dev/null +++ b/src/increase/resources/card_tokens.py @@ -0,0 +1,369 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import card_token_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_token import CardToken +from ..types.card_token_capabilities import CardTokenCapabilities + +__all__ = ["CardTokensResource", "AsyncCardTokensResource"] + + +class CardTokensResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardTokensResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardTokensResourceWithStreamingResponse(self) + + def retrieve( + self, + card_token_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardToken: + """ + Retrieve a Card Token + + Args: + card_token_id: The identifier of the Card Token. + + 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_id: + raise ValueError(f"Expected a non-empty value for `card_token_id` but received {card_token_id!r}") + return self._get( + path_template("/card_tokens/{card_token_id}", card_token_id=card_token_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardToken, + ) + + def list( + self, + *, + created_at: card_token_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[CardToken]: + """ + List Card Tokens + + Args: + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/card_tokens", + page=SyncPage[CardToken], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + card_token_list_params.CardTokenListParams, + ), + ), + model=CardToken, + ) + + def capabilities( + self, + card_token_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardTokenCapabilities: + """ + The capabilities of a Card Token describe whether the card can be used for + specific operations, such as Card Push Transfers. The capabilities can change + over time based on the issuing bank's configuration of the card range. + + Args: + card_token_id: The identifier of the Card Token. + + 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_id: + raise ValueError(f"Expected a non-empty value for `card_token_id` but received {card_token_id!r}") + return self._get( + path_template("/card_tokens/{card_token_id}/capabilities", card_token_id=card_token_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardTokenCapabilities, + ) + + +class AsyncCardTokensResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardTokensResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardTokensResourceWithStreamingResponse(self) + + async def retrieve( + self, + card_token_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardToken: + """ + Retrieve a Card Token + + Args: + card_token_id: The identifier of the Card Token. + + 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_id: + raise ValueError(f"Expected a non-empty value for `card_token_id` but received {card_token_id!r}") + return await self._get( + path_template("/card_tokens/{card_token_id}", card_token_id=card_token_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardToken, + ) + + def list( + self, + *, + created_at: card_token_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[CardToken, AsyncPage[CardToken]]: + """ + List Card Tokens + + Args: + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/card_tokens", + page=AsyncPage[CardToken], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + card_token_list_params.CardTokenListParams, + ), + ), + model=CardToken, + ) + + async def capabilities( + self, + card_token_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardTokenCapabilities: + """ + The capabilities of a Card Token describe whether the card can be used for + specific operations, such as Card Push Transfers. The capabilities can change + over time based on the issuing bank's configuration of the card range. + + Args: + card_token_id: The identifier of the Card Token. + + 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_id: + raise ValueError(f"Expected a non-empty value for `card_token_id` but received {card_token_id!r}") + return await self._get( + path_template("/card_tokens/{card_token_id}/capabilities", card_token_id=card_token_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardTokenCapabilities, + ) + + +class CardTokensResourceWithRawResponse: + def __init__(self, card_tokens: CardTokensResource) -> None: + self._card_tokens = card_tokens + + self.retrieve = to_raw_response_wrapper( + card_tokens.retrieve, + ) + self.list = to_raw_response_wrapper( + card_tokens.list, + ) + self.capabilities = to_raw_response_wrapper( + card_tokens.capabilities, + ) + + +class AsyncCardTokensResourceWithRawResponse: + def __init__(self, card_tokens: AsyncCardTokensResource) -> None: + self._card_tokens = card_tokens + + self.retrieve = async_to_raw_response_wrapper( + card_tokens.retrieve, + ) + self.list = async_to_raw_response_wrapper( + card_tokens.list, + ) + self.capabilities = async_to_raw_response_wrapper( + card_tokens.capabilities, + ) + + +class CardTokensResourceWithStreamingResponse: + def __init__(self, card_tokens: CardTokensResource) -> None: + self._card_tokens = card_tokens + + self.retrieve = to_streamed_response_wrapper( + card_tokens.retrieve, + ) + self.list = to_streamed_response_wrapper( + card_tokens.list, + ) + self.capabilities = to_streamed_response_wrapper( + card_tokens.capabilities, + ) + + +class AsyncCardTokensResourceWithStreamingResponse: + def __init__(self, card_tokens: AsyncCardTokensResource) -> None: + self._card_tokens = card_tokens + + self.retrieve = async_to_streamed_response_wrapper( + card_tokens.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + card_tokens.list, + ) + self.capabilities = async_to_streamed_response_wrapper( + card_tokens.capabilities, + ) diff --git a/src/increase/resources/card_validations.py b/src/increase/resources/card_validations.py new file mode 100644 index 000000000..81841f677 --- /dev/null +++ b/src/increase/resources/card_validations.py @@ -0,0 +1,506 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import card_validation_list_params, card_validation_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_validation import CardValidation + +__all__ = ["CardValidationsResource", "AsyncCardValidationsResource"] + + +class CardValidationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardValidationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardValidationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardValidationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardValidationsResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + card_token_id: str, + merchant_category_code: str, + merchant_city_name: str, + merchant_name: str, + merchant_postal_code: str, + merchant_state: str, + cardholder_first_name: str | Omit = omit, + cardholder_last_name: str | Omit = omit, + cardholder_middle_name: str | Omit = omit, + cardholder_postal_code: str | Omit = omit, + cardholder_street_address: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardValidation: + """ + Create a Card Validation + + Args: + account_id: The identifier of the Account from which to send the validation. + + card_token_id: The Increase identifier for the Card Token that represents the card number + you're validating. + + merchant_category_code: A four-digit code (MCC) identifying the type of business or service provided by + the merchant. + + merchant_city_name: The city where the merchant (typically your business) is located. + + merchant_name: The merchant name that will appear in the cardholder’s statement descriptor. + Typically your business name. + + merchant_postal_code: The postal code for the merchant’s (typically your business’s) location. + + merchant_state: The U.S. state where the merchant (typically your business) is located. + + cardholder_first_name: The cardholder's first name. + + cardholder_last_name: The cardholder's last name. + + cardholder_middle_name: The cardholder's middle name. + + cardholder_postal_code: The postal code of the cardholder's address. + + cardholder_street_address: The cardholder's street address. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/card_validations", + body=maybe_transform( + { + "account_id": account_id, + "card_token_id": card_token_id, + "merchant_category_code": merchant_category_code, + "merchant_city_name": merchant_city_name, + "merchant_name": merchant_name, + "merchant_postal_code": merchant_postal_code, + "merchant_state": merchant_state, + "cardholder_first_name": cardholder_first_name, + "cardholder_last_name": cardholder_last_name, + "cardholder_middle_name": cardholder_middle_name, + "cardholder_postal_code": cardholder_postal_code, + "cardholder_street_address": cardholder_street_address, + }, + card_validation_create_params.CardValidationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardValidation, + ) + + def retrieve( + self, + card_validation_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardValidation: + """ + Retrieve a Card Validation + + Args: + card_validation_id: The identifier of the Card Validation. + + 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_validation_id: + raise ValueError(f"Expected a non-empty value for `card_validation_id` but received {card_validation_id!r}") + return self._get( + path_template("/card_validations/{card_validation_id}", card_validation_id=card_validation_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardValidation, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: card_validation_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_validation_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[CardValidation]: + """ + List Card Validations + + Args: + account_id: Filter Card Validations to ones belonging to the specified Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/card_validations", + page=SyncPage[CardValidation], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + card_validation_list_params.CardValidationListParams, + ), + ), + model=CardValidation, + ) + + +class AsyncCardValidationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardValidationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardValidationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardValidationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardValidationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + card_token_id: str, + merchant_category_code: str, + merchant_city_name: str, + merchant_name: str, + merchant_postal_code: str, + merchant_state: str, + cardholder_first_name: str | Omit = omit, + cardholder_last_name: str | Omit = omit, + cardholder_middle_name: str | Omit = omit, + cardholder_postal_code: str | Omit = omit, + cardholder_street_address: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardValidation: + """ + Create a Card Validation + + Args: + account_id: The identifier of the Account from which to send the validation. + + card_token_id: The Increase identifier for the Card Token that represents the card number + you're validating. + + merchant_category_code: A four-digit code (MCC) identifying the type of business or service provided by + the merchant. + + merchant_city_name: The city where the merchant (typically your business) is located. + + merchant_name: The merchant name that will appear in the cardholder’s statement descriptor. + Typically your business name. + + merchant_postal_code: The postal code for the merchant’s (typically your business’s) location. + + merchant_state: The U.S. state where the merchant (typically your business) is located. + + cardholder_first_name: The cardholder's first name. + + cardholder_last_name: The cardholder's last name. + + cardholder_middle_name: The cardholder's middle name. + + cardholder_postal_code: The postal code of the cardholder's address. + + cardholder_street_address: The cardholder's street address. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/card_validations", + body=await async_maybe_transform( + { + "account_id": account_id, + "card_token_id": card_token_id, + "merchant_category_code": merchant_category_code, + "merchant_city_name": merchant_city_name, + "merchant_name": merchant_name, + "merchant_postal_code": merchant_postal_code, + "merchant_state": merchant_state, + "cardholder_first_name": cardholder_first_name, + "cardholder_last_name": cardholder_last_name, + "cardholder_middle_name": cardholder_middle_name, + "cardholder_postal_code": cardholder_postal_code, + "cardholder_street_address": cardholder_street_address, + }, + card_validation_create_params.CardValidationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardValidation, + ) + + async def retrieve( + self, + card_validation_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> CardValidation: + """ + Retrieve a Card Validation + + Args: + card_validation_id: The identifier of the Card Validation. + + 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_validation_id: + raise ValueError(f"Expected a non-empty value for `card_validation_id` but received {card_validation_id!r}") + return await self._get( + path_template("/card_validations/{card_validation_id}", card_validation_id=card_validation_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardValidation, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: card_validation_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_validation_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[CardValidation, AsyncPage[CardValidation]]: + """ + List Card Validations + + Args: + account_id: Filter Card Validations to ones belonging to the specified Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/card_validations", + page=AsyncPage[CardValidation], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + card_validation_list_params.CardValidationListParams, + ), + ), + model=CardValidation, + ) + + +class CardValidationsResourceWithRawResponse: + def __init__(self, card_validations: CardValidationsResource) -> None: + self._card_validations = card_validations + + self.create = to_raw_response_wrapper( + card_validations.create, + ) + self.retrieve = to_raw_response_wrapper( + card_validations.retrieve, + ) + self.list = to_raw_response_wrapper( + card_validations.list, + ) + + +class AsyncCardValidationsResourceWithRawResponse: + def __init__(self, card_validations: AsyncCardValidationsResource) -> None: + self._card_validations = card_validations + + self.create = async_to_raw_response_wrapper( + card_validations.create, + ) + self.retrieve = async_to_raw_response_wrapper( + card_validations.retrieve, + ) + self.list = async_to_raw_response_wrapper( + card_validations.list, + ) + + +class CardValidationsResourceWithStreamingResponse: + def __init__(self, card_validations: CardValidationsResource) -> None: + self._card_validations = card_validations + + self.create = to_streamed_response_wrapper( + card_validations.create, + ) + self.retrieve = to_streamed_response_wrapper( + card_validations.retrieve, + ) + self.list = to_streamed_response_wrapper( + card_validations.list, + ) + + +class AsyncCardValidationsResourceWithStreamingResponse: + def __init__(self, card_validations: AsyncCardValidationsResource) -> None: + self._card_validations = card_validations + + self.create = async_to_streamed_response_wrapper( + card_validations.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + card_validations.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + card_validations.list, + ) diff --git a/src/increase/resources/cards.py b/src/increase/resources/cards.py index 36a7597ce..e39ed5225 100644 --- a/src/increase/resources/cards.py +++ b/src/increase/resources/cards.py @@ -6,48 +6,67 @@ import httpx -from .. import _legacy_response -from ..types import Card, CardDetails, card_list_params, card_create_params, card_update_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, +from ..types import ( + card_list_params, + card_create_params, + card_update_params, + card_update_pin_params, + card_create_details_iframe_params, ) +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from ..types.card import Card +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_details import CardDetails +from ..types.card_iframe_url import CardIframeURL -__all__ = ["Cards", "AsyncCards"] +__all__ = ["CardsResource", "AsyncCardsResource"] -class Cards(SyncAPIResource): +class CardsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CardsWithRawResponse: - return CardsWithRawResponse(self) + def with_raw_response(self) -> CardsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CardsWithStreamingResponse: - return CardsWithStreamingResponse(self) + def with_streaming_response(self) -> CardsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardsResourceWithStreamingResponse(self) def create( self, *, account_id: str, - billing_address: card_create_params.BillingAddress | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - digital_wallet: card_create_params.DigitalWallet | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, + authorization_controls: card_create_params.AuthorizationControls | Omit = omit, + billing_address: card_create_params.BillingAddress | Omit = omit, + description: str | Omit = omit, + digital_wallet: card_create_params.DigitalWallet | Omit = omit, + entity_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Card: """ @@ -56,6 +75,8 @@ def create( Args: account_id: The Account the card should belong to. + authorization_controls: Controls that restrict how this card can be used. + billing_address: The card's billing address. description: The description you choose to give the card. @@ -84,6 +105,7 @@ def create( body=maybe_transform( { "account_id": account_id, + "authorization_controls": authorization_controls, "billing_address": billing_address, "description": description, "digital_wallet": digital_wallet, @@ -110,7 +132,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Card: """ Retrieve a Card @@ -129,7 +151,7 @@ def retrieve( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._get( - f"/cards/{card_id}", + path_template("/cards/{card_id}", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -140,17 +162,18 @@ def update( self, card_id: str, *, - billing_address: card_update_params.BillingAddress | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - digital_wallet: card_update_params.DigitalWallet | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - status: Literal["active", "disabled", "canceled"] | NotGiven = NOT_GIVEN, + authorization_controls: card_update_params.AuthorizationControls | Omit = omit, + billing_address: card_update_params.BillingAddress | Omit = omit, + description: str | Omit = omit, + digital_wallet: card_update_params.DigitalWallet | Omit = omit, + entity_id: str | Omit = omit, + status: Literal["active", "disabled", "canceled"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Card: """ @@ -159,6 +182,8 @@ def update( Args: card_id: The card identifier. + authorization_controls: Controls that restrict how this card can be used. + billing_address: The card's updated billing address. description: The description you choose to give the card. @@ -189,9 +214,10 @@ def update( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._patch( - f"/cards/{card_id}", + path_template("/cards/{card_id}", card_id=card_id), body=maybe_transform( { + "authorization_controls": authorization_controls, "billing_address": billing_address, "description": description, "digital_wallet": digital_wallet, @@ -213,17 +239,18 @@ def update( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: card_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: card_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Card]: """ List Cards @@ -264,6 +291,7 @@ def list( "cursor": cursor, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, card_list_params.CardListParams, ), @@ -271,19 +299,72 @@ def list( model=Card, ) - def retrieve_sensitive_details( + def create_details_iframe( self, card_id: str, *, + physical_card_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardIframeURL: + """Create an iframe URL for a Card to display the card details. + + More details about + styling and usage can be found in the + [documentation](/documentation/embedded-card-component). + + Args: + card_id: The identifier of the Card to create an iframe for. + + physical_card_id: The identifier of the Physical Card to create an iframe for. This will inform + the appearance of the card rendered in the iframe. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_id: + raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") + return self._post( + path_template("/cards/{card_id}/create_details_iframe", card_id=card_id), + body=maybe_transform( + {"physical_card_id": physical_card_id}, card_create_details_iframe_params.CardCreateDetailsIframeParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardIframeURL, + ) + + def details( + self, + card_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardDetails: """ - Retrieve sensitive details for a Card + Sensitive details for a Card include the primary account number, expiry, card + verification code, and PIN. Args: card_id: The identifier of the Card to retrieve details for. @@ -299,37 +380,95 @@ def retrieve_sensitive_details( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return self._get( - f"/cards/{card_id}/details", + path_template("/cards/{card_id}/details", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=CardDetails, ) + def update_pin( + self, + card_id: str, + *, + pin: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDetails: + """ + Update a Card's PIN + + Args: + card_id: The identifier of the Card to update the PIN for. + + pin: The 4-digit PIN for the card, for use with ATMs. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_id: + raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") + return self._post( + path_template("/cards/{card_id}/update_pin", card_id=card_id), + body=maybe_transform({"pin": pin}, card_update_pin_params.CardUpdatePinParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDetails, + ) + -class AsyncCards(AsyncAPIResource): +class AsyncCardsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCardsWithRawResponse: - return AsyncCardsWithRawResponse(self) + def with_raw_response(self) -> AsyncCardsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCardsWithStreamingResponse: - return AsyncCardsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCardsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, - billing_address: card_create_params.BillingAddress | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - digital_wallet: card_create_params.DigitalWallet | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, + authorization_controls: card_create_params.AuthorizationControls | Omit = omit, + billing_address: card_create_params.BillingAddress | Omit = omit, + description: str | Omit = omit, + digital_wallet: card_create_params.DigitalWallet | Omit = omit, + entity_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Card: """ @@ -338,6 +477,8 @@ async def create( Args: account_id: The Account the card should belong to. + authorization_controls: Controls that restrict how this card can be used. + billing_address: The card's billing address. description: The description you choose to give the card. @@ -366,6 +507,7 @@ async def create( body=await async_maybe_transform( { "account_id": account_id, + "authorization_controls": authorization_controls, "billing_address": billing_address, "description": description, "digital_wallet": digital_wallet, @@ -392,7 +534,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Card: """ Retrieve a Card @@ -411,7 +553,7 @@ async def retrieve( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._get( - f"/cards/{card_id}", + path_template("/cards/{card_id}", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -422,17 +564,18 @@ async def update( self, card_id: str, *, - billing_address: card_update_params.BillingAddress | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - digital_wallet: card_update_params.DigitalWallet | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - status: Literal["active", "disabled", "canceled"] | NotGiven = NOT_GIVEN, + authorization_controls: card_update_params.AuthorizationControls | Omit = omit, + billing_address: card_update_params.BillingAddress | Omit = omit, + description: str | Omit = omit, + digital_wallet: card_update_params.DigitalWallet | Omit = omit, + entity_id: str | Omit = omit, + status: Literal["active", "disabled", "canceled"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Card: """ @@ -441,6 +584,8 @@ async def update( Args: card_id: The card identifier. + authorization_controls: Controls that restrict how this card can be used. + billing_address: The card's updated billing address. description: The description you choose to give the card. @@ -471,9 +616,10 @@ async def update( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._patch( - f"/cards/{card_id}", + path_template("/cards/{card_id}", card_id=card_id), body=await async_maybe_transform( { + "authorization_controls": authorization_controls, "billing_address": billing_address, "description": description, "digital_wallet": digital_wallet, @@ -495,17 +641,18 @@ async def update( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: card_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: card_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Card, AsyncPage[Card]]: """ List Cards @@ -546,6 +693,7 @@ def list( "cursor": cursor, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, card_list_params.CardListParams, ), @@ -553,19 +701,72 @@ def list( model=Card, ) - async def retrieve_sensitive_details( + async def create_details_iframe( self, card_id: str, *, + physical_card_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardIframeURL: + """Create an iframe URL for a Card to display the card details. + + More details about + styling and usage can be found in the + [documentation](/documentation/embedded-card-component). + + Args: + card_id: The identifier of the Card to create an iframe for. + + physical_card_id: The identifier of the Physical Card to create an iframe for. This will inform + the appearance of the card rendered in the iframe. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_id: + raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") + return await self._post( + path_template("/cards/{card_id}/create_details_iframe", card_id=card_id), + body=await async_maybe_transform( + {"physical_card_id": physical_card_id}, card_create_details_iframe_params.CardCreateDetailsIframeParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardIframeURL, + ) + + async def details( + self, + card_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CardDetails: """ - Retrieve sensitive details for a Card + Sensitive details for a Card include the primary account number, expiry, card + verification code, and PIN. Args: card_id: The identifier of the Card to retrieve details for. @@ -581,58 +782,116 @@ async def retrieve_sensitive_details( if not card_id: raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") return await self._get( - f"/cards/{card_id}/details", + path_template("/cards/{card_id}/details", card_id=card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=CardDetails, ) + async def update_pin( + self, + card_id: str, + *, + pin: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDetails: + """ + Update a Card's PIN + + Args: + card_id: The identifier of the Card to update the PIN for. + + pin: The 4-digit PIN for the card, for use with ATMs. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_id: + raise ValueError(f"Expected a non-empty value for `card_id` but received {card_id!r}") + return await self._post( + path_template("/cards/{card_id}/update_pin", card_id=card_id), + body=await async_maybe_transform({"pin": pin}, card_update_pin_params.CardUpdatePinParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDetails, + ) + -class CardsWithRawResponse: - def __init__(self, cards: Cards) -> None: +class CardsResourceWithRawResponse: + def __init__(self, cards: CardsResource) -> None: self._cards = cards - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( cards.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( cards.retrieve, ) - self.update = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( cards.update, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( cards.list, ) - self.retrieve_sensitive_details = _legacy_response.to_raw_response_wrapper( - cards.retrieve_sensitive_details, + self.create_details_iframe = to_raw_response_wrapper( + cards.create_details_iframe, + ) + self.details = to_raw_response_wrapper( + cards.details, + ) + self.update_pin = to_raw_response_wrapper( + cards.update_pin, ) -class AsyncCardsWithRawResponse: - def __init__(self, cards: AsyncCards) -> None: +class AsyncCardsResourceWithRawResponse: + def __init__(self, cards: AsyncCardsResource) -> None: self._cards = cards - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( cards.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( cards.retrieve, ) - self.update = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( cards.update, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( cards.list, ) - self.retrieve_sensitive_details = _legacy_response.async_to_raw_response_wrapper( - cards.retrieve_sensitive_details, + self.create_details_iframe = async_to_raw_response_wrapper( + cards.create_details_iframe, + ) + self.details = async_to_raw_response_wrapper( + cards.details, + ) + self.update_pin = async_to_raw_response_wrapper( + cards.update_pin, ) -class CardsWithStreamingResponse: - def __init__(self, cards: Cards) -> None: +class CardsResourceWithStreamingResponse: + def __init__(self, cards: CardsResource) -> None: self._cards = cards self.create = to_streamed_response_wrapper( @@ -647,13 +906,19 @@ def __init__(self, cards: Cards) -> None: self.list = to_streamed_response_wrapper( cards.list, ) - self.retrieve_sensitive_details = to_streamed_response_wrapper( - cards.retrieve_sensitive_details, + self.create_details_iframe = to_streamed_response_wrapper( + cards.create_details_iframe, + ) + self.details = to_streamed_response_wrapper( + cards.details, + ) + self.update_pin = to_streamed_response_wrapper( + cards.update_pin, ) -class AsyncCardsWithStreamingResponse: - def __init__(self, cards: AsyncCards) -> None: +class AsyncCardsResourceWithStreamingResponse: + def __init__(self, cards: AsyncCardsResource) -> None: self._cards = cards self.create = async_to_streamed_response_wrapper( @@ -668,6 +933,12 @@ def __init__(self, cards: AsyncCards) -> None: self.list = async_to_streamed_response_wrapper( cards.list, ) - self.retrieve_sensitive_details = async_to_streamed_response_wrapper( - cards.retrieve_sensitive_details, + self.create_details_iframe = async_to_streamed_response_wrapper( + cards.create_details_iframe, + ) + self.details = async_to_streamed_response_wrapper( + cards.details, + ) + self.update_pin = async_to_streamed_response_wrapper( + cards.update_pin, ) diff --git a/src/increase/resources/check_deposits.py b/src/increase/resources/check_deposits.py index a3c2e1899..4dcfad110 100644 --- a/src/increase/resources/check_deposits.py +++ b/src/increase/resources/check_deposits.py @@ -4,33 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import CheckDeposit, check_deposit_list_params, check_deposit_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import check_deposit_list_params, check_deposit_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.check_deposit import CheckDeposit -__all__ = ["CheckDeposits", "AsyncCheckDeposits"] +__all__ = ["CheckDepositsResource", "AsyncCheckDepositsResource"] -class CheckDeposits(SyncAPIResource): +class CheckDepositsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CheckDepositsWithRawResponse: - return CheckDepositsWithRawResponse(self) + def with_raw_response(self) -> CheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CheckDepositsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CheckDepositsWithStreamingResponse: - return CheckDepositsWithStreamingResponse(self) + def with_streaming_response(self) -> CheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CheckDepositsResourceWithStreamingResponse(self) def create( self, @@ -38,14 +48,14 @@ def create( account_id: str, amount: int, back_image_file_id: str, - currency: str, front_image_file_id: str, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """ @@ -54,15 +64,14 @@ def create( Args: account_id: The identifier for the Account to deposit the check in. - amount: The deposit amount in the minor unit of the account currency. For dollars, for - example, this is cents. + amount: The deposit amount in USD cents. back_image_file_id: The File containing the check's back image. - currency: The currency to use for the deposit. - front_image_file_id: The File containing the check's front image. + description: The description you choose to give the Check Deposit, for display purposes only. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -80,8 +89,8 @@ def create( "account_id": account_id, "amount": amount, "back_image_file_id": back_image_file_id, - "currency": currency, "front_image_file_id": front_image_file_id, + "description": description, }, check_deposit_create_params.CheckDepositCreateParams, ), @@ -104,7 +113,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckDeposit: """ Retrieve a Check Deposit @@ -123,7 +132,7 @@ def retrieve( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return self._get( - f"/check_deposits/{check_deposit_id}", + path_template("/check_deposits/{check_deposit_id}", check_deposit_id=check_deposit_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -133,17 +142,17 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: check_deposit_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: check_deposit_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[CheckDeposit]: """ List Check Deposits @@ -192,14 +201,25 @@ def list( ) -class AsyncCheckDeposits(AsyncAPIResource): +class AsyncCheckDepositsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCheckDepositsWithRawResponse: - return AsyncCheckDepositsWithRawResponse(self) + def with_raw_response(self) -> AsyncCheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCheckDepositsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCheckDepositsWithStreamingResponse: - return AsyncCheckDepositsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCheckDepositsResourceWithStreamingResponse(self) async def create( self, @@ -207,14 +227,14 @@ async def create( account_id: str, amount: int, back_image_file_id: str, - currency: str, front_image_file_id: str, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """ @@ -223,15 +243,14 @@ async def create( Args: account_id: The identifier for the Account to deposit the check in. - amount: The deposit amount in the minor unit of the account currency. For dollars, for - example, this is cents. + amount: The deposit amount in USD cents. back_image_file_id: The File containing the check's back image. - currency: The currency to use for the deposit. - front_image_file_id: The File containing the check's front image. + description: The description you choose to give the Check Deposit, for display purposes only. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -249,8 +268,8 @@ async def create( "account_id": account_id, "amount": amount, "back_image_file_id": back_image_file_id, - "currency": currency, "front_image_file_id": front_image_file_id, + "description": description, }, check_deposit_create_params.CheckDepositCreateParams, ), @@ -273,7 +292,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckDeposit: """ Retrieve a Check Deposit @@ -292,7 +311,7 @@ async def retrieve( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return await self._get( - f"/check_deposits/{check_deposit_id}", + path_template("/check_deposits/{check_deposit_id}", check_deposit_id=check_deposit_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -302,17 +321,17 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: check_deposit_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: check_deposit_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[CheckDeposit, AsyncPage[CheckDeposit]]: """ List Check Deposits @@ -361,38 +380,38 @@ def list( ) -class CheckDepositsWithRawResponse: - def __init__(self, check_deposits: CheckDeposits) -> None: +class CheckDepositsResourceWithRawResponse: + def __init__(self, check_deposits: CheckDepositsResource) -> None: self._check_deposits = check_deposits - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( check_deposits.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( check_deposits.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( check_deposits.list, ) -class AsyncCheckDepositsWithRawResponse: - def __init__(self, check_deposits: AsyncCheckDeposits) -> None: +class AsyncCheckDepositsResourceWithRawResponse: + def __init__(self, check_deposits: AsyncCheckDepositsResource) -> None: self._check_deposits = check_deposits - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( check_deposits.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( check_deposits.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( check_deposits.list, ) -class CheckDepositsWithStreamingResponse: - def __init__(self, check_deposits: CheckDeposits) -> None: +class CheckDepositsResourceWithStreamingResponse: + def __init__(self, check_deposits: CheckDepositsResource) -> None: self._check_deposits = check_deposits self.create = to_streamed_response_wrapper( @@ -406,8 +425,8 @@ def __init__(self, check_deposits: CheckDeposits) -> None: ) -class AsyncCheckDepositsWithStreamingResponse: - def __init__(self, check_deposits: AsyncCheckDeposits) -> None: +class AsyncCheckDepositsResourceWithStreamingResponse: + def __init__(self, check_deposits: AsyncCheckDepositsResource) -> None: self._check_deposits = check_deposits self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/check_transfers.py b/src/increase/resources/check_transfers.py index 58ab41c2d..4a72d6549 100644 --- a/src/increase/resources/check_transfers.py +++ b/src/increase/resources/check_transfers.py @@ -2,58 +2,69 @@ from __future__ import annotations +from typing import Union +from datetime import date from typing_extensions import Literal import httpx -from .. import _legacy_response -from ..types import ( - CheckTransfer, - check_transfer_list_params, - check_transfer_create_params, - check_transfer_stop_payment_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import check_transfer_list_params, check_transfer_create_params, check_transfer_stop_payment_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.check_transfer import CheckTransfer -__all__ = ["CheckTransfers", "AsyncCheckTransfers"] +__all__ = ["CheckTransfersResource", "AsyncCheckTransfersResource"] -class CheckTransfers(SyncAPIResource): +class CheckTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CheckTransfersWithRawResponse: - return CheckTransfersWithRawResponse(self) + def with_raw_response(self) -> CheckTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CheckTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CheckTransfersWithStreamingResponse: - return CheckTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> CheckTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CheckTransfersResourceWithStreamingResponse(self) def create( self, *, account_id: str, amount: int, + fulfillment_method: Literal["physical_check", "third_party"], source_account_number_id: str, - fulfillment_method: Literal["physical_check", "third_party"] | NotGiven = NOT_GIVEN, - physical_check: check_transfer_create_params.PhysicalCheck | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, + balance_check: Literal["full", "none"] | Omit = omit, + check_number: str | Omit = omit, + physical_check: check_transfer_create_params.PhysicalCheck | Omit = omit, + require_approval: bool | Omit = omit, + third_party: check_transfer_create_params.ThirdParty | Omit = omit, + valid_until_date: Union[str, date] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ @@ -62,10 +73,7 @@ def create( Args: account_id: The identifier for the account that will send the transfer. - amount: The transfer amount in cents. - - source_account_number_id: The identifier of the Account Number from which to send the transfer and print - on the check. + amount: The transfer amount in USD cents. fulfillment_method: Whether Increase will print and mail the check or if you will do it yourself. @@ -74,12 +82,38 @@ def create( printing and mailing a check with the provided account number, routing number, check number, and amount. + source_account_number_id: The identifier of the Account Number from which to send the transfer and print + on the check. + + balance_check: How the account's available balance should be checked. If omitted, the default + behavior is `balance_check: full`. + + - `full` - The available balance of the account must be at least the amount of + the check, and a Pending Transaction will be created for the full amount. This + is the default behavior if `balance_check` is omitted. + - `none` - No balance check will performed when the check transfer is initiated. + A zero-dollar Pending Transaction will be created. The balance will still be + checked when the Inbound Check Deposit is created. + + check_number: The check number Increase should use for the check. This should not contain + leading zeroes and must be unique across the `source_account_number`. If this is + omitted, Increase will generate a check number for you. + physical_check: Details relating to the physical check that Increase will print and mail. This is required if `fulfillment_method` is equal to `physical_check`. It must not be included if any other `fulfillment_method` is provided. require_approval: Whether the transfer requires explicit approval via the dashboard or API. + third_party: Details relating to the custom fulfillment you will perform. This is required if + `fulfillment_method` is equal to `third_party`. It must not be included if any + other `fulfillment_method` is provided. + + valid_until_date: If provided, the check will be valid on or before this date. After this date, + the check transfer will be automatically stopped and deposits will not be + accepted. For checks printed by Increase, this date is included on the check as + its expiry. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -96,10 +130,14 @@ def create( { "account_id": account_id, "amount": amount, - "source_account_number_id": source_account_number_id, "fulfillment_method": fulfillment_method, + "source_account_number_id": source_account_number_id, + "balance_check": balance_check, + "check_number": check_number, "physical_check": physical_check, "require_approval": require_approval, + "third_party": third_party, + "valid_until_date": valid_until_date, }, check_transfer_create_params.CheckTransferCreateParams, ), @@ -122,7 +160,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckTransfer: """ Retrieve a Check Transfer @@ -141,7 +179,7 @@ def retrieve( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return self._get( - f"/check_transfers/{check_transfer_id}", + path_template("/check_transfers/{check_transfer_id}", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,17 +189,18 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: check_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: check_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: check_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[CheckTransfer]: """ List Check Transfers @@ -202,6 +241,7 @@ def list( "cursor": cursor, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, check_transfer_list_params.CheckTransferListParams, ), @@ -218,7 +258,7 @@ def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ @@ -240,7 +280,7 @@ def approve( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return self._post( - f"/check_transfers/{check_transfer_id}/approve", + path_template("/check_transfers/{check_transfer_id}/approve", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -260,11 +300,13 @@ def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: - """ - Cancel a pending Check Transfer + """Cancel a Check Transfer with the `pending_approval` status. + + See + [Transfer Approvals](/documentation/transfer-approvals) for more information. Args: check_transfer_id: The identifier of the pending Check Transfer to cancel. @@ -282,7 +324,7 @@ def cancel( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return self._post( - f"/check_transfers/{check_transfer_id}/cancel", + path_template("/check_transfers/{check_transfer_id}/cancel", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -297,17 +339,17 @@ def stop_payment( self, check_transfer_id: str, *, - reason: Literal["mail_delivery_failed", "not_authorized", "unknown"] | NotGiven = NOT_GIVEN, + reason: Literal["mail_delivery_failed", "not_authorized", "valid_until_date_passed", "unknown"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ - Request a stop payment on a Check Transfer + Stop payment on a Check Transfer Args: check_transfer_id: The identifier of the Check Transfer. @@ -316,6 +358,8 @@ def stop_payment( - `mail_delivery_failed` - The check could not be delivered. - `not_authorized` - The check was not authorized. + - `valid_until_date_passed` - The check was stopped for `valid_until_date` being + in the past. - `unknown` - The check was stopped for another reason. extra_headers: Send extra headers @@ -331,7 +375,7 @@ def stop_payment( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return self._post( - f"/check_transfers/{check_transfer_id}/stop_payment", + path_template("/check_transfers/{check_transfer_id}/stop_payment", check_transfer_id=check_transfer_id), body=maybe_transform({"reason": reason}, check_transfer_stop_payment_params.CheckTransferStopPaymentParams), options=make_request_options( extra_headers=extra_headers, @@ -344,30 +388,45 @@ def stop_payment( ) -class AsyncCheckTransfers(AsyncAPIResource): +class AsyncCheckTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCheckTransfersWithRawResponse: - return AsyncCheckTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncCheckTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCheckTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCheckTransfersWithStreamingResponse: - return AsyncCheckTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCheckTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCheckTransfersResourceWithStreamingResponse(self) async def create( self, *, account_id: str, amount: int, + fulfillment_method: Literal["physical_check", "third_party"], source_account_number_id: str, - fulfillment_method: Literal["physical_check", "third_party"] | NotGiven = NOT_GIVEN, - physical_check: check_transfer_create_params.PhysicalCheck | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, + balance_check: Literal["full", "none"] | Omit = omit, + check_number: str | Omit = omit, + physical_check: check_transfer_create_params.PhysicalCheck | Omit = omit, + require_approval: bool | Omit = omit, + third_party: check_transfer_create_params.ThirdParty | Omit = omit, + valid_until_date: Union[str, date] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ @@ -376,10 +435,7 @@ async def create( Args: account_id: The identifier for the account that will send the transfer. - amount: The transfer amount in cents. - - source_account_number_id: The identifier of the Account Number from which to send the transfer and print - on the check. + amount: The transfer amount in USD cents. fulfillment_method: Whether Increase will print and mail the check or if you will do it yourself. @@ -388,12 +444,38 @@ async def create( printing and mailing a check with the provided account number, routing number, check number, and amount. + source_account_number_id: The identifier of the Account Number from which to send the transfer and print + on the check. + + balance_check: How the account's available balance should be checked. If omitted, the default + behavior is `balance_check: full`. + + - `full` - The available balance of the account must be at least the amount of + the check, and a Pending Transaction will be created for the full amount. This + is the default behavior if `balance_check` is omitted. + - `none` - No balance check will performed when the check transfer is initiated. + A zero-dollar Pending Transaction will be created. The balance will still be + checked when the Inbound Check Deposit is created. + + check_number: The check number Increase should use for the check. This should not contain + leading zeroes and must be unique across the `source_account_number`. If this is + omitted, Increase will generate a check number for you. + physical_check: Details relating to the physical check that Increase will print and mail. This is required if `fulfillment_method` is equal to `physical_check`. It must not be included if any other `fulfillment_method` is provided. require_approval: Whether the transfer requires explicit approval via the dashboard or API. + third_party: Details relating to the custom fulfillment you will perform. This is required if + `fulfillment_method` is equal to `third_party`. It must not be included if any + other `fulfillment_method` is provided. + + valid_until_date: If provided, the check will be valid on or before this date. After this date, + the check transfer will be automatically stopped and deposits will not be + accepted. For checks printed by Increase, this date is included on the check as + its expiry. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -410,10 +492,14 @@ async def create( { "account_id": account_id, "amount": amount, - "source_account_number_id": source_account_number_id, "fulfillment_method": fulfillment_method, + "source_account_number_id": source_account_number_id, + "balance_check": balance_check, + "check_number": check_number, "physical_check": physical_check, "require_approval": require_approval, + "third_party": third_party, + "valid_until_date": valid_until_date, }, check_transfer_create_params.CheckTransferCreateParams, ), @@ -436,7 +522,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> CheckTransfer: """ Retrieve a Check Transfer @@ -455,7 +541,7 @@ async def retrieve( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return await self._get( - f"/check_transfers/{check_transfer_id}", + path_template("/check_transfers/{check_transfer_id}", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -465,17 +551,18 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: check_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: check_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: check_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[CheckTransfer, AsyncPage[CheckTransfer]]: """ List Check Transfers @@ -516,6 +603,7 @@ def list( "cursor": cursor, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, check_transfer_list_params.CheckTransferListParams, ), @@ -532,7 +620,7 @@ async def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ @@ -554,7 +642,7 @@ async def approve( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return await self._post( - f"/check_transfers/{check_transfer_id}/approve", + path_template("/check_transfers/{check_transfer_id}/approve", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -574,11 +662,13 @@ async def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: - """ - Cancel a pending Check Transfer + """Cancel a Check Transfer with the `pending_approval` status. + + See + [Transfer Approvals](/documentation/transfer-approvals) for more information. Args: check_transfer_id: The identifier of the pending Check Transfer to cancel. @@ -596,7 +686,7 @@ async def cancel( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return await self._post( - f"/check_transfers/{check_transfer_id}/cancel", + path_template("/check_transfers/{check_transfer_id}/cancel", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -611,17 +701,17 @@ async def stop_payment( self, check_transfer_id: str, *, - reason: Literal["mail_delivery_failed", "not_authorized", "unknown"] | NotGiven = NOT_GIVEN, + reason: Literal["mail_delivery_failed", "not_authorized", "valid_until_date_passed", "unknown"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ - Request a stop payment on a Check Transfer + Stop payment on a Check Transfer Args: check_transfer_id: The identifier of the Check Transfer. @@ -630,6 +720,8 @@ async def stop_payment( - `mail_delivery_failed` - The check could not be delivered. - `not_authorized` - The check was not authorized. + - `valid_until_date_passed` - The check was stopped for `valid_until_date` being + in the past. - `unknown` - The check was stopped for another reason. extra_headers: Send extra headers @@ -645,7 +737,7 @@ async def stop_payment( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return await self._post( - f"/check_transfers/{check_transfer_id}/stop_payment", + path_template("/check_transfers/{check_transfer_id}/stop_payment", check_transfer_id=check_transfer_id), body=await async_maybe_transform( {"reason": reason}, check_transfer_stop_payment_params.CheckTransferStopPaymentParams ), @@ -660,56 +752,56 @@ async def stop_payment( ) -class CheckTransfersWithRawResponse: - def __init__(self, check_transfers: CheckTransfers) -> None: +class CheckTransfersResourceWithRawResponse: + def __init__(self, check_transfers: CheckTransfersResource) -> None: self._check_transfers = check_transfers - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( check_transfers.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( check_transfers.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( check_transfers.list, ) - self.approve = _legacy_response.to_raw_response_wrapper( + self.approve = to_raw_response_wrapper( check_transfers.approve, ) - self.cancel = _legacy_response.to_raw_response_wrapper( + self.cancel = to_raw_response_wrapper( check_transfers.cancel, ) - self.stop_payment = _legacy_response.to_raw_response_wrapper( + self.stop_payment = to_raw_response_wrapper( check_transfers.stop_payment, ) -class AsyncCheckTransfersWithRawResponse: - def __init__(self, check_transfers: AsyncCheckTransfers) -> None: +class AsyncCheckTransfersResourceWithRawResponse: + def __init__(self, check_transfers: AsyncCheckTransfersResource) -> None: self._check_transfers = check_transfers - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( check_transfers.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( check_transfers.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( check_transfers.list, ) - self.approve = _legacy_response.async_to_raw_response_wrapper( + self.approve = async_to_raw_response_wrapper( check_transfers.approve, ) - self.cancel = _legacy_response.async_to_raw_response_wrapper( + self.cancel = async_to_raw_response_wrapper( check_transfers.cancel, ) - self.stop_payment = _legacy_response.async_to_raw_response_wrapper( + self.stop_payment = async_to_raw_response_wrapper( check_transfers.stop_payment, ) -class CheckTransfersWithStreamingResponse: - def __init__(self, check_transfers: CheckTransfers) -> None: +class CheckTransfersResourceWithStreamingResponse: + def __init__(self, check_transfers: CheckTransfersResource) -> None: self._check_transfers = check_transfers self.create = to_streamed_response_wrapper( @@ -732,8 +824,8 @@ def __init__(self, check_transfers: CheckTransfers) -> None: ) -class AsyncCheckTransfersWithStreamingResponse: - def __init__(self, check_transfers: AsyncCheckTransfers) -> None: +class AsyncCheckTransfersResourceWithStreamingResponse: + def __init__(self, check_transfers: AsyncCheckTransfersResource) -> None: self._check_transfers = check_transfers self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/declined_transactions.py b/src/increase/resources/declined_transactions.py index 74e54e963..ca3f93ff4 100644 --- a/src/increase/resources/declined_transactions.py +++ b/src/increase/resources/declined_transactions.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import DeclinedTransaction, declined_transaction_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import declined_transaction_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.declined_transaction import DeclinedTransaction -__all__ = ["DeclinedTransactions", "AsyncDeclinedTransactions"] +__all__ = ["DeclinedTransactionsResource", "AsyncDeclinedTransactionsResource"] -class DeclinedTransactions(SyncAPIResource): +class DeclinedTransactionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DeclinedTransactionsWithRawResponse: - return DeclinedTransactionsWithRawResponse(self) + def with_raw_response(self) -> DeclinedTransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return DeclinedTransactionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DeclinedTransactionsWithStreamingResponse: - return DeclinedTransactionsWithStreamingResponse(self) + def with_streaming_response(self) -> DeclinedTransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return DeclinedTransactionsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeclinedTransaction: """ Retrieve a Declined Transaction @@ -59,7 +72,9 @@ def retrieve( f"Expected a non-empty value for `declined_transaction_id` but received {declined_transaction_id!r}" ) return self._get( - f"/declined_transactions/{declined_transaction_id}", + path_template( + "/declined_transactions/{declined_transaction_id}", declined_transaction_id=declined_transaction_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,18 +84,18 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - category: declined_transaction_list_params.Category | NotGiven = NOT_GIVEN, - created_at: declined_transaction_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - route_id: str | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + category: declined_transaction_list_params.Category | Omit = omit, + created_at: declined_transaction_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + route_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[DeclinedTransaction]: """ List Declined Transactions @@ -127,14 +142,25 @@ def list( ) -class AsyncDeclinedTransactions(AsyncAPIResource): +class AsyncDeclinedTransactionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDeclinedTransactionsWithRawResponse: - return AsyncDeclinedTransactionsWithRawResponse(self) + def with_raw_response(self) -> AsyncDeclinedTransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncDeclinedTransactionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDeclinedTransactionsWithStreamingResponse: - return AsyncDeclinedTransactionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDeclinedTransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncDeclinedTransactionsResourceWithStreamingResponse(self) async def retrieve( self, @@ -145,7 +171,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DeclinedTransaction: """ Retrieve a Declined Transaction @@ -166,7 +192,9 @@ async def retrieve( f"Expected a non-empty value for `declined_transaction_id` but received {declined_transaction_id!r}" ) return await self._get( - f"/declined_transactions/{declined_transaction_id}", + path_template( + "/declined_transactions/{declined_transaction_id}", declined_transaction_id=declined_transaction_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -176,18 +204,18 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - category: declined_transaction_list_params.Category | NotGiven = NOT_GIVEN, - created_at: declined_transaction_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - route_id: str | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + category: declined_transaction_list_params.Category | Omit = omit, + created_at: declined_transaction_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + route_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[DeclinedTransaction, AsyncPage[DeclinedTransaction]]: """ List Declined Transactions @@ -234,32 +262,32 @@ def list( ) -class DeclinedTransactionsWithRawResponse: - def __init__(self, declined_transactions: DeclinedTransactions) -> None: +class DeclinedTransactionsResourceWithRawResponse: + def __init__(self, declined_transactions: DeclinedTransactionsResource) -> None: self._declined_transactions = declined_transactions - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( declined_transactions.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( declined_transactions.list, ) -class AsyncDeclinedTransactionsWithRawResponse: - def __init__(self, declined_transactions: AsyncDeclinedTransactions) -> None: +class AsyncDeclinedTransactionsResourceWithRawResponse: + def __init__(self, declined_transactions: AsyncDeclinedTransactionsResource) -> None: self._declined_transactions = declined_transactions - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( declined_transactions.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( declined_transactions.list, ) -class DeclinedTransactionsWithStreamingResponse: - def __init__(self, declined_transactions: DeclinedTransactions) -> None: +class DeclinedTransactionsResourceWithStreamingResponse: + def __init__(self, declined_transactions: DeclinedTransactionsResource) -> None: self._declined_transactions = declined_transactions self.retrieve = to_streamed_response_wrapper( @@ -270,8 +298,8 @@ def __init__(self, declined_transactions: DeclinedTransactions) -> None: ) -class AsyncDeclinedTransactionsWithStreamingResponse: - def __init__(self, declined_transactions: AsyncDeclinedTransactions) -> None: +class AsyncDeclinedTransactionsResourceWithStreamingResponse: + def __init__(self, declined_transactions: AsyncDeclinedTransactionsResource) -> None: self._declined_transactions = declined_transactions self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/digital_card_profiles.py b/src/increase/resources/digital_card_profiles.py index 7dffaaaaf..5af05d847 100644 --- a/src/increase/resources/digital_card_profiles.py +++ b/src/increase/resources/digital_card_profiles.py @@ -4,38 +4,47 @@ import httpx -from .. import _legacy_response from ..types import ( - DigitalCardProfile, digital_card_profile_list_params, digital_card_profile_clone_params, digital_card_profile_create_params, ) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.digital_card_profile import DigitalCardProfile -__all__ = ["DigitalCardProfiles", "AsyncDigitalCardProfiles"] +__all__ = ["DigitalCardProfilesResource", "AsyncDigitalCardProfilesResource"] -class DigitalCardProfiles(SyncAPIResource): +class DigitalCardProfilesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DigitalCardProfilesWithRawResponse: - return DigitalCardProfilesWithRawResponse(self) + def with_raw_response(self) -> DigitalCardProfilesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return DigitalCardProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DigitalCardProfilesWithStreamingResponse: - return DigitalCardProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> DigitalCardProfilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return DigitalCardProfilesResourceWithStreamingResponse(self) def create( self, @@ -45,16 +54,16 @@ def create( card_description: str, description: str, issuer_name: str, - contact_email: str | NotGiven = NOT_GIVEN, - contact_phone: str | NotGiven = NOT_GIVEN, - contact_website: str | NotGiven = NOT_GIVEN, - text_color: digital_card_profile_create_params.TextColor | NotGiven = NOT_GIVEN, + contact_email: str | Omit = omit, + contact_phone: str | Omit = omit, + contact_website: str | Omit = omit, + text_color: digital_card_profile_create_params.TextColor | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalCardProfile: """ @@ -124,7 +133,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DigitalCardProfile: """ Retrieve a Digital Card Profile @@ -145,7 +154,9 @@ def retrieve( f"Expected a non-empty value for `digital_card_profile_id` but received {digital_card_profile_id!r}" ) return self._get( - f"/digital_card_profiles/{digital_card_profile_id}", + path_template( + "/digital_card_profiles/{digital_card_profile_id}", digital_card_profile_id=digital_card_profile_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -155,16 +166,16 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: digital_card_profile_list_params.Status | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: digital_card_profile_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[DigitalCardProfile]: """ List Card Profiles @@ -218,7 +229,7 @@ def archive( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalCardProfile: """ @@ -242,7 +253,10 @@ def archive( f"Expected a non-empty value for `digital_card_profile_id` but received {digital_card_profile_id!r}" ) return self._post( - f"/digital_card_profiles/{digital_card_profile_id}/archive", + path_template( + "/digital_card_profiles/{digital_card_profile_id}/archive", + digital_card_profile_id=digital_card_profile_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -257,21 +271,21 @@ def clone( self, digital_card_profile_id: str, *, - app_icon_file_id: str | NotGiven = NOT_GIVEN, - background_image_file_id: str | NotGiven = NOT_GIVEN, - card_description: str | NotGiven = NOT_GIVEN, - contact_email: str | NotGiven = NOT_GIVEN, - contact_phone: str | NotGiven = NOT_GIVEN, - contact_website: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - issuer_name: str | NotGiven = NOT_GIVEN, - text_color: digital_card_profile_clone_params.TextColor | NotGiven = NOT_GIVEN, + app_icon_file_id: str | Omit = omit, + background_image_file_id: str | Omit = omit, + card_description: str | Omit = omit, + contact_email: str | Omit = omit, + contact_phone: str | Omit = omit, + contact_website: str | Omit = omit, + description: str | Omit = omit, + issuer_name: str | Omit = omit, + text_color: digital_card_profile_clone_params.TextColor | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalCardProfile: """ @@ -313,7 +327,10 @@ def clone( f"Expected a non-empty value for `digital_card_profile_id` but received {digital_card_profile_id!r}" ) return self._post( - f"/digital_card_profiles/{digital_card_profile_id}/clone", + path_template( + "/digital_card_profiles/{digital_card_profile_id}/clone", + digital_card_profile_id=digital_card_profile_id, + ), body=maybe_transform( { "app_icon_file_id": app_icon_file_id, @@ -339,14 +356,25 @@ def clone( ) -class AsyncDigitalCardProfiles(AsyncAPIResource): +class AsyncDigitalCardProfilesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDigitalCardProfilesWithRawResponse: - return AsyncDigitalCardProfilesWithRawResponse(self) + def with_raw_response(self) -> AsyncDigitalCardProfilesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncDigitalCardProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDigitalCardProfilesWithStreamingResponse: - return AsyncDigitalCardProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDigitalCardProfilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncDigitalCardProfilesResourceWithStreamingResponse(self) async def create( self, @@ -356,16 +384,16 @@ async def create( card_description: str, description: str, issuer_name: str, - contact_email: str | NotGiven = NOT_GIVEN, - contact_phone: str | NotGiven = NOT_GIVEN, - contact_website: str | NotGiven = NOT_GIVEN, - text_color: digital_card_profile_create_params.TextColor | NotGiven = NOT_GIVEN, + contact_email: str | Omit = omit, + contact_phone: str | Omit = omit, + contact_website: str | Omit = omit, + text_color: digital_card_profile_create_params.TextColor | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalCardProfile: """ @@ -435,7 +463,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DigitalCardProfile: """ Retrieve a Digital Card Profile @@ -456,7 +484,9 @@ async def retrieve( f"Expected a non-empty value for `digital_card_profile_id` but received {digital_card_profile_id!r}" ) return await self._get( - f"/digital_card_profiles/{digital_card_profile_id}", + path_template( + "/digital_card_profiles/{digital_card_profile_id}", digital_card_profile_id=digital_card_profile_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -466,16 +496,16 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: digital_card_profile_list_params.Status | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: digital_card_profile_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[DigitalCardProfile, AsyncPage[DigitalCardProfile]]: """ List Card Profiles @@ -529,7 +559,7 @@ async def archive( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalCardProfile: """ @@ -553,7 +583,10 @@ async def archive( f"Expected a non-empty value for `digital_card_profile_id` but received {digital_card_profile_id!r}" ) return await self._post( - f"/digital_card_profiles/{digital_card_profile_id}/archive", + path_template( + "/digital_card_profiles/{digital_card_profile_id}/archive", + digital_card_profile_id=digital_card_profile_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -568,21 +601,21 @@ async def clone( self, digital_card_profile_id: str, *, - app_icon_file_id: str | NotGiven = NOT_GIVEN, - background_image_file_id: str | NotGiven = NOT_GIVEN, - card_description: str | NotGiven = NOT_GIVEN, - contact_email: str | NotGiven = NOT_GIVEN, - contact_phone: str | NotGiven = NOT_GIVEN, - contact_website: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - issuer_name: str | NotGiven = NOT_GIVEN, - text_color: digital_card_profile_clone_params.TextColor | NotGiven = NOT_GIVEN, + app_icon_file_id: str | Omit = omit, + background_image_file_id: str | Omit = omit, + card_description: str | Omit = omit, + contact_email: str | Omit = omit, + contact_phone: str | Omit = omit, + contact_website: str | Omit = omit, + description: str | Omit = omit, + issuer_name: str | Omit = omit, + text_color: digital_card_profile_clone_params.TextColor | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalCardProfile: """ @@ -624,7 +657,10 @@ async def clone( f"Expected a non-empty value for `digital_card_profile_id` but received {digital_card_profile_id!r}" ) return await self._post( - f"/digital_card_profiles/{digital_card_profile_id}/clone", + path_template( + "/digital_card_profiles/{digital_card_profile_id}/clone", + digital_card_profile_id=digital_card_profile_id, + ), body=await async_maybe_transform( { "app_icon_file_id": app_icon_file_id, @@ -650,50 +686,50 @@ async def clone( ) -class DigitalCardProfilesWithRawResponse: - def __init__(self, digital_card_profiles: DigitalCardProfiles) -> None: +class DigitalCardProfilesResourceWithRawResponse: + def __init__(self, digital_card_profiles: DigitalCardProfilesResource) -> None: self._digital_card_profiles = digital_card_profiles - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( digital_card_profiles.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( digital_card_profiles.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( digital_card_profiles.list, ) - self.archive = _legacy_response.to_raw_response_wrapper( + self.archive = to_raw_response_wrapper( digital_card_profiles.archive, ) - self.clone = _legacy_response.to_raw_response_wrapper( + self.clone = to_raw_response_wrapper( digital_card_profiles.clone, ) -class AsyncDigitalCardProfilesWithRawResponse: - def __init__(self, digital_card_profiles: AsyncDigitalCardProfiles) -> None: +class AsyncDigitalCardProfilesResourceWithRawResponse: + def __init__(self, digital_card_profiles: AsyncDigitalCardProfilesResource) -> None: self._digital_card_profiles = digital_card_profiles - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( digital_card_profiles.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( digital_card_profiles.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( digital_card_profiles.list, ) - self.archive = _legacy_response.async_to_raw_response_wrapper( + self.archive = async_to_raw_response_wrapper( digital_card_profiles.archive, ) - self.clone = _legacy_response.async_to_raw_response_wrapper( + self.clone = async_to_raw_response_wrapper( digital_card_profiles.clone, ) -class DigitalCardProfilesWithStreamingResponse: - def __init__(self, digital_card_profiles: DigitalCardProfiles) -> None: +class DigitalCardProfilesResourceWithStreamingResponse: + def __init__(self, digital_card_profiles: DigitalCardProfilesResource) -> None: self._digital_card_profiles = digital_card_profiles self.create = to_streamed_response_wrapper( @@ -713,8 +749,8 @@ def __init__(self, digital_card_profiles: DigitalCardProfiles) -> None: ) -class AsyncDigitalCardProfilesWithStreamingResponse: - def __init__(self, digital_card_profiles: AsyncDigitalCardProfiles) -> None: +class AsyncDigitalCardProfilesResourceWithStreamingResponse: + def __init__(self, digital_card_profiles: AsyncDigitalCardProfilesResource) -> None: self._digital_card_profiles = digital_card_profiles self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/digital_wallet_tokens.py b/src/increase/resources/digital_wallet_tokens.py index dff9d7e1f..bcdd713ec 100644 --- a/src/increase/resources/digital_wallet_tokens.py +++ b/src/increase/resources/digital_wallet_tokens.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import DigitalWalletToken, digital_wallet_token_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import digital_wallet_token_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.digital_wallet_token import DigitalWalletToken -__all__ = ["DigitalWalletTokens", "AsyncDigitalWalletTokens"] +__all__ = ["DigitalWalletTokensResource", "AsyncDigitalWalletTokensResource"] -class DigitalWalletTokens(SyncAPIResource): +class DigitalWalletTokensResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DigitalWalletTokensWithRawResponse: - return DigitalWalletTokensWithRawResponse(self) + def with_raw_response(self) -> DigitalWalletTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return DigitalWalletTokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DigitalWalletTokensWithStreamingResponse: - return DigitalWalletTokensWithStreamingResponse(self) + def with_streaming_response(self) -> DigitalWalletTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return DigitalWalletTokensResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DigitalWalletToken: """ Retrieve a Digital Wallet Token @@ -59,7 +72,9 @@ def retrieve( f"Expected a non-empty value for `digital_wallet_token_id` but received {digital_wallet_token_id!r}" ) return self._get( - f"/digital_wallet_tokens/{digital_wallet_token_id}", + path_template( + "/digital_wallet_tokens/{digital_wallet_token_id}", digital_wallet_token_id=digital_wallet_token_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,16 +84,16 @@ def retrieve( def list( self, *, - card_id: str | NotGiven = NOT_GIVEN, - created_at: digital_wallet_token_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + card_id: str | Omit = omit, + created_at: digital_wallet_token_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[DigitalWalletToken]: """ List Digital Wallet Tokens @@ -121,14 +136,25 @@ def list( ) -class AsyncDigitalWalletTokens(AsyncAPIResource): +class AsyncDigitalWalletTokensResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDigitalWalletTokensWithRawResponse: - return AsyncDigitalWalletTokensWithRawResponse(self) + def with_raw_response(self) -> AsyncDigitalWalletTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncDigitalWalletTokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDigitalWalletTokensWithStreamingResponse: - return AsyncDigitalWalletTokensWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDigitalWalletTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncDigitalWalletTokensResourceWithStreamingResponse(self) async def retrieve( self, @@ -139,7 +165,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> DigitalWalletToken: """ Retrieve a Digital Wallet Token @@ -160,7 +186,9 @@ async def retrieve( f"Expected a non-empty value for `digital_wallet_token_id` but received {digital_wallet_token_id!r}" ) return await self._get( - f"/digital_wallet_tokens/{digital_wallet_token_id}", + path_template( + "/digital_wallet_tokens/{digital_wallet_token_id}", digital_wallet_token_id=digital_wallet_token_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -170,16 +198,16 @@ async def retrieve( def list( self, *, - card_id: str | NotGiven = NOT_GIVEN, - created_at: digital_wallet_token_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + card_id: str | Omit = omit, + created_at: digital_wallet_token_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[DigitalWalletToken, AsyncPage[DigitalWalletToken]]: """ List Digital Wallet Tokens @@ -222,32 +250,32 @@ def list( ) -class DigitalWalletTokensWithRawResponse: - def __init__(self, digital_wallet_tokens: DigitalWalletTokens) -> None: +class DigitalWalletTokensResourceWithRawResponse: + def __init__(self, digital_wallet_tokens: DigitalWalletTokensResource) -> None: self._digital_wallet_tokens = digital_wallet_tokens - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( digital_wallet_tokens.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( digital_wallet_tokens.list, ) -class AsyncDigitalWalletTokensWithRawResponse: - def __init__(self, digital_wallet_tokens: AsyncDigitalWalletTokens) -> None: +class AsyncDigitalWalletTokensResourceWithRawResponse: + def __init__(self, digital_wallet_tokens: AsyncDigitalWalletTokensResource) -> None: self._digital_wallet_tokens = digital_wallet_tokens - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( digital_wallet_tokens.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( digital_wallet_tokens.list, ) -class DigitalWalletTokensWithStreamingResponse: - def __init__(self, digital_wallet_tokens: DigitalWalletTokens) -> None: +class DigitalWalletTokensResourceWithStreamingResponse: + def __init__(self, digital_wallet_tokens: DigitalWalletTokensResource) -> None: self._digital_wallet_tokens = digital_wallet_tokens self.retrieve = to_streamed_response_wrapper( @@ -258,8 +286,8 @@ def __init__(self, digital_wallet_tokens: DigitalWalletTokens) -> None: ) -class AsyncDigitalWalletTokensWithStreamingResponse: - def __init__(self, digital_wallet_tokens: AsyncDigitalWalletTokens) -> None: +class AsyncDigitalWalletTokensResourceWithStreamingResponse: + def __init__(self, digital_wallet_tokens: AsyncDigitalWalletTokensResource) -> None: self._digital_wallet_tokens = digital_wallet_tokens self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/documents.py b/src/increase/resources/documents.py deleted file mode 100644 index 8405fcb01..000000000 --- a/src/increase/resources/documents.py +++ /dev/null @@ -1,270 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .. import _legacy_response -from ..types import Document, document_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) - -__all__ = ["Documents", "AsyncDocuments"] - - -class Documents(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DocumentsWithRawResponse: - return DocumentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DocumentsWithStreamingResponse: - return DocumentsWithStreamingResponse(self) - - def retrieve( - self, - document_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Document: - """ - Retrieve a Document - - Args: - document_id: The identifier of the Document to retrieve. - - 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 document_id: - raise ValueError(f"Expected a non-empty value for `document_id` but received {document_id!r}") - return self._get( - f"/documents/{document_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Document, - ) - - def list( - self, - *, - category: document_list_params.Category | NotGiven = NOT_GIVEN, - created_at: document_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - limit: int | 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, - ) -> SyncPage[Document]: - """ - List Documents - - Args: - cursor: Return the page of entries after this one. - - entity_id: Filter Documents to ones belonging to the specified Entity. - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - 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 - """ - return self._get_api_list( - "/documents", - page=SyncPage[Document], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "category": category, - "created_at": created_at, - "cursor": cursor, - "entity_id": entity_id, - "limit": limit, - }, - document_list_params.DocumentListParams, - ), - ), - model=Document, - ) - - -class AsyncDocuments(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDocumentsWithRawResponse: - return AsyncDocumentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDocumentsWithStreamingResponse: - return AsyncDocumentsWithStreamingResponse(self) - - async def retrieve( - self, - document_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> Document: - """ - Retrieve a Document - - Args: - document_id: The identifier of the Document to retrieve. - - 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 document_id: - raise ValueError(f"Expected a non-empty value for `document_id` but received {document_id!r}") - return await self._get( - f"/documents/{document_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=Document, - ) - - def list( - self, - *, - category: document_list_params.Category | NotGiven = NOT_GIVEN, - created_at: document_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - limit: int | 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, - ) -> AsyncPaginator[Document, AsyncPage[Document]]: - """ - List Documents - - Args: - cursor: Return the page of entries after this one. - - entity_id: Filter Documents to ones belonging to the specified Entity. - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - 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 - """ - return self._get_api_list( - "/documents", - page=AsyncPage[Document], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "category": category, - "created_at": created_at, - "cursor": cursor, - "entity_id": entity_id, - "limit": limit, - }, - document_list_params.DocumentListParams, - ), - ), - model=Document, - ) - - -class DocumentsWithRawResponse: - def __init__(self, documents: Documents) -> None: - self._documents = documents - - self.retrieve = _legacy_response.to_raw_response_wrapper( - documents.retrieve, - ) - self.list = _legacy_response.to_raw_response_wrapper( - documents.list, - ) - - -class AsyncDocumentsWithRawResponse: - def __init__(self, documents: AsyncDocuments) -> None: - self._documents = documents - - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - documents.retrieve, - ) - self.list = _legacy_response.async_to_raw_response_wrapper( - documents.list, - ) - - -class DocumentsWithStreamingResponse: - def __init__(self, documents: Documents) -> None: - self._documents = documents - - self.retrieve = to_streamed_response_wrapper( - documents.retrieve, - ) - self.list = to_streamed_response_wrapper( - documents.list, - ) - - -class AsyncDocumentsWithStreamingResponse: - def __init__(self, documents: AsyncDocuments) -> None: - self._documents = documents - - self.retrieve = async_to_streamed_response_wrapper( - documents.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - documents.list, - ) diff --git a/src/increase/resources/entities/entities.py b/src/increase/resources/entities.py similarity index 57% rename from src/increase/resources/entities/entities.py rename to src/increase/resources/entities.py index 9c9f37dfb..e567b03e2 100644 --- a/src/increase/resources/entities/entities.py +++ b/src/increase/resources/entities.py @@ -8,93 +8,64 @@ import httpx -from ... import _legacy_response -from ...types import ( - Entity, - entity_list_params, - entity_create_params, - entity_confirm_params, - entity_update_address_params, -) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ...pagination import SyncPage, AsyncPage -from .industry_code import ( - IndustryCode, - AsyncIndustryCode, - IndustryCodeWithRawResponse, - AsyncIndustryCodeWithRawResponse, - IndustryCodeWithStreamingResponse, - AsyncIndustryCodeWithStreamingResponse, -) -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from .beneficial_owners import ( - BeneficialOwners, - AsyncBeneficialOwners, - BeneficialOwnersWithRawResponse, - AsyncBeneficialOwnersWithRawResponse, - BeneficialOwnersWithStreamingResponse, - AsyncBeneficialOwnersWithStreamingResponse, -) -from .supplemental_documents import ( - SupplementalDocuments, - AsyncSupplementalDocuments, - SupplementalDocumentsWithRawResponse, - AsyncSupplementalDocumentsWithRawResponse, - SupplementalDocumentsWithStreamingResponse, - AsyncSupplementalDocumentsWithStreamingResponse, +from ..types import entity_list_params, entity_create_params, entity_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.entity import Entity -__all__ = ["Entities", "AsyncEntities"] +__all__ = ["EntitiesResource", "AsyncEntitiesResource"] -class Entities(SyncAPIResource): +class EntitiesResource(SyncAPIResource): @cached_property - def beneficial_owners(self) -> BeneficialOwners: - return BeneficialOwners(self._client) - - @cached_property - def supplemental_documents(self) -> SupplementalDocuments: - return SupplementalDocuments(self._client) + def with_raw_response(self) -> EntitiesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. - @cached_property - def industry_code(self) -> IndustryCode: - return IndustryCode(self._client) + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return EntitiesResourceWithRawResponse(self) @cached_property - def with_raw_response(self) -> EntitiesWithRawResponse: - return EntitiesWithRawResponse(self) + def with_streaming_response(self) -> EntitiesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - @cached_property - def with_streaming_response(self) -> EntitiesWithStreamingResponse: - return EntitiesWithStreamingResponse(self) + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return EntitiesResourceWithStreamingResponse(self) def create( self, *, - structure: Literal["corporation", "natural_person", "joint", "trust"], - corporation: entity_create_params.Corporation | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - joint: entity_create_params.Joint | NotGiven = NOT_GIVEN, - natural_person: entity_create_params.NaturalPerson | NotGiven = NOT_GIVEN, - relationship: Literal["affiliated", "informational", "unaffiliated"] | NotGiven = NOT_GIVEN, - supplemental_documents: Iterable[entity_create_params.SupplementalDocument] | NotGiven = NOT_GIVEN, - trust: entity_create_params.Trust | NotGiven = NOT_GIVEN, + structure: Literal["corporation", "natural_person", "joint", "trust", "government_authority"], + corporation: entity_create_params.Corporation | Omit = omit, + description: str | Omit = omit, + government_authority: entity_create_params.GovernmentAuthority | Omit = omit, + joint: entity_create_params.Joint | Omit = omit, + natural_person: entity_create_params.NaturalPerson | Omit = omit, + risk_rating: entity_create_params.RiskRating | Omit = omit, + supplemental_documents: Iterable[entity_create_params.SupplementalDocument] | Omit = omit, + terms_agreements: Iterable[entity_create_params.TermsAgreement] | Omit = omit, + third_party_verification: entity_create_params.ThirdPartyVerification | Omit = omit, + trust: entity_create_params.Trust | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Entity: """ @@ -107,12 +78,16 @@ def create( - `natural_person` - An individual person. - `joint` - Multiple individual people. - `trust` - A trust. + - `government_authority` - A government authority. corporation: Details of the corporation entity to create. Required if `structure` is equal to `corporation`. description: The description you choose to give the entity. + government_authority: Details of the Government Authority entity to create. Required if `structure` is + equal to `government_authority`. + joint: Details of the joint entity to create. Required if `structure` is equal to `joint`. @@ -121,15 +96,18 @@ def create( `social_security_number` or `individual_taxpayer_identification_number` identification methods. - relationship: The relationship between your group and the entity. - - - `affiliated` - The entity is controlled by your group. - - `informational` - The entity is for informational purposes only. - - `unaffiliated` - The entity is not controlled by your group, but can still - directly open accounts. + risk_rating: An assessment of the entity's potential risk of involvement in financial crimes, + such as money laundering. supplemental_documents: Additional documentation associated with the entity. + terms_agreements: The terms that the Entity agreed to. Not all programs are required to submit + this data. + + third_party_verification: If you are using a third-party service for identity verification, you can use + this field to associate this Entity with the identifier that represents them in + that service. + trust: Details of the trust entity to create. Required if `structure` is equal to `trust`. @@ -150,10 +128,13 @@ def create( "structure": structure, "corporation": corporation, "description": description, + "government_authority": government_authority, "joint": joint, "natural_person": natural_person, - "relationship": relationship, + "risk_rating": risk_rating, "supplemental_documents": supplemental_documents, + "terms_agreements": terms_agreements, + "third_party_verification": third_party_verification, "trust": trust, }, entity_create_params.EntityCreateParams, @@ -177,7 +158,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Entity: """ Retrieve an Entity @@ -196,91 +177,60 @@ def retrieve( if not entity_id: raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") return self._get( - f"/entities/{entity_id}", + path_template("/entities/{entity_id}", entity_id=entity_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=Entity, ) - def list( + def update( self, + entity_id: str, *, - created_at: entity_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: entity_list_params.Status | NotGiven = NOT_GIVEN, + corporation: entity_update_params.Corporation | Omit = omit, + details_confirmed_at: Union[str, datetime] | Omit = omit, + government_authority: entity_update_params.GovernmentAuthority | Omit = omit, + natural_person: entity_update_params.NaturalPerson | Omit = omit, + risk_rating: entity_update_params.RiskRating | Omit = omit, + third_party_verification: entity_update_params.ThirdPartyVerification | Omit = omit, + trust: entity_update_params.Trust | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncPage[Entity]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Entity: """ - List Entities + Update an Entity Args: - cursor: Return the page of entries after this one. + entity_id: The entity identifier. - idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for - that object. This value is unique across Increase and is used to ensure that a - request is only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). + corporation: Details of the corporation entity to update. If you specify this parameter and + the entity is not a corporation, the request will fail. - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. + details_confirmed_at: When your user last confirmed the Entity's details. Depending on your program, + you may be required to affirmatively confirm details with your users on an + annual basis. - extra_headers: Send extra headers + government_authority: Details of the government authority entity to update. If you specify this + parameter and the entity is not a government authority, the request will fail. - extra_query: Add additional query parameters to the request + natural_person: Details of the natural person entity to update. If you specify this parameter + and the entity is not a natural person, the request will fail. - extra_body: Add additional JSON properties to the request + risk_rating: An assessment of the entity’s potential risk of involvement in financial crimes, + such as money laundering. - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/entities", - page=SyncPage[Entity], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "created_at": created_at, - "cursor": cursor, - "idempotency_key": idempotency_key, - "limit": limit, - "status": status, - }, - entity_list_params.EntityListParams, - ), - ), - model=Entity, - ) + third_party_verification: If you are using a third-party service for identity verification, you can use + this field to associate this Entity with the identifier that represents them in + that service. - def archive( - self, - entity_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """Archive an Entity - - Args: - entity_id: The identifier of the Entity to archive. - - Any accounts associated with an entity - must be closed before the entity can be archived. + trust: Details of the trust entity to update. If you specify this parameter and the + entity is not a trust, the request will fail. extra_headers: Send extra headers @@ -294,8 +244,20 @@ def archive( """ if not entity_id: raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") - return self._post( - f"/entities/{entity_id}/archive", + return self._patch( + path_template("/entities/{entity_id}", entity_id=entity_id), + body=maybe_transform( + { + "corporation": corporation, + "details_confirmed_at": details_confirmed_at, + "government_authority": government_authority, + "natural_person": natural_person, + "risk_rating": risk_rating, + "third_party_verification": third_party_verification, + "trust": trust, + }, + entity_update_params.EntityUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -306,29 +268,34 @@ def archive( cast_to=Entity, ) - def confirm( + def list( self, - entity_id: str, *, - confirmed_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + created_at: entity_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: entity_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[Entity]: """ - Depending on your program, you may be required to re-confirm an Entity's details - on a recurring basis. After making any required updates, call this endpoint to - record that your user confirmed their details. + List Entities Args: - entity_id: The identifier of the Entity to confirm the details of. + cursor: Return the page of entries after this one. - confirmed_at: When your user confirmed the Entity's details. If not provided, the current time - will be used. + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. extra_headers: Send extra headers @@ -337,45 +304,48 @@ def confirm( extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds - - idempotency_key: Specify a custom idempotency key for this request """ - if not entity_id: - raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") - return self._post( - f"/entities/{entity_id}/confirm", - body=maybe_transform({"confirmed_at": confirmed_at}, entity_confirm_params.EntityConfirmParams), + return self._get_api_list( + "/entities", + page=SyncPage[Entity], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - idempotency_key=idempotency_key, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + entity_list_params.EntityListParams, + ), ), - cast_to=Entity, + model=Entity, ) - def update_address( + def archive( self, entity_id: str, *, - address: entity_update_address_params.Address, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Entity: - """ - Update a Natural Person or Corporation's address + """Archive an Entity Args: entity_id: The identifier of the Entity to archive. - address: The entity's physical address. Mail receiving locations like PO Boxes and PMB's - are disallowed. + Any accounts associated with an entity + must be closed before the entity can be archived. extra_headers: Send extra headers @@ -390,8 +360,7 @@ def update_address( if not entity_id: raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") return self._post( - f"/entities/{entity_id}/address", - body=maybe_transform({"address": address}, entity_update_address_params.EntityUpdateAddressParams), + path_template("/entities/{entity_id}/archive", entity_id=entity_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -403,44 +372,46 @@ def update_address( ) -class AsyncEntities(AsyncAPIResource): +class AsyncEntitiesResource(AsyncAPIResource): @cached_property - def beneficial_owners(self) -> AsyncBeneficialOwners: - return AsyncBeneficialOwners(self._client) - - @cached_property - def supplemental_documents(self) -> AsyncSupplementalDocuments: - return AsyncSupplementalDocuments(self._client) + def with_raw_response(self) -> AsyncEntitiesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. - @cached_property - def industry_code(self) -> AsyncIndustryCode: - return AsyncIndustryCode(self._client) + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncEntitiesResourceWithRawResponse(self) @cached_property - def with_raw_response(self) -> AsyncEntitiesWithRawResponse: - return AsyncEntitiesWithRawResponse(self) + def with_streaming_response(self) -> AsyncEntitiesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - @cached_property - def with_streaming_response(self) -> AsyncEntitiesWithStreamingResponse: - return AsyncEntitiesWithStreamingResponse(self) + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncEntitiesResourceWithStreamingResponse(self) async def create( self, *, - structure: Literal["corporation", "natural_person", "joint", "trust"], - corporation: entity_create_params.Corporation | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - joint: entity_create_params.Joint | NotGiven = NOT_GIVEN, - natural_person: entity_create_params.NaturalPerson | NotGiven = NOT_GIVEN, - relationship: Literal["affiliated", "informational", "unaffiliated"] | NotGiven = NOT_GIVEN, - supplemental_documents: Iterable[entity_create_params.SupplementalDocument] | NotGiven = NOT_GIVEN, - trust: entity_create_params.Trust | NotGiven = NOT_GIVEN, + structure: Literal["corporation", "natural_person", "joint", "trust", "government_authority"], + corporation: entity_create_params.Corporation | Omit = omit, + description: str | Omit = omit, + government_authority: entity_create_params.GovernmentAuthority | Omit = omit, + joint: entity_create_params.Joint | Omit = omit, + natural_person: entity_create_params.NaturalPerson | Omit = omit, + risk_rating: entity_create_params.RiskRating | Omit = omit, + supplemental_documents: Iterable[entity_create_params.SupplementalDocument] | Omit = omit, + terms_agreements: Iterable[entity_create_params.TermsAgreement] | Omit = omit, + third_party_verification: entity_create_params.ThirdPartyVerification | Omit = omit, + trust: entity_create_params.Trust | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Entity: """ @@ -453,12 +424,16 @@ async def create( - `natural_person` - An individual person. - `joint` - Multiple individual people. - `trust` - A trust. + - `government_authority` - A government authority. corporation: Details of the corporation entity to create. Required if `structure` is equal to `corporation`. description: The description you choose to give the entity. + government_authority: Details of the Government Authority entity to create. Required if `structure` is + equal to `government_authority`. + joint: Details of the joint entity to create. Required if `structure` is equal to `joint`. @@ -467,15 +442,18 @@ async def create( `social_security_number` or `individual_taxpayer_identification_number` identification methods. - relationship: The relationship between your group and the entity. - - - `affiliated` - The entity is controlled by your group. - - `informational` - The entity is for informational purposes only. - - `unaffiliated` - The entity is not controlled by your group, but can still - directly open accounts. + risk_rating: An assessment of the entity's potential risk of involvement in financial crimes, + such as money laundering. supplemental_documents: Additional documentation associated with the entity. + terms_agreements: The terms that the Entity agreed to. Not all programs are required to submit + this data. + + third_party_verification: If you are using a third-party service for identity verification, you can use + this field to associate this Entity with the identifier that represents them in + that service. + trust: Details of the trust entity to create. Required if `structure` is equal to `trust`. @@ -496,10 +474,13 @@ async def create( "structure": structure, "corporation": corporation, "description": description, + "government_authority": government_authority, "joint": joint, "natural_person": natural_person, - "relationship": relationship, + "risk_rating": risk_rating, "supplemental_documents": supplemental_documents, + "terms_agreements": terms_agreements, + "third_party_verification": third_party_verification, "trust": trust, }, entity_create_params.EntityCreateParams, @@ -523,7 +504,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Entity: """ Retrieve an Entity @@ -542,91 +523,60 @@ async def retrieve( if not entity_id: raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") return await self._get( - f"/entities/{entity_id}", + path_template("/entities/{entity_id}", entity_id=entity_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), cast_to=Entity, ) - def list( + async def update( self, + entity_id: str, *, - created_at: entity_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: entity_list_params.Status | NotGiven = NOT_GIVEN, + corporation: entity_update_params.Corporation | Omit = omit, + details_confirmed_at: Union[str, datetime] | Omit = omit, + government_authority: entity_update_params.GovernmentAuthority | Omit = omit, + natural_person: entity_update_params.NaturalPerson | Omit = omit, + risk_rating: entity_update_params.RiskRating | Omit = omit, + third_party_verification: entity_update_params.ThirdPartyVerification | Omit = omit, + trust: entity_update_params.Trust | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[Entity, AsyncPage[Entity]]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Entity: """ - List Entities + Update an Entity Args: - cursor: Return the page of entries after this one. + entity_id: The entity identifier. - idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for - that object. This value is unique across Increase and is used to ensure that a - request is only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). + corporation: Details of the corporation entity to update. If you specify this parameter and + the entity is not a corporation, the request will fail. - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. + details_confirmed_at: When your user last confirmed the Entity's details. Depending on your program, + you may be required to affirmatively confirm details with your users on an + annual basis. - extra_headers: Send extra headers + government_authority: Details of the government authority entity to update. If you specify this + parameter and the entity is not a government authority, the request will fail. - extra_query: Add additional query parameters to the request + natural_person: Details of the natural person entity to update. If you specify this parameter + and the entity is not a natural person, the request will fail. - extra_body: Add additional JSON properties to the request + risk_rating: An assessment of the entity’s potential risk of involvement in financial crimes, + such as money laundering. - timeout: Override the client-level default timeout for this request, in seconds - """ - return self._get_api_list( - "/entities", - page=AsyncPage[Entity], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "created_at": created_at, - "cursor": cursor, - "idempotency_key": idempotency_key, - "limit": limit, - "status": status, - }, - entity_list_params.EntityListParams, - ), - ), - model=Entity, - ) + third_party_verification: If you are using a third-party service for identity verification, you can use + this field to associate this Entity with the identifier that represents them in + that service. - async def archive( - self, - entity_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """Archive an Entity - - Args: - entity_id: The identifier of the Entity to archive. - - Any accounts associated with an entity - must be closed before the entity can be archived. + trust: Details of the trust entity to update. If you specify this parameter and the + entity is not a trust, the request will fail. extra_headers: Send extra headers @@ -640,8 +590,20 @@ async def archive( """ if not entity_id: raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") - return await self._post( - f"/entities/{entity_id}/archive", + return await self._patch( + path_template("/entities/{entity_id}", entity_id=entity_id), + body=await async_maybe_transform( + { + "corporation": corporation, + "details_confirmed_at": details_confirmed_at, + "government_authority": government_authority, + "natural_person": natural_person, + "risk_rating": risk_rating, + "third_party_verification": third_party_verification, + "trust": trust, + }, + entity_update_params.EntityUpdateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -652,29 +614,34 @@ async def archive( cast_to=Entity, ) - async def confirm( + def list( self, - entity_id: str, *, - confirmed_at: Union[str, datetime] | NotGiven = NOT_GIVEN, + created_at: entity_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: entity_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[Entity, AsyncPage[Entity]]: """ - Depending on your program, you may be required to re-confirm an Entity's details - on a recurring basis. After making any required updates, call this endpoint to - record that your user confirmed their details. + List Entities Args: - entity_id: The identifier of the Entity to confirm the details of. + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). - confirmed_at: When your user confirmed the Entity's details. If not provided, the current time - will be used. + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. extra_headers: Send extra headers @@ -683,45 +650,48 @@ async def confirm( extra_body: Add additional JSON properties to the request timeout: Override the client-level default timeout for this request, in seconds - - idempotency_key: Specify a custom idempotency key for this request """ - if not entity_id: - raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") - return await self._post( - f"/entities/{entity_id}/confirm", - body=await async_maybe_transform({"confirmed_at": confirmed_at}, entity_confirm_params.EntityConfirmParams), + return self._get_api_list( + "/entities", + page=AsyncPage[Entity], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout, - idempotency_key=idempotency_key, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + entity_list_params.EntityListParams, + ), ), - cast_to=Entity, + model=Entity, ) - async def update_address( + async def archive( self, entity_id: str, *, - address: entity_update_address_params.Address, # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Entity: - """ - Update a Natural Person or Corporation's address + """Archive an Entity Args: entity_id: The identifier of the Entity to archive. - address: The entity's physical address. Mail receiving locations like PO Boxes and PMB's - are disallowed. + Any accounts associated with an entity + must be closed before the entity can be archived. extra_headers: Send extra headers @@ -736,10 +706,7 @@ async def update_address( if not entity_id: raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") return await self._post( - f"/entities/{entity_id}/address", - body=await async_maybe_transform( - {"address": address}, entity_update_address_params.EntityUpdateAddressParams - ), + path_template("/entities/{entity_id}/archive", entity_id=entity_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -751,80 +718,50 @@ async def update_address( ) -class EntitiesWithRawResponse: - def __init__(self, entities: Entities) -> None: +class EntitiesResourceWithRawResponse: + def __init__(self, entities: EntitiesResource) -> None: self._entities = entities - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( entities.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( entities.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( + entities.update, + ) + self.list = to_raw_response_wrapper( entities.list, ) - self.archive = _legacy_response.to_raw_response_wrapper( + self.archive = to_raw_response_wrapper( entities.archive, ) - self.confirm = _legacy_response.to_raw_response_wrapper( - entities.confirm, - ) - self.update_address = _legacy_response.to_raw_response_wrapper( - entities.update_address, - ) - @cached_property - def beneficial_owners(self) -> BeneficialOwnersWithRawResponse: - return BeneficialOwnersWithRawResponse(self._entities.beneficial_owners) - @cached_property - def supplemental_documents(self) -> SupplementalDocumentsWithRawResponse: - return SupplementalDocumentsWithRawResponse(self._entities.supplemental_documents) - - @cached_property - def industry_code(self) -> IndustryCodeWithRawResponse: - return IndustryCodeWithRawResponse(self._entities.industry_code) - - -class AsyncEntitiesWithRawResponse: - def __init__(self, entities: AsyncEntities) -> None: +class AsyncEntitiesResourceWithRawResponse: + def __init__(self, entities: AsyncEntitiesResource) -> None: self._entities = entities - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( entities.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( entities.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( + entities.update, + ) + self.list = async_to_raw_response_wrapper( entities.list, ) - self.archive = _legacy_response.async_to_raw_response_wrapper( + self.archive = async_to_raw_response_wrapper( entities.archive, ) - self.confirm = _legacy_response.async_to_raw_response_wrapper( - entities.confirm, - ) - self.update_address = _legacy_response.async_to_raw_response_wrapper( - entities.update_address, - ) - - @cached_property - def beneficial_owners(self) -> AsyncBeneficialOwnersWithRawResponse: - return AsyncBeneficialOwnersWithRawResponse(self._entities.beneficial_owners) - - @cached_property - def supplemental_documents(self) -> AsyncSupplementalDocumentsWithRawResponse: - return AsyncSupplementalDocumentsWithRawResponse(self._entities.supplemental_documents) - - @cached_property - def industry_code(self) -> AsyncIndustryCodeWithRawResponse: - return AsyncIndustryCodeWithRawResponse(self._entities.industry_code) -class EntitiesWithStreamingResponse: - def __init__(self, entities: Entities) -> None: +class EntitiesResourceWithStreamingResponse: + def __init__(self, entities: EntitiesResource) -> None: self._entities = entities self.create = to_streamed_response_wrapper( @@ -833,34 +770,19 @@ def __init__(self, entities: Entities) -> None: self.retrieve = to_streamed_response_wrapper( entities.retrieve, ) + self.update = to_streamed_response_wrapper( + entities.update, + ) self.list = to_streamed_response_wrapper( entities.list, ) self.archive = to_streamed_response_wrapper( entities.archive, ) - self.confirm = to_streamed_response_wrapper( - entities.confirm, - ) - self.update_address = to_streamed_response_wrapper( - entities.update_address, - ) - @cached_property - def beneficial_owners(self) -> BeneficialOwnersWithStreamingResponse: - return BeneficialOwnersWithStreamingResponse(self._entities.beneficial_owners) - - @cached_property - def supplemental_documents(self) -> SupplementalDocumentsWithStreamingResponse: - return SupplementalDocumentsWithStreamingResponse(self._entities.supplemental_documents) - @cached_property - def industry_code(self) -> IndustryCodeWithStreamingResponse: - return IndustryCodeWithStreamingResponse(self._entities.industry_code) - - -class AsyncEntitiesWithStreamingResponse: - def __init__(self, entities: AsyncEntities) -> None: +class AsyncEntitiesResourceWithStreamingResponse: + def __init__(self, entities: AsyncEntitiesResource) -> None: self._entities = entities self.create = async_to_streamed_response_wrapper( @@ -869,27 +791,12 @@ def __init__(self, entities: AsyncEntities) -> None: self.retrieve = async_to_streamed_response_wrapper( entities.retrieve, ) + self.update = async_to_streamed_response_wrapper( + entities.update, + ) self.list = async_to_streamed_response_wrapper( entities.list, ) self.archive = async_to_streamed_response_wrapper( entities.archive, ) - self.confirm = async_to_streamed_response_wrapper( - entities.confirm, - ) - self.update_address = async_to_streamed_response_wrapper( - entities.update_address, - ) - - @cached_property - def beneficial_owners(self) -> AsyncBeneficialOwnersWithStreamingResponse: - return AsyncBeneficialOwnersWithStreamingResponse(self._entities.beneficial_owners) - - @cached_property - def supplemental_documents(self) -> AsyncSupplementalDocumentsWithStreamingResponse: - return AsyncSupplementalDocumentsWithStreamingResponse(self._entities.supplemental_documents) - - @cached_property - def industry_code(self) -> AsyncIndustryCodeWithStreamingResponse: - return AsyncIndustryCodeWithStreamingResponse(self._entities.industry_code) diff --git a/src/increase/resources/entities/__init__.py b/src/increase/resources/entities/__init__.py deleted file mode 100644 index 67780ab76..000000000 --- a/src/increase/resources/entities/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .entities import ( - Entities, - AsyncEntities, - EntitiesWithRawResponse, - AsyncEntitiesWithRawResponse, - EntitiesWithStreamingResponse, - AsyncEntitiesWithStreamingResponse, -) -from .industry_code import ( - IndustryCode, - AsyncIndustryCode, - IndustryCodeWithRawResponse, - AsyncIndustryCodeWithRawResponse, - IndustryCodeWithStreamingResponse, - AsyncIndustryCodeWithStreamingResponse, -) -from .beneficial_owners import ( - BeneficialOwners, - AsyncBeneficialOwners, - BeneficialOwnersWithRawResponse, - AsyncBeneficialOwnersWithRawResponse, - BeneficialOwnersWithStreamingResponse, - AsyncBeneficialOwnersWithStreamingResponse, -) -from .supplemental_documents import ( - SupplementalDocuments, - AsyncSupplementalDocuments, - SupplementalDocumentsWithRawResponse, - AsyncSupplementalDocumentsWithRawResponse, - SupplementalDocumentsWithStreamingResponse, - AsyncSupplementalDocumentsWithStreamingResponse, -) - -__all__ = [ - "BeneficialOwners", - "AsyncBeneficialOwners", - "BeneficialOwnersWithRawResponse", - "AsyncBeneficialOwnersWithRawResponse", - "BeneficialOwnersWithStreamingResponse", - "AsyncBeneficialOwnersWithStreamingResponse", - "SupplementalDocuments", - "AsyncSupplementalDocuments", - "SupplementalDocumentsWithRawResponse", - "AsyncSupplementalDocumentsWithRawResponse", - "SupplementalDocumentsWithStreamingResponse", - "AsyncSupplementalDocumentsWithStreamingResponse", - "IndustryCode", - "AsyncIndustryCode", - "IndustryCodeWithRawResponse", - "AsyncIndustryCodeWithRawResponse", - "IndustryCodeWithStreamingResponse", - "AsyncIndustryCodeWithStreamingResponse", - "Entities", - "AsyncEntities", - "EntitiesWithRawResponse", - "AsyncEntitiesWithRawResponse", - "EntitiesWithStreamingResponse", - "AsyncEntitiesWithStreamingResponse", -] diff --git a/src/increase/resources/entities/beneficial_owners.py b/src/increase/resources/entities/beneficial_owners.py deleted file mode 100644 index c31714ab3..000000000 --- a/src/increase/resources/entities/beneficial_owners.py +++ /dev/null @@ -1,422 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ... import _legacy_response -from ...types import Entity -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) -from ...types.entities import ( - beneficial_owner_create_params, - beneficial_owner_archive_params, - beneficial_owner_update_address_params, -) - -__all__ = ["BeneficialOwners", "AsyncBeneficialOwners"] - - -class BeneficialOwners(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BeneficialOwnersWithRawResponse: - return BeneficialOwnersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BeneficialOwnersWithStreamingResponse: - return BeneficialOwnersWithStreamingResponse(self) - - def create( - self, - *, - beneficial_owner: beneficial_owner_create_params.BeneficialOwner, - entity_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Create a beneficial owner for a corporate Entity - - Args: - beneficial_owner: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - entity_id: The identifier of the Entity to associate with the new Beneficial Owner. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/entity_beneficial_owners", - body=maybe_transform( - { - "beneficial_owner": beneficial_owner, - "entity_id": entity_id, - }, - beneficial_owner_create_params.BeneficialOwnerCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - def archive( - self, - *, - beneficial_owner_id: str, - entity_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Archive a beneficial owner for a corporate Entity - - Args: - beneficial_owner_id: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - entity_id: The identifier of the Entity to retrieve. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/entity_beneficial_owners/archive", - body=maybe_transform( - { - "beneficial_owner_id": beneficial_owner_id, - "entity_id": entity_id, - }, - beneficial_owner_archive_params.BeneficialOwnerArchiveParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - def update_address( - self, - *, - address: beneficial_owner_update_address_params.Address, - beneficial_owner_id: str, - entity_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Update the address for a beneficial owner belonging to a corporate Entity - - Args: - address: The individual's physical address. Mail receiving locations like PO Boxes and - PMB's are disallowed. - - beneficial_owner_id: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - entity_id: The identifier of the Entity to retrieve. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/entity_beneficial_owners/address", - body=maybe_transform( - { - "address": address, - "beneficial_owner_id": beneficial_owner_id, - "entity_id": entity_id, - }, - beneficial_owner_update_address_params.BeneficialOwnerUpdateAddressParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - -class AsyncBeneficialOwners(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBeneficialOwnersWithRawResponse: - return AsyncBeneficialOwnersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBeneficialOwnersWithStreamingResponse: - return AsyncBeneficialOwnersWithStreamingResponse(self) - - async def create( - self, - *, - beneficial_owner: beneficial_owner_create_params.BeneficialOwner, - entity_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Create a beneficial owner for a corporate Entity - - Args: - beneficial_owner: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - entity_id: The identifier of the Entity to associate with the new Beneficial Owner. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/entity_beneficial_owners", - body=await async_maybe_transform( - { - "beneficial_owner": beneficial_owner, - "entity_id": entity_id, - }, - beneficial_owner_create_params.BeneficialOwnerCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - async def archive( - self, - *, - beneficial_owner_id: str, - entity_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Archive a beneficial owner for a corporate Entity - - Args: - beneficial_owner_id: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - entity_id: The identifier of the Entity to retrieve. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/entity_beneficial_owners/archive", - body=await async_maybe_transform( - { - "beneficial_owner_id": beneficial_owner_id, - "entity_id": entity_id, - }, - beneficial_owner_archive_params.BeneficialOwnerArchiveParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - async def update_address( - self, - *, - address: beneficial_owner_update_address_params.Address, - beneficial_owner_id: str, - entity_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Update the address for a beneficial owner belonging to a corporate Entity - - Args: - address: The individual's physical address. Mail receiving locations like PO Boxes and - PMB's are disallowed. - - beneficial_owner_id: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - entity_id: The identifier of the Entity to retrieve. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/entity_beneficial_owners/address", - body=await async_maybe_transform( - { - "address": address, - "beneficial_owner_id": beneficial_owner_id, - "entity_id": entity_id, - }, - beneficial_owner_update_address_params.BeneficialOwnerUpdateAddressParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - -class BeneficialOwnersWithRawResponse: - def __init__(self, beneficial_owners: BeneficialOwners) -> None: - self._beneficial_owners = beneficial_owners - - self.create = _legacy_response.to_raw_response_wrapper( - beneficial_owners.create, - ) - self.archive = _legacy_response.to_raw_response_wrapper( - beneficial_owners.archive, - ) - self.update_address = _legacy_response.to_raw_response_wrapper( - beneficial_owners.update_address, - ) - - -class AsyncBeneficialOwnersWithRawResponse: - def __init__(self, beneficial_owners: AsyncBeneficialOwners) -> None: - self._beneficial_owners = beneficial_owners - - self.create = _legacy_response.async_to_raw_response_wrapper( - beneficial_owners.create, - ) - self.archive = _legacy_response.async_to_raw_response_wrapper( - beneficial_owners.archive, - ) - self.update_address = _legacy_response.async_to_raw_response_wrapper( - beneficial_owners.update_address, - ) - - -class BeneficialOwnersWithStreamingResponse: - def __init__(self, beneficial_owners: BeneficialOwners) -> None: - self._beneficial_owners = beneficial_owners - - self.create = to_streamed_response_wrapper( - beneficial_owners.create, - ) - self.archive = to_streamed_response_wrapper( - beneficial_owners.archive, - ) - self.update_address = to_streamed_response_wrapper( - beneficial_owners.update_address, - ) - - -class AsyncBeneficialOwnersWithStreamingResponse: - def __init__(self, beneficial_owners: AsyncBeneficialOwners) -> None: - self._beneficial_owners = beneficial_owners - - self.create = async_to_streamed_response_wrapper( - beneficial_owners.create, - ) - self.archive = async_to_streamed_response_wrapper( - beneficial_owners.archive, - ) - self.update_address = async_to_streamed_response_wrapper( - beneficial_owners.update_address, - ) diff --git a/src/increase/resources/entities/industry_code.py b/src/increase/resources/entities/industry_code.py deleted file mode 100644 index 93255bbd1..000000000 --- a/src/increase/resources/entities/industry_code.py +++ /dev/null @@ -1,182 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ... import _legacy_response -from ...types import Entity -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) -from ...types.entities import industry_code_create_params - -__all__ = ["IndustryCode", "AsyncIndustryCode"] - - -class IndustryCode(SyncAPIResource): - @cached_property - def with_raw_response(self) -> IndustryCodeWithRawResponse: - return IndustryCodeWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> IndustryCodeWithStreamingResponse: - return IndustryCodeWithStreamingResponse(self) - - def create( - self, - entity_id: str, - *, - industry_code: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Update the industry code for a corporate Entity - - Args: - entity_id: The identifier of the Entity to update. This endpoint only accepts `corporation` - entities. - - industry_code: The North American Industry Classification System (NAICS) code for the - corporation's primary line of business. This is a number, like `5132` for - `Software Publishers`. A full list of classification codes is available at - https://www.naics.com. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - if not entity_id: - raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") - return self._post( - f"/entities/{entity_id}/industry_code", - body=maybe_transform( - {"industry_code": industry_code}, industry_code_create_params.IndustryCodeCreateParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - -class AsyncIndustryCode(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncIndustryCodeWithRawResponse: - return AsyncIndustryCodeWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncIndustryCodeWithStreamingResponse: - return AsyncIndustryCodeWithStreamingResponse(self) - - async def create( - self, - entity_id: str, - *, - industry_code: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Entity: - """ - Update the industry code for a corporate Entity - - Args: - entity_id: The identifier of the Entity to update. This endpoint only accepts `corporation` - entities. - - industry_code: The North American Industry Classification System (NAICS) code for the - corporation's primary line of business. This is a number, like `5132` for - `Software Publishers`. A full list of classification codes is available at - https://www.naics.com. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - if not entity_id: - raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") - return await self._post( - f"/entities/{entity_id}/industry_code", - body=await async_maybe_transform( - {"industry_code": industry_code}, industry_code_create_params.IndustryCodeCreateParams - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Entity, - ) - - -class IndustryCodeWithRawResponse: - def __init__(self, industry_code: IndustryCode) -> None: - self._industry_code = industry_code - - self.create = _legacy_response.to_raw_response_wrapper( - industry_code.create, - ) - - -class AsyncIndustryCodeWithRawResponse: - def __init__(self, industry_code: AsyncIndustryCode) -> None: - self._industry_code = industry_code - - self.create = _legacy_response.async_to_raw_response_wrapper( - industry_code.create, - ) - - -class IndustryCodeWithStreamingResponse: - def __init__(self, industry_code: IndustryCode) -> None: - self._industry_code = industry_code - - self.create = to_streamed_response_wrapper( - industry_code.create, - ) - - -class AsyncIndustryCodeWithStreamingResponse: - def __init__(self, industry_code: AsyncIndustryCode) -> None: - self._industry_code = industry_code - - self.create = async_to_streamed_response_wrapper( - industry_code.create, - ) diff --git a/src/increase/resources/entity_onboarding_sessions.py b/src/increase/resources/entity_onboarding_sessions.py new file mode 100644 index 000000000..bc315a878 --- /dev/null +++ b/src/increase/resources/entity_onboarding_sessions.py @@ -0,0 +1,540 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import entity_onboarding_session_list_params, entity_onboarding_session_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.entity_onboarding_session import EntityOnboardingSession + +__all__ = ["EntityOnboardingSessionsResource", "AsyncEntityOnboardingSessionsResource"] + + +class EntityOnboardingSessionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EntityOnboardingSessionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return EntityOnboardingSessionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EntityOnboardingSessionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return EntityOnboardingSessionsResourceWithStreamingResponse(self) + + def create( + self, + *, + program_id: str, + redirect_url: str, + entity_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityOnboardingSession: + """ + Create an Entity Onboarding Session + + Args: + program_id: The identifier of the Program the Entity will be onboarded to. + + redirect_url: The URL to redirect the customer to after they complete the onboarding form. The + redirect will include `entity_onboarding_session_id` and `entity_id` query + parameters. + + entity_id: The identifier of an existing Entity to associate with the onboarding session. + If provided, the onboarding form will display any outstanding tasks required to + complete the Entity's onboarding. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/entity_onboarding_sessions", + body=maybe_transform( + { + "program_id": program_id, + "redirect_url": redirect_url, + "entity_id": entity_id, + }, + entity_onboarding_session_create_params.EntityOnboardingSessionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityOnboardingSession, + ) + + def retrieve( + self, + entity_onboarding_session_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> EntityOnboardingSession: + """ + Retrieve an Entity Onboarding Session + + Args: + entity_onboarding_session_id: The identifier of the Entity Onboarding Session. + + 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 entity_onboarding_session_id: + raise ValueError( + f"Expected a non-empty value for `entity_onboarding_session_id` but received {entity_onboarding_session_id!r}" + ) + return self._get( + path_template( + "/entity_onboarding_sessions/{entity_onboarding_session_id}", + entity_onboarding_session_id=entity_onboarding_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EntityOnboardingSession, + ) + + def list( + self, + *, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: entity_onboarding_session_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[EntityOnboardingSession]: + """ + List Entity Onboarding Session + + Args: + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/entity_onboarding_sessions", + page=SyncPage[EntityOnboardingSession], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + entity_onboarding_session_list_params.EntityOnboardingSessionListParams, + ), + ), + model=EntityOnboardingSession, + ) + + def expire( + self, + entity_onboarding_session_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityOnboardingSession: + """ + Expire an Entity Onboarding Session + + Args: + entity_onboarding_session_id: The identifier of the Entity Onboarding Session to expire. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_onboarding_session_id: + raise ValueError( + f"Expected a non-empty value for `entity_onboarding_session_id` but received {entity_onboarding_session_id!r}" + ) + return self._post( + path_template( + "/entity_onboarding_sessions/{entity_onboarding_session_id}/expire", + entity_onboarding_session_id=entity_onboarding_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityOnboardingSession, + ) + + +class AsyncEntityOnboardingSessionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEntityOnboardingSessionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncEntityOnboardingSessionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEntityOnboardingSessionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncEntityOnboardingSessionsResourceWithStreamingResponse(self) + + async def create( + self, + *, + program_id: str, + redirect_url: str, + entity_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityOnboardingSession: + """ + Create an Entity Onboarding Session + + Args: + program_id: The identifier of the Program the Entity will be onboarded to. + + redirect_url: The URL to redirect the customer to after they complete the onboarding form. The + redirect will include `entity_onboarding_session_id` and `entity_id` query + parameters. + + entity_id: The identifier of an existing Entity to associate with the onboarding session. + If provided, the onboarding form will display any outstanding tasks required to + complete the Entity's onboarding. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/entity_onboarding_sessions", + body=await async_maybe_transform( + { + "program_id": program_id, + "redirect_url": redirect_url, + "entity_id": entity_id, + }, + entity_onboarding_session_create_params.EntityOnboardingSessionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityOnboardingSession, + ) + + async def retrieve( + self, + entity_onboarding_session_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> EntityOnboardingSession: + """ + Retrieve an Entity Onboarding Session + + Args: + entity_onboarding_session_id: The identifier of the Entity Onboarding Session. + + 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 entity_onboarding_session_id: + raise ValueError( + f"Expected a non-empty value for `entity_onboarding_session_id` but received {entity_onboarding_session_id!r}" + ) + return await self._get( + path_template( + "/entity_onboarding_sessions/{entity_onboarding_session_id}", + entity_onboarding_session_id=entity_onboarding_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=EntityOnboardingSession, + ) + + def list( + self, + *, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: entity_onboarding_session_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[EntityOnboardingSession, AsyncPage[EntityOnboardingSession]]: + """ + List Entity Onboarding Session + + Args: + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/entity_onboarding_sessions", + page=AsyncPage[EntityOnboardingSession], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + entity_onboarding_session_list_params.EntityOnboardingSessionListParams, + ), + ), + model=EntityOnboardingSession, + ) + + async def expire( + self, + entity_onboarding_session_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityOnboardingSession: + """ + Expire an Entity Onboarding Session + + Args: + entity_onboarding_session_id: The identifier of the Entity Onboarding Session to expire. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_onboarding_session_id: + raise ValueError( + f"Expected a non-empty value for `entity_onboarding_session_id` but received {entity_onboarding_session_id!r}" + ) + return await self._post( + path_template( + "/entity_onboarding_sessions/{entity_onboarding_session_id}/expire", + entity_onboarding_session_id=entity_onboarding_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityOnboardingSession, + ) + + +class EntityOnboardingSessionsResourceWithRawResponse: + def __init__(self, entity_onboarding_sessions: EntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.create = to_raw_response_wrapper( + entity_onboarding_sessions.create, + ) + self.retrieve = to_raw_response_wrapper( + entity_onboarding_sessions.retrieve, + ) + self.list = to_raw_response_wrapper( + entity_onboarding_sessions.list, + ) + self.expire = to_raw_response_wrapper( + entity_onboarding_sessions.expire, + ) + + +class AsyncEntityOnboardingSessionsResourceWithRawResponse: + def __init__(self, entity_onboarding_sessions: AsyncEntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.create = async_to_raw_response_wrapper( + entity_onboarding_sessions.create, + ) + self.retrieve = async_to_raw_response_wrapper( + entity_onboarding_sessions.retrieve, + ) + self.list = async_to_raw_response_wrapper( + entity_onboarding_sessions.list, + ) + self.expire = async_to_raw_response_wrapper( + entity_onboarding_sessions.expire, + ) + + +class EntityOnboardingSessionsResourceWithStreamingResponse: + def __init__(self, entity_onboarding_sessions: EntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.create = to_streamed_response_wrapper( + entity_onboarding_sessions.create, + ) + self.retrieve = to_streamed_response_wrapper( + entity_onboarding_sessions.retrieve, + ) + self.list = to_streamed_response_wrapper( + entity_onboarding_sessions.list, + ) + self.expire = to_streamed_response_wrapper( + entity_onboarding_sessions.expire, + ) + + +class AsyncEntityOnboardingSessionsResourceWithStreamingResponse: + def __init__(self, entity_onboarding_sessions: AsyncEntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.create = async_to_streamed_response_wrapper( + entity_onboarding_sessions.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + entity_onboarding_sessions.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + entity_onboarding_sessions.list, + ) + self.expire = async_to_streamed_response_wrapper( + entity_onboarding_sessions.expire, + ) diff --git a/src/increase/resources/event_subscriptions.py b/src/increase/resources/event_subscriptions.py index c6a96883f..f226c6336 100644 --- a/src/increase/resources/event_subscriptions.py +++ b/src/increase/resources/event_subscriptions.py @@ -2,135 +2,63 @@ from __future__ import annotations +from typing import Iterable from typing_extensions import Literal import httpx -from .. import _legacy_response -from ..types import ( - EventSubscription, - event_subscription_list_params, - event_subscription_create_params, - event_subscription_update_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import event_subscription_list_params, event_subscription_create_params, event_subscription_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.event_subscription import EventSubscription -__all__ = ["EventSubscriptions", "AsyncEventSubscriptions"] +__all__ = ["EventSubscriptionsResource", "AsyncEventSubscriptionsResource"] -class EventSubscriptions(SyncAPIResource): +class EventSubscriptionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EventSubscriptionsWithRawResponse: - return EventSubscriptionsWithRawResponse(self) + def with_raw_response(self) -> EventSubscriptionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return EventSubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EventSubscriptionsWithStreamingResponse: - return EventSubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> EventSubscriptionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return EventSubscriptionsResourceWithStreamingResponse(self) def create( self, *, url: str, - selected_event_category: Literal[ - "account.created", - "account.updated", - "account_number.created", - "account_number.updated", - "account_statement.created", - "account_transfer.created", - "account_transfer.updated", - "ach_prenotification.created", - "ach_prenotification.updated", - "ach_transfer.created", - "ach_transfer.updated", - "bookkeeping_account.created", - "bookkeeping_account.updated", - "bookkeeping_entry_set.updated", - "card.created", - "card.updated", - "card_payment.created", - "card_payment.updated", - "card_profile.created", - "card_profile.updated", - "card_dispute.created", - "card_dispute.updated", - "check_deposit.created", - "check_deposit.updated", - "check_transfer.created", - "check_transfer.updated", - "declined_transaction.created", - "digital_card_profile.created", - "digital_card_profile.updated", - "digital_wallet_token.created", - "digital_wallet_token.updated", - "document.created", - "entity.created", - "entity.updated", - "event_subscription.created", - "event_subscription.updated", - "export.created", - "export.updated", - "external_account.created", - "external_account.updated", - "file.created", - "group.updated", - "group.heartbeat", - "inbound_ach_transfer.created", - "inbound_ach_transfer.updated", - "inbound_ach_transfer_return.created", - "inbound_ach_transfer_return.updated", - "inbound_wire_drawdown_request.created", - "inbound_wire_transfer.created", - "inbound_wire_transfer.updated", - "intrafi_account_enrollment.created", - "intrafi_account_enrollment.updated", - "intrafi_exclusion.created", - "intrafi_exclusion.updated", - "oauth_connection.created", - "oauth_connection.deactivated", - "pending_transaction.created", - "pending_transaction.updated", - "physical_card.created", - "physical_card.updated", - "physical_card_profile.created", - "physical_card_profile.updated", - "proof_of_authorization_request.created", - "proof_of_authorization_request.updated", - "proof_of_authorization_request_submission.created", - "proof_of_authorization_request_submission.updated", - "real_time_decision.card_authorization_requested", - "real_time_decision.digital_wallet_token_requested", - "real_time_decision.digital_wallet_authentication_requested", - "real_time_payments_transfer.created", - "real_time_payments_transfer.updated", - "real_time_payments_request_for_payment.created", - "real_time_payments_request_for_payment.updated", - "transaction.created", - "wire_drawdown_request.created", - "wire_drawdown_request.updated", - "wire_transfer.created", - "wire_transfer.updated", - ] - | NotGiven = NOT_GIVEN, - shared_secret: str | NotGiven = NOT_GIVEN, + oauth_connection_id: str | Omit = omit, + selected_event_categories: Iterable[event_subscription_create_params.SelectedEventCategory] | Omit = omit, + shared_secret: str | Omit = omit, + status: Literal["active", "disabled"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> EventSubscription: """ @@ -139,133 +67,22 @@ def create( Args: url: The URL you'd like us to send webhooks to. - selected_event_category: If specified, this subscription will only receive webhooks for Events with the - specified `category`. - - - `account.created` - Occurs whenever an Account is created. - - `account.updated` - Occurs whenever an Account is updated. - - `account_number.created` - Occurs whenever an Account Number is created. - - `account_number.updated` - Occurs whenever an Account Number is updated. - - `account_statement.created` - Occurs whenever an Account Statement is created. - - `account_transfer.created` - Occurs whenever an Account Transfer is created. - - `account_transfer.updated` - Occurs whenever an Account Transfer is updated. - - `ach_prenotification.created` - Occurs whenever an ACH Prenotification is - created. - - `ach_prenotification.updated` - Occurs whenever an ACH Prenotification is - updated. - - `ach_transfer.created` - Occurs whenever an ACH Transfer is created. - - `ach_transfer.updated` - Occurs whenever an ACH Transfer is updated. - - `bookkeeping_account.created` - Occurs whenever a Bookkeeping Account is - created. - - `bookkeeping_account.updated` - Occurs whenever a Bookkeeping Account is - updated. - - `bookkeeping_entry_set.updated` - Occurs whenever a Bookkeeping Entry Set is - created. - - `card.created` - Occurs whenever a Card is created. - - `card.updated` - Occurs whenever a Card is updated. - - `card_payment.created` - Occurs whenever a Card Payment is created. - - `card_payment.updated` - Occurs whenever a Card Payment is updated. - - `card_profile.created` - Occurs whenever a Card Profile is created. - - `card_profile.updated` - Occurs whenever a Card Profile is updated. - - `card_dispute.created` - Occurs whenever a Card Dispute is created. - - `card_dispute.updated` - Occurs whenever a Card Dispute is updated. - - `check_deposit.created` - Occurs whenever a Check Deposit is created. - - `check_deposit.updated` - Occurs whenever a Check Deposit is updated. - - `check_transfer.created` - Occurs whenever a Check Transfer is created. - - `check_transfer.updated` - Occurs whenever a Check Transfer is updated. - - `declined_transaction.created` - Occurs whenever a Declined Transaction is - created. - - `digital_card_profile.created` - Occurs whenever a Digital Card Profile is - created. - - `digital_card_profile.updated` - Occurs whenever a Digital Card Profile is - updated. - - `digital_wallet_token.created` - Occurs whenever a Digital Wallet Token is - created. - - `digital_wallet_token.updated` - Occurs whenever a Digital Wallet Token is - updated. - - `document.created` - Occurs whenever a Document is created. - - `entity.created` - Occurs whenever an Entity is created. - - `entity.updated` - Occurs whenever an Entity is updated. - - `event_subscription.created` - Occurs whenever an Event Subscription is - created. - - `event_subscription.updated` - Occurs whenever an Event Subscription is - updated. - - `export.created` - Occurs whenever an Export is created. - - `export.updated` - Occurs whenever an Export is updated. - - `external_account.created` - Occurs whenever an External Account is created. - - `external_account.updated` - Occurs whenever an External Account is updated. - - `file.created` - Occurs whenever a File is created. - - `group.updated` - Occurs whenever a Group is updated. - - `group.heartbeat` - Increase may send webhooks with this category to see if a - webhook endpoint is working properly. - - `inbound_ach_transfer.created` - Occurs whenever an Inbound ACH Transfer is - created. - - `inbound_ach_transfer.updated` - Occurs whenever an Inbound ACH Transfer is - updated. - - `inbound_ach_transfer_return.created` - Occurs whenever an Inbound ACH - Transfer Return is created. - - `inbound_ach_transfer_return.updated` - Occurs whenever an Inbound ACH - Transfer Return is updated. - - `inbound_wire_drawdown_request.created` - Occurs whenever an Inbound Wire - Drawdown Request is created. - - `inbound_wire_transfer.created` - Occurs whenever an Inbound Wire Transfer is - created. - - `inbound_wire_transfer.updated` - Occurs whenever an Inbound Wire Transfer is - updated. - - `intrafi_account_enrollment.created` - Occurs whenever an IntraFi Account - Enrollment is created. - - `intrafi_account_enrollment.updated` - Occurs whenever an IntraFi Account - Enrollment is updated. - - `intrafi_exclusion.created` - Occurs whenever an IntraFi Exclusion is created. - - `intrafi_exclusion.updated` - Occurs whenever an IntraFi Exclusion is updated. - - `oauth_connection.created` - Occurs whenever an OAuth Connection is created. - - `oauth_connection.deactivated` - Occurs whenever an OAuth Connection is - deactivated. - - `pending_transaction.created` - Occurs whenever a Pending Transaction is - created. - - `pending_transaction.updated` - Occurs whenever a Pending Transaction is - updated. - - `physical_card.created` - Occurs whenever a Physical Card is created. - - `physical_card.updated` - Occurs whenever a Physical Card is updated. - - `physical_card_profile.created` - Occurs whenever a Physical Card Profile is - created. - - `physical_card_profile.updated` - Occurs whenever a Physical Card Profile is - updated. - - `proof_of_authorization_request.created` - Occurs whenever a Proof of - Authorization Request is created. - - `proof_of_authorization_request.updated` - Occurs whenever a Proof of - Authorization Request is updated. - - `proof_of_authorization_request_submission.created` - Occurs whenever a Proof - of Authorization Request Submission is created. - - `proof_of_authorization_request_submission.updated` - Occurs whenever a Proof - of Authorization Request Submission is updated. - - `real_time_decision.card_authorization_requested` - Occurs whenever a - Real-Time Decision is created in response to a card authorization. - - `real_time_decision.digital_wallet_token_requested` - Occurs whenever a - Real-Time Decision is created in response to a digital wallet provisioning - attempt. - - `real_time_decision.digital_wallet_authentication_requested` - Occurs whenever - a Real-Time Decision is created in response to a digital wallet requiring - two-factor authentication. - - `real_time_payments_transfer.created` - Occurs whenever a Real-Time Payments - Transfer is created. - - `real_time_payments_transfer.updated` - Occurs whenever a Real-Time Payments - Transfer is updated. - - `real_time_payments_request_for_payment.created` - Occurs whenever a Real-Time - Payments Request for Payment is created. - - `real_time_payments_request_for_payment.updated` - Occurs whenever a Real-Time - Payments Request for Payment is updated. - - `transaction.created` - Occurs whenever a Transaction is created. - - `wire_drawdown_request.created` - Occurs whenever a Wire Drawdown Request is - created. - - `wire_drawdown_request.updated` - Occurs whenever a Wire Drawdown Request is - updated. - - `wire_transfer.created` - Occurs whenever a Wire Transfer is created. - - `wire_transfer.updated` - Occurs whenever a Wire Transfer is updated. + oauth_connection_id: If specified, this subscription will only receive webhooks for Events associated + with the specified OAuth Connection. + + selected_event_categories: If specified, this subscription will only receive webhooks for Events with the + specified `category`. If specifying a Real-Time Decision event category, only + one Event Category can be specified for the Event Subscription. shared_secret: The key that will be used to sign webhooks. If no value is passed, a random string will be used as default. + status: The status of the event subscription. Defaults to `active` if not specified. + + - `active` - The subscription is active and Events will be delivered normally. + - `disabled` - The subscription is temporarily disabled and Events will not be + delivered. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -281,8 +98,10 @@ def create( body=maybe_transform( { "url": url, - "selected_event_category": selected_event_category, + "oauth_connection_id": oauth_connection_id, + "selected_event_categories": selected_event_categories, "shared_secret": shared_secret, + "status": status, }, event_subscription_create_params.EventSubscriptionCreateParams, ), @@ -305,7 +124,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EventSubscription: """ Retrieve an Event Subscription @@ -326,7 +145,7 @@ def retrieve( f"Expected a non-empty value for `event_subscription_id` but received {event_subscription_id!r}" ) return self._get( - f"/event_subscriptions/{event_subscription_id}", + path_template("/event_subscriptions/{event_subscription_id}", event_subscription_id=event_subscription_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -337,13 +156,13 @@ def update( self, event_subscription_id: str, *, - status: Literal["active", "disabled", "deleted"] | NotGiven = NOT_GIVEN, + status: Literal["active", "disabled", "deleted"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> EventSubscription: """ @@ -375,7 +194,7 @@ def update( f"Expected a non-empty value for `event_subscription_id` but received {event_subscription_id!r}" ) return self._patch( - f"/event_subscriptions/{event_subscription_id}", + path_template("/event_subscriptions/{event_subscription_id}", event_subscription_id=event_subscription_id), body=maybe_transform({"status": status}, event_subscription_update_params.EventSubscriptionUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -390,15 +209,15 @@ def update( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[EventSubscription]: """ List Event Subscriptions @@ -443,107 +262,40 @@ def list( ) -class AsyncEventSubscriptions(AsyncAPIResource): +class AsyncEventSubscriptionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEventSubscriptionsWithRawResponse: - return AsyncEventSubscriptionsWithRawResponse(self) + def with_raw_response(self) -> AsyncEventSubscriptionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncEventSubscriptionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEventSubscriptionsWithStreamingResponse: - return AsyncEventSubscriptionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEventSubscriptionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncEventSubscriptionsResourceWithStreamingResponse(self) async def create( self, *, url: str, - selected_event_category: Literal[ - "account.created", - "account.updated", - "account_number.created", - "account_number.updated", - "account_statement.created", - "account_transfer.created", - "account_transfer.updated", - "ach_prenotification.created", - "ach_prenotification.updated", - "ach_transfer.created", - "ach_transfer.updated", - "bookkeeping_account.created", - "bookkeeping_account.updated", - "bookkeeping_entry_set.updated", - "card.created", - "card.updated", - "card_payment.created", - "card_payment.updated", - "card_profile.created", - "card_profile.updated", - "card_dispute.created", - "card_dispute.updated", - "check_deposit.created", - "check_deposit.updated", - "check_transfer.created", - "check_transfer.updated", - "declined_transaction.created", - "digital_card_profile.created", - "digital_card_profile.updated", - "digital_wallet_token.created", - "digital_wallet_token.updated", - "document.created", - "entity.created", - "entity.updated", - "event_subscription.created", - "event_subscription.updated", - "export.created", - "export.updated", - "external_account.created", - "external_account.updated", - "file.created", - "group.updated", - "group.heartbeat", - "inbound_ach_transfer.created", - "inbound_ach_transfer.updated", - "inbound_ach_transfer_return.created", - "inbound_ach_transfer_return.updated", - "inbound_wire_drawdown_request.created", - "inbound_wire_transfer.created", - "inbound_wire_transfer.updated", - "intrafi_account_enrollment.created", - "intrafi_account_enrollment.updated", - "intrafi_exclusion.created", - "intrafi_exclusion.updated", - "oauth_connection.created", - "oauth_connection.deactivated", - "pending_transaction.created", - "pending_transaction.updated", - "physical_card.created", - "physical_card.updated", - "physical_card_profile.created", - "physical_card_profile.updated", - "proof_of_authorization_request.created", - "proof_of_authorization_request.updated", - "proof_of_authorization_request_submission.created", - "proof_of_authorization_request_submission.updated", - "real_time_decision.card_authorization_requested", - "real_time_decision.digital_wallet_token_requested", - "real_time_decision.digital_wallet_authentication_requested", - "real_time_payments_transfer.created", - "real_time_payments_transfer.updated", - "real_time_payments_request_for_payment.created", - "real_time_payments_request_for_payment.updated", - "transaction.created", - "wire_drawdown_request.created", - "wire_drawdown_request.updated", - "wire_transfer.created", - "wire_transfer.updated", - ] - | NotGiven = NOT_GIVEN, - shared_secret: str | NotGiven = NOT_GIVEN, + oauth_connection_id: str | Omit = omit, + selected_event_categories: Iterable[event_subscription_create_params.SelectedEventCategory] | Omit = omit, + shared_secret: str | Omit = omit, + status: Literal["active", "disabled"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> EventSubscription: """ @@ -552,133 +304,22 @@ async def create( Args: url: The URL you'd like us to send webhooks to. - selected_event_category: If specified, this subscription will only receive webhooks for Events with the - specified `category`. - - - `account.created` - Occurs whenever an Account is created. - - `account.updated` - Occurs whenever an Account is updated. - - `account_number.created` - Occurs whenever an Account Number is created. - - `account_number.updated` - Occurs whenever an Account Number is updated. - - `account_statement.created` - Occurs whenever an Account Statement is created. - - `account_transfer.created` - Occurs whenever an Account Transfer is created. - - `account_transfer.updated` - Occurs whenever an Account Transfer is updated. - - `ach_prenotification.created` - Occurs whenever an ACH Prenotification is - created. - - `ach_prenotification.updated` - Occurs whenever an ACH Prenotification is - updated. - - `ach_transfer.created` - Occurs whenever an ACH Transfer is created. - - `ach_transfer.updated` - Occurs whenever an ACH Transfer is updated. - - `bookkeeping_account.created` - Occurs whenever a Bookkeeping Account is - created. - - `bookkeeping_account.updated` - Occurs whenever a Bookkeeping Account is - updated. - - `bookkeeping_entry_set.updated` - Occurs whenever a Bookkeeping Entry Set is - created. - - `card.created` - Occurs whenever a Card is created. - - `card.updated` - Occurs whenever a Card is updated. - - `card_payment.created` - Occurs whenever a Card Payment is created. - - `card_payment.updated` - Occurs whenever a Card Payment is updated. - - `card_profile.created` - Occurs whenever a Card Profile is created. - - `card_profile.updated` - Occurs whenever a Card Profile is updated. - - `card_dispute.created` - Occurs whenever a Card Dispute is created. - - `card_dispute.updated` - Occurs whenever a Card Dispute is updated. - - `check_deposit.created` - Occurs whenever a Check Deposit is created. - - `check_deposit.updated` - Occurs whenever a Check Deposit is updated. - - `check_transfer.created` - Occurs whenever a Check Transfer is created. - - `check_transfer.updated` - Occurs whenever a Check Transfer is updated. - - `declined_transaction.created` - Occurs whenever a Declined Transaction is - created. - - `digital_card_profile.created` - Occurs whenever a Digital Card Profile is - created. - - `digital_card_profile.updated` - Occurs whenever a Digital Card Profile is - updated. - - `digital_wallet_token.created` - Occurs whenever a Digital Wallet Token is - created. - - `digital_wallet_token.updated` - Occurs whenever a Digital Wallet Token is - updated. - - `document.created` - Occurs whenever a Document is created. - - `entity.created` - Occurs whenever an Entity is created. - - `entity.updated` - Occurs whenever an Entity is updated. - - `event_subscription.created` - Occurs whenever an Event Subscription is - created. - - `event_subscription.updated` - Occurs whenever an Event Subscription is - updated. - - `export.created` - Occurs whenever an Export is created. - - `export.updated` - Occurs whenever an Export is updated. - - `external_account.created` - Occurs whenever an External Account is created. - - `external_account.updated` - Occurs whenever an External Account is updated. - - `file.created` - Occurs whenever a File is created. - - `group.updated` - Occurs whenever a Group is updated. - - `group.heartbeat` - Increase may send webhooks with this category to see if a - webhook endpoint is working properly. - - `inbound_ach_transfer.created` - Occurs whenever an Inbound ACH Transfer is - created. - - `inbound_ach_transfer.updated` - Occurs whenever an Inbound ACH Transfer is - updated. - - `inbound_ach_transfer_return.created` - Occurs whenever an Inbound ACH - Transfer Return is created. - - `inbound_ach_transfer_return.updated` - Occurs whenever an Inbound ACH - Transfer Return is updated. - - `inbound_wire_drawdown_request.created` - Occurs whenever an Inbound Wire - Drawdown Request is created. - - `inbound_wire_transfer.created` - Occurs whenever an Inbound Wire Transfer is - created. - - `inbound_wire_transfer.updated` - Occurs whenever an Inbound Wire Transfer is - updated. - - `intrafi_account_enrollment.created` - Occurs whenever an IntraFi Account - Enrollment is created. - - `intrafi_account_enrollment.updated` - Occurs whenever an IntraFi Account - Enrollment is updated. - - `intrafi_exclusion.created` - Occurs whenever an IntraFi Exclusion is created. - - `intrafi_exclusion.updated` - Occurs whenever an IntraFi Exclusion is updated. - - `oauth_connection.created` - Occurs whenever an OAuth Connection is created. - - `oauth_connection.deactivated` - Occurs whenever an OAuth Connection is - deactivated. - - `pending_transaction.created` - Occurs whenever a Pending Transaction is - created. - - `pending_transaction.updated` - Occurs whenever a Pending Transaction is - updated. - - `physical_card.created` - Occurs whenever a Physical Card is created. - - `physical_card.updated` - Occurs whenever a Physical Card is updated. - - `physical_card_profile.created` - Occurs whenever a Physical Card Profile is - created. - - `physical_card_profile.updated` - Occurs whenever a Physical Card Profile is - updated. - - `proof_of_authorization_request.created` - Occurs whenever a Proof of - Authorization Request is created. - - `proof_of_authorization_request.updated` - Occurs whenever a Proof of - Authorization Request is updated. - - `proof_of_authorization_request_submission.created` - Occurs whenever a Proof - of Authorization Request Submission is created. - - `proof_of_authorization_request_submission.updated` - Occurs whenever a Proof - of Authorization Request Submission is updated. - - `real_time_decision.card_authorization_requested` - Occurs whenever a - Real-Time Decision is created in response to a card authorization. - - `real_time_decision.digital_wallet_token_requested` - Occurs whenever a - Real-Time Decision is created in response to a digital wallet provisioning - attempt. - - `real_time_decision.digital_wallet_authentication_requested` - Occurs whenever - a Real-Time Decision is created in response to a digital wallet requiring - two-factor authentication. - - `real_time_payments_transfer.created` - Occurs whenever a Real-Time Payments - Transfer is created. - - `real_time_payments_transfer.updated` - Occurs whenever a Real-Time Payments - Transfer is updated. - - `real_time_payments_request_for_payment.created` - Occurs whenever a Real-Time - Payments Request for Payment is created. - - `real_time_payments_request_for_payment.updated` - Occurs whenever a Real-Time - Payments Request for Payment is updated. - - `transaction.created` - Occurs whenever a Transaction is created. - - `wire_drawdown_request.created` - Occurs whenever a Wire Drawdown Request is - created. - - `wire_drawdown_request.updated` - Occurs whenever a Wire Drawdown Request is - updated. - - `wire_transfer.created` - Occurs whenever a Wire Transfer is created. - - `wire_transfer.updated` - Occurs whenever a Wire Transfer is updated. + oauth_connection_id: If specified, this subscription will only receive webhooks for Events associated + with the specified OAuth Connection. + + selected_event_categories: If specified, this subscription will only receive webhooks for Events with the + specified `category`. If specifying a Real-Time Decision event category, only + one Event Category can be specified for the Event Subscription. shared_secret: The key that will be used to sign webhooks. If no value is passed, a random string will be used as default. + status: The status of the event subscription. Defaults to `active` if not specified. + + - `active` - The subscription is active and Events will be delivered normally. + - `disabled` - The subscription is temporarily disabled and Events will not be + delivered. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -694,8 +335,10 @@ async def create( body=await async_maybe_transform( { "url": url, - "selected_event_category": selected_event_category, + "oauth_connection_id": oauth_connection_id, + "selected_event_categories": selected_event_categories, "shared_secret": shared_secret, + "status": status, }, event_subscription_create_params.EventSubscriptionCreateParams, ), @@ -718,7 +361,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> EventSubscription: """ Retrieve an Event Subscription @@ -739,7 +382,7 @@ async def retrieve( f"Expected a non-empty value for `event_subscription_id` but received {event_subscription_id!r}" ) return await self._get( - f"/event_subscriptions/{event_subscription_id}", + path_template("/event_subscriptions/{event_subscription_id}", event_subscription_id=event_subscription_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -750,13 +393,13 @@ async def update( self, event_subscription_id: str, *, - status: Literal["active", "disabled", "deleted"] | NotGiven = NOT_GIVEN, + status: Literal["active", "disabled", "deleted"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> EventSubscription: """ @@ -788,7 +431,7 @@ async def update( f"Expected a non-empty value for `event_subscription_id` but received {event_subscription_id!r}" ) return await self._patch( - f"/event_subscriptions/{event_subscription_id}", + path_template("/event_subscriptions/{event_subscription_id}", event_subscription_id=event_subscription_id), body=await async_maybe_transform( {"status": status}, event_subscription_update_params.EventSubscriptionUpdateParams ), @@ -805,15 +448,15 @@ async def update( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[EventSubscription, AsyncPage[EventSubscription]]: """ List Event Subscriptions @@ -858,44 +501,44 @@ def list( ) -class EventSubscriptionsWithRawResponse: - def __init__(self, event_subscriptions: EventSubscriptions) -> None: +class EventSubscriptionsResourceWithRawResponse: + def __init__(self, event_subscriptions: EventSubscriptionsResource) -> None: self._event_subscriptions = event_subscriptions - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( event_subscriptions.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( event_subscriptions.retrieve, ) - self.update = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( event_subscriptions.update, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( event_subscriptions.list, ) -class AsyncEventSubscriptionsWithRawResponse: - def __init__(self, event_subscriptions: AsyncEventSubscriptions) -> None: +class AsyncEventSubscriptionsResourceWithRawResponse: + def __init__(self, event_subscriptions: AsyncEventSubscriptionsResource) -> None: self._event_subscriptions = event_subscriptions - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( event_subscriptions.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( event_subscriptions.retrieve, ) - self.update = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( event_subscriptions.update, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( event_subscriptions.list, ) -class EventSubscriptionsWithStreamingResponse: - def __init__(self, event_subscriptions: EventSubscriptions) -> None: +class EventSubscriptionsResourceWithStreamingResponse: + def __init__(self, event_subscriptions: EventSubscriptionsResource) -> None: self._event_subscriptions = event_subscriptions self.create = to_streamed_response_wrapper( @@ -912,8 +555,8 @@ def __init__(self, event_subscriptions: EventSubscriptions) -> None: ) -class AsyncEventSubscriptionsWithStreamingResponse: - def __init__(self, event_subscriptions: AsyncEventSubscriptions) -> None: +class AsyncEventSubscriptionsResourceWithStreamingResponse: + def __init__(self, event_subscriptions: AsyncEventSubscriptionsResource) -> None: self._event_subscriptions = event_subscriptions self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/events.py b/src/increase/resources/events.py index 29094afcc..c70270154 100644 --- a/src/increase/resources/events.py +++ b/src/increase/resources/events.py @@ -2,32 +2,51 @@ from __future__ import annotations +import json +from typing import Mapping, cast + import httpx -from .. import _legacy_response -from ..types import Event, event_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import event_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property +from .._models import construct_type from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._exceptions import IncreaseError +from ..types.event import Event +from .._base_client import AsyncPaginator, make_request_options +from ..types.unwrap_webhook_event import UnwrapWebhookEvent -__all__ = ["Events", "AsyncEvents"] +__all__ = ["EventsResource", "AsyncEventsResource"] -class Events(SyncAPIResource): +class EventsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> EventsWithRawResponse: - return EventsWithRawResponse(self) + def with_raw_response(self) -> EventsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return EventsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> EventsWithStreamingResponse: - return EventsWithStreamingResponse(self) + def with_streaming_response(self) -> EventsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return EventsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +57,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Event: """ Retrieve an Event @@ -57,7 +76,7 @@ def retrieve( if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return self._get( - f"/events/{event_id}", + path_template("/events/{event_id}", event_id=event_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -67,17 +86,17 @@ def retrieve( def list( self, *, - associated_object_id: str | NotGiven = NOT_GIVEN, - category: event_list_params.Category | NotGiven = NOT_GIVEN, - created_at: event_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + associated_object_id: str | Omit = omit, + category: event_list_params.Category | Omit = omit, + created_at: event_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Event]: """ List Events @@ -120,15 +139,53 @@ def list( model=Event, ) + def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None) -> UnwrapWebhookEvent: + try: + from standardwebhooks import Webhook + except ImportError as exc: + raise IncreaseError("You need to install `increase[webhooks]` to use this method") from exc + + if key is None: + raw_key = self._client.webhook_secret + if raw_key is None: + raise ValueError( + "Cannot verify a webhook without a key on either the client's webhook_secret or passed in as an argument" + ) + key = raw_key.encode("utf-8") + + if not isinstance(headers, dict): + headers = dict(headers) + + Webhook(key).verify(payload, headers) + + return cast( + UnwrapWebhookEvent, + construct_type( + type_=UnwrapWebhookEvent, + value=json.loads(payload), + ), + ) -class AsyncEvents(AsyncAPIResource): + +class AsyncEventsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncEventsWithRawResponse: - return AsyncEventsWithRawResponse(self) + def with_raw_response(self) -> AsyncEventsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncEventsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncEventsWithStreamingResponse: - return AsyncEventsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncEventsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncEventsResourceWithStreamingResponse(self) async def retrieve( self, @@ -139,7 +196,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Event: """ Retrieve an Event @@ -158,7 +215,7 @@ async def retrieve( if not event_id: raise ValueError(f"Expected a non-empty value for `event_id` but received {event_id!r}") return await self._get( - f"/events/{event_id}", + path_template("/events/{event_id}", event_id=event_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -168,17 +225,17 @@ async def retrieve( def list( self, *, - associated_object_id: str | NotGiven = NOT_GIVEN, - category: event_list_params.Category | NotGiven = NOT_GIVEN, - created_at: event_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + associated_object_id: str | Omit = omit, + category: event_list_params.Category | Omit = omit, + created_at: event_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Event, AsyncPage[Event]]: """ List Events @@ -221,33 +278,60 @@ def list( model=Event, ) + def unwrap(self, payload: str, *, headers: Mapping[str, str], key: str | bytes | None = None) -> UnwrapWebhookEvent: + try: + from standardwebhooks import Webhook + except ImportError as exc: + raise IncreaseError("You need to install `increase[webhooks]` to use this method") from exc + + if key is None: + raw_key = self._client.webhook_secret + if raw_key is None: + raise ValueError( + "Cannot verify a webhook without a key on either the client's webhook_secret or passed in as an argument" + ) + key = raw_key.encode("utf-8") + + if not isinstance(headers, dict): + headers = dict(headers) + + Webhook(key).verify(payload, headers) + + return cast( + UnwrapWebhookEvent, + construct_type( + type_=UnwrapWebhookEvent, + value=json.loads(payload), + ), + ) + -class EventsWithRawResponse: - def __init__(self, events: Events) -> None: +class EventsResourceWithRawResponse: + def __init__(self, events: EventsResource) -> None: self._events = events - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( events.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( events.list, ) -class AsyncEventsWithRawResponse: - def __init__(self, events: AsyncEvents) -> None: +class AsyncEventsResourceWithRawResponse: + def __init__(self, events: AsyncEventsResource) -> None: self._events = events - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( events.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( events.list, ) -class EventsWithStreamingResponse: - def __init__(self, events: Events) -> None: +class EventsResourceWithStreamingResponse: + def __init__(self, events: EventsResource) -> None: self._events = events self.retrieve = to_streamed_response_wrapper( @@ -258,8 +342,8 @@ def __init__(self, events: Events) -> None: ) -class AsyncEventsWithStreamingResponse: - def __init__(self, events: AsyncEvents) -> None: +class AsyncEventsResourceWithStreamingResponse: + def __init__(self, events: AsyncEventsResource) -> None: self._events = events self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/exports.py b/src/increase/resources/exports.py index 5383ac398..dee6557a4 100644 --- a/src/increase/resources/exports.py +++ b/src/increase/resources/exports.py @@ -6,51 +6,77 @@ import httpx -from .. import _legacy_response -from ..types import Export, export_list_params, export_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import export_list_params, export_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.export import Export -__all__ = ["Exports", "AsyncExports"] +__all__ = ["ExportsResource", "AsyncExportsResource"] -class Exports(SyncAPIResource): +class ExportsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ExportsWithRawResponse: - return ExportsWithRawResponse(self) + def with_raw_response(self) -> ExportsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ExportsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ExportsWithStreamingResponse: - return ExportsWithStreamingResponse(self) + def with_streaming_response(self) -> ExportsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ExportsResourceWithStreamingResponse(self) def create( self, *, category: Literal[ - "account_statement_ofx", "transaction_csv", "balance_csv", "bookkeeping_account_balance_csv", "entity_csv" + "account_statement_ofx", + "account_statement_bai2", + "transaction_csv", + "balance_csv", + "bookkeeping_account_balance_csv", + "entity_csv", + "vendor_csv", + "account_verification_letter", + "funding_instructions", + "voided_check", + "daily_account_balance_csv", ], - account_statement_ofx: export_create_params.AccountStatementOfx | NotGiven = NOT_GIVEN, - balance_csv: export_create_params.BalanceCsv | NotGiven = NOT_GIVEN, - bookkeeping_account_balance_csv: export_create_params.BookkeepingAccountBalanceCsv | NotGiven = NOT_GIVEN, - entity_csv: export_create_params.EntityCsv | NotGiven = NOT_GIVEN, - transaction_csv: export_create_params.TransactionCsv | NotGiven = NOT_GIVEN, + account_statement_bai2: export_create_params.AccountStatementBai2 | Omit = omit, + account_statement_ofx: export_create_params.AccountStatementOfx | Omit = omit, + account_verification_letter: export_create_params.AccountVerificationLetter | Omit = omit, + balance_csv: export_create_params.BalanceCsv | Omit = omit, + bookkeeping_account_balance_csv: export_create_params.BookkeepingAccountBalanceCsv | Omit = omit, + daily_account_balance_csv: export_create_params.DailyAccountBalanceCsv | Omit = omit, + entity_csv: export_create_params.EntityCsv | Omit = omit, + funding_instructions: export_create_params.FundingInstructions | Omit = omit, + transaction_csv: export_create_params.TransactionCsv | Omit = omit, + vendor_csv: export_create_params.VendorCsv | Omit = omit, + voided_check: export_create_params.VoidedCheck | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Export: """ @@ -61,27 +87,53 @@ def create( - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of transactions and balances for a given time range and Account. + - `account_statement_bai2` - Export a BAI2 file of transactions and balances for + a given date and optional Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. - `bookkeeping_account_balance_csv` - Export a CSV of bookkeeping account balances for the dates in a given range. - `entity_csv` - Export a CSV of entities with a given status. + - `vendor_csv` - Export a CSV of vendors added to the third-party risk + management dashboard. + - `account_verification_letter` - A PDF of an account verification letter. + - `funding_instructions` - A PDF of funding instructions. + - `voided_check` - A PDF of a voided check. + - `daily_account_balance_csv` - Export a CSV of daily account balances with + starting and ending balances for a given date range. + + account_statement_bai2: Options for the created export. Required if `category` is equal to + `account_statement_bai2`. account_statement_ofx: Options for the created export. Required if `category` is equal to `account_statement_ofx`. + account_verification_letter: Options for the created export. Required if `category` is equal to + `account_verification_letter`. + balance_csv: Options for the created export. Required if `category` is equal to `balance_csv`. bookkeeping_account_balance_csv: Options for the created export. Required if `category` is equal to `bookkeeping_account_balance_csv`. + daily_account_balance_csv: Options for the created export. Required if `category` is equal to + `daily_account_balance_csv`. + entity_csv: Options for the created export. Required if `category` is equal to `entity_csv`. + funding_instructions: Options for the created export. Required if `category` is equal to + `funding_instructions`. + transaction_csv: Options for the created export. Required if `category` is equal to `transaction_csv`. + vendor_csv: Options for the created export. Required if `category` is equal to `vendor_csv`. + + voided_check: Options for the created export. Required if `category` is equal to + `voided_check`. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -97,11 +149,17 @@ def create( body=maybe_transform( { "category": category, + "account_statement_bai2": account_statement_bai2, "account_statement_ofx": account_statement_ofx, + "account_verification_letter": account_verification_letter, "balance_csv": balance_csv, "bookkeeping_account_balance_csv": bookkeeping_account_balance_csv, + "daily_account_balance_csv": daily_account_balance_csv, "entity_csv": entity_csv, + "funding_instructions": funding_instructions, "transaction_csv": transaction_csv, + "vendor_csv": vendor_csv, + "voided_check": voided_check, }, export_create_params.ExportCreateParams, ), @@ -124,7 +182,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Export: """ Retrieve an Export @@ -143,7 +201,7 @@ def retrieve( if not export_id: raise ValueError(f"Expected a non-empty value for `export_id` but received {export_id!r}") return self._get( - f"/exports/{export_id}", + path_template("/exports/{export_id}", export_id=export_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -153,21 +211,75 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + category: Literal[ + "account_statement_ofx", + "account_statement_bai2", + "transaction_csv", + "balance_csv", + "bookkeeping_account_balance_csv", + "entity_csv", + "vendor_csv", + "dashboard_table_csv", + "account_verification_letter", + "funding_instructions", + "form_1099_int", + "form_1099_misc", + "fee_csv", + "voided_check", + "daily_account_balance_csv", + ] + | Omit = omit, + created_at: export_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + form_1099_int: export_list_params.Form1099Int | Omit = omit, + form_1099_misc: export_list_params.Form1099Misc | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: export_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Export]: """ List Exports Args: + category: Filter Exports for those with the specified category. + + - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of + transactions and balances for a given time range and Account. + - `account_statement_bai2` - Export a BAI2 file of transactions and balances for + a given date and optional Account. + - `transaction_csv` - Export a CSV of all transactions for a given time range. + - `balance_csv` - Export a CSV of account balances for the dates in a given + range. + - `bookkeeping_account_balance_csv` - Export a CSV of bookkeeping account + balances for the dates in a given range. + - `entity_csv` - Export a CSV of entities with a given status. + - `vendor_csv` - Export a CSV of vendors added to the third-party risk + management dashboard. + - `dashboard_table_csv` - Certain dashboard tables are available as CSV exports. + This export cannot be created via the API. + - `account_verification_letter` - A PDF of an account verification letter. + - `funding_instructions` - A PDF of funding instructions. + - `form_1099_int` - A PDF of an Internal Revenue Service Form 1099-INT. + - `form_1099_misc` - A PDF of an Internal Revenue Service Form 1099-MISC. + - `fee_csv` - Export a CSV of fees. The time range must not include any fees + that are part of an open fee statement. + - `voided_check` - A PDF of a voided check. + - `daily_account_balance_csv` - Export a CSV of daily account balances with + starting and ending balances for a given date range. + cursor: Return the page of entries after this one. + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. @@ -189,8 +301,14 @@ def list( timeout=timeout, query=maybe_transform( { + "category": category, + "created_at": created_at, "cursor": cursor, + "form_1099_int": form_1099_int, + "form_1099_misc": form_1099_misc, + "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, export_list_params.ExportListParams, ), @@ -199,32 +317,59 @@ def list( ) -class AsyncExports(AsyncAPIResource): +class AsyncExportsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncExportsWithRawResponse: - return AsyncExportsWithRawResponse(self) + def with_raw_response(self) -> AsyncExportsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncExportsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncExportsWithStreamingResponse: - return AsyncExportsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncExportsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncExportsResourceWithStreamingResponse(self) async def create( self, *, category: Literal[ - "account_statement_ofx", "transaction_csv", "balance_csv", "bookkeeping_account_balance_csv", "entity_csv" + "account_statement_ofx", + "account_statement_bai2", + "transaction_csv", + "balance_csv", + "bookkeeping_account_balance_csv", + "entity_csv", + "vendor_csv", + "account_verification_letter", + "funding_instructions", + "voided_check", + "daily_account_balance_csv", ], - account_statement_ofx: export_create_params.AccountStatementOfx | NotGiven = NOT_GIVEN, - balance_csv: export_create_params.BalanceCsv | NotGiven = NOT_GIVEN, - bookkeeping_account_balance_csv: export_create_params.BookkeepingAccountBalanceCsv | NotGiven = NOT_GIVEN, - entity_csv: export_create_params.EntityCsv | NotGiven = NOT_GIVEN, - transaction_csv: export_create_params.TransactionCsv | NotGiven = NOT_GIVEN, + account_statement_bai2: export_create_params.AccountStatementBai2 | Omit = omit, + account_statement_ofx: export_create_params.AccountStatementOfx | Omit = omit, + account_verification_letter: export_create_params.AccountVerificationLetter | Omit = omit, + balance_csv: export_create_params.BalanceCsv | Omit = omit, + bookkeeping_account_balance_csv: export_create_params.BookkeepingAccountBalanceCsv | Omit = omit, + daily_account_balance_csv: export_create_params.DailyAccountBalanceCsv | Omit = omit, + entity_csv: export_create_params.EntityCsv | Omit = omit, + funding_instructions: export_create_params.FundingInstructions | Omit = omit, + transaction_csv: export_create_params.TransactionCsv | Omit = omit, + vendor_csv: export_create_params.VendorCsv | Omit = omit, + voided_check: export_create_params.VoidedCheck | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Export: """ @@ -235,27 +380,53 @@ async def create( - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of transactions and balances for a given time range and Account. + - `account_statement_bai2` - Export a BAI2 file of transactions and balances for + a given date and optional Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. - `bookkeeping_account_balance_csv` - Export a CSV of bookkeeping account balances for the dates in a given range. - `entity_csv` - Export a CSV of entities with a given status. + - `vendor_csv` - Export a CSV of vendors added to the third-party risk + management dashboard. + - `account_verification_letter` - A PDF of an account verification letter. + - `funding_instructions` - A PDF of funding instructions. + - `voided_check` - A PDF of a voided check. + - `daily_account_balance_csv` - Export a CSV of daily account balances with + starting and ending balances for a given date range. + + account_statement_bai2: Options for the created export. Required if `category` is equal to + `account_statement_bai2`. account_statement_ofx: Options for the created export. Required if `category` is equal to `account_statement_ofx`. + account_verification_letter: Options for the created export. Required if `category` is equal to + `account_verification_letter`. + balance_csv: Options for the created export. Required if `category` is equal to `balance_csv`. bookkeeping_account_balance_csv: Options for the created export. Required if `category` is equal to `bookkeeping_account_balance_csv`. + daily_account_balance_csv: Options for the created export. Required if `category` is equal to + `daily_account_balance_csv`. + entity_csv: Options for the created export. Required if `category` is equal to `entity_csv`. + funding_instructions: Options for the created export. Required if `category` is equal to + `funding_instructions`. + transaction_csv: Options for the created export. Required if `category` is equal to `transaction_csv`. + vendor_csv: Options for the created export. Required if `category` is equal to `vendor_csv`. + + voided_check: Options for the created export. Required if `category` is equal to + `voided_check`. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -271,11 +442,17 @@ async def create( body=await async_maybe_transform( { "category": category, + "account_statement_bai2": account_statement_bai2, "account_statement_ofx": account_statement_ofx, + "account_verification_letter": account_verification_letter, "balance_csv": balance_csv, "bookkeeping_account_balance_csv": bookkeeping_account_balance_csv, + "daily_account_balance_csv": daily_account_balance_csv, "entity_csv": entity_csv, + "funding_instructions": funding_instructions, "transaction_csv": transaction_csv, + "vendor_csv": vendor_csv, + "voided_check": voided_check, }, export_create_params.ExportCreateParams, ), @@ -298,7 +475,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Export: """ Retrieve an Export @@ -317,7 +494,7 @@ async def retrieve( if not export_id: raise ValueError(f"Expected a non-empty value for `export_id` but received {export_id!r}") return await self._get( - f"/exports/{export_id}", + path_template("/exports/{export_id}", export_id=export_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -327,21 +504,75 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + category: Literal[ + "account_statement_ofx", + "account_statement_bai2", + "transaction_csv", + "balance_csv", + "bookkeeping_account_balance_csv", + "entity_csv", + "vendor_csv", + "dashboard_table_csv", + "account_verification_letter", + "funding_instructions", + "form_1099_int", + "form_1099_misc", + "fee_csv", + "voided_check", + "daily_account_balance_csv", + ] + | Omit = omit, + created_at: export_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + form_1099_int: export_list_params.Form1099Int | Omit = omit, + form_1099_misc: export_list_params.Form1099Misc | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: export_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Export, AsyncPage[Export]]: """ List Exports Args: + category: Filter Exports for those with the specified category. + + - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of + transactions and balances for a given time range and Account. + - `account_statement_bai2` - Export a BAI2 file of transactions and balances for + a given date and optional Account. + - `transaction_csv` - Export a CSV of all transactions for a given time range. + - `balance_csv` - Export a CSV of account balances for the dates in a given + range. + - `bookkeeping_account_balance_csv` - Export a CSV of bookkeeping account + balances for the dates in a given range. + - `entity_csv` - Export a CSV of entities with a given status. + - `vendor_csv` - Export a CSV of vendors added to the third-party risk + management dashboard. + - `dashboard_table_csv` - Certain dashboard tables are available as CSV exports. + This export cannot be created via the API. + - `account_verification_letter` - A PDF of an account verification letter. + - `funding_instructions` - A PDF of funding instructions. + - `form_1099_int` - A PDF of an Internal Revenue Service Form 1099-INT. + - `form_1099_misc` - A PDF of an Internal Revenue Service Form 1099-MISC. + - `fee_csv` - Export a CSV of fees. The time range must not include any fees + that are part of an open fee statement. + - `voided_check` - A PDF of a voided check. + - `daily_account_balance_csv` - Export a CSV of daily account balances with + starting and ending balances for a given date range. + cursor: Return the page of entries after this one. + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. @@ -363,8 +594,14 @@ def list( timeout=timeout, query=maybe_transform( { + "category": category, + "created_at": created_at, "cursor": cursor, + "form_1099_int": form_1099_int, + "form_1099_misc": form_1099_misc, + "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, export_list_params.ExportListParams, ), @@ -373,38 +610,38 @@ def list( ) -class ExportsWithRawResponse: - def __init__(self, exports: Exports) -> None: +class ExportsResourceWithRawResponse: + def __init__(self, exports: ExportsResource) -> None: self._exports = exports - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( exports.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( exports.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( exports.list, ) -class AsyncExportsWithRawResponse: - def __init__(self, exports: AsyncExports) -> None: +class AsyncExportsResourceWithRawResponse: + def __init__(self, exports: AsyncExportsResource) -> None: self._exports = exports - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( exports.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( exports.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( exports.list, ) -class ExportsWithStreamingResponse: - def __init__(self, exports: Exports) -> None: +class ExportsResourceWithStreamingResponse: + def __init__(self, exports: ExportsResource) -> None: self._exports = exports self.create = to_streamed_response_wrapper( @@ -418,8 +655,8 @@ def __init__(self, exports: Exports) -> None: ) -class AsyncExportsWithStreamingResponse: - def __init__(self, exports: AsyncExports) -> None: +class AsyncExportsResourceWithStreamingResponse: + def __init__(self, exports: AsyncExportsResource) -> None: self._exports = exports self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/external_accounts.py b/src/increase/resources/external_accounts.py index c0166a489..82626cf7a 100644 --- a/src/increase/resources/external_accounts.py +++ b/src/increase/resources/external_accounts.py @@ -6,38 +6,43 @@ import httpx -from .. import _legacy_response -from ..types import ( - ExternalAccount, - external_account_list_params, - external_account_create_params, - external_account_update_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import external_account_list_params, external_account_create_params, external_account_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.external_account import ExternalAccount -__all__ = ["ExternalAccounts", "AsyncExternalAccounts"] +__all__ = ["ExternalAccountsResource", "AsyncExternalAccountsResource"] -class ExternalAccounts(SyncAPIResource): +class ExternalAccountsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ExternalAccountsWithRawResponse: - return ExternalAccountsWithRawResponse(self) + def with_raw_response(self) -> ExternalAccountsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ExternalAccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ExternalAccountsWithStreamingResponse: - return ExternalAccountsWithStreamingResponse(self) + def with_streaming_response(self) -> ExternalAccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ExternalAccountsResourceWithStreamingResponse(self) def create( self, @@ -45,14 +50,14 @@ def create( account_number: str, description: str, routing_number: str, - account_holder: Literal["business", "individual", "unknown"] | NotGiven = NOT_GIVEN, - funding: Literal["checking", "savings", "other"] | NotGiven = NOT_GIVEN, + account_holder: Literal["business", "individual", "unknown"] | Omit = omit, + funding: Literal["checking", "savings", "general_ledger", "other"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ExternalAccount: """ @@ -76,6 +81,7 @@ def create( - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A general ledger account. - `other` - A different type of account. extra_headers: Send extra headers @@ -119,7 +125,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccount: """ Retrieve an External Account @@ -140,7 +146,7 @@ def retrieve( f"Expected a non-empty value for `external_account_id` but received {external_account_id!r}" ) return self._get( - f"/external_accounts/{external_account_id}", + path_template("/external_accounts/{external_account_id}", external_account_id=external_account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -151,16 +157,16 @@ def update( self, external_account_id: str, *, - account_holder: Literal["business", "individual"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - funding: Literal["checking", "savings", "other"] | NotGiven = NOT_GIVEN, - status: Literal["active", "archived"] | NotGiven = NOT_GIVEN, + account_holder: Literal["business", "individual"] | Omit = omit, + description: str | Omit = omit, + funding: Literal["checking", "savings", "general_ledger", "other"] | Omit = omit, + status: Literal["active", "archived"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ExternalAccount: """ @@ -180,6 +186,7 @@ def update( - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A general ledger account. - `other` - A different type of account. status: The status of the External Account. @@ -203,7 +210,7 @@ def update( f"Expected a non-empty value for `external_account_id` but received {external_account_id!r}" ) return self._patch( - f"/external_accounts/{external_account_id}", + path_template("/external_accounts/{external_account_id}", external_account_id=external_account_id), body=maybe_transform( { "account_holder": account_holder, @@ -226,17 +233,17 @@ def update( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - routing_number: str | NotGiven = NOT_GIVEN, - status: external_account_list_params.Status | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + routing_number: str | Omit = omit, + status: external_account_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[ExternalAccount]: """ List External Accounts @@ -285,14 +292,25 @@ def list( ) -class AsyncExternalAccounts(AsyncAPIResource): +class AsyncExternalAccountsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncExternalAccountsWithRawResponse: - return AsyncExternalAccountsWithRawResponse(self) + def with_raw_response(self) -> AsyncExternalAccountsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncExternalAccountsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncExternalAccountsWithStreamingResponse: - return AsyncExternalAccountsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncExternalAccountsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncExternalAccountsResourceWithStreamingResponse(self) async def create( self, @@ -300,14 +318,14 @@ async def create( account_number: str, description: str, routing_number: str, - account_holder: Literal["business", "individual", "unknown"] | NotGiven = NOT_GIVEN, - funding: Literal["checking", "savings", "other"] | NotGiven = NOT_GIVEN, + account_holder: Literal["business", "individual", "unknown"] | Omit = omit, + funding: Literal["checking", "savings", "general_ledger", "other"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ExternalAccount: """ @@ -331,6 +349,7 @@ async def create( - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A general ledger account. - `other` - A different type of account. extra_headers: Send extra headers @@ -374,7 +393,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> ExternalAccount: """ Retrieve an External Account @@ -395,7 +414,7 @@ async def retrieve( f"Expected a non-empty value for `external_account_id` but received {external_account_id!r}" ) return await self._get( - f"/external_accounts/{external_account_id}", + path_template("/external_accounts/{external_account_id}", external_account_id=external_account_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -406,16 +425,16 @@ async def update( self, external_account_id: str, *, - account_holder: Literal["business", "individual"] | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - funding: Literal["checking", "savings", "other"] | NotGiven = NOT_GIVEN, - status: Literal["active", "archived"] | NotGiven = NOT_GIVEN, + account_holder: Literal["business", "individual"] | Omit = omit, + description: str | Omit = omit, + funding: Literal["checking", "savings", "general_ledger", "other"] | Omit = omit, + status: Literal["active", "archived"] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ExternalAccount: """ @@ -435,6 +454,7 @@ async def update( - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A general ledger account. - `other` - A different type of account. status: The status of the External Account. @@ -458,7 +478,7 @@ async def update( f"Expected a non-empty value for `external_account_id` but received {external_account_id!r}" ) return await self._patch( - f"/external_accounts/{external_account_id}", + path_template("/external_accounts/{external_account_id}", external_account_id=external_account_id), body=await async_maybe_transform( { "account_holder": account_holder, @@ -481,17 +501,17 @@ async def update( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - routing_number: str | NotGiven = NOT_GIVEN, - status: external_account_list_params.Status | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + routing_number: str | Omit = omit, + status: external_account_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[ExternalAccount, AsyncPage[ExternalAccount]]: """ List External Accounts @@ -540,44 +560,44 @@ def list( ) -class ExternalAccountsWithRawResponse: - def __init__(self, external_accounts: ExternalAccounts) -> None: +class ExternalAccountsResourceWithRawResponse: + def __init__(self, external_accounts: ExternalAccountsResource) -> None: self._external_accounts = external_accounts - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( external_accounts.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( external_accounts.retrieve, ) - self.update = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( external_accounts.update, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( external_accounts.list, ) -class AsyncExternalAccountsWithRawResponse: - def __init__(self, external_accounts: AsyncExternalAccounts) -> None: +class AsyncExternalAccountsResourceWithRawResponse: + def __init__(self, external_accounts: AsyncExternalAccountsResource) -> None: self._external_accounts = external_accounts - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( external_accounts.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( external_accounts.retrieve, ) - self.update = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( external_accounts.update, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( external_accounts.list, ) -class ExternalAccountsWithStreamingResponse: - def __init__(self, external_accounts: ExternalAccounts) -> None: +class ExternalAccountsResourceWithStreamingResponse: + def __init__(self, external_accounts: ExternalAccountsResource) -> None: self._external_accounts = external_accounts self.create = to_streamed_response_wrapper( @@ -594,8 +614,8 @@ def __init__(self, external_accounts: ExternalAccounts) -> None: ) -class AsyncExternalAccountsWithStreamingResponse: - def __init__(self, external_accounts: AsyncExternalAccounts) -> None: +class AsyncExternalAccountsResourceWithStreamingResponse: + def __init__(self, external_accounts: AsyncExternalAccountsResource) -> None: self._external_accounts = external_accounts self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/fednow_transfers.py b/src/increase/resources/fednow_transfers.py new file mode 100644 index 000000000..23c2ea806 --- /dev/null +++ b/src/increase/resources/fednow_transfers.py @@ -0,0 +1,694 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import fednow_transfer_list_params, fednow_transfer_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.fednow_transfer import FednowTransfer + +__all__ = ["FednowTransfersResource", "AsyncFednowTransfersResource"] + + +class FednowTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FednowTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return FednowTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FednowTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return FednowTransfersResourceWithStreamingResponse(self) + + def create( + self, + *, + amount: int, + creditor_name: str, + debtor_name: str, + source_account_number_id: str, + unstructured_remittance_information: str, + account_number: str | Omit = omit, + creditor_address: fednow_transfer_create_params.CreditorAddress | Omit = omit, + debtor_address: fednow_transfer_create_params.DebtorAddress | Omit = omit, + external_account_id: str | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FednowTransfer: + """ + Create a FedNow Transfer + + Args: + amount: The amount, in minor units, to send to the creditor. + + creditor_name: The creditor's name. + + debtor_name: The debtor's name. + + source_account_number_id: The Account Number to include in the transfer as the debtor's account number. + + unstructured_remittance_information: Unstructured remittance information to include in the transfer. + + account_number: The creditor's account number. + + creditor_address: The creditor's address. + + debtor_address: The debtor's address. + + external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is + provided, `account_number` and `routing_number` must be absent. + + require_approval: Whether the transfer requires explicit approval via the dashboard or API. + + routing_number: The creditor's bank account routing number. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/fednow_transfers", + body=maybe_transform( + { + "amount": amount, + "creditor_name": creditor_name, + "debtor_name": debtor_name, + "source_account_number_id": source_account_number_id, + "unstructured_remittance_information": unstructured_remittance_information, + "account_number": account_number, + "creditor_address": creditor_address, + "debtor_address": debtor_address, + "external_account_id": external_account_id, + "require_approval": require_approval, + "routing_number": routing_number, + }, + fednow_transfer_create_params.FednowTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FednowTransfer, + ) + + def retrieve( + self, + fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> FednowTransfer: + """ + Retrieve a FedNow Transfer + + Args: + fednow_transfer_id: The identifier of the FedNow Transfer. + + 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 fednow_transfer_id: + raise ValueError(f"Expected a non-empty value for `fednow_transfer_id` but received {fednow_transfer_id!r}") + return self._get( + path_template("/fednow_transfers/{fednow_transfer_id}", fednow_transfer_id=fednow_transfer_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FednowTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: fednow_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: fednow_transfer_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[FednowTransfer]: + """ + List FedNow Transfers + + Args: + account_id: Filter FedNow Transfers to those that originated from the specified Account. + + cursor: Return the page of entries after this one. + + external_account_id: Filter FedNow Transfers to those made to the specified External Account. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/fednow_transfers", + page=SyncPage[FednowTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "external_account_id": external_account_id, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + fednow_transfer_list_params.FednowTransferListParams, + ), + ), + model=FednowTransfer, + ) + + def approve( + self, + fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FednowTransfer: + """ + Approve a FedNow Transfer + + Args: + fednow_transfer_id: The identifier of the FedNow Transfer to approve. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not fednow_transfer_id: + raise ValueError(f"Expected a non-empty value for `fednow_transfer_id` but received {fednow_transfer_id!r}") + return self._post( + path_template("/fednow_transfers/{fednow_transfer_id}/approve", fednow_transfer_id=fednow_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FednowTransfer, + ) + + def cancel( + self, + fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FednowTransfer: + """ + Cancel a pending FedNow Transfer + + Args: + fednow_transfer_id: The identifier of the pending FedNow Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not fednow_transfer_id: + raise ValueError(f"Expected a non-empty value for `fednow_transfer_id` but received {fednow_transfer_id!r}") + return self._post( + path_template("/fednow_transfers/{fednow_transfer_id}/cancel", fednow_transfer_id=fednow_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FednowTransfer, + ) + + +class AsyncFednowTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFednowTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncFednowTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFednowTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncFednowTransfersResourceWithStreamingResponse(self) + + async def create( + self, + *, + amount: int, + creditor_name: str, + debtor_name: str, + source_account_number_id: str, + unstructured_remittance_information: str, + account_number: str | Omit = omit, + creditor_address: fednow_transfer_create_params.CreditorAddress | Omit = omit, + debtor_address: fednow_transfer_create_params.DebtorAddress | Omit = omit, + external_account_id: str | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FednowTransfer: + """ + Create a FedNow Transfer + + Args: + amount: The amount, in minor units, to send to the creditor. + + creditor_name: The creditor's name. + + debtor_name: The debtor's name. + + source_account_number_id: The Account Number to include in the transfer as the debtor's account number. + + unstructured_remittance_information: Unstructured remittance information to include in the transfer. + + account_number: The creditor's account number. + + creditor_address: The creditor's address. + + debtor_address: The debtor's address. + + external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is + provided, `account_number` and `routing_number` must be absent. + + require_approval: Whether the transfer requires explicit approval via the dashboard or API. + + routing_number: The creditor's bank account routing number. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/fednow_transfers", + body=await async_maybe_transform( + { + "amount": amount, + "creditor_name": creditor_name, + "debtor_name": debtor_name, + "source_account_number_id": source_account_number_id, + "unstructured_remittance_information": unstructured_remittance_information, + "account_number": account_number, + "creditor_address": creditor_address, + "debtor_address": debtor_address, + "external_account_id": external_account_id, + "require_approval": require_approval, + "routing_number": routing_number, + }, + fednow_transfer_create_params.FednowTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FednowTransfer, + ) + + async def retrieve( + self, + fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> FednowTransfer: + """ + Retrieve a FedNow Transfer + + Args: + fednow_transfer_id: The identifier of the FedNow Transfer. + + 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 fednow_transfer_id: + raise ValueError(f"Expected a non-empty value for `fednow_transfer_id` but received {fednow_transfer_id!r}") + return await self._get( + path_template("/fednow_transfers/{fednow_transfer_id}", fednow_transfer_id=fednow_transfer_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=FednowTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: fednow_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: fednow_transfer_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[FednowTransfer, AsyncPage[FednowTransfer]]: + """ + List FedNow Transfers + + Args: + account_id: Filter FedNow Transfers to those that originated from the specified Account. + + cursor: Return the page of entries after this one. + + external_account_id: Filter FedNow Transfers to those made to the specified External Account. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/fednow_transfers", + page=AsyncPage[FednowTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "external_account_id": external_account_id, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + fednow_transfer_list_params.FednowTransferListParams, + ), + ), + model=FednowTransfer, + ) + + async def approve( + self, + fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FednowTransfer: + """ + Approve a FedNow Transfer + + Args: + fednow_transfer_id: The identifier of the FedNow Transfer to approve. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not fednow_transfer_id: + raise ValueError(f"Expected a non-empty value for `fednow_transfer_id` but received {fednow_transfer_id!r}") + return await self._post( + path_template("/fednow_transfers/{fednow_transfer_id}/approve", fednow_transfer_id=fednow_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FednowTransfer, + ) + + async def cancel( + self, + fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FednowTransfer: + """ + Cancel a pending FedNow Transfer + + Args: + fednow_transfer_id: The identifier of the pending FedNow Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not fednow_transfer_id: + raise ValueError(f"Expected a non-empty value for `fednow_transfer_id` but received {fednow_transfer_id!r}") + return await self._post( + path_template("/fednow_transfers/{fednow_transfer_id}/cancel", fednow_transfer_id=fednow_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FednowTransfer, + ) + + +class FednowTransfersResourceWithRawResponse: + def __init__(self, fednow_transfers: FednowTransfersResource) -> None: + self._fednow_transfers = fednow_transfers + + self.create = to_raw_response_wrapper( + fednow_transfers.create, + ) + self.retrieve = to_raw_response_wrapper( + fednow_transfers.retrieve, + ) + self.list = to_raw_response_wrapper( + fednow_transfers.list, + ) + self.approve = to_raw_response_wrapper( + fednow_transfers.approve, + ) + self.cancel = to_raw_response_wrapper( + fednow_transfers.cancel, + ) + + +class AsyncFednowTransfersResourceWithRawResponse: + def __init__(self, fednow_transfers: AsyncFednowTransfersResource) -> None: + self._fednow_transfers = fednow_transfers + + self.create = async_to_raw_response_wrapper( + fednow_transfers.create, + ) + self.retrieve = async_to_raw_response_wrapper( + fednow_transfers.retrieve, + ) + self.list = async_to_raw_response_wrapper( + fednow_transfers.list, + ) + self.approve = async_to_raw_response_wrapper( + fednow_transfers.approve, + ) + self.cancel = async_to_raw_response_wrapper( + fednow_transfers.cancel, + ) + + +class FednowTransfersResourceWithStreamingResponse: + def __init__(self, fednow_transfers: FednowTransfersResource) -> None: + self._fednow_transfers = fednow_transfers + + self.create = to_streamed_response_wrapper( + fednow_transfers.create, + ) + self.retrieve = to_streamed_response_wrapper( + fednow_transfers.retrieve, + ) + self.list = to_streamed_response_wrapper( + fednow_transfers.list, + ) + self.approve = to_streamed_response_wrapper( + fednow_transfers.approve, + ) + self.cancel = to_streamed_response_wrapper( + fednow_transfers.cancel, + ) + + +class AsyncFednowTransfersResourceWithStreamingResponse: + def __init__(self, fednow_transfers: AsyncFednowTransfersResource) -> None: + self._fednow_transfers = fednow_transfers + + self.create = async_to_streamed_response_wrapper( + fednow_transfers.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + fednow_transfers.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + fednow_transfers.list, + ) + self.approve = async_to_streamed_response_wrapper( + fednow_transfers.approve, + ) + self.cancel = async_to_streamed_response_wrapper( + fednow_transfers.cancel, + ) diff --git a/src/increase/resources/file_links.py b/src/increase/resources/file_links.py new file mode 100644 index 000000000..f31574997 --- /dev/null +++ b/src/increase/resources/file_links.py @@ -0,0 +1,204 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime + +import httpx + +from ..types import file_link_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.file_link import FileLink + +__all__ = ["FileLinksResource", "AsyncFileLinksResource"] + + +class FileLinksResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> FileLinksResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return FileLinksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> FileLinksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return FileLinksResourceWithStreamingResponse(self) + + def create( + self, + *, + file_id: str, + expires_at: Union[str, datetime] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FileLink: + """ + Create a File Link + + Args: + file_id: The File to create a File Link for. + + expires_at: The time at which the File Link will expire. The default is 1 hour from the time + of the request. The maximum is 1 day from the time of the request. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/file_links", + body=maybe_transform( + { + "file_id": file_id, + "expires_at": expires_at, + }, + file_link_create_params.FileLinkCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FileLink, + ) + + +class AsyncFileLinksResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncFileLinksResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncFileLinksResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncFileLinksResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncFileLinksResourceWithStreamingResponse(self) + + async def create( + self, + *, + file_id: str, + expires_at: Union[str, datetime] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> FileLink: + """ + Create a File Link + + Args: + file_id: The File to create a File Link for. + + expires_at: The time at which the File Link will expire. The default is 1 hour from the time + of the request. The maximum is 1 day from the time of the request. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/file_links", + body=await async_maybe_transform( + { + "file_id": file_id, + "expires_at": expires_at, + }, + file_link_create_params.FileLinkCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=FileLink, + ) + + +class FileLinksResourceWithRawResponse: + def __init__(self, file_links: FileLinksResource) -> None: + self._file_links = file_links + + self.create = to_raw_response_wrapper( + file_links.create, + ) + + +class AsyncFileLinksResourceWithRawResponse: + def __init__(self, file_links: AsyncFileLinksResource) -> None: + self._file_links = file_links + + self.create = async_to_raw_response_wrapper( + file_links.create, + ) + + +class FileLinksResourceWithStreamingResponse: + def __init__(self, file_links: FileLinksResource) -> None: + self._file_links = file_links + + self.create = to_streamed_response_wrapper( + file_links.create, + ) + + +class AsyncFileLinksResourceWithStreamingResponse: + def __init__(self, file_links: AsyncFileLinksResource) -> None: + self._file_links = file_links + + self.create = async_to_streamed_response_wrapper( + file_links.create, + ) diff --git a/src/increase/resources/files.py b/src/increase/resources/files.py index cd1ddfae0..8ea95babc 100644 --- a/src/increase/resources/files.py +++ b/src/increase/resources/files.py @@ -7,46 +7,59 @@ import httpx -from .. import _legacy_response -from ..types import File, file_list_params, file_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven, FileTypes -from .._utils import ( - extract_files, - maybe_transform, - deepcopy_minimal, - async_maybe_transform, -) +from ..types import file_list_params, file_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, FileTypes, omit, not_given +from .._utils import extract_files, path_template, maybe_transform, deepcopy_minimal, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from ..types.file import File +from .._base_client import AsyncPaginator, make_request_options -__all__ = ["Files", "AsyncFiles"] +__all__ = ["FilesResource", "AsyncFilesResource"] -class Files(SyncAPIResource): +class FilesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> FilesWithRawResponse: - return FilesWithRawResponse(self) + def with_raw_response(self) -> FilesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return FilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> FilesWithStreamingResponse: - return FilesWithStreamingResponse(self) + def with_streaming_response(self) -> FilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return FilesResourceWithStreamingResponse(self) def create( self, *, file: FileTypes, purpose: Literal[ + "card_dispute_attachment", "check_image_front", "check_image_back", "mailed_check_image", + "check_attachment", + "check_voucher_image", + "check_signature", "form_ss_4", "identity_document", + "loan_application_supplemental_document", "other", "trust_formation_document", "digital_wallet_artwork", @@ -56,14 +69,15 @@ def create( "document_request", "entity_supplemental_document", "unusual_activity_report_attachment", + "proof_of_authorization_request_submission", ], - description: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> File: """ @@ -78,12 +92,23 @@ def create( purpose: What the File will be used for in Increase's systems. + - `card_dispute_attachment` - A file to be attached to a Card Dispute. - `check_image_front` - An image of the front of a check, used for check deposits. - `check_image_back` - An image of the back of a check, used for check deposits. - `mailed_check_image` - An image of a check that was mailed to a recipient. + - `check_attachment` - A document to be printed on an additional page and mailed + with a check that you've requested Increase print. This must be a PDF whose + pages are all US letter size and all have the same orientation. + - `check_voucher_image` - An image to be used as the check voucher image, which + is printed in the middle of the trifold area of a check. This must be a + 2550x1100 pixel PNG. + - `check_signature` - A signature image to be printed on a check. This must be a + 1320x120 pixel PNG. - `form_ss_4` - IRS Form SS-4. - `identity_document` - An image of a government-issued ID. + - `loan_application_supplemental_document` - A supplemental document for a Loan + Application. - `other` - A file purpose not covered by any of the other cases. - `trust_formation_document` - A legal document forming a trust. - `digital_wallet_artwork` - A card image to be rendered inside digital wallet @@ -91,7 +116,7 @@ def create( - `digital_wallet_app_icon` - An icon for you app to be rendered inside digital wallet apps. This must be a 100x100 pixel PNG. - `physical_card_front` - A card image to be printed on the front of a physical - card. This must be a 2100x1340 pixel PNG with no other color but black. + card. This must be a 2100x1344 pixel PNG with no other color but black. - `physical_card_carrier` - An image representing the entirety of the carrier used for a physical card. This must be a 2550x3300 pixel PNG with no other color but black. @@ -100,6 +125,8 @@ def create( Entity. - `unusual_activity_report_attachment` - An attachment to an Unusual Activity Report. + - `proof_of_authorization_request_submission` - A file containing additional + evidence for a Proof of Authorization Request Submission. description: The description you choose to give the File. @@ -121,11 +148,10 @@ def create( } ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - if files: - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return self._post( "/files", body=maybe_transform(body, file_create_params.FileCreateParams), @@ -149,7 +175,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> File: """ Retrieve a File @@ -168,7 +194,7 @@ def retrieve( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") return self._get( - f"/files/{file_id}", + path_template("/files/{file_id}", file_id=file_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,17 +204,17 @@ def retrieve( def list( self, *, - created_at: file_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - purpose: file_list_params.Purpose | NotGiven = NOT_GIVEN, + created_at: file_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + purpose: file_list_params.Purpose | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[File]: """ List Files @@ -235,25 +261,41 @@ def list( ) -class AsyncFiles(AsyncAPIResource): +class AsyncFilesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncFilesWithRawResponse: - return AsyncFilesWithRawResponse(self) + def with_raw_response(self) -> AsyncFilesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncFilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncFilesWithStreamingResponse: - return AsyncFilesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncFilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncFilesResourceWithStreamingResponse(self) async def create( self, *, file: FileTypes, purpose: Literal[ + "card_dispute_attachment", "check_image_front", "check_image_back", "mailed_check_image", + "check_attachment", + "check_voucher_image", + "check_signature", "form_ss_4", "identity_document", + "loan_application_supplemental_document", "other", "trust_formation_document", "digital_wallet_artwork", @@ -263,14 +305,15 @@ async def create( "document_request", "entity_supplemental_document", "unusual_activity_report_attachment", + "proof_of_authorization_request_submission", ], - description: str | NotGiven = NOT_GIVEN, + description: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> File: """ @@ -285,12 +328,23 @@ async def create( purpose: What the File will be used for in Increase's systems. + - `card_dispute_attachment` - A file to be attached to a Card Dispute. - `check_image_front` - An image of the front of a check, used for check deposits. - `check_image_back` - An image of the back of a check, used for check deposits. - `mailed_check_image` - An image of a check that was mailed to a recipient. + - `check_attachment` - A document to be printed on an additional page and mailed + with a check that you've requested Increase print. This must be a PDF whose + pages are all US letter size and all have the same orientation. + - `check_voucher_image` - An image to be used as the check voucher image, which + is printed in the middle of the trifold area of a check. This must be a + 2550x1100 pixel PNG. + - `check_signature` - A signature image to be printed on a check. This must be a + 1320x120 pixel PNG. - `form_ss_4` - IRS Form SS-4. - `identity_document` - An image of a government-issued ID. + - `loan_application_supplemental_document` - A supplemental document for a Loan + Application. - `other` - A file purpose not covered by any of the other cases. - `trust_formation_document` - A legal document forming a trust. - `digital_wallet_artwork` - A card image to be rendered inside digital wallet @@ -298,7 +352,7 @@ async def create( - `digital_wallet_app_icon` - An icon for you app to be rendered inside digital wallet apps. This must be a 100x100 pixel PNG. - `physical_card_front` - A card image to be printed on the front of a physical - card. This must be a 2100x1340 pixel PNG with no other color but black. + card. This must be a 2100x1344 pixel PNG with no other color but black. - `physical_card_carrier` - An image representing the entirety of the carrier used for a physical card. This must be a 2550x3300 pixel PNG with no other color but black. @@ -307,6 +361,8 @@ async def create( Entity. - `unusual_activity_report_attachment` - An attachment to an Unusual Activity Report. + - `proof_of_authorization_request_submission` - A file containing additional + evidence for a Proof of Authorization Request Submission. description: The description you choose to give the File. @@ -328,11 +384,10 @@ async def create( } ) files = extract_files(cast(Mapping[str, object], body), paths=[["file"]]) - if files: - # It should be noted that the actual Content-Type header that will be - # sent to the server will contain a `boundary` parameter, e.g. - # multipart/form-data; boundary=---abc-- - extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} + # It should be noted that the actual Content-Type header that will be + # sent to the server will contain a `boundary` parameter, e.g. + # multipart/form-data; boundary=---abc-- + extra_headers = {"Content-Type": "multipart/form-data", **(extra_headers or {})} return await self._post( "/files", body=await async_maybe_transform(body, file_create_params.FileCreateParams), @@ -356,7 +411,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> File: """ Retrieve a File @@ -375,7 +430,7 @@ async def retrieve( if not file_id: raise ValueError(f"Expected a non-empty value for `file_id` but received {file_id!r}") return await self._get( - f"/files/{file_id}", + path_template("/files/{file_id}", file_id=file_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -385,17 +440,17 @@ async def retrieve( def list( self, *, - created_at: file_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - purpose: file_list_params.Purpose | NotGiven = NOT_GIVEN, + created_at: file_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + purpose: file_list_params.Purpose | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[File, AsyncPage[File]]: """ List Files @@ -442,38 +497,38 @@ def list( ) -class FilesWithRawResponse: - def __init__(self, files: Files) -> None: +class FilesResourceWithRawResponse: + def __init__(self, files: FilesResource) -> None: self._files = files - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( files.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( files.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( files.list, ) -class AsyncFilesWithRawResponse: - def __init__(self, files: AsyncFiles) -> None: +class AsyncFilesResourceWithRawResponse: + def __init__(self, files: AsyncFilesResource) -> None: self._files = files - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( files.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( files.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( files.list, ) -class FilesWithStreamingResponse: - def __init__(self, files: Files) -> None: +class FilesResourceWithStreamingResponse: + def __init__(self, files: FilesResource) -> None: self._files = files self.create = to_streamed_response_wrapper( @@ -487,8 +542,8 @@ def __init__(self, files: Files) -> None: ) -class AsyncFilesWithStreamingResponse: - def __init__(self, files: AsyncFiles) -> None: +class AsyncFilesResourceWithStreamingResponse: + def __init__(self, files: AsyncFilesResource) -> None: self._files = files self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/groups.py b/src/increase/resources/groups.py index 0db2c3e14..9090fde98 100644 --- a/src/increase/resources/groups.py +++ b/src/increase/resources/groups.py @@ -4,29 +4,42 @@ import httpx -from .. import _legacy_response -from ..types import Group -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from .._types import Body, Query, Headers, NotGiven, not_given from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from .._base_client import ( - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..types.group import Group +from .._base_client import make_request_options -__all__ = ["Groups", "AsyncGroups"] +__all__ = ["GroupsResource", "AsyncGroupsResource"] -class Groups(SyncAPIResource): +class GroupsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> GroupsWithRawResponse: - return GroupsWithRawResponse(self) + def with_raw_response(self) -> GroupsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return GroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> GroupsWithStreamingResponse: - return GroupsWithStreamingResponse(self) + def with_streaming_response(self) -> GroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return GroupsResourceWithStreamingResponse(self) - def retrieve_details( + def retrieve( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -34,7 +47,7 @@ def retrieve_details( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Group: """Returns details for the currently authenticated Group.""" return self._get( @@ -46,16 +59,27 @@ def retrieve_details( ) -class AsyncGroups(AsyncAPIResource): +class AsyncGroupsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncGroupsWithRawResponse: - return AsyncGroupsWithRawResponse(self) + def with_raw_response(self) -> AsyncGroupsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncGroupsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncGroupsWithStreamingResponse: - return AsyncGroupsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncGroupsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncGroupsResourceWithStreamingResponse(self) - async def retrieve_details( + async def retrieve( self, *, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. @@ -63,7 +87,7 @@ async def retrieve_details( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Group: """Returns details for the currently authenticated Group.""" return await self._get( @@ -75,37 +99,37 @@ async def retrieve_details( ) -class GroupsWithRawResponse: - def __init__(self, groups: Groups) -> None: +class GroupsResourceWithRawResponse: + def __init__(self, groups: GroupsResource) -> None: self._groups = groups - self.retrieve_details = _legacy_response.to_raw_response_wrapper( - groups.retrieve_details, + self.retrieve = to_raw_response_wrapper( + groups.retrieve, ) -class AsyncGroupsWithRawResponse: - def __init__(self, groups: AsyncGroups) -> None: +class AsyncGroupsResourceWithRawResponse: + def __init__(self, groups: AsyncGroupsResource) -> None: self._groups = groups - self.retrieve_details = _legacy_response.async_to_raw_response_wrapper( - groups.retrieve_details, + self.retrieve = async_to_raw_response_wrapper( + groups.retrieve, ) -class GroupsWithStreamingResponse: - def __init__(self, groups: Groups) -> None: +class GroupsResourceWithStreamingResponse: + def __init__(self, groups: GroupsResource) -> None: self._groups = groups - self.retrieve_details = to_streamed_response_wrapper( - groups.retrieve_details, + self.retrieve = to_streamed_response_wrapper( + groups.retrieve, ) -class AsyncGroupsWithStreamingResponse: - def __init__(self, groups: AsyncGroups) -> None: +class AsyncGroupsResourceWithStreamingResponse: + def __init__(self, groups: AsyncGroupsResource) -> None: self._groups = groups - self.retrieve_details = async_to_streamed_response_wrapper( - groups.retrieve_details, + self.retrieve = async_to_streamed_response_wrapper( + groups.retrieve, ) diff --git a/src/increase/resources/inbound_ach_transfers.py b/src/increase/resources/inbound_ach_transfers.py index 11bce0c43..163a4ed45 100644 --- a/src/increase/resources/inbound_ach_transfers.py +++ b/src/increase/resources/inbound_ach_transfers.py @@ -6,38 +6,48 @@ import httpx -from .. import _legacy_response from ..types import ( - InboundACHTransfer, inbound_ach_transfer_list_params, + inbound_ach_transfer_decline_params, inbound_ach_transfer_transfer_return_params, - inbound_ach_transfer_notification_of_change_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, + inbound_ach_transfer_create_notification_of_change_params, ) +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.inbound_ach_transfer import InboundACHTransfer -__all__ = ["InboundACHTransfers", "AsyncInboundACHTransfers"] +__all__ = ["InboundACHTransfersResource", "AsyncInboundACHTransfersResource"] -class InboundACHTransfers(SyncAPIResource): +class InboundACHTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> InboundACHTransfersWithRawResponse: - return InboundACHTransfersWithRawResponse(self) + def with_raw_response(self) -> InboundACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundACHTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> InboundACHTransfersWithStreamingResponse: - return InboundACHTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> InboundACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundACHTransfersResourceWithStreamingResponse(self) def retrieve( self, @@ -48,7 +58,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InboundACHTransfer: """ Retrieve an Inbound ACH Transfer @@ -69,7 +79,9 @@ def retrieve( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return self._get( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}", inbound_ach_transfer_id=inbound_ach_transfer_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -79,40 +91,32 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - account_number_id: str | NotGiven = NOT_GIVEN, - created_at: inbound_ach_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["pending", "declined", "accepted", "returned"] | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_ach_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + status: inbound_ach_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[InboundACHTransfer]: """ List Inbound ACH Transfers Args: - account_id: Filter Inbound ACH Tranfers to ones belonging to the specified Account. + account_id: Filter Inbound ACH Transfers to ones belonging to the specified Account. - account_number_id: Filter Inbound ACH Tranfers to ones belonging to the specified Account Number. + account_number_id: Filter Inbound ACH Transfers to ones belonging to the specified Account Number. cursor: Return the page of entries after this one. limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: Filter Inbound ACH Transfers to those with the specified status. - - - `pending` - The Inbound ACH Transfer is awaiting action, will transition - automatically if no action is taken. - - `declined` - The Inbound ACH Transfer has been declined. - - `accepted` - The Inbound ACH Transfer is accepted. - - `returned` - The Inbound ACH Transfer has been returned. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -144,23 +148,30 @@ def list( model=InboundACHTransfer, ) - def decline( + def create_notification_of_change( self, inbound_ach_transfer_id: str, *, + updated_account_number: str | Omit = omit, + updated_routing_number: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundACHTransfer: """ - Decline an Inbound ACH Transfer + Create a notification of change for an Inbound ACH Transfer Args: - inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer to decline. + inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer for which to create a notification of + change. + + updated_account_number: The updated account number to send in the notification of change. + + updated_routing_number: The updated routing number to send in the notification of change. extra_headers: Send extra headers @@ -177,7 +188,17 @@ def decline( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return self._post( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}/decline", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}/create_notification_of_change", + inbound_ach_transfer_id=inbound_ach_transfer_id, + ), + body=maybe_transform( + { + "updated_account_number": updated_account_number, + "updated_routing_number": updated_routing_number, + }, + inbound_ach_transfer_create_notification_of_change_params.InboundACHTransferCreateNotificationOfChangeParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -188,30 +209,59 @@ def decline( cast_to=InboundACHTransfer, ) - def notification_of_change( + def decline( self, inbound_ach_transfer_id: str, *, - updated_account_number: str | NotGiven = NOT_GIVEN, - updated_routing_number: str | NotGiven = NOT_GIVEN, + reason: Literal[ + "insufficient_funds", + "authorization_revoked_by_customer", + "payment_stopped", + "customer_advised_unauthorized_improper_ineligible_or_incomplete", + "representative_payee_deceased_or_unable_to_continue_in_that_capacity", + "beneficiary_or_account_holder_deceased", + "credit_entry_refused_by_receiver", + "duplicate_entry", + "corporate_customer_advised_not_authorized", + ] + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundACHTransfer: """ - Create a notification of change for an Inbound ACH Transfer + Decline an Inbound ACH Transfer Args: - inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer for which to create a notification of - change. + inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer to decline. - updated_account_number: The updated account number to send in the notification of change. + reason: The reason why this transfer will be returned. If this parameter is unset, the + return codes will be `payment_stopped` for debits and + `credit_entry_refused_by_receiver` for credits. - updated_routing_number: The updated routing number to send in the notification of change. + - `insufficient_funds` - The customer's account has insufficient funds. This + reason is only allowed for debits. The Nacha return code is R01. + - `authorization_revoked_by_customer` - The customer no longer authorizes this + transaction. The Nacha return code is R07. + - `payment_stopped` - The customer asked for the payment to be stopped. This + reason is only allowed for debits. The Nacha return code is R08. + - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - The + customer advises that the debit was unauthorized. The Nacha return code is + R10. + - `representative_payee_deceased_or_unable_to_continue_in_that_capacity` - The + payee is deceased. The Nacha return code is R14. + - `beneficiary_or_account_holder_deceased` - The account holder is deceased. The + Nacha return code is R15. + - `credit_entry_refused_by_receiver` - The customer refused a credit entry. This + reason is only allowed for credits. The Nacha return code is R23. + - `duplicate_entry` - The account holder identified this transaction as a + duplicate. The Nacha return code is R24. + - `corporate_customer_advised_not_authorized` - The corporate customer no longer + authorizes this transaction. The Nacha return code is R29. extra_headers: Send extra headers @@ -228,13 +278,12 @@ def notification_of_change( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return self._post( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}/notification_of_change", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}/decline", + inbound_ach_transfer_id=inbound_ach_transfer_id, + ), body=maybe_transform( - { - "updated_account_number": updated_account_number, - "updated_routing_number": updated_routing_number, - }, - inbound_ach_transfer_notification_of_change_params.InboundACHTransferNotificationOfChangeParams, + {"reason": reason}, inbound_ach_transfer_decline_params.InboundACHTransferDeclineParams ), options=make_request_options( extra_headers=extra_headers, @@ -251,7 +300,7 @@ def transfer_return( inbound_ach_transfer_id: str, *, reason: Literal[ - "returned_per_odfi_request", + "insufficient_funds", "authorization_revoked_by_customer", "payment_stopped", "customer_advised_unauthorized_improper_ineligible_or_incomplete", @@ -266,7 +315,7 @@ def transfer_return( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundACHTransfer: """ @@ -279,9 +328,8 @@ def transfer_return( reason: The reason why this transfer will be returned. The most usual return codes are `payment_stopped` for debits and `credit_entry_refused_by_receiver` for credits. - - `returned_per_odfi_request` - The originating financial institution asked for - this transfer to be returned. The receiving bank is complying with the - request. The Nacha return code is R06. + - `insufficient_funds` - The customer's account has insufficient funds. This + reason is only allowed for debits. The Nacha return code is R01. - `authorization_revoked_by_customer` - The customer no longer authorizes this transaction. The Nacha return code is R07. - `payment_stopped` - The customer asked for the payment to be stopped. This @@ -315,7 +363,10 @@ def transfer_return( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return self._post( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}/transfer_return", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}/transfer_return", + inbound_ach_transfer_id=inbound_ach_transfer_id, + ), body=maybe_transform( {"reason": reason}, inbound_ach_transfer_transfer_return_params.InboundACHTransferTransferReturnParams ), @@ -330,14 +381,25 @@ def transfer_return( ) -class AsyncInboundACHTransfers(AsyncAPIResource): +class AsyncInboundACHTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncInboundACHTransfersWithRawResponse: - return AsyncInboundACHTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncInboundACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundACHTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncInboundACHTransfersWithStreamingResponse: - return AsyncInboundACHTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncInboundACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundACHTransfersResourceWithStreamingResponse(self) async def retrieve( self, @@ -348,7 +410,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InboundACHTransfer: """ Retrieve an Inbound ACH Transfer @@ -369,7 +431,9 @@ async def retrieve( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return await self._get( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}", inbound_ach_transfer_id=inbound_ach_transfer_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -379,40 +443,32 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - account_number_id: str | NotGiven = NOT_GIVEN, - created_at: inbound_ach_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["pending", "declined", "accepted", "returned"] | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_ach_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + status: inbound_ach_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InboundACHTransfer, AsyncPage[InboundACHTransfer]]: """ List Inbound ACH Transfers Args: - account_id: Filter Inbound ACH Tranfers to ones belonging to the specified Account. + account_id: Filter Inbound ACH Transfers to ones belonging to the specified Account. - account_number_id: Filter Inbound ACH Tranfers to ones belonging to the specified Account Number. + account_number_id: Filter Inbound ACH Transfers to ones belonging to the specified Account Number. cursor: Return the page of entries after this one. limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: Filter Inbound ACH Transfers to those with the specified status. - - - `pending` - The Inbound ACH Transfer is awaiting action, will transition - automatically if no action is taken. - - `declined` - The Inbound ACH Transfer has been declined. - - `accepted` - The Inbound ACH Transfer is accepted. - - `returned` - The Inbound ACH Transfer has been returned. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -444,23 +500,30 @@ def list( model=InboundACHTransfer, ) - async def decline( + async def create_notification_of_change( self, inbound_ach_transfer_id: str, *, + updated_account_number: str | Omit = omit, + updated_routing_number: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundACHTransfer: """ - Decline an Inbound ACH Transfer + Create a notification of change for an Inbound ACH Transfer Args: - inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer to decline. + inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer for which to create a notification of + change. + + updated_account_number: The updated account number to send in the notification of change. + + updated_routing_number: The updated routing number to send in the notification of change. extra_headers: Send extra headers @@ -477,7 +540,17 @@ async def decline( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return await self._post( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}/decline", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}/create_notification_of_change", + inbound_ach_transfer_id=inbound_ach_transfer_id, + ), + body=await async_maybe_transform( + { + "updated_account_number": updated_account_number, + "updated_routing_number": updated_routing_number, + }, + inbound_ach_transfer_create_notification_of_change_params.InboundACHTransferCreateNotificationOfChangeParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -488,30 +561,59 @@ async def decline( cast_to=InboundACHTransfer, ) - async def notification_of_change( + async def decline( self, inbound_ach_transfer_id: str, *, - updated_account_number: str | NotGiven = NOT_GIVEN, - updated_routing_number: str | NotGiven = NOT_GIVEN, + reason: Literal[ + "insufficient_funds", + "authorization_revoked_by_customer", + "payment_stopped", + "customer_advised_unauthorized_improper_ineligible_or_incomplete", + "representative_payee_deceased_or_unable_to_continue_in_that_capacity", + "beneficiary_or_account_holder_deceased", + "credit_entry_refused_by_receiver", + "duplicate_entry", + "corporate_customer_advised_not_authorized", + ] + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundACHTransfer: """ - Create a notification of change for an Inbound ACH Transfer + Decline an Inbound ACH Transfer Args: - inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer for which to create a notification of - change. + inbound_ach_transfer_id: The identifier of the Inbound ACH Transfer to decline. - updated_account_number: The updated account number to send in the notification of change. + reason: The reason why this transfer will be returned. If this parameter is unset, the + return codes will be `payment_stopped` for debits and + `credit_entry_refused_by_receiver` for credits. - updated_routing_number: The updated routing number to send in the notification of change. + - `insufficient_funds` - The customer's account has insufficient funds. This + reason is only allowed for debits. The Nacha return code is R01. + - `authorization_revoked_by_customer` - The customer no longer authorizes this + transaction. The Nacha return code is R07. + - `payment_stopped` - The customer asked for the payment to be stopped. This + reason is only allowed for debits. The Nacha return code is R08. + - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - The + customer advises that the debit was unauthorized. The Nacha return code is + R10. + - `representative_payee_deceased_or_unable_to_continue_in_that_capacity` - The + payee is deceased. The Nacha return code is R14. + - `beneficiary_or_account_holder_deceased` - The account holder is deceased. The + Nacha return code is R15. + - `credit_entry_refused_by_receiver` - The customer refused a credit entry. This + reason is only allowed for credits. The Nacha return code is R23. + - `duplicate_entry` - The account holder identified this transaction as a + duplicate. The Nacha return code is R24. + - `corporate_customer_advised_not_authorized` - The corporate customer no longer + authorizes this transaction. The Nacha return code is R29. extra_headers: Send extra headers @@ -528,13 +630,12 @@ async def notification_of_change( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return await self._post( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}/notification_of_change", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}/decline", + inbound_ach_transfer_id=inbound_ach_transfer_id, + ), body=await async_maybe_transform( - { - "updated_account_number": updated_account_number, - "updated_routing_number": updated_routing_number, - }, - inbound_ach_transfer_notification_of_change_params.InboundACHTransferNotificationOfChangeParams, + {"reason": reason}, inbound_ach_transfer_decline_params.InboundACHTransferDeclineParams ), options=make_request_options( extra_headers=extra_headers, @@ -551,7 +652,7 @@ async def transfer_return( inbound_ach_transfer_id: str, *, reason: Literal[ - "returned_per_odfi_request", + "insufficient_funds", "authorization_revoked_by_customer", "payment_stopped", "customer_advised_unauthorized_improper_ineligible_or_incomplete", @@ -566,7 +667,7 @@ async def transfer_return( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundACHTransfer: """ @@ -579,9 +680,8 @@ async def transfer_return( reason: The reason why this transfer will be returned. The most usual return codes are `payment_stopped` for debits and `credit_entry_refused_by_receiver` for credits. - - `returned_per_odfi_request` - The originating financial institution asked for - this transfer to be returned. The receiving bank is complying with the - request. The Nacha return code is R06. + - `insufficient_funds` - The customer's account has insufficient funds. This + reason is only allowed for debits. The Nacha return code is R01. - `authorization_revoked_by_customer` - The customer no longer authorizes this transaction. The Nacha return code is R07. - `payment_stopped` - The customer asked for the payment to be stopped. This @@ -615,7 +715,10 @@ async def transfer_return( f"Expected a non-empty value for `inbound_ach_transfer_id` but received {inbound_ach_transfer_id!r}" ) return await self._post( - f"/inbound_ach_transfers/{inbound_ach_transfer_id}/transfer_return", + path_template( + "/inbound_ach_transfers/{inbound_ach_transfer_id}/transfer_return", + inbound_ach_transfer_id=inbound_ach_transfer_id, + ), body=await async_maybe_transform( {"reason": reason}, inbound_ach_transfer_transfer_return_params.InboundACHTransferTransferReturnParams ), @@ -630,50 +733,50 @@ async def transfer_return( ) -class InboundACHTransfersWithRawResponse: - def __init__(self, inbound_ach_transfers: InboundACHTransfers) -> None: +class InboundACHTransfersResourceWithRawResponse: + def __init__(self, inbound_ach_transfers: InboundACHTransfersResource) -> None: self._inbound_ach_transfers = inbound_ach_transfers - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( inbound_ach_transfers.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( inbound_ach_transfers.list, ) - self.decline = _legacy_response.to_raw_response_wrapper( - inbound_ach_transfers.decline, + self.create_notification_of_change = to_raw_response_wrapper( + inbound_ach_transfers.create_notification_of_change, ) - self.notification_of_change = _legacy_response.to_raw_response_wrapper( - inbound_ach_transfers.notification_of_change, + self.decline = to_raw_response_wrapper( + inbound_ach_transfers.decline, ) - self.transfer_return = _legacy_response.to_raw_response_wrapper( + self.transfer_return = to_raw_response_wrapper( inbound_ach_transfers.transfer_return, ) -class AsyncInboundACHTransfersWithRawResponse: - def __init__(self, inbound_ach_transfers: AsyncInboundACHTransfers) -> None: +class AsyncInboundACHTransfersResourceWithRawResponse: + def __init__(self, inbound_ach_transfers: AsyncInboundACHTransfersResource) -> None: self._inbound_ach_transfers = inbound_ach_transfers - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( inbound_ach_transfers.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( inbound_ach_transfers.list, ) - self.decline = _legacy_response.async_to_raw_response_wrapper( - inbound_ach_transfers.decline, + self.create_notification_of_change = async_to_raw_response_wrapper( + inbound_ach_transfers.create_notification_of_change, ) - self.notification_of_change = _legacy_response.async_to_raw_response_wrapper( - inbound_ach_transfers.notification_of_change, + self.decline = async_to_raw_response_wrapper( + inbound_ach_transfers.decline, ) - self.transfer_return = _legacy_response.async_to_raw_response_wrapper( + self.transfer_return = async_to_raw_response_wrapper( inbound_ach_transfers.transfer_return, ) -class InboundACHTransfersWithStreamingResponse: - def __init__(self, inbound_ach_transfers: InboundACHTransfers) -> None: +class InboundACHTransfersResourceWithStreamingResponse: + def __init__(self, inbound_ach_transfers: InboundACHTransfersResource) -> None: self._inbound_ach_transfers = inbound_ach_transfers self.retrieve = to_streamed_response_wrapper( @@ -682,19 +785,19 @@ def __init__(self, inbound_ach_transfers: InboundACHTransfers) -> None: self.list = to_streamed_response_wrapper( inbound_ach_transfers.list, ) + self.create_notification_of_change = to_streamed_response_wrapper( + inbound_ach_transfers.create_notification_of_change, + ) self.decline = to_streamed_response_wrapper( inbound_ach_transfers.decline, ) - self.notification_of_change = to_streamed_response_wrapper( - inbound_ach_transfers.notification_of_change, - ) self.transfer_return = to_streamed_response_wrapper( inbound_ach_transfers.transfer_return, ) -class AsyncInboundACHTransfersWithStreamingResponse: - def __init__(self, inbound_ach_transfers: AsyncInboundACHTransfers) -> None: +class AsyncInboundACHTransfersResourceWithStreamingResponse: + def __init__(self, inbound_ach_transfers: AsyncInboundACHTransfersResource) -> None: self._inbound_ach_transfers = inbound_ach_transfers self.retrieve = async_to_streamed_response_wrapper( @@ -703,12 +806,12 @@ def __init__(self, inbound_ach_transfers: AsyncInboundACHTransfers) -> None: self.list = async_to_streamed_response_wrapper( inbound_ach_transfers.list, ) + self.create_notification_of_change = async_to_streamed_response_wrapper( + inbound_ach_transfers.create_notification_of_change, + ) self.decline = async_to_streamed_response_wrapper( inbound_ach_transfers.decline, ) - self.notification_of_change = async_to_streamed_response_wrapper( - inbound_ach_transfers.notification_of_change, - ) self.transfer_return = async_to_streamed_response_wrapper( inbound_ach_transfers.transfer_return, ) diff --git a/src/increase/resources/inbound_check_deposits.py b/src/increase/resources/inbound_check_deposits.py new file mode 100644 index 000000000..d70fccad5 --- /dev/null +++ b/src/increase/resources/inbound_check_deposits.py @@ -0,0 +1,562 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..types import inbound_check_deposit_list_params, inbound_check_deposit_return_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.inbound_check_deposit import InboundCheckDeposit + +__all__ = ["InboundCheckDepositsResource", "AsyncInboundCheckDepositsResource"] + + +class InboundCheckDepositsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundCheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundCheckDepositsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundCheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundCheckDepositsResourceWithStreamingResponse(self) + + def retrieve( + self, + inbound_check_deposit_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundCheckDeposit: + """ + Retrieve an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to get details for. + + 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 inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return self._get( + path_template( + "/inbound_check_deposits/{inbound_check_deposit_id}", inbound_check_deposit_id=inbound_check_deposit_id + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundCheckDeposit, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + check_transfer_id: str | Omit = omit, + created_at: inbound_check_deposit_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[InboundCheckDeposit]: + """ + List Inbound Check Deposits + + Args: + account_id: Filter Inbound Check Deposits to those belonging to the specified Account. + + check_transfer_id: Filter Inbound Check Deposits to those belonging to the specified Check + Transfer. + + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/inbound_check_deposits", + page=SyncPage[InboundCheckDeposit], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "check_transfer_id": check_transfer_id, + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + inbound_check_deposit_list_params.InboundCheckDepositListParams, + ), + ), + model=InboundCheckDeposit, + ) + + def decline( + self, + inbound_check_deposit_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """ + Decline an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to decline. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return self._post( + path_template( + "/inbound_check_deposits/{inbound_check_deposit_id}/decline", + inbound_check_deposit_id=inbound_check_deposit_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + def return_( + self, + inbound_check_deposit_id: str, + *, + reason: Literal[ + "altered_or_fictitious", + "not_authorized", + "duplicate_presentment", + "endorsement_missing", + "endorsement_irregular", + "refer_to_maker", + ], + # 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, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """ + Return an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to return. + + reason: The reason to return the Inbound Check Deposit. + + - `altered_or_fictitious` - The check was altered or fictitious. + - `not_authorized` - The check was not authorized. + - `duplicate_presentment` - The check was a duplicate presentment. + - `endorsement_missing` - The check was not endorsed. + - `endorsement_irregular` - The check was not endorsed by the payee. + - `refer_to_maker` - The maker of the check requested its return. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return self._post( + path_template( + "/inbound_check_deposits/{inbound_check_deposit_id}/return", + inbound_check_deposit_id=inbound_check_deposit_id, + ), + body=maybe_transform( + {"reason": reason}, inbound_check_deposit_return_params.InboundCheckDepositReturnParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + +class AsyncInboundCheckDepositsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundCheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundCheckDepositsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundCheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundCheckDepositsResourceWithStreamingResponse(self) + + async def retrieve( + self, + inbound_check_deposit_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundCheckDeposit: + """ + Retrieve an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to get details for. + + 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 inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return await self._get( + path_template( + "/inbound_check_deposits/{inbound_check_deposit_id}", inbound_check_deposit_id=inbound_check_deposit_id + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundCheckDeposit, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + check_transfer_id: str | Omit = omit, + created_at: inbound_check_deposit_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[InboundCheckDeposit, AsyncPage[InboundCheckDeposit]]: + """ + List Inbound Check Deposits + + Args: + account_id: Filter Inbound Check Deposits to those belonging to the specified Account. + + check_transfer_id: Filter Inbound Check Deposits to those belonging to the specified Check + Transfer. + + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/inbound_check_deposits", + page=AsyncPage[InboundCheckDeposit], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "check_transfer_id": check_transfer_id, + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + inbound_check_deposit_list_params.InboundCheckDepositListParams, + ), + ), + model=InboundCheckDeposit, + ) + + async def decline( + self, + inbound_check_deposit_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """ + Decline an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to decline. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return await self._post( + path_template( + "/inbound_check_deposits/{inbound_check_deposit_id}/decline", + inbound_check_deposit_id=inbound_check_deposit_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + async def return_( + self, + inbound_check_deposit_id: str, + *, + reason: Literal[ + "altered_or_fictitious", + "not_authorized", + "duplicate_presentment", + "endorsement_missing", + "endorsement_irregular", + "refer_to_maker", + ], + # 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, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """ + Return an Inbound Check Deposit + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to return. + + reason: The reason to return the Inbound Check Deposit. + + - `altered_or_fictitious` - The check was altered or fictitious. + - `not_authorized` - The check was not authorized. + - `duplicate_presentment` - The check was a duplicate presentment. + - `endorsement_missing` - The check was not endorsed. + - `endorsement_irregular` - The check was not endorsed by the payee. + - `refer_to_maker` - The maker of the check requested its return. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return await self._post( + path_template( + "/inbound_check_deposits/{inbound_check_deposit_id}/return", + inbound_check_deposit_id=inbound_check_deposit_id, + ), + body=await async_maybe_transform( + {"reason": reason}, inbound_check_deposit_return_params.InboundCheckDepositReturnParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + +class InboundCheckDepositsResourceWithRawResponse: + def __init__(self, inbound_check_deposits: InboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.retrieve = to_raw_response_wrapper( + inbound_check_deposits.retrieve, + ) + self.list = to_raw_response_wrapper( + inbound_check_deposits.list, + ) + self.decline = to_raw_response_wrapper( + inbound_check_deposits.decline, + ) + self.return_ = to_raw_response_wrapper( + inbound_check_deposits.return_, + ) + + +class AsyncInboundCheckDepositsResourceWithRawResponse: + def __init__(self, inbound_check_deposits: AsyncInboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.retrieve = async_to_raw_response_wrapper( + inbound_check_deposits.retrieve, + ) + self.list = async_to_raw_response_wrapper( + inbound_check_deposits.list, + ) + self.decline = async_to_raw_response_wrapper( + inbound_check_deposits.decline, + ) + self.return_ = async_to_raw_response_wrapper( + inbound_check_deposits.return_, + ) + + +class InboundCheckDepositsResourceWithStreamingResponse: + def __init__(self, inbound_check_deposits: InboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.retrieve = to_streamed_response_wrapper( + inbound_check_deposits.retrieve, + ) + self.list = to_streamed_response_wrapper( + inbound_check_deposits.list, + ) + self.decline = to_streamed_response_wrapper( + inbound_check_deposits.decline, + ) + self.return_ = to_streamed_response_wrapper( + inbound_check_deposits.return_, + ) + + +class AsyncInboundCheckDepositsResourceWithStreamingResponse: + def __init__(self, inbound_check_deposits: AsyncInboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.retrieve = async_to_streamed_response_wrapper( + inbound_check_deposits.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + inbound_check_deposits.list, + ) + self.decline = async_to_streamed_response_wrapper( + inbound_check_deposits.decline, + ) + self.return_ = async_to_streamed_response_wrapper( + inbound_check_deposits.return_, + ) diff --git a/src/increase/resources/inbound_fednow_transfers.py b/src/increase/resources/inbound_fednow_transfers.py new file mode 100644 index 000000000..b4b91e369 --- /dev/null +++ b/src/increase/resources/inbound_fednow_transfers.py @@ -0,0 +1,310 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import inbound_fednow_transfer_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.inbound_fednow_transfer import InboundFednowTransfer + +__all__ = ["InboundFednowTransfersResource", "AsyncInboundFednowTransfersResource"] + + +class InboundFednowTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundFednowTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundFednowTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundFednowTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundFednowTransfersResourceWithStreamingResponse(self) + + def retrieve( + self, + inbound_fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundFednowTransfer: + """ + Retrieve an Inbound FedNow Transfer + + Args: + inbound_fednow_transfer_id: The identifier of the Inbound FedNow Transfer to get details for. + + 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 inbound_fednow_transfer_id: + raise ValueError( + f"Expected a non-empty value for `inbound_fednow_transfer_id` but received {inbound_fednow_transfer_id!r}" + ) + return self._get( + path_template( + "/inbound_fednow_transfers/{inbound_fednow_transfer_id}", + inbound_fednow_transfer_id=inbound_fednow_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundFednowTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_fednow_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[InboundFednowTransfer]: + """ + List Inbound FedNow Transfers + + Args: + account_id: Filter Inbound FedNow Transfers to those belonging to the specified Account. + + account_number_id: Filter Inbound FedNow Transfers to ones belonging to the specified Account + Number. + + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/inbound_fednow_transfers", + page=SyncPage[InboundFednowTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "account_number_id": account_number_id, + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + inbound_fednow_transfer_list_params.InboundFednowTransferListParams, + ), + ), + model=InboundFednowTransfer, + ) + + +class AsyncInboundFednowTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundFednowTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundFednowTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundFednowTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundFednowTransfersResourceWithStreamingResponse(self) + + async def retrieve( + self, + inbound_fednow_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundFednowTransfer: + """ + Retrieve an Inbound FedNow Transfer + + Args: + inbound_fednow_transfer_id: The identifier of the Inbound FedNow Transfer to get details for. + + 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 inbound_fednow_transfer_id: + raise ValueError( + f"Expected a non-empty value for `inbound_fednow_transfer_id` but received {inbound_fednow_transfer_id!r}" + ) + return await self._get( + path_template( + "/inbound_fednow_transfers/{inbound_fednow_transfer_id}", + inbound_fednow_transfer_id=inbound_fednow_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundFednowTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_fednow_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[InboundFednowTransfer, AsyncPage[InboundFednowTransfer]]: + """ + List Inbound FedNow Transfers + + Args: + account_id: Filter Inbound FedNow Transfers to those belonging to the specified Account. + + account_number_id: Filter Inbound FedNow Transfers to ones belonging to the specified Account + Number. + + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/inbound_fednow_transfers", + page=AsyncPage[InboundFednowTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "account_number_id": account_number_id, + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + inbound_fednow_transfer_list_params.InboundFednowTransferListParams, + ), + ), + model=InboundFednowTransfer, + ) + + +class InboundFednowTransfersResourceWithRawResponse: + def __init__(self, inbound_fednow_transfers: InboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.retrieve = to_raw_response_wrapper( + inbound_fednow_transfers.retrieve, + ) + self.list = to_raw_response_wrapper( + inbound_fednow_transfers.list, + ) + + +class AsyncInboundFednowTransfersResourceWithRawResponse: + def __init__(self, inbound_fednow_transfers: AsyncInboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.retrieve = async_to_raw_response_wrapper( + inbound_fednow_transfers.retrieve, + ) + self.list = async_to_raw_response_wrapper( + inbound_fednow_transfers.list, + ) + + +class InboundFednowTransfersResourceWithStreamingResponse: + def __init__(self, inbound_fednow_transfers: InboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.retrieve = to_streamed_response_wrapper( + inbound_fednow_transfers.retrieve, + ) + self.list = to_streamed_response_wrapper( + inbound_fednow_transfers.list, + ) + + +class AsyncInboundFednowTransfersResourceWithStreamingResponse: + def __init__(self, inbound_fednow_transfers: AsyncInboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.retrieve = async_to_streamed_response_wrapper( + inbound_fednow_transfers.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + inbound_fednow_transfers.list, + ) diff --git a/src/increase/resources/inbound_mail_items.py b/src/increase/resources/inbound_mail_items.py new file mode 100644 index 000000000..8af4e7791 --- /dev/null +++ b/src/increase/resources/inbound_mail_items.py @@ -0,0 +1,410 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable + +import httpx + +from ..types import inbound_mail_item_list_params, inbound_mail_item_action_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.inbound_mail_item import InboundMailItem + +__all__ = ["InboundMailItemsResource", "AsyncInboundMailItemsResource"] + + +class InboundMailItemsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundMailItemsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundMailItemsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundMailItemsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundMailItemsResourceWithStreamingResponse(self) + + def retrieve( + self, + inbound_mail_item_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundMailItem: + """ + Retrieve an Inbound Mail Item + + Args: + inbound_mail_item_id: The identifier of the Inbound Mail Item to retrieve. + + 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 inbound_mail_item_id: + raise ValueError( + f"Expected a non-empty value for `inbound_mail_item_id` but received {inbound_mail_item_id!r}" + ) + return self._get( + path_template("/inbound_mail_items/{inbound_mail_item_id}", inbound_mail_item_id=inbound_mail_item_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundMailItem, + ) + + def list( + self, + *, + created_at: inbound_mail_item_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + lockbox_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[InboundMailItem]: + """ + List Inbound Mail Items + + Args: + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + lockbox_id: Filter Inbound Mail Items to ones sent to the provided Lockbox. + + 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 + """ + return self._get_api_list( + "/inbound_mail_items", + page=SyncPage[InboundMailItem], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "limit": limit, + "lockbox_id": lockbox_id, + }, + inbound_mail_item_list_params.InboundMailItemListParams, + ), + ), + model=InboundMailItem, + ) + + def action( + self, + inbound_mail_item_id: str, + *, + checks: Iterable[inbound_mail_item_action_params.Check], + # 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, + idempotency_key: str | None = None, + ) -> InboundMailItem: + """ + Action an Inbound Mail Item + + Args: + inbound_mail_item_id: The identifier of the Inbound Mail Item to action. + + checks: The actions to perform on the Inbound Mail Item. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_mail_item_id: + raise ValueError( + f"Expected a non-empty value for `inbound_mail_item_id` but received {inbound_mail_item_id!r}" + ) + return self._post( + path_template( + "/inbound_mail_items/{inbound_mail_item_id}/action", inbound_mail_item_id=inbound_mail_item_id + ), + body=maybe_transform({"checks": checks}, inbound_mail_item_action_params.InboundMailItemActionParams), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundMailItem, + ) + + +class AsyncInboundMailItemsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundMailItemsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundMailItemsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundMailItemsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundMailItemsResourceWithStreamingResponse(self) + + async def retrieve( + self, + inbound_mail_item_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundMailItem: + """ + Retrieve an Inbound Mail Item + + Args: + inbound_mail_item_id: The identifier of the Inbound Mail Item to retrieve. + + 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 inbound_mail_item_id: + raise ValueError( + f"Expected a non-empty value for `inbound_mail_item_id` but received {inbound_mail_item_id!r}" + ) + return await self._get( + path_template("/inbound_mail_items/{inbound_mail_item_id}", inbound_mail_item_id=inbound_mail_item_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundMailItem, + ) + + def list( + self, + *, + created_at: inbound_mail_item_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + lockbox_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[InboundMailItem, AsyncPage[InboundMailItem]]: + """ + List Inbound Mail Items + + Args: + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + lockbox_id: Filter Inbound Mail Items to ones sent to the provided Lockbox. + + 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 + """ + return self._get_api_list( + "/inbound_mail_items", + page=AsyncPage[InboundMailItem], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "limit": limit, + "lockbox_id": lockbox_id, + }, + inbound_mail_item_list_params.InboundMailItemListParams, + ), + ), + model=InboundMailItem, + ) + + async def action( + self, + inbound_mail_item_id: str, + *, + checks: Iterable[inbound_mail_item_action_params.Check], + # 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, + idempotency_key: str | None = None, + ) -> InboundMailItem: + """ + Action an Inbound Mail Item + + Args: + inbound_mail_item_id: The identifier of the Inbound Mail Item to action. + + checks: The actions to perform on the Inbound Mail Item. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_mail_item_id: + raise ValueError( + f"Expected a non-empty value for `inbound_mail_item_id` but received {inbound_mail_item_id!r}" + ) + return await self._post( + path_template( + "/inbound_mail_items/{inbound_mail_item_id}/action", inbound_mail_item_id=inbound_mail_item_id + ), + body=await async_maybe_transform( + {"checks": checks}, inbound_mail_item_action_params.InboundMailItemActionParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundMailItem, + ) + + +class InboundMailItemsResourceWithRawResponse: + def __init__(self, inbound_mail_items: InboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.retrieve = to_raw_response_wrapper( + inbound_mail_items.retrieve, + ) + self.list = to_raw_response_wrapper( + inbound_mail_items.list, + ) + self.action = to_raw_response_wrapper( + inbound_mail_items.action, + ) + + +class AsyncInboundMailItemsResourceWithRawResponse: + def __init__(self, inbound_mail_items: AsyncInboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.retrieve = async_to_raw_response_wrapper( + inbound_mail_items.retrieve, + ) + self.list = async_to_raw_response_wrapper( + inbound_mail_items.list, + ) + self.action = async_to_raw_response_wrapper( + inbound_mail_items.action, + ) + + +class InboundMailItemsResourceWithStreamingResponse: + def __init__(self, inbound_mail_items: InboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.retrieve = to_streamed_response_wrapper( + inbound_mail_items.retrieve, + ) + self.list = to_streamed_response_wrapper( + inbound_mail_items.list, + ) + self.action = to_streamed_response_wrapper( + inbound_mail_items.action, + ) + + +class AsyncInboundMailItemsResourceWithStreamingResponse: + def __init__(self, inbound_mail_items: AsyncInboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.retrieve = async_to_streamed_response_wrapper( + inbound_mail_items.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + inbound_mail_items.list, + ) + self.action = async_to_streamed_response_wrapper( + inbound_mail_items.action, + ) diff --git a/src/increase/resources/inbound_real_time_payments_transfers.py b/src/increase/resources/inbound_real_time_payments_transfers.py new file mode 100755 index 000000000..1e127a215 --- /dev/null +++ b/src/increase/resources/inbound_real_time_payments_transfers.py @@ -0,0 +1,312 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import inbound_real_time_payments_transfer_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.inbound_real_time_payments_transfer import InboundRealTimePaymentsTransfer + +__all__ = ["InboundRealTimePaymentsTransfersResource", "AsyncInboundRealTimePaymentsTransfersResource"] + + +class InboundRealTimePaymentsTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundRealTimePaymentsTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundRealTimePaymentsTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundRealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundRealTimePaymentsTransfersResourceWithStreamingResponse(self) + + def retrieve( + self, + inbound_real_time_payments_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundRealTimePaymentsTransfer: + """ + Retrieve an Inbound Real-Time Payments Transfer + + Args: + inbound_real_time_payments_transfer_id: The identifier of the Inbound Real-Time Payments Transfer to get details for. + + 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 inbound_real_time_payments_transfer_id: + raise ValueError( + f"Expected a non-empty value for `inbound_real_time_payments_transfer_id` but received {inbound_real_time_payments_transfer_id!r}" + ) + return self._get( + path_template( + "/inbound_real_time_payments_transfers/{inbound_real_time_payments_transfer_id}", + inbound_real_time_payments_transfer_id=inbound_real_time_payments_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundRealTimePaymentsTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_real_time_payments_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[InboundRealTimePaymentsTransfer]: + """ + List Inbound Real-Time Payments Transfers + + Args: + account_id: Filter Inbound Real-Time Payments Transfers to those belonging to the specified + Account. + + account_number_id: Filter Inbound Real-Time Payments Transfers to ones belonging to the specified + Account Number. + + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/inbound_real_time_payments_transfers", + page=SyncPage[InboundRealTimePaymentsTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "account_number_id": account_number_id, + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + inbound_real_time_payments_transfer_list_params.InboundRealTimePaymentsTransferListParams, + ), + ), + model=InboundRealTimePaymentsTransfer, + ) + + +class AsyncInboundRealTimePaymentsTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse(self) + + async def retrieve( + self, + inbound_real_time_payments_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> InboundRealTimePaymentsTransfer: + """ + Retrieve an Inbound Real-Time Payments Transfer + + Args: + inbound_real_time_payments_transfer_id: The identifier of the Inbound Real-Time Payments Transfer to get details for. + + 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 inbound_real_time_payments_transfer_id: + raise ValueError( + f"Expected a non-empty value for `inbound_real_time_payments_transfer_id` but received {inbound_real_time_payments_transfer_id!r}" + ) + return await self._get( + path_template( + "/inbound_real_time_payments_transfers/{inbound_real_time_payments_transfer_id}", + inbound_real_time_payments_transfer_id=inbound_real_time_payments_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=InboundRealTimePaymentsTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_real_time_payments_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[InboundRealTimePaymentsTransfer, AsyncPage[InboundRealTimePaymentsTransfer]]: + """ + List Inbound Real-Time Payments Transfers + + Args: + account_id: Filter Inbound Real-Time Payments Transfers to those belonging to the specified + Account. + + account_number_id: Filter Inbound Real-Time Payments Transfers to ones belonging to the specified + Account Number. + + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/inbound_real_time_payments_transfers", + page=AsyncPage[InboundRealTimePaymentsTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "account_number_id": account_number_id, + "created_at": created_at, + "cursor": cursor, + "limit": limit, + }, + inbound_real_time_payments_transfer_list_params.InboundRealTimePaymentsTransferListParams, + ), + ), + model=InboundRealTimePaymentsTransfer, + ) + + +class InboundRealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, inbound_real_time_payments_transfers: InboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.retrieve = to_raw_response_wrapper( + inbound_real_time_payments_transfers.retrieve, + ) + self.list = to_raw_response_wrapper( + inbound_real_time_payments_transfers.list, + ) + + +class AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, inbound_real_time_payments_transfers: AsyncInboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.retrieve = async_to_raw_response_wrapper( + inbound_real_time_payments_transfers.retrieve, + ) + self.list = async_to_raw_response_wrapper( + inbound_real_time_payments_transfers.list, + ) + + +class InboundRealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, inbound_real_time_payments_transfers: InboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.retrieve = to_streamed_response_wrapper( + inbound_real_time_payments_transfers.retrieve, + ) + self.list = to_streamed_response_wrapper( + inbound_real_time_payments_transfers.list, + ) + + +class AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, inbound_real_time_payments_transfers: AsyncInboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.retrieve = async_to_streamed_response_wrapper( + inbound_real_time_payments_transfers.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + inbound_real_time_payments_transfers.list, + ) diff --git a/src/increase/resources/inbound_wire_drawdown_requests.py b/src/increase/resources/inbound_wire_drawdown_requests.py index 3287e17b9..31987d38c 100644 --- a/src/increase/resources/inbound_wire_drawdown_requests.py +++ b/src/increase/resources/inbound_wire_drawdown_requests.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import InboundWireDrawdownRequest, inbound_wire_drawdown_request_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import inbound_wire_drawdown_request_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.inbound_wire_drawdown_request import InboundWireDrawdownRequest -__all__ = ["InboundWireDrawdownRequests", "AsyncInboundWireDrawdownRequests"] +__all__ = ["InboundWireDrawdownRequestsResource", "AsyncInboundWireDrawdownRequestsResource"] -class InboundWireDrawdownRequests(SyncAPIResource): +class InboundWireDrawdownRequestsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> InboundWireDrawdownRequestsWithRawResponse: - return InboundWireDrawdownRequestsWithRawResponse(self) + def with_raw_response(self) -> InboundWireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundWireDrawdownRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> InboundWireDrawdownRequestsWithStreamingResponse: - return InboundWireDrawdownRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> InboundWireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundWireDrawdownRequestsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InboundWireDrawdownRequest: """ Retrieve an Inbound Wire Drawdown Request @@ -59,7 +72,10 @@ def retrieve( f"Expected a non-empty value for `inbound_wire_drawdown_request_id` but received {inbound_wire_drawdown_request_id!r}" ) return self._get( - f"/inbound_wire_drawdown_requests/{inbound_wire_drawdown_request_id}", + path_template( + "/inbound_wire_drawdown_requests/{inbound_wire_drawdown_request_id}", + inbound_wire_drawdown_request_id=inbound_wire_drawdown_request_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,14 +85,14 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[InboundWireDrawdownRequest]: """ List Inbound Wire Drawdown Requests @@ -115,14 +131,25 @@ def list( ) -class AsyncInboundWireDrawdownRequests(AsyncAPIResource): +class AsyncInboundWireDrawdownRequestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncInboundWireDrawdownRequestsWithRawResponse: - return AsyncInboundWireDrawdownRequestsWithRawResponse(self) + def with_raw_response(self) -> AsyncInboundWireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundWireDrawdownRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncInboundWireDrawdownRequestsWithStreamingResponse: - return AsyncInboundWireDrawdownRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse(self) async def retrieve( self, @@ -133,7 +160,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InboundWireDrawdownRequest: """ Retrieve an Inbound Wire Drawdown Request @@ -154,7 +181,10 @@ async def retrieve( f"Expected a non-empty value for `inbound_wire_drawdown_request_id` but received {inbound_wire_drawdown_request_id!r}" ) return await self._get( - f"/inbound_wire_drawdown_requests/{inbound_wire_drawdown_request_id}", + path_template( + "/inbound_wire_drawdown_requests/{inbound_wire_drawdown_request_id}", + inbound_wire_drawdown_request_id=inbound_wire_drawdown_request_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,14 +194,14 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InboundWireDrawdownRequest, AsyncPage[InboundWireDrawdownRequest]]: """ List Inbound Wire Drawdown Requests @@ -210,32 +240,32 @@ def list( ) -class InboundWireDrawdownRequestsWithRawResponse: - def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequests) -> None: +class InboundWireDrawdownRequestsResourceWithRawResponse: + def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( inbound_wire_drawdown_requests.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( inbound_wire_drawdown_requests.list, ) -class AsyncInboundWireDrawdownRequestsWithRawResponse: - def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequests) -> None: +class AsyncInboundWireDrawdownRequestsResourceWithRawResponse: + def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( inbound_wire_drawdown_requests.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( inbound_wire_drawdown_requests.list, ) -class InboundWireDrawdownRequestsWithStreamingResponse: - def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequests) -> None: +class InboundWireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests self.retrieve = to_streamed_response_wrapper( @@ -246,8 +276,8 @@ def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequests) ) -class AsyncInboundWireDrawdownRequestsWithStreamingResponse: - def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequests) -> None: +class AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/inbound_wire_transfers.py b/src/increase/resources/inbound_wire_transfers.py index 3196f9788..cf8b2f641 100644 --- a/src/increase/resources/inbound_wire_transfers.py +++ b/src/increase/resources/inbound_wire_transfers.py @@ -6,30 +6,43 @@ import httpx -from .. import _legacy_response -from ..types import InboundWireTransfer, inbound_wire_transfer_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import inbound_wire_transfer_list_params, inbound_wire_transfer_reverse_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.inbound_wire_transfer import InboundWireTransfer -__all__ = ["InboundWireTransfers", "AsyncInboundWireTransfers"] +__all__ = ["InboundWireTransfersResource", "AsyncInboundWireTransfersResource"] -class InboundWireTransfers(SyncAPIResource): +class InboundWireTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> InboundWireTransfersWithRawResponse: - return InboundWireTransfersWithRawResponse(self) + def with_raw_response(self) -> InboundWireTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundWireTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> InboundWireTransfersWithStreamingResponse: - return InboundWireTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> InboundWireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundWireTransfersResourceWithStreamingResponse(self) def retrieve( self, @@ -40,7 +53,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InboundWireTransfer: """ Retrieve an Inbound Wire Transfer @@ -61,7 +74,9 @@ def retrieve( f"Expected a non-empty value for `inbound_wire_transfer_id` but received {inbound_wire_transfer_id!r}" ) return self._get( - f"/inbound_wire_transfers/{inbound_wire_transfer_id}", + path_template( + "/inbound_wire_transfers/{inbound_wire_transfer_id}", inbound_wire_transfer_id=inbound_wire_transfer_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -71,39 +86,35 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - account_number_id: str | NotGiven = NOT_GIVEN, - created_at: inbound_wire_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["pending", "accepted", "declined", "reversed"] | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_wire_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + status: inbound_wire_transfer_list_params.Status | Omit = omit, + wire_drawdown_request_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[InboundWireTransfer]: """ List Inbound Wire Transfers Args: - account_id: Filter Inbound Wire Tranfers to ones belonging to the specified Account. + account_id: Filter Inbound Wire Transfers to ones belonging to the specified Account. - account_number_id: Filter Inbound Wire Tranfers to ones belonging to the specified Account Number. + account_number_id: Filter Inbound Wire Transfers to ones belonging to the specified Account Number. cursor: Return the page of entries after this one. limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: Filter Inbound Wire Transfers to those with the specified status. - - - `pending` - The Inbound Wire Transfer is awaiting action, will transition - automatically if no action is taken. - - `accepted` - The Inbound Wire Transfer is accepted. - - `declined` - The Inbound Wire Transfer was declined. - - `reversed` - The Inbound Wire Transfer was reversed. + wire_drawdown_request_id: Filter Inbound Wire Transfers to ones belonging to the specified Wire Drawdown + Request. extra_headers: Send extra headers @@ -129,6 +140,7 @@ def list( "cursor": cursor, "limit": limit, "status": status, + "wire_drawdown_request_id": wire_drawdown_request_id, }, inbound_wire_transfer_list_params.InboundWireTransferListParams, ), @@ -136,15 +148,84 @@ def list( model=InboundWireTransfer, ) + def reverse( + self, + inbound_wire_transfer_id: str, + *, + reason: Literal["duplicate", "creditor_request", "transaction_forbidden"], + # 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, + idempotency_key: str | None = None, + ) -> InboundWireTransfer: + """ + Reverse an Inbound Wire Transfer + + Args: + inbound_wire_transfer_id: The identifier of the Inbound Wire Transfer to reverse. + + reason: Reason for the reversal. + + - `duplicate` - The inbound wire transfer was a duplicate. + - `creditor_request` - The recipient of the wire transfer requested the funds be + returned to the sender. + - `transaction_forbidden` - The account cannot currently receive inbound wires. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_wire_transfer_id: + raise ValueError( + f"Expected a non-empty value for `inbound_wire_transfer_id` but received {inbound_wire_transfer_id!r}" + ) + return self._post( + path_template( + "/inbound_wire_transfers/{inbound_wire_transfer_id}/reverse", + inbound_wire_transfer_id=inbound_wire_transfer_id, + ), + body=maybe_transform( + {"reason": reason}, inbound_wire_transfer_reverse_params.InboundWireTransferReverseParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundWireTransfer, + ) + -class AsyncInboundWireTransfers(AsyncAPIResource): +class AsyncInboundWireTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncInboundWireTransfersWithRawResponse: - return AsyncInboundWireTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncInboundWireTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundWireTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncInboundWireTransfersWithStreamingResponse: - return AsyncInboundWireTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncInboundWireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundWireTransfersResourceWithStreamingResponse(self) async def retrieve( self, @@ -155,7 +236,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> InboundWireTransfer: """ Retrieve an Inbound Wire Transfer @@ -176,7 +257,9 @@ async def retrieve( f"Expected a non-empty value for `inbound_wire_transfer_id` but received {inbound_wire_transfer_id!r}" ) return await self._get( - f"/inbound_wire_transfers/{inbound_wire_transfer_id}", + path_template( + "/inbound_wire_transfers/{inbound_wire_transfer_id}", inbound_wire_transfer_id=inbound_wire_transfer_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -186,39 +269,35 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - account_number_id: str | NotGiven = NOT_GIVEN, - created_at: inbound_wire_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: Literal["pending", "accepted", "declined", "reversed"] | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + account_number_id: str | Omit = omit, + created_at: inbound_wire_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + status: inbound_wire_transfer_list_params.Status | Omit = omit, + wire_drawdown_request_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[InboundWireTransfer, AsyncPage[InboundWireTransfer]]: """ List Inbound Wire Transfers Args: - account_id: Filter Inbound Wire Tranfers to ones belonging to the specified Account. + account_id: Filter Inbound Wire Transfers to ones belonging to the specified Account. - account_number_id: Filter Inbound Wire Tranfers to ones belonging to the specified Account Number. + account_number_id: Filter Inbound Wire Transfers to ones belonging to the specified Account Number. cursor: Return the page of entries after this one. limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. - status: Filter Inbound Wire Transfers to those with the specified status. - - - `pending` - The Inbound Wire Transfer is awaiting action, will transition - automatically if no action is taken. - - `accepted` - The Inbound Wire Transfer is accepted. - - `declined` - The Inbound Wire Transfer was declined. - - `reversed` - The Inbound Wire Transfer was reversed. + wire_drawdown_request_id: Filter Inbound Wire Transfers to ones belonging to the specified Wire Drawdown + Request. extra_headers: Send extra headers @@ -244,6 +323,7 @@ def list( "cursor": cursor, "limit": limit, "status": status, + "wire_drawdown_request_id": wire_drawdown_request_id, }, inbound_wire_transfer_list_params.InboundWireTransferListParams, ), @@ -251,33 +331,97 @@ def list( model=InboundWireTransfer, ) + async def reverse( + self, + inbound_wire_transfer_id: str, + *, + reason: Literal["duplicate", "creditor_request", "transaction_forbidden"], + # 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, + idempotency_key: str | None = None, + ) -> InboundWireTransfer: + """ + Reverse an Inbound Wire Transfer + + Args: + inbound_wire_transfer_id: The identifier of the Inbound Wire Transfer to reverse. + + reason: Reason for the reversal. + + - `duplicate` - The inbound wire transfer was a duplicate. + - `creditor_request` - The recipient of the wire transfer requested the funds be + returned to the sender. + - `transaction_forbidden` - The account cannot currently receive inbound wires. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_wire_transfer_id: + raise ValueError( + f"Expected a non-empty value for `inbound_wire_transfer_id` but received {inbound_wire_transfer_id!r}" + ) + return await self._post( + path_template( + "/inbound_wire_transfers/{inbound_wire_transfer_id}/reverse", + inbound_wire_transfer_id=inbound_wire_transfer_id, + ), + body=await async_maybe_transform( + {"reason": reason}, inbound_wire_transfer_reverse_params.InboundWireTransferReverseParams + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundWireTransfer, + ) + -class InboundWireTransfersWithRawResponse: - def __init__(self, inbound_wire_transfers: InboundWireTransfers) -> None: +class InboundWireTransfersResourceWithRawResponse: + def __init__(self, inbound_wire_transfers: InboundWireTransfersResource) -> None: self._inbound_wire_transfers = inbound_wire_transfers - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( inbound_wire_transfers.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( inbound_wire_transfers.list, ) + self.reverse = to_raw_response_wrapper( + inbound_wire_transfers.reverse, + ) -class AsyncInboundWireTransfersWithRawResponse: - def __init__(self, inbound_wire_transfers: AsyncInboundWireTransfers) -> None: +class AsyncInboundWireTransfersResourceWithRawResponse: + def __init__(self, inbound_wire_transfers: AsyncInboundWireTransfersResource) -> None: self._inbound_wire_transfers = inbound_wire_transfers - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( inbound_wire_transfers.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( inbound_wire_transfers.list, ) + self.reverse = async_to_raw_response_wrapper( + inbound_wire_transfers.reverse, + ) -class InboundWireTransfersWithStreamingResponse: - def __init__(self, inbound_wire_transfers: InboundWireTransfers) -> None: +class InboundWireTransfersResourceWithStreamingResponse: + def __init__(self, inbound_wire_transfers: InboundWireTransfersResource) -> None: self._inbound_wire_transfers = inbound_wire_transfers self.retrieve = to_streamed_response_wrapper( @@ -286,10 +430,13 @@ def __init__(self, inbound_wire_transfers: InboundWireTransfers) -> None: self.list = to_streamed_response_wrapper( inbound_wire_transfers.list, ) + self.reverse = to_streamed_response_wrapper( + inbound_wire_transfers.reverse, + ) -class AsyncInboundWireTransfersWithStreamingResponse: - def __init__(self, inbound_wire_transfers: AsyncInboundWireTransfers) -> None: +class AsyncInboundWireTransfersResourceWithStreamingResponse: + def __init__(self, inbound_wire_transfers: AsyncInboundWireTransfersResource) -> None: self._inbound_wire_transfers = inbound_wire_transfers self.retrieve = async_to_streamed_response_wrapper( @@ -298,3 +445,6 @@ def __init__(self, inbound_wire_transfers: AsyncInboundWireTransfers) -> None: self.list = async_to_streamed_response_wrapper( inbound_wire_transfers.list, ) + self.reverse = async_to_streamed_response_wrapper( + inbound_wire_transfers.reverse, + ) diff --git a/src/increase/resources/intrafi/__init__.py b/src/increase/resources/intrafi/__init__.py deleted file mode 100644 index 95d677c98..000000000 --- a/src/increase/resources/intrafi/__init__.py +++ /dev/null @@ -1,61 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from .intrafi import ( - Intrafi, - AsyncIntrafi, - IntrafiWithRawResponse, - AsyncIntrafiWithRawResponse, - IntrafiWithStreamingResponse, - AsyncIntrafiWithStreamingResponse, -) -from .balances import ( - Balances, - AsyncBalances, - BalancesWithRawResponse, - AsyncBalancesWithRawResponse, - BalancesWithStreamingResponse, - AsyncBalancesWithStreamingResponse, -) -from .exclusions import ( - Exclusions, - AsyncExclusions, - ExclusionsWithRawResponse, - AsyncExclusionsWithRawResponse, - ExclusionsWithStreamingResponse, - AsyncExclusionsWithStreamingResponse, -) -from .account_enrollments import ( - AccountEnrollments, - AsyncAccountEnrollments, - AccountEnrollmentsWithRawResponse, - AsyncAccountEnrollmentsWithRawResponse, - AccountEnrollmentsWithStreamingResponse, - AsyncAccountEnrollmentsWithStreamingResponse, -) - -__all__ = [ - "AccountEnrollments", - "AsyncAccountEnrollments", - "AccountEnrollmentsWithRawResponse", - "AsyncAccountEnrollmentsWithRawResponse", - "AccountEnrollmentsWithStreamingResponse", - "AsyncAccountEnrollmentsWithStreamingResponse", - "Balances", - "AsyncBalances", - "BalancesWithRawResponse", - "AsyncBalancesWithRawResponse", - "BalancesWithStreamingResponse", - "AsyncBalancesWithStreamingResponse", - "Exclusions", - "AsyncExclusions", - "ExclusionsWithRawResponse", - "AsyncExclusionsWithRawResponse", - "ExclusionsWithStreamingResponse", - "AsyncExclusionsWithStreamingResponse", - "Intrafi", - "AsyncIntrafi", - "IntrafiWithRawResponse", - "AsyncIntrafiWithRawResponse", - "IntrafiWithStreamingResponse", - "AsyncIntrafiWithStreamingResponse", -] diff --git a/src/increase/resources/intrafi/balances.py b/src/increase/resources/intrafi/balances.py deleted file mode 100644 index f59b3842d..000000000 --- a/src/increase/resources/intrafi/balances.py +++ /dev/null @@ -1,143 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) -from ...types.intrafi import IntrafiBalance - -__all__ = ["Balances", "AsyncBalances"] - - -class Balances(SyncAPIResource): - @cached_property - def with_raw_response(self) -> BalancesWithRawResponse: - return BalancesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> BalancesWithStreamingResponse: - return BalancesWithStreamingResponse(self) - - def retrieve( - self, - account_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntrafiBalance: - """ - Get IntraFi balances by bank - - Args: - account_id: The identifier of the Account to get balances for. - - 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_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return self._get( - f"/intrafi_balances/{account_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=IntrafiBalance, - ) - - -class AsyncBalances(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncBalancesWithRawResponse: - return AsyncBalancesWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncBalancesWithStreamingResponse: - return AsyncBalancesWithStreamingResponse(self) - - async def retrieve( - self, - account_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> IntrafiBalance: - """ - Get IntraFi balances by bank - - Args: - account_id: The identifier of the Account to get balances for. - - 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_id: - raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") - return await self._get( - f"/intrafi_balances/{account_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=IntrafiBalance, - ) - - -class BalancesWithRawResponse: - def __init__(self, balances: Balances) -> None: - self._balances = balances - - self.retrieve = _legacy_response.to_raw_response_wrapper( - balances.retrieve, - ) - - -class AsyncBalancesWithRawResponse: - def __init__(self, balances: AsyncBalances) -> None: - self._balances = balances - - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - balances.retrieve, - ) - - -class BalancesWithStreamingResponse: - def __init__(self, balances: Balances) -> None: - self._balances = balances - - self.retrieve = to_streamed_response_wrapper( - balances.retrieve, - ) - - -class AsyncBalancesWithStreamingResponse: - def __init__(self, balances: AsyncBalances) -> None: - self._balances = balances - - self.retrieve = async_to_streamed_response_wrapper( - balances.retrieve, - ) diff --git a/src/increase/resources/intrafi/intrafi.py b/src/increase/resources/intrafi/intrafi.py deleted file mode 100644 index 6c978b037..000000000 --- a/src/increase/resources/intrafi/intrafi.py +++ /dev/null @@ -1,144 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .balances import ( - Balances, - AsyncBalances, - BalancesWithRawResponse, - AsyncBalancesWithRawResponse, - BalancesWithStreamingResponse, - AsyncBalancesWithStreamingResponse, -) -from ..._compat import cached_property -from .exclusions import ( - Exclusions, - AsyncExclusions, - ExclusionsWithRawResponse, - AsyncExclusionsWithRawResponse, - ExclusionsWithStreamingResponse, - AsyncExclusionsWithStreamingResponse, -) -from ..._resource import SyncAPIResource, AsyncAPIResource -from .account_enrollments import ( - AccountEnrollments, - AsyncAccountEnrollments, - AccountEnrollmentsWithRawResponse, - AsyncAccountEnrollmentsWithRawResponse, - AccountEnrollmentsWithStreamingResponse, - AsyncAccountEnrollmentsWithStreamingResponse, -) - -__all__ = ["Intrafi", "AsyncIntrafi"] - - -class Intrafi(SyncAPIResource): - @cached_property - def account_enrollments(self) -> AccountEnrollments: - return AccountEnrollments(self._client) - - @cached_property - def balances(self) -> Balances: - return Balances(self._client) - - @cached_property - def exclusions(self) -> Exclusions: - return Exclusions(self._client) - - @cached_property - def with_raw_response(self) -> IntrafiWithRawResponse: - return IntrafiWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> IntrafiWithStreamingResponse: - return IntrafiWithStreamingResponse(self) - - -class AsyncIntrafi(AsyncAPIResource): - @cached_property - def account_enrollments(self) -> AsyncAccountEnrollments: - return AsyncAccountEnrollments(self._client) - - @cached_property - def balances(self) -> AsyncBalances: - return AsyncBalances(self._client) - - @cached_property - def exclusions(self) -> AsyncExclusions: - return AsyncExclusions(self._client) - - @cached_property - def with_raw_response(self) -> AsyncIntrafiWithRawResponse: - return AsyncIntrafiWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncIntrafiWithStreamingResponse: - return AsyncIntrafiWithStreamingResponse(self) - - -class IntrafiWithRawResponse: - def __init__(self, intrafi: Intrafi) -> None: - self._intrafi = intrafi - - @cached_property - def account_enrollments(self) -> AccountEnrollmentsWithRawResponse: - return AccountEnrollmentsWithRawResponse(self._intrafi.account_enrollments) - - @cached_property - def balances(self) -> BalancesWithRawResponse: - return BalancesWithRawResponse(self._intrafi.balances) - - @cached_property - def exclusions(self) -> ExclusionsWithRawResponse: - return ExclusionsWithRawResponse(self._intrafi.exclusions) - - -class AsyncIntrafiWithRawResponse: - def __init__(self, intrafi: AsyncIntrafi) -> None: - self._intrafi = intrafi - - @cached_property - def account_enrollments(self) -> AsyncAccountEnrollmentsWithRawResponse: - return AsyncAccountEnrollmentsWithRawResponse(self._intrafi.account_enrollments) - - @cached_property - def balances(self) -> AsyncBalancesWithRawResponse: - return AsyncBalancesWithRawResponse(self._intrafi.balances) - - @cached_property - def exclusions(self) -> AsyncExclusionsWithRawResponse: - return AsyncExclusionsWithRawResponse(self._intrafi.exclusions) - - -class IntrafiWithStreamingResponse: - def __init__(self, intrafi: Intrafi) -> None: - self._intrafi = intrafi - - @cached_property - def account_enrollments(self) -> AccountEnrollmentsWithStreamingResponse: - return AccountEnrollmentsWithStreamingResponse(self._intrafi.account_enrollments) - - @cached_property - def balances(self) -> BalancesWithStreamingResponse: - return BalancesWithStreamingResponse(self._intrafi.balances) - - @cached_property - def exclusions(self) -> ExclusionsWithStreamingResponse: - return ExclusionsWithStreamingResponse(self._intrafi.exclusions) - - -class AsyncIntrafiWithStreamingResponse: - def __init__(self, intrafi: AsyncIntrafi) -> None: - self._intrafi = intrafi - - @cached_property - def account_enrollments(self) -> AsyncAccountEnrollmentsWithStreamingResponse: - return AsyncAccountEnrollmentsWithStreamingResponse(self._intrafi.account_enrollments) - - @cached_property - def balances(self) -> AsyncBalancesWithStreamingResponse: - return AsyncBalancesWithStreamingResponse(self._intrafi.balances) - - @cached_property - def exclusions(self) -> AsyncExclusionsWithStreamingResponse: - return AsyncExclusionsWithStreamingResponse(self._intrafi.exclusions) diff --git a/src/increase/resources/intrafi/account_enrollments.py b/src/increase/resources/intrafi_account_enrollments.py similarity index 67% rename from src/increase/resources/intrafi/account_enrollments.py rename to src/increase/resources/intrafi_account_enrollments.py index 454c1f63b..9eac8ac3a 100644 --- a/src/increase/resources/intrafi/account_enrollments.py +++ b/src/increase/resources/intrafi_account_enrollments.py @@ -4,33 +4,43 @@ import httpx -from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, +from ..types import intrafi_account_enrollment_list_params, intrafi_account_enrollment_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ...pagination import SyncPage, AsyncPage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from ...types.intrafi import IntrafiAccountEnrollment, account_enrollment_list_params, account_enrollment_create_params +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.intrafi_account_enrollment import IntrafiAccountEnrollment -__all__ = ["AccountEnrollments", "AsyncAccountEnrollments"] +__all__ = ["IntrafiAccountEnrollmentsResource", "AsyncIntrafiAccountEnrollmentsResource"] -class AccountEnrollments(SyncAPIResource): +class IntrafiAccountEnrollmentsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountEnrollmentsWithRawResponse: - return AccountEnrollmentsWithRawResponse(self) + def with_raw_response(self) -> IntrafiAccountEnrollmentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return IntrafiAccountEnrollmentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountEnrollmentsWithStreamingResponse: - return AccountEnrollmentsWithStreamingResponse(self) + def with_streaming_response(self) -> IntrafiAccountEnrollmentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return IntrafiAccountEnrollmentsResourceWithStreamingResponse(self) def create( self, @@ -42,11 +52,11 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiAccountEnrollment: """ - Enroll an account in the IntraFi deposit sweep network. + Enroll an account in the IntraFi deposit sweep network Args: account_id: The identifier for the account to be added to IntraFi. @@ -70,7 +80,7 @@ def create( "account_id": account_id, "email_address": email_address, }, - account_enrollment_create_params.AccountEnrollmentCreateParams, + intrafi_account_enrollment_create_params.IntrafiAccountEnrollmentCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -91,7 +101,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IntrafiAccountEnrollment: """ Get an IntraFi Account Enrollment @@ -112,7 +122,10 @@ def retrieve( f"Expected a non-empty value for `intrafi_account_enrollment_id` but received {intrafi_account_enrollment_id!r}" ) return self._get( - f"/intrafi_account_enrollments/{intrafi_account_enrollment_id}", + path_template( + "/intrafi_account_enrollments/{intrafi_account_enrollment_id}", + intrafi_account_enrollment_id=intrafi_account_enrollment_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -122,17 +135,17 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: account_enrollment_list_params.Status | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: intrafi_account_enrollment_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[IntrafiAccountEnrollment]: """ List IntraFi Account Enrollments @@ -174,7 +187,7 @@ def list( "limit": limit, "status": status, }, - account_enrollment_list_params.AccountEnrollmentListParams, + intrafi_account_enrollment_list_params.IntrafiAccountEnrollmentListParams, ), ), model=IntrafiAccountEnrollment, @@ -189,11 +202,11 @@ def unenroll( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiAccountEnrollment: """ - Unenroll an account from IntraFi. + Unenroll an account from IntraFi Args: intrafi_account_enrollment_id: The Identifier of the IntraFi Account Enrollment to remove from IntraFi. @@ -213,7 +226,10 @@ def unenroll( f"Expected a non-empty value for `intrafi_account_enrollment_id` but received {intrafi_account_enrollment_id!r}" ) return self._post( - f"/intrafi_account_enrollments/{intrafi_account_enrollment_id}/unenroll", + path_template( + "/intrafi_account_enrollments/{intrafi_account_enrollment_id}/unenroll", + intrafi_account_enrollment_id=intrafi_account_enrollment_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -225,14 +241,25 @@ def unenroll( ) -class AsyncAccountEnrollments(AsyncAPIResource): +class AsyncIntrafiAccountEnrollmentsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountEnrollmentsWithRawResponse: - return AsyncAccountEnrollmentsWithRawResponse(self) + def with_raw_response(self) -> AsyncIntrafiAccountEnrollmentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncIntrafiAccountEnrollmentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountEnrollmentsWithStreamingResponse: - return AsyncAccountEnrollmentsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse(self) async def create( self, @@ -244,11 +271,11 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiAccountEnrollment: """ - Enroll an account in the IntraFi deposit sweep network. + Enroll an account in the IntraFi deposit sweep network Args: account_id: The identifier for the account to be added to IntraFi. @@ -272,7 +299,7 @@ async def create( "account_id": account_id, "email_address": email_address, }, - account_enrollment_create_params.AccountEnrollmentCreateParams, + intrafi_account_enrollment_create_params.IntrafiAccountEnrollmentCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -293,7 +320,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IntrafiAccountEnrollment: """ Get an IntraFi Account Enrollment @@ -314,7 +341,10 @@ async def retrieve( f"Expected a non-empty value for `intrafi_account_enrollment_id` but received {intrafi_account_enrollment_id!r}" ) return await self._get( - f"/intrafi_account_enrollments/{intrafi_account_enrollment_id}", + path_template( + "/intrafi_account_enrollments/{intrafi_account_enrollment_id}", + intrafi_account_enrollment_id=intrafi_account_enrollment_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -324,17 +354,17 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: account_enrollment_list_params.Status | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: intrafi_account_enrollment_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[IntrafiAccountEnrollment, AsyncPage[IntrafiAccountEnrollment]]: """ List IntraFi Account Enrollments @@ -376,7 +406,7 @@ def list( "limit": limit, "status": status, }, - account_enrollment_list_params.AccountEnrollmentListParams, + intrafi_account_enrollment_list_params.IntrafiAccountEnrollmentListParams, ), ), model=IntrafiAccountEnrollment, @@ -391,11 +421,11 @@ async def unenroll( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiAccountEnrollment: """ - Unenroll an account from IntraFi. + Unenroll an account from IntraFi Args: intrafi_account_enrollment_id: The Identifier of the IntraFi Account Enrollment to remove from IntraFi. @@ -415,7 +445,10 @@ async def unenroll( f"Expected a non-empty value for `intrafi_account_enrollment_id` but received {intrafi_account_enrollment_id!r}" ) return await self._post( - f"/intrafi_account_enrollments/{intrafi_account_enrollment_id}/unenroll", + path_template( + "/intrafi_account_enrollments/{intrafi_account_enrollment_id}/unenroll", + intrafi_account_enrollment_id=intrafi_account_enrollment_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -427,73 +460,73 @@ async def unenroll( ) -class AccountEnrollmentsWithRawResponse: - def __init__(self, account_enrollments: AccountEnrollments) -> None: - self._account_enrollments = account_enrollments +class IntrafiAccountEnrollmentsResourceWithRawResponse: + def __init__(self, intrafi_account_enrollments: IntrafiAccountEnrollmentsResource) -> None: + self._intrafi_account_enrollments = intrafi_account_enrollments - self.create = _legacy_response.to_raw_response_wrapper( - account_enrollments.create, + self.create = to_raw_response_wrapper( + intrafi_account_enrollments.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( - account_enrollments.retrieve, + self.retrieve = to_raw_response_wrapper( + intrafi_account_enrollments.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( - account_enrollments.list, + self.list = to_raw_response_wrapper( + intrafi_account_enrollments.list, ) - self.unenroll = _legacy_response.to_raw_response_wrapper( - account_enrollments.unenroll, + self.unenroll = to_raw_response_wrapper( + intrafi_account_enrollments.unenroll, ) -class AsyncAccountEnrollmentsWithRawResponse: - def __init__(self, account_enrollments: AsyncAccountEnrollments) -> None: - self._account_enrollments = account_enrollments +class AsyncIntrafiAccountEnrollmentsResourceWithRawResponse: + def __init__(self, intrafi_account_enrollments: AsyncIntrafiAccountEnrollmentsResource) -> None: + self._intrafi_account_enrollments = intrafi_account_enrollments - self.create = _legacy_response.async_to_raw_response_wrapper( - account_enrollments.create, + self.create = async_to_raw_response_wrapper( + intrafi_account_enrollments.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - account_enrollments.retrieve, + self.retrieve = async_to_raw_response_wrapper( + intrafi_account_enrollments.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( - account_enrollments.list, + self.list = async_to_raw_response_wrapper( + intrafi_account_enrollments.list, ) - self.unenroll = _legacy_response.async_to_raw_response_wrapper( - account_enrollments.unenroll, + self.unenroll = async_to_raw_response_wrapper( + intrafi_account_enrollments.unenroll, ) -class AccountEnrollmentsWithStreamingResponse: - def __init__(self, account_enrollments: AccountEnrollments) -> None: - self._account_enrollments = account_enrollments +class IntrafiAccountEnrollmentsResourceWithStreamingResponse: + def __init__(self, intrafi_account_enrollments: IntrafiAccountEnrollmentsResource) -> None: + self._intrafi_account_enrollments = intrafi_account_enrollments self.create = to_streamed_response_wrapper( - account_enrollments.create, + intrafi_account_enrollments.create, ) self.retrieve = to_streamed_response_wrapper( - account_enrollments.retrieve, + intrafi_account_enrollments.retrieve, ) self.list = to_streamed_response_wrapper( - account_enrollments.list, + intrafi_account_enrollments.list, ) self.unenroll = to_streamed_response_wrapper( - account_enrollments.unenroll, + intrafi_account_enrollments.unenroll, ) -class AsyncAccountEnrollmentsWithStreamingResponse: - def __init__(self, account_enrollments: AsyncAccountEnrollments) -> None: - self._account_enrollments = account_enrollments +class AsyncIntrafiAccountEnrollmentsResourceWithStreamingResponse: + def __init__(self, intrafi_account_enrollments: AsyncIntrafiAccountEnrollmentsResource) -> None: + self._intrafi_account_enrollments = intrafi_account_enrollments self.create = async_to_streamed_response_wrapper( - account_enrollments.create, + intrafi_account_enrollments.create, ) self.retrieve = async_to_streamed_response_wrapper( - account_enrollments.retrieve, + intrafi_account_enrollments.retrieve, ) self.list = async_to_streamed_response_wrapper( - account_enrollments.list, + intrafi_account_enrollments.list, ) self.unenroll = async_to_streamed_response_wrapper( - account_enrollments.unenroll, + intrafi_account_enrollments.unenroll, ) diff --git a/src/increase/resources/intrafi_balances.py b/src/increase/resources/intrafi_balances.py new file mode 100644 index 000000000..9b9a92647 --- /dev/null +++ b/src/increase/resources/intrafi_balances.py @@ -0,0 +1,174 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from .._types import Body, Query, Headers, NotGiven, not_given +from .._utils import path_template +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from .._base_client import make_request_options +from ..types.intrafi_balance import IntrafiBalance + +__all__ = ["IntrafiBalancesResource", "AsyncIntrafiBalancesResource"] + + +class IntrafiBalancesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> IntrafiBalancesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return IntrafiBalancesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> IntrafiBalancesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return IntrafiBalancesResourceWithStreamingResponse(self) + + def intrafi_balance( + self, + account_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> IntrafiBalance: + """Returns the IntraFi balance for the given account. + + IntraFi may sweep funds to + multiple banks. This endpoint will include both the total balance and the amount + swept to each institution. + + Args: + account_id: The identifier of the Account to get balances for. + + 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_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return self._get( + path_template("/accounts/{account_id}/intrafi_balance", account_id=account_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=IntrafiBalance, + ) + + +class AsyncIntrafiBalancesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncIntrafiBalancesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncIntrafiBalancesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncIntrafiBalancesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncIntrafiBalancesResourceWithStreamingResponse(self) + + async def intrafi_balance( + self, + account_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> IntrafiBalance: + """Returns the IntraFi balance for the given account. + + IntraFi may sweep funds to + multiple banks. This endpoint will include both the total balance and the amount + swept to each institution. + + Args: + account_id: The identifier of the Account to get balances for. + + 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_id: + raise ValueError(f"Expected a non-empty value for `account_id` but received {account_id!r}") + return await self._get( + path_template("/accounts/{account_id}/intrafi_balance", account_id=account_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=IntrafiBalance, + ) + + +class IntrafiBalancesResourceWithRawResponse: + def __init__(self, intrafi_balances: IntrafiBalancesResource) -> None: + self._intrafi_balances = intrafi_balances + + self.intrafi_balance = to_raw_response_wrapper( + intrafi_balances.intrafi_balance, + ) + + +class AsyncIntrafiBalancesResourceWithRawResponse: + def __init__(self, intrafi_balances: AsyncIntrafiBalancesResource) -> None: + self._intrafi_balances = intrafi_balances + + self.intrafi_balance = async_to_raw_response_wrapper( + intrafi_balances.intrafi_balance, + ) + + +class IntrafiBalancesResourceWithStreamingResponse: + def __init__(self, intrafi_balances: IntrafiBalancesResource) -> None: + self._intrafi_balances = intrafi_balances + + self.intrafi_balance = to_streamed_response_wrapper( + intrafi_balances.intrafi_balance, + ) + + +class AsyncIntrafiBalancesResourceWithStreamingResponse: + def __init__(self, intrafi_balances: AsyncIntrafiBalancesResource) -> None: + self._intrafi_balances = intrafi_balances + + self.intrafi_balance = async_to_streamed_response_wrapper( + intrafi_balances.intrafi_balance, + ) diff --git a/src/increase/resources/intrafi/exclusions.py b/src/increase/resources/intrafi_exclusions.py similarity index 66% rename from src/increase/resources/intrafi/exclusions.py rename to src/increase/resources/intrafi_exclusions.py index 0cd802fe5..84a64c6fe 100644 --- a/src/increase/resources/intrafi/exclusions.py +++ b/src/increase/resources/intrafi_exclusions.py @@ -4,55 +4,68 @@ import httpx -from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, +from ..types import intrafi_exclusion_list_params, intrafi_exclusion_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ...pagination import SyncPage, AsyncPage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from ...types.intrafi import IntrafiExclusion, exclusion_list_params, exclusion_create_params +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.intrafi_exclusion import IntrafiExclusion -__all__ = ["Exclusions", "AsyncExclusions"] +__all__ = ["IntrafiExclusionsResource", "AsyncIntrafiExclusionsResource"] -class Exclusions(SyncAPIResource): +class IntrafiExclusionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ExclusionsWithRawResponse: - return ExclusionsWithRawResponse(self) + def with_raw_response(self) -> IntrafiExclusionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return IntrafiExclusionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ExclusionsWithStreamingResponse: - return ExclusionsWithStreamingResponse(self) + def with_streaming_response(self) -> IntrafiExclusionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return IntrafiExclusionsResourceWithStreamingResponse(self) def create( self, *, - bank_name: str, entity_id: str, + fdic_certificate_number: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiExclusion: """ Create an IntraFi Exclusion Args: - bank_name: The name of the financial institution to be excluded. - entity_id: The identifier of the Entity whose deposits will be excluded. + fdic_certificate_number: The FDIC certificate number of the financial institution to be excluded. An FDIC + certificate number uniquely identifies a financial institution, and is different + than a routing number. To find one, we recommend searching by Bank Name using + the [FDIC's bankfind tool](https://banks.data.fdic.gov/bankfind-suite/bankfind). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -67,10 +80,10 @@ def create( "/intrafi_exclusions", body=maybe_transform( { - "bank_name": bank_name, "entity_id": entity_id, + "fdic_certificate_number": fdic_certificate_number, }, - exclusion_create_params.ExclusionCreateParams, + intrafi_exclusion_create_params.IntrafiExclusionCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -91,7 +104,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IntrafiExclusion: """ Get an IntraFi Exclusion @@ -112,7 +125,7 @@ def retrieve( f"Expected a non-empty value for `intrafi_exclusion_id` but received {intrafi_exclusion_id!r}" ) return self._get( - f"/intrafi_exclusions/{intrafi_exclusion_id}", + path_template("/intrafi_exclusions/{intrafi_exclusion_id}", intrafi_exclusion_id=intrafi_exclusion_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -122,19 +135,19 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + entity_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[IntrafiExclusion]: """ - List IntraFi Exclusions. + List IntraFi Exclusions Args: cursor: Return the page of entries after this one. @@ -172,7 +185,7 @@ def list( "idempotency_key": idempotency_key, "limit": limit, }, - exclusion_list_params.ExclusionListParams, + intrafi_exclusion_list_params.IntrafiExclusionListParams, ), ), model=IntrafiExclusion, @@ -187,7 +200,7 @@ def archive( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiExclusion: """ @@ -213,7 +226,9 @@ def archive( f"Expected a non-empty value for `intrafi_exclusion_id` but received {intrafi_exclusion_id!r}" ) return self._post( - f"/intrafi_exclusions/{intrafi_exclusion_id}/archive", + path_template( + "/intrafi_exclusions/{intrafi_exclusion_id}/archive", intrafi_exclusion_id=intrafi_exclusion_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -225,36 +240,50 @@ def archive( ) -class AsyncExclusions(AsyncAPIResource): +class AsyncIntrafiExclusionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncExclusionsWithRawResponse: - return AsyncExclusionsWithRawResponse(self) + def with_raw_response(self) -> AsyncIntrafiExclusionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncIntrafiExclusionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncExclusionsWithStreamingResponse: - return AsyncExclusionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncIntrafiExclusionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncIntrafiExclusionsResourceWithStreamingResponse(self) async def create( self, *, - bank_name: str, entity_id: str, + fdic_certificate_number: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiExclusion: """ Create an IntraFi Exclusion Args: - bank_name: The name of the financial institution to be excluded. - entity_id: The identifier of the Entity whose deposits will be excluded. + fdic_certificate_number: The FDIC certificate number of the financial institution to be excluded. An FDIC + certificate number uniquely identifies a financial institution, and is different + than a routing number. To find one, we recommend searching by Bank Name using + the [FDIC's bankfind tool](https://banks.data.fdic.gov/bankfind-suite/bankfind). + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -269,10 +298,10 @@ async def create( "/intrafi_exclusions", body=await async_maybe_transform( { - "bank_name": bank_name, "entity_id": entity_id, + "fdic_certificate_number": fdic_certificate_number, }, - exclusion_create_params.ExclusionCreateParams, + intrafi_exclusion_create_params.IntrafiExclusionCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -293,7 +322,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> IntrafiExclusion: """ Get an IntraFi Exclusion @@ -314,7 +343,7 @@ async def retrieve( f"Expected a non-empty value for `intrafi_exclusion_id` but received {intrafi_exclusion_id!r}" ) return await self._get( - f"/intrafi_exclusions/{intrafi_exclusion_id}", + path_template("/intrafi_exclusions/{intrafi_exclusion_id}", intrafi_exclusion_id=intrafi_exclusion_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -324,19 +353,19 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - entity_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + entity_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[IntrafiExclusion, AsyncPage[IntrafiExclusion]]: """ - List IntraFi Exclusions. + List IntraFi Exclusions Args: cursor: Return the page of entries after this one. @@ -374,7 +403,7 @@ def list( "idempotency_key": idempotency_key, "limit": limit, }, - exclusion_list_params.ExclusionListParams, + intrafi_exclusion_list_params.IntrafiExclusionListParams, ), ), model=IntrafiExclusion, @@ -389,7 +418,7 @@ async def archive( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> IntrafiExclusion: """ @@ -415,7 +444,9 @@ async def archive( f"Expected a non-empty value for `intrafi_exclusion_id` but received {intrafi_exclusion_id!r}" ) return await self._post( - f"/intrafi_exclusions/{intrafi_exclusion_id}/archive", + path_template( + "/intrafi_exclusions/{intrafi_exclusion_id}/archive", intrafi_exclusion_id=intrafi_exclusion_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -427,73 +458,73 @@ async def archive( ) -class ExclusionsWithRawResponse: - def __init__(self, exclusions: Exclusions) -> None: - self._exclusions = exclusions +class IntrafiExclusionsResourceWithRawResponse: + def __init__(self, intrafi_exclusions: IntrafiExclusionsResource) -> None: + self._intrafi_exclusions = intrafi_exclusions - self.create = _legacy_response.to_raw_response_wrapper( - exclusions.create, + self.create = to_raw_response_wrapper( + intrafi_exclusions.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( - exclusions.retrieve, + self.retrieve = to_raw_response_wrapper( + intrafi_exclusions.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( - exclusions.list, + self.list = to_raw_response_wrapper( + intrafi_exclusions.list, ) - self.archive = _legacy_response.to_raw_response_wrapper( - exclusions.archive, + self.archive = to_raw_response_wrapper( + intrafi_exclusions.archive, ) -class AsyncExclusionsWithRawResponse: - def __init__(self, exclusions: AsyncExclusions) -> None: - self._exclusions = exclusions +class AsyncIntrafiExclusionsResourceWithRawResponse: + def __init__(self, intrafi_exclusions: AsyncIntrafiExclusionsResource) -> None: + self._intrafi_exclusions = intrafi_exclusions - self.create = _legacy_response.async_to_raw_response_wrapper( - exclusions.create, + self.create = async_to_raw_response_wrapper( + intrafi_exclusions.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - exclusions.retrieve, + self.retrieve = async_to_raw_response_wrapper( + intrafi_exclusions.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( - exclusions.list, + self.list = async_to_raw_response_wrapper( + intrafi_exclusions.list, ) - self.archive = _legacy_response.async_to_raw_response_wrapper( - exclusions.archive, + self.archive = async_to_raw_response_wrapper( + intrafi_exclusions.archive, ) -class ExclusionsWithStreamingResponse: - def __init__(self, exclusions: Exclusions) -> None: - self._exclusions = exclusions +class IntrafiExclusionsResourceWithStreamingResponse: + def __init__(self, intrafi_exclusions: IntrafiExclusionsResource) -> None: + self._intrafi_exclusions = intrafi_exclusions self.create = to_streamed_response_wrapper( - exclusions.create, + intrafi_exclusions.create, ) self.retrieve = to_streamed_response_wrapper( - exclusions.retrieve, + intrafi_exclusions.retrieve, ) self.list = to_streamed_response_wrapper( - exclusions.list, + intrafi_exclusions.list, ) self.archive = to_streamed_response_wrapper( - exclusions.archive, + intrafi_exclusions.archive, ) -class AsyncExclusionsWithStreamingResponse: - def __init__(self, exclusions: AsyncExclusions) -> None: - self._exclusions = exclusions +class AsyncIntrafiExclusionsResourceWithStreamingResponse: + def __init__(self, intrafi_exclusions: AsyncIntrafiExclusionsResource) -> None: + self._intrafi_exclusions = intrafi_exclusions self.create = async_to_streamed_response_wrapper( - exclusions.create, + intrafi_exclusions.create, ) self.retrieve = async_to_streamed_response_wrapper( - exclusions.retrieve, + intrafi_exclusions.retrieve, ) self.list = async_to_streamed_response_wrapper( - exclusions.list, + intrafi_exclusions.list, ) self.archive = async_to_streamed_response_wrapper( - exclusions.archive, + intrafi_exclusions.archive, ) diff --git a/src/increase/resources/lockboxes.py b/src/increase/resources/lockboxes.py new file mode 100644 index 000000000..b06fb0e1e --- /dev/null +++ b/src/increase/resources/lockboxes.py @@ -0,0 +1,566 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..types import lockbox_list_params, lockbox_create_params, lockbox_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.lockbox import Lockbox + +__all__ = ["LockboxesResource", "AsyncLockboxesResource"] + + +class LockboxesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> LockboxesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return LockboxesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> LockboxesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return LockboxesResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + description: str | Omit = omit, + recipient_name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Lockbox: + """ + Create a Lockbox + + Args: + account_id: The Account checks sent to this Lockbox should be deposited into. + + description: The description you choose for the Lockbox, for display purposes. + + recipient_name: The name of the recipient that will receive mail at this location. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/lockboxes", + body=maybe_transform( + { + "account_id": account_id, + "description": description, + "recipient_name": recipient_name, + }, + lockbox_create_params.LockboxCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Lockbox, + ) + + def retrieve( + self, + lockbox_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Lockbox: + """ + Retrieve a Lockbox + + Args: + lockbox_id: The identifier of the Lockbox to retrieve. + + 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 lockbox_id: + raise ValueError(f"Expected a non-empty value for `lockbox_id` but received {lockbox_id!r}") + return self._get( + path_template("/lockboxes/{lockbox_id}", lockbox_id=lockbox_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Lockbox, + ) + + def update( + self, + lockbox_id: str, + *, + check_deposit_behavior: Literal["enabled", "disabled", "pend_for_processing"] | Omit = omit, + description: str | Omit = omit, + recipient_name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Lockbox: + """ + Update a Lockbox + + Args: + lockbox_id: The identifier of the Lockbox. + + check_deposit_behavior: This indicates if checks mailed to this lockbox will be deposited. + + - `enabled` - Checks mailed to this Lockbox will be deposited. + - `disabled` - Checks mailed to this Lockbox will not be deposited. + - `pend_for_processing` - Checks mailed to this Lockbox will be pending until + actioned. + + description: The description you choose for the Lockbox. + + recipient_name: The recipient name you choose for the Lockbox. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not lockbox_id: + raise ValueError(f"Expected a non-empty value for `lockbox_id` but received {lockbox_id!r}") + return self._patch( + path_template("/lockboxes/{lockbox_id}", lockbox_id=lockbox_id), + body=maybe_transform( + { + "check_deposit_behavior": check_deposit_behavior, + "description": description, + "recipient_name": recipient_name, + }, + lockbox_update_params.LockboxUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Lockbox, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: lockbox_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[Lockbox]: + """ + List Lockboxes + + Args: + account_id: Filter Lockboxes to those associated with the provided Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/lockboxes", + page=SyncPage[Lockbox], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + }, + lockbox_list_params.LockboxListParams, + ), + ), + model=Lockbox, + ) + + +class AsyncLockboxesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncLockboxesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncLockboxesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncLockboxesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncLockboxesResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + description: str | Omit = omit, + recipient_name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Lockbox: + """ + Create a Lockbox + + Args: + account_id: The Account checks sent to this Lockbox should be deposited into. + + description: The description you choose for the Lockbox, for display purposes. + + recipient_name: The name of the recipient that will receive mail at this location. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/lockboxes", + body=await async_maybe_transform( + { + "account_id": account_id, + "description": description, + "recipient_name": recipient_name, + }, + lockbox_create_params.LockboxCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Lockbox, + ) + + async def retrieve( + self, + lockbox_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> Lockbox: + """ + Retrieve a Lockbox + + Args: + lockbox_id: The identifier of the Lockbox to retrieve. + + 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 lockbox_id: + raise ValueError(f"Expected a non-empty value for `lockbox_id` but received {lockbox_id!r}") + return await self._get( + path_template("/lockboxes/{lockbox_id}", lockbox_id=lockbox_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=Lockbox, + ) + + async def update( + self, + lockbox_id: str, + *, + check_deposit_behavior: Literal["enabled", "disabled", "pend_for_processing"] | Omit = omit, + description: str | Omit = omit, + recipient_name: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Lockbox: + """ + Update a Lockbox + + Args: + lockbox_id: The identifier of the Lockbox. + + check_deposit_behavior: This indicates if checks mailed to this lockbox will be deposited. + + - `enabled` - Checks mailed to this Lockbox will be deposited. + - `disabled` - Checks mailed to this Lockbox will not be deposited. + - `pend_for_processing` - Checks mailed to this Lockbox will be pending until + actioned. + + description: The description you choose for the Lockbox. + + recipient_name: The recipient name you choose for the Lockbox. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not lockbox_id: + raise ValueError(f"Expected a non-empty value for `lockbox_id` but received {lockbox_id!r}") + return await self._patch( + path_template("/lockboxes/{lockbox_id}", lockbox_id=lockbox_id), + body=await async_maybe_transform( + { + "check_deposit_behavior": check_deposit_behavior, + "description": description, + "recipient_name": recipient_name, + }, + lockbox_update_params.LockboxUpdateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Lockbox, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: lockbox_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[Lockbox, AsyncPage[Lockbox]]: + """ + List Lockboxes + + Args: + account_id: Filter Lockboxes to those associated with the provided Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/lockboxes", + page=AsyncPage[Lockbox], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + }, + lockbox_list_params.LockboxListParams, + ), + ), + model=Lockbox, + ) + + +class LockboxesResourceWithRawResponse: + def __init__(self, lockboxes: LockboxesResource) -> None: + self._lockboxes = lockboxes + + self.create = to_raw_response_wrapper( + lockboxes.create, + ) + self.retrieve = to_raw_response_wrapper( + lockboxes.retrieve, + ) + self.update = to_raw_response_wrapper( + lockboxes.update, + ) + self.list = to_raw_response_wrapper( + lockboxes.list, + ) + + +class AsyncLockboxesResourceWithRawResponse: + def __init__(self, lockboxes: AsyncLockboxesResource) -> None: + self._lockboxes = lockboxes + + self.create = async_to_raw_response_wrapper( + lockboxes.create, + ) + self.retrieve = async_to_raw_response_wrapper( + lockboxes.retrieve, + ) + self.update = async_to_raw_response_wrapper( + lockboxes.update, + ) + self.list = async_to_raw_response_wrapper( + lockboxes.list, + ) + + +class LockboxesResourceWithStreamingResponse: + def __init__(self, lockboxes: LockboxesResource) -> None: + self._lockboxes = lockboxes + + self.create = to_streamed_response_wrapper( + lockboxes.create, + ) + self.retrieve = to_streamed_response_wrapper( + lockboxes.retrieve, + ) + self.update = to_streamed_response_wrapper( + lockboxes.update, + ) + self.list = to_streamed_response_wrapper( + lockboxes.list, + ) + + +class AsyncLockboxesResourceWithStreamingResponse: + def __init__(self, lockboxes: AsyncLockboxesResource) -> None: + self._lockboxes = lockboxes + + self.create = async_to_streamed_response_wrapper( + lockboxes.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + lockboxes.retrieve, + ) + self.update = async_to_streamed_response_wrapper( + lockboxes.update, + ) + self.list = async_to_streamed_response_wrapper( + lockboxes.list, + ) diff --git a/src/increase/resources/oauth_applications.py b/src/increase/resources/oauth_applications.py new file mode 100644 index 000000000..e209a6375 --- /dev/null +++ b/src/increase/resources/oauth_applications.py @@ -0,0 +1,290 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..types import oauth_application_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.oauth_application import OAuthApplication + +__all__ = ["OAuthApplicationsResource", "AsyncOAuthApplicationsResource"] + + +class OAuthApplicationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> OAuthApplicationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return OAuthApplicationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> OAuthApplicationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return OAuthApplicationsResourceWithStreamingResponse(self) + + def retrieve( + self, + oauth_application_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OAuthApplication: + """ + Retrieve an OAuth Application + + Args: + oauth_application_id: The identifier of the OAuth Application. + + 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 oauth_application_id: + raise ValueError( + f"Expected a non-empty value for `oauth_application_id` but received {oauth_application_id!r}" + ) + return self._get( + path_template("/oauth_applications/{oauth_application_id}", oauth_application_id=oauth_application_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OAuthApplication, + ) + + def list( + self, + *, + created_at: oauth_application_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + status: oauth_application_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[OAuthApplication]: + """ + List OAuth Applications + + Args: + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/oauth_applications", + page=SyncPage[OAuthApplication], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "limit": limit, + "status": status, + }, + oauth_application_list_params.OAuthApplicationListParams, + ), + ), + model=OAuthApplication, + ) + + +class AsyncOAuthApplicationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncOAuthApplicationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncOAuthApplicationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncOAuthApplicationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncOAuthApplicationsResourceWithStreamingResponse(self) + + async def retrieve( + self, + oauth_application_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> OAuthApplication: + """ + Retrieve an OAuth Application + + Args: + oauth_application_id: The identifier of the OAuth Application. + + 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 oauth_application_id: + raise ValueError( + f"Expected a non-empty value for `oauth_application_id` but received {oauth_application_id!r}" + ) + return await self._get( + path_template("/oauth_applications/{oauth_application_id}", oauth_application_id=oauth_application_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=OAuthApplication, + ) + + def list( + self, + *, + created_at: oauth_application_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + status: oauth_application_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[OAuthApplication, AsyncPage[OAuthApplication]]: + """ + List OAuth Applications + + Args: + cursor: Return the page of entries after this one. + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/oauth_applications", + page=AsyncPage[OAuthApplication], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "limit": limit, + "status": status, + }, + oauth_application_list_params.OAuthApplicationListParams, + ), + ), + model=OAuthApplication, + ) + + +class OAuthApplicationsResourceWithRawResponse: + def __init__(self, oauth_applications: OAuthApplicationsResource) -> None: + self._oauth_applications = oauth_applications + + self.retrieve = to_raw_response_wrapper( + oauth_applications.retrieve, + ) + self.list = to_raw_response_wrapper( + oauth_applications.list, + ) + + +class AsyncOAuthApplicationsResourceWithRawResponse: + def __init__(self, oauth_applications: AsyncOAuthApplicationsResource) -> None: + self._oauth_applications = oauth_applications + + self.retrieve = async_to_raw_response_wrapper( + oauth_applications.retrieve, + ) + self.list = async_to_raw_response_wrapper( + oauth_applications.list, + ) + + +class OAuthApplicationsResourceWithStreamingResponse: + def __init__(self, oauth_applications: OAuthApplicationsResource) -> None: + self._oauth_applications = oauth_applications + + self.retrieve = to_streamed_response_wrapper( + oauth_applications.retrieve, + ) + self.list = to_streamed_response_wrapper( + oauth_applications.list, + ) + + +class AsyncOAuthApplicationsResourceWithStreamingResponse: + def __init__(self, oauth_applications: AsyncOAuthApplicationsResource) -> None: + self._oauth_applications = oauth_applications + + self.retrieve = async_to_streamed_response_wrapper( + oauth_applications.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + oauth_applications.list, + ) diff --git a/src/increase/resources/oauth_connections.py b/src/increase/resources/oauth_connections.py index df815c726..ae4bd3208 100644 --- a/src/increase/resources/oauth_connections.py +++ b/src/increase/resources/oauth_connections.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import OAuthConnection, oauth_connection_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import oauth_connection_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.oauth_connection import OAuthConnection -__all__ = ["OAuthConnections", "AsyncOAuthConnections"] +__all__ = ["OAuthConnectionsResource", "AsyncOAuthConnectionsResource"] -class OAuthConnections(SyncAPIResource): +class OAuthConnectionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OAuthConnectionsWithRawResponse: - return OAuthConnectionsWithRawResponse(self) + def with_raw_response(self) -> OAuthConnectionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return OAuthConnectionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OAuthConnectionsWithStreamingResponse: - return OAuthConnectionsWithStreamingResponse(self) + def with_streaming_response(self) -> OAuthConnectionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return OAuthConnectionsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OAuthConnection: """ Retrieve an OAuth Connection @@ -59,7 +72,7 @@ def retrieve( f"Expected a non-empty value for `oauth_connection_id` but received {oauth_connection_id!r}" ) return self._get( - f"/oauth_connections/{oauth_connection_id}", + path_template("/oauth_connections/{oauth_connection_id}", oauth_connection_id=oauth_connection_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,14 +82,16 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, + oauth_application_id: str | Omit = omit, + status: oauth_connection_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[OAuthConnection]: """ List OAuth Connections @@ -87,6 +102,9 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. + oauth_application_id: Filter results to only include OAuth Connections for a specific OAuth + Application. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -107,6 +125,8 @@ def list( { "cursor": cursor, "limit": limit, + "oauth_application_id": oauth_application_id, + "status": status, }, oauth_connection_list_params.OAuthConnectionListParams, ), @@ -115,14 +135,25 @@ def list( ) -class AsyncOAuthConnections(AsyncAPIResource): +class AsyncOAuthConnectionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOAuthConnectionsWithRawResponse: - return AsyncOAuthConnectionsWithRawResponse(self) + def with_raw_response(self) -> AsyncOAuthConnectionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncOAuthConnectionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOAuthConnectionsWithStreamingResponse: - return AsyncOAuthConnectionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOAuthConnectionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncOAuthConnectionsResourceWithStreamingResponse(self) async def retrieve( self, @@ -133,7 +164,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> OAuthConnection: """ Retrieve an OAuth Connection @@ -154,7 +185,7 @@ async def retrieve( f"Expected a non-empty value for `oauth_connection_id` but received {oauth_connection_id!r}" ) return await self._get( - f"/oauth_connections/{oauth_connection_id}", + path_template("/oauth_connections/{oauth_connection_id}", oauth_connection_id=oauth_connection_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -164,14 +195,16 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, + oauth_application_id: str | Omit = omit, + status: oauth_connection_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[OAuthConnection, AsyncPage[OAuthConnection]]: """ List OAuth Connections @@ -182,6 +215,9 @@ def list( limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. + oauth_application_id: Filter results to only include OAuth Connections for a specific OAuth + Application. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -202,6 +238,8 @@ def list( { "cursor": cursor, "limit": limit, + "oauth_application_id": oauth_application_id, + "status": status, }, oauth_connection_list_params.OAuthConnectionListParams, ), @@ -210,32 +248,32 @@ def list( ) -class OAuthConnectionsWithRawResponse: - def __init__(self, oauth_connections: OAuthConnections) -> None: +class OAuthConnectionsResourceWithRawResponse: + def __init__(self, oauth_connections: OAuthConnectionsResource) -> None: self._oauth_connections = oauth_connections - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( oauth_connections.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( oauth_connections.list, ) -class AsyncOAuthConnectionsWithRawResponse: - def __init__(self, oauth_connections: AsyncOAuthConnections) -> None: +class AsyncOAuthConnectionsResourceWithRawResponse: + def __init__(self, oauth_connections: AsyncOAuthConnectionsResource) -> None: self._oauth_connections = oauth_connections - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( oauth_connections.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( oauth_connections.list, ) -class OAuthConnectionsWithStreamingResponse: - def __init__(self, oauth_connections: OAuthConnections) -> None: +class OAuthConnectionsResourceWithStreamingResponse: + def __init__(self, oauth_connections: OAuthConnectionsResource) -> None: self._oauth_connections = oauth_connections self.retrieve = to_streamed_response_wrapper( @@ -246,8 +284,8 @@ def __init__(self, oauth_connections: OAuthConnections) -> None: ) -class AsyncOAuthConnectionsWithStreamingResponse: - def __init__(self, oauth_connections: AsyncOAuthConnections) -> None: +class AsyncOAuthConnectionsResourceWithStreamingResponse: + def __init__(self, oauth_connections: AsyncOAuthConnectionsResource) -> None: self._oauth_connections = oauth_connections self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/oauth_tokens.py b/src/increase/resources/oauth_tokens.py index 304bee468..cc2efe348 100644 --- a/src/increase/resources/oauth_tokens.py +++ b/src/increase/resources/oauth_tokens.py @@ -6,46 +6,57 @@ import httpx -from .. import _legacy_response -from ..types import OAuthToken, oauth_token_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import oauth_token_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from .._base_client import ( - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from .._base_client import make_request_options +from ..types.oauth_token import OAuthToken -__all__ = ["OAuthTokens", "AsyncOAuthTokens"] +__all__ = ["OAuthTokensResource", "AsyncOAuthTokensResource"] -class OAuthTokens(SyncAPIResource): +class OAuthTokensResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> OAuthTokensWithRawResponse: - return OAuthTokensWithRawResponse(self) + def with_raw_response(self) -> OAuthTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return OAuthTokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> OAuthTokensWithStreamingResponse: - return OAuthTokensWithStreamingResponse(self) + def with_streaming_response(self) -> OAuthTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return OAuthTokensResourceWithStreamingResponse(self) def create( self, *, grant_type: Literal["authorization_code", "production_token"], - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, - code: str | NotGiven = NOT_GIVEN, - production_token: str | NotGiven = NOT_GIVEN, + client_id: str | Omit = omit, + client_secret: str | Omit = omit, + code: str | Omit = omit, + production_token: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> OAuthToken: """ @@ -60,7 +71,7 @@ def create( client_id: The public identifier for your application. - client_secret: The secret that confirms you own the application. This is redundent given that + client_secret: The secret that confirms you own the application. This is redundant given that the request is made with your API key but it's a required component of OAuth 2.0. @@ -104,29 +115,40 @@ def create( ) -class AsyncOAuthTokens(AsyncAPIResource): +class AsyncOAuthTokensResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncOAuthTokensWithRawResponse: - return AsyncOAuthTokensWithRawResponse(self) + def with_raw_response(self) -> AsyncOAuthTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncOAuthTokensResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncOAuthTokensWithStreamingResponse: - return AsyncOAuthTokensWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncOAuthTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncOAuthTokensResourceWithStreamingResponse(self) async def create( self, *, grant_type: Literal["authorization_code", "production_token"], - client_id: str | NotGiven = NOT_GIVEN, - client_secret: str | NotGiven = NOT_GIVEN, - code: str | NotGiven = NOT_GIVEN, - production_token: str | NotGiven = NOT_GIVEN, + client_id: str | Omit = omit, + client_secret: str | Omit = omit, + code: str | Omit = omit, + production_token: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> OAuthToken: """ @@ -141,7 +163,7 @@ async def create( client_id: The public identifier for your application. - client_secret: The secret that confirms you own the application. This is redundent given that + client_secret: The secret that confirms you own the application. This is redundant given that the request is made with your API key but it's a required component of OAuth 2.0. @@ -185,26 +207,26 @@ async def create( ) -class OAuthTokensWithRawResponse: - def __init__(self, oauth_tokens: OAuthTokens) -> None: +class OAuthTokensResourceWithRawResponse: + def __init__(self, oauth_tokens: OAuthTokensResource) -> None: self._oauth_tokens = oauth_tokens - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( oauth_tokens.create, ) -class AsyncOAuthTokensWithRawResponse: - def __init__(self, oauth_tokens: AsyncOAuthTokens) -> None: +class AsyncOAuthTokensResourceWithRawResponse: + def __init__(self, oauth_tokens: AsyncOAuthTokensResource) -> None: self._oauth_tokens = oauth_tokens - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( oauth_tokens.create, ) -class OAuthTokensWithStreamingResponse: - def __init__(self, oauth_tokens: OAuthTokens) -> None: +class OAuthTokensResourceWithStreamingResponse: + def __init__(self, oauth_tokens: OAuthTokensResource) -> None: self._oauth_tokens = oauth_tokens self.create = to_streamed_response_wrapper( @@ -212,8 +234,8 @@ def __init__(self, oauth_tokens: OAuthTokens) -> None: ) -class AsyncOAuthTokensWithStreamingResponse: - def __init__(self, oauth_tokens: AsyncOAuthTokens) -> None: +class AsyncOAuthTokensResourceWithStreamingResponse: + def __init__(self, oauth_tokens: AsyncOAuthTokensResource) -> None: self._oauth_tokens = oauth_tokens self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/pending_transactions.py b/src/increase/resources/pending_transactions.py index 4a6658573..5eb7e2404 100644 --- a/src/increase/resources/pending_transactions.py +++ b/src/increase/resources/pending_transactions.py @@ -4,30 +4,104 @@ import httpx -from .. import _legacy_response -from ..types import PendingTransaction, pending_transaction_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import pending_transaction_list_params, pending_transaction_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.pending_transaction import PendingTransaction -__all__ = ["PendingTransactions", "AsyncPendingTransactions"] +__all__ = ["PendingTransactionsResource", "AsyncPendingTransactionsResource"] -class PendingTransactions(SyncAPIResource): +class PendingTransactionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PendingTransactionsWithRawResponse: - return PendingTransactionsWithRawResponse(self) + def with_raw_response(self) -> PendingTransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return PendingTransactionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PendingTransactionsWithStreamingResponse: - return PendingTransactionsWithStreamingResponse(self) + def with_streaming_response(self) -> PendingTransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return PendingTransactionsResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + amount: int, + description: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PendingTransaction: + """Creates a pending transaction on an account. + + This can be useful to hold funds + for an external payment or known future transaction outside of Increase (only + negative amounts are supported). The resulting Pending Transaction will have a + `category` of `user_initiated_hold` and can be released via the API to unlock + the held funds. + + Args: + account_id: The Account to place the hold on. + + amount: The amount to hold in the minor unit of the account's currency. For dollars, for + example, this is cents. This should be a negative amount - to hold $1.00 from + the account, you would pass -100. + + description: The description you choose to give the hold. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/pending_transactions", + body=maybe_transform( + { + "account_id": account_id, + "amount": amount, + "description": description, + }, + pending_transaction_create_params.PendingTransactionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PendingTransaction, + ) def retrieve( self, @@ -38,7 +112,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PendingTransaction: """ Retrieve a Pending Transaction @@ -59,7 +133,9 @@ def retrieve( f"Expected a non-empty value for `pending_transaction_id` but received {pending_transaction_id!r}" ) return self._get( - f"/pending_transactions/{pending_transaction_id}", + path_template( + "/pending_transactions/{pending_transaction_id}", pending_transaction_id=pending_transaction_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -69,20 +145,19 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - category: pending_transaction_list_params.Category | NotGiven = NOT_GIVEN, - created_at: pending_transaction_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - route_id: str | NotGiven = NOT_GIVEN, - source_id: str | NotGiven = NOT_GIVEN, - status: pending_transaction_list_params.Status | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + category: pending_transaction_list_params.Category | Omit = omit, + created_at: pending_transaction_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + route_id: str | Omit = omit, + status: pending_transaction_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[PendingTransaction]: """ List Pending Transactions @@ -97,8 +172,6 @@ def list( route_id: Filter pending transactions to those belonging to the specified Route. - source_id: Filter pending transactions to those caused by the specified source. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -123,7 +196,6 @@ def list( "cursor": cursor, "limit": limit, "route_id": route_id, - "source_id": source_id, "status": status, }, pending_transaction_list_params.PendingTransactionListParams, @@ -132,15 +204,137 @@ def list( model=PendingTransaction, ) + def release( + self, + pending_transaction_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PendingTransaction: + """Release a Pending Transaction you had previously created. -class AsyncPendingTransactions(AsyncAPIResource): + The Pending + Transaction must have a `category` of `user_initiated_hold` and a `status` of + `pending`. This will unlock the held funds and mark the Pending Transaction as + complete. + + Args: + pending_transaction_id: The identifier of the Pending Transaction to release. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not pending_transaction_id: + raise ValueError( + f"Expected a non-empty value for `pending_transaction_id` but received {pending_transaction_id!r}" + ) + return self._post( + path_template( + "/pending_transactions/{pending_transaction_id}/release", pending_transaction_id=pending_transaction_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PendingTransaction, + ) + + +class AsyncPendingTransactionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPendingTransactionsWithRawResponse: - return AsyncPendingTransactionsWithRawResponse(self) + def with_raw_response(self) -> AsyncPendingTransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncPendingTransactionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPendingTransactionsWithStreamingResponse: - return AsyncPendingTransactionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPendingTransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncPendingTransactionsResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + amount: int, + description: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PendingTransaction: + """Creates a pending transaction on an account. + + This can be useful to hold funds + for an external payment or known future transaction outside of Increase (only + negative amounts are supported). The resulting Pending Transaction will have a + `category` of `user_initiated_hold` and can be released via the API to unlock + the held funds. + + Args: + account_id: The Account to place the hold on. + + amount: The amount to hold in the minor unit of the account's currency. For dollars, for + example, this is cents. This should be a negative amount - to hold $1.00 from + the account, you would pass -100. + + description: The description you choose to give the hold. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/pending_transactions", + body=await async_maybe_transform( + { + "account_id": account_id, + "amount": amount, + "description": description, + }, + pending_transaction_create_params.PendingTransactionCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PendingTransaction, + ) async def retrieve( self, @@ -151,7 +345,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PendingTransaction: """ Retrieve a Pending Transaction @@ -172,7 +366,9 @@ async def retrieve( f"Expected a non-empty value for `pending_transaction_id` but received {pending_transaction_id!r}" ) return await self._get( - f"/pending_transactions/{pending_transaction_id}", + path_template( + "/pending_transactions/{pending_transaction_id}", pending_transaction_id=pending_transaction_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -182,20 +378,19 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - category: pending_transaction_list_params.Category | NotGiven = NOT_GIVEN, - created_at: pending_transaction_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - route_id: str | NotGiven = NOT_GIVEN, - source_id: str | NotGiven = NOT_GIVEN, - status: pending_transaction_list_params.Status | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + category: pending_transaction_list_params.Category | Omit = omit, + created_at: pending_transaction_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + route_id: str | Omit = omit, + status: pending_transaction_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[PendingTransaction, AsyncPage[PendingTransaction]]: """ List Pending Transactions @@ -210,8 +405,6 @@ def list( route_id: Filter pending transactions to those belonging to the specified Route. - source_id: Filter pending transactions to those caused by the specified source. - extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -236,7 +429,6 @@ def list( "cursor": cursor, "limit": limit, "route_id": route_id, - "source_id": source_id, "status": status, }, pending_transaction_list_params.PendingTransactionListParams, @@ -245,50 +437,124 @@ def list( model=PendingTransaction, ) + async def release( + self, + pending_transaction_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PendingTransaction: + """Release a Pending Transaction you had previously created. + + The Pending + Transaction must have a `category` of `user_initiated_hold` and a `status` of + `pending`. This will unlock the held funds and mark the Pending Transaction as + complete. + + Args: + pending_transaction_id: The identifier of the Pending Transaction to release. + + extra_headers: Send extra headers -class PendingTransactionsWithRawResponse: - def __init__(self, pending_transactions: PendingTransactions) -> None: + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not pending_transaction_id: + raise ValueError( + f"Expected a non-empty value for `pending_transaction_id` but received {pending_transaction_id!r}" + ) + return await self._post( + path_template( + "/pending_transactions/{pending_transaction_id}/release", pending_transaction_id=pending_transaction_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PendingTransaction, + ) + + +class PendingTransactionsResourceWithRawResponse: + def __init__(self, pending_transactions: PendingTransactionsResource) -> None: self._pending_transactions = pending_transactions - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( + pending_transactions.create, + ) + self.retrieve = to_raw_response_wrapper( pending_transactions.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( pending_transactions.list, ) + self.release = to_raw_response_wrapper( + pending_transactions.release, + ) -class AsyncPendingTransactionsWithRawResponse: - def __init__(self, pending_transactions: AsyncPendingTransactions) -> None: +class AsyncPendingTransactionsResourceWithRawResponse: + def __init__(self, pending_transactions: AsyncPendingTransactionsResource) -> None: self._pending_transactions = pending_transactions - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( + pending_transactions.create, + ) + self.retrieve = async_to_raw_response_wrapper( pending_transactions.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( pending_transactions.list, ) + self.release = async_to_raw_response_wrapper( + pending_transactions.release, + ) -class PendingTransactionsWithStreamingResponse: - def __init__(self, pending_transactions: PendingTransactions) -> None: +class PendingTransactionsResourceWithStreamingResponse: + def __init__(self, pending_transactions: PendingTransactionsResource) -> None: self._pending_transactions = pending_transactions + self.create = to_streamed_response_wrapper( + pending_transactions.create, + ) self.retrieve = to_streamed_response_wrapper( pending_transactions.retrieve, ) self.list = to_streamed_response_wrapper( pending_transactions.list, ) + self.release = to_streamed_response_wrapper( + pending_transactions.release, + ) -class AsyncPendingTransactionsWithStreamingResponse: - def __init__(self, pending_transactions: AsyncPendingTransactions) -> None: +class AsyncPendingTransactionsResourceWithStreamingResponse: + def __init__(self, pending_transactions: AsyncPendingTransactionsResource) -> None: self._pending_transactions = pending_transactions + self.create = async_to_streamed_response_wrapper( + pending_transactions.create, + ) self.retrieve = async_to_streamed_response_wrapper( pending_transactions.retrieve, ) self.list = async_to_streamed_response_wrapper( pending_transactions.list, ) + self.release = async_to_streamed_response_wrapper( + pending_transactions.release, + ) diff --git a/src/increase/resources/physical_card_profiles.py b/src/increase/resources/physical_card_profiles.py index 78c0a37bc..e0ad95108 100644 --- a/src/increase/resources/physical_card_profiles.py +++ b/src/increase/resources/physical_card_profiles.py @@ -4,38 +4,47 @@ import httpx -from .. import _legacy_response from ..types import ( - PhysicalCardProfile, physical_card_profile_list_params, physical_card_profile_clone_params, physical_card_profile_create_params, ) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.physical_card_profile import PhysicalCardProfile -__all__ = ["PhysicalCardProfiles", "AsyncPhysicalCardProfiles"] +__all__ = ["PhysicalCardProfilesResource", "AsyncPhysicalCardProfilesResource"] -class PhysicalCardProfiles(SyncAPIResource): +class PhysicalCardProfilesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PhysicalCardProfilesWithRawResponse: - return PhysicalCardProfilesWithRawResponse(self) + def with_raw_response(self) -> PhysicalCardProfilesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return PhysicalCardProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PhysicalCardProfilesWithStreamingResponse: - return PhysicalCardProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> PhysicalCardProfilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return PhysicalCardProfilesResourceWithStreamingResponse(self) def create( self, @@ -44,12 +53,14 @@ def create( contact_phone: str, description: str, front_image_file_id: str, + program_id: str, + front_text: physical_card_profile_create_params.FrontText | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCardProfile: """ @@ -64,6 +75,11 @@ def create( front_image_file_id: The identifier of the File containing the physical card's front image. + program_id: The identifier for the Program that this Physical Card Profile falls under. + + front_text: Text printed on the front of the card. Reach out to + [support@increase.com](mailto:support@increase.com) for more information. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -82,6 +98,8 @@ def create( "contact_phone": contact_phone, "description": description, "front_image_file_id": front_image_file_id, + "program_id": program_id, + "front_text": front_text, }, physical_card_profile_create_params.PhysicalCardProfileCreateParams, ), @@ -104,7 +122,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhysicalCardProfile: """ Retrieve a Card Profile @@ -125,7 +143,9 @@ def retrieve( f"Expected a non-empty value for `physical_card_profile_id` but received {physical_card_profile_id!r}" ) return self._get( - f"/physical_card_profiles/{physical_card_profile_id}", + path_template( + "/physical_card_profiles/{physical_card_profile_id}", physical_card_profile_id=physical_card_profile_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -135,16 +155,16 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: physical_card_profile_list_params.Status | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: physical_card_profile_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[PhysicalCardProfile]: """ List Physical Card Profiles @@ -198,7 +218,7 @@ def archive( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCardProfile: """ @@ -222,7 +242,10 @@ def archive( f"Expected a non-empty value for `physical_card_profile_id` but received {physical_card_profile_id!r}" ) return self._post( - f"/physical_card_profiles/{physical_card_profile_id}/archive", + path_template( + "/physical_card_profiles/{physical_card_profile_id}/archive", + physical_card_profile_id=physical_card_profile_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -237,17 +260,18 @@ def clone( self, physical_card_profile_id: str, *, - carrier_image_file_id: str | NotGiven = NOT_GIVEN, - contact_phone: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - front_image_file_id: str | NotGiven = NOT_GIVEN, - front_text: physical_card_profile_clone_params.FrontText | NotGiven = NOT_GIVEN, + carrier_image_file_id: str | Omit = omit, + contact_phone: str | Omit = omit, + description: str | Omit = omit, + front_image_file_id: str | Omit = omit, + front_text: physical_card_profile_clone_params.FrontText | Omit = omit, + program_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCardProfile: """ @@ -267,6 +291,8 @@ def clone( front_text: Text printed on the front of the card. Reach out to [support@increase.com](mailto:support@increase.com) for more information. + program_id: The identifier of the Program to use for the cloned Physical Card Profile. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -282,7 +308,10 @@ def clone( f"Expected a non-empty value for `physical_card_profile_id` but received {physical_card_profile_id!r}" ) return self._post( - f"/physical_card_profiles/{physical_card_profile_id}/clone", + path_template( + "/physical_card_profiles/{physical_card_profile_id}/clone", + physical_card_profile_id=physical_card_profile_id, + ), body=maybe_transform( { "carrier_image_file_id": carrier_image_file_id, @@ -290,6 +319,7 @@ def clone( "description": description, "front_image_file_id": front_image_file_id, "front_text": front_text, + "program_id": program_id, }, physical_card_profile_clone_params.PhysicalCardProfileCloneParams, ), @@ -304,14 +334,25 @@ def clone( ) -class AsyncPhysicalCardProfiles(AsyncAPIResource): +class AsyncPhysicalCardProfilesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPhysicalCardProfilesWithRawResponse: - return AsyncPhysicalCardProfilesWithRawResponse(self) + def with_raw_response(self) -> AsyncPhysicalCardProfilesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncPhysicalCardProfilesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPhysicalCardProfilesWithStreamingResponse: - return AsyncPhysicalCardProfilesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPhysicalCardProfilesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncPhysicalCardProfilesResourceWithStreamingResponse(self) async def create( self, @@ -320,12 +361,14 @@ async def create( contact_phone: str, description: str, front_image_file_id: str, + program_id: str, + front_text: physical_card_profile_create_params.FrontText | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCardProfile: """ @@ -340,6 +383,11 @@ async def create( front_image_file_id: The identifier of the File containing the physical card's front image. + program_id: The identifier for the Program that this Physical Card Profile falls under. + + front_text: Text printed on the front of the card. Reach out to + [support@increase.com](mailto:support@increase.com) for more information. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -358,6 +406,8 @@ async def create( "contact_phone": contact_phone, "description": description, "front_image_file_id": front_image_file_id, + "program_id": program_id, + "front_text": front_text, }, physical_card_profile_create_params.PhysicalCardProfileCreateParams, ), @@ -380,7 +430,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhysicalCardProfile: """ Retrieve a Card Profile @@ -401,7 +451,9 @@ async def retrieve( f"Expected a non-empty value for `physical_card_profile_id` but received {physical_card_profile_id!r}" ) return await self._get( - f"/physical_card_profiles/{physical_card_profile_id}", + path_template( + "/physical_card_profiles/{physical_card_profile_id}", physical_card_profile_id=physical_card_profile_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -411,16 +463,16 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - status: physical_card_profile_list_params.Status | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: physical_card_profile_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[PhysicalCardProfile, AsyncPage[PhysicalCardProfile]]: """ List Physical Card Profiles @@ -474,7 +526,7 @@ async def archive( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCardProfile: """ @@ -498,7 +550,10 @@ async def archive( f"Expected a non-empty value for `physical_card_profile_id` but received {physical_card_profile_id!r}" ) return await self._post( - f"/physical_card_profiles/{physical_card_profile_id}/archive", + path_template( + "/physical_card_profiles/{physical_card_profile_id}/archive", + physical_card_profile_id=physical_card_profile_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -513,17 +568,18 @@ async def clone( self, physical_card_profile_id: str, *, - carrier_image_file_id: str | NotGiven = NOT_GIVEN, - contact_phone: str | NotGiven = NOT_GIVEN, - description: str | NotGiven = NOT_GIVEN, - front_image_file_id: str | NotGiven = NOT_GIVEN, - front_text: physical_card_profile_clone_params.FrontText | NotGiven = NOT_GIVEN, + carrier_image_file_id: str | Omit = omit, + contact_phone: str | Omit = omit, + description: str | Omit = omit, + front_image_file_id: str | Omit = omit, + front_text: physical_card_profile_clone_params.FrontText | Omit = omit, + program_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCardProfile: """ @@ -543,6 +599,8 @@ async def clone( front_text: Text printed on the front of the card. Reach out to [support@increase.com](mailto:support@increase.com) for more information. + program_id: The identifier of the Program to use for the cloned Physical Card Profile. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -558,7 +616,10 @@ async def clone( f"Expected a non-empty value for `physical_card_profile_id` but received {physical_card_profile_id!r}" ) return await self._post( - f"/physical_card_profiles/{physical_card_profile_id}/clone", + path_template( + "/physical_card_profiles/{physical_card_profile_id}/clone", + physical_card_profile_id=physical_card_profile_id, + ), body=await async_maybe_transform( { "carrier_image_file_id": carrier_image_file_id, @@ -566,6 +627,7 @@ async def clone( "description": description, "front_image_file_id": front_image_file_id, "front_text": front_text, + "program_id": program_id, }, physical_card_profile_clone_params.PhysicalCardProfileCloneParams, ), @@ -580,50 +642,50 @@ async def clone( ) -class PhysicalCardProfilesWithRawResponse: - def __init__(self, physical_card_profiles: PhysicalCardProfiles) -> None: +class PhysicalCardProfilesResourceWithRawResponse: + def __init__(self, physical_card_profiles: PhysicalCardProfilesResource) -> None: self._physical_card_profiles = physical_card_profiles - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( physical_card_profiles.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( physical_card_profiles.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( physical_card_profiles.list, ) - self.archive = _legacy_response.to_raw_response_wrapper( + self.archive = to_raw_response_wrapper( physical_card_profiles.archive, ) - self.clone = _legacy_response.to_raw_response_wrapper( + self.clone = to_raw_response_wrapper( physical_card_profiles.clone, ) -class AsyncPhysicalCardProfilesWithRawResponse: - def __init__(self, physical_card_profiles: AsyncPhysicalCardProfiles) -> None: +class AsyncPhysicalCardProfilesResourceWithRawResponse: + def __init__(self, physical_card_profiles: AsyncPhysicalCardProfilesResource) -> None: self._physical_card_profiles = physical_card_profiles - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( physical_card_profiles.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( physical_card_profiles.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( physical_card_profiles.list, ) - self.archive = _legacy_response.async_to_raw_response_wrapper( + self.archive = async_to_raw_response_wrapper( physical_card_profiles.archive, ) - self.clone = _legacy_response.async_to_raw_response_wrapper( + self.clone = async_to_raw_response_wrapper( physical_card_profiles.clone, ) -class PhysicalCardProfilesWithStreamingResponse: - def __init__(self, physical_card_profiles: PhysicalCardProfiles) -> None: +class PhysicalCardProfilesResourceWithStreamingResponse: + def __init__(self, physical_card_profiles: PhysicalCardProfilesResource) -> None: self._physical_card_profiles = physical_card_profiles self.create = to_streamed_response_wrapper( @@ -643,8 +705,8 @@ def __init__(self, physical_card_profiles: PhysicalCardProfiles) -> None: ) -class AsyncPhysicalCardProfilesWithStreamingResponse: - def __init__(self, physical_card_profiles: AsyncPhysicalCardProfiles) -> None: +class AsyncPhysicalCardProfilesResourceWithStreamingResponse: + def __init__(self, physical_card_profiles: AsyncPhysicalCardProfilesResource) -> None: self._physical_card_profiles = physical_card_profiles self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/physical_cards.py b/src/increase/resources/physical_cards.py index 906bd56ed..bb6cd8b7d 100644 --- a/src/increase/resources/physical_cards.py +++ b/src/increase/resources/physical_cards.py @@ -6,38 +6,43 @@ import httpx -from .. import _legacy_response -from ..types import ( - PhysicalCard, - physical_card_list_params, - physical_card_create_params, - physical_card_update_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import physical_card_list_params, physical_card_create_params, physical_card_update_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.physical_card import PhysicalCard -__all__ = ["PhysicalCards", "AsyncPhysicalCards"] +__all__ = ["PhysicalCardsResource", "AsyncPhysicalCardsResource"] -class PhysicalCards(SyncAPIResource): +class PhysicalCardsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PhysicalCardsWithRawResponse: - return PhysicalCardsWithRawResponse(self) + def with_raw_response(self) -> PhysicalCardsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return PhysicalCardsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PhysicalCardsWithStreamingResponse: - return PhysicalCardsWithStreamingResponse(self) + def with_streaming_response(self) -> PhysicalCardsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return PhysicalCardsResourceWithStreamingResponse(self) def create( self, @@ -45,13 +50,13 @@ def create( card_id: str, cardholder: physical_card_create_params.Cardholder, shipment: physical_card_create_params.Shipment, - physical_card_profile_id: str | NotGiven = NOT_GIVEN, + physical_card_profile_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCard: """ @@ -107,7 +112,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhysicalCard: """ Retrieve a Physical Card @@ -126,7 +131,7 @@ def retrieve( if not physical_card_id: raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") return self._get( - f"/physical_cards/{physical_card_id}", + path_template("/physical_cards/{physical_card_id}", physical_card_id=physical_card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -143,7 +148,7 @@ def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCard: """ @@ -171,7 +176,7 @@ def update( if not physical_card_id: raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") return self._patch( - f"/physical_cards/{physical_card_id}", + path_template("/physical_cards/{physical_card_id}", physical_card_id=physical_card_id), body=maybe_transform({"status": status}, physical_card_update_params.PhysicalCardUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -186,17 +191,17 @@ def update( def list( self, *, - card_id: str | NotGiven = NOT_GIVEN, - created_at: physical_card_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + card_id: str | Omit = omit, + created_at: physical_card_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[PhysicalCard]: """ List Physical Cards @@ -245,14 +250,25 @@ def list( ) -class AsyncPhysicalCards(AsyncAPIResource): +class AsyncPhysicalCardsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPhysicalCardsWithRawResponse: - return AsyncPhysicalCardsWithRawResponse(self) + def with_raw_response(self) -> AsyncPhysicalCardsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncPhysicalCardsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPhysicalCardsWithStreamingResponse: - return AsyncPhysicalCardsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPhysicalCardsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncPhysicalCardsResourceWithStreamingResponse(self) async def create( self, @@ -260,13 +276,13 @@ async def create( card_id: str, cardholder: physical_card_create_params.Cardholder, shipment: physical_card_create_params.Shipment, - physical_card_profile_id: str | NotGiven = NOT_GIVEN, + physical_card_profile_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCard: """ @@ -322,7 +338,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> PhysicalCard: """ Retrieve a Physical Card @@ -341,7 +357,7 @@ async def retrieve( if not physical_card_id: raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") return await self._get( - f"/physical_cards/{physical_card_id}", + path_template("/physical_cards/{physical_card_id}", physical_card_id=physical_card_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -358,7 +374,7 @@ async def update( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCard: """ @@ -386,7 +402,7 @@ async def update( if not physical_card_id: raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") return await self._patch( - f"/physical_cards/{physical_card_id}", + path_template("/physical_cards/{physical_card_id}", physical_card_id=physical_card_id), body=await async_maybe_transform({"status": status}, physical_card_update_params.PhysicalCardUpdateParams), options=make_request_options( extra_headers=extra_headers, @@ -401,17 +417,17 @@ async def update( def list( self, *, - card_id: str | NotGiven = NOT_GIVEN, - created_at: physical_card_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + card_id: str | Omit = omit, + created_at: physical_card_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[PhysicalCard, AsyncPage[PhysicalCard]]: """ List Physical Cards @@ -460,44 +476,44 @@ def list( ) -class PhysicalCardsWithRawResponse: - def __init__(self, physical_cards: PhysicalCards) -> None: +class PhysicalCardsResourceWithRawResponse: + def __init__(self, physical_cards: PhysicalCardsResource) -> None: self._physical_cards = physical_cards - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( physical_cards.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( physical_cards.retrieve, ) - self.update = _legacy_response.to_raw_response_wrapper( + self.update = to_raw_response_wrapper( physical_cards.update, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( physical_cards.list, ) -class AsyncPhysicalCardsWithRawResponse: - def __init__(self, physical_cards: AsyncPhysicalCards) -> None: +class AsyncPhysicalCardsResourceWithRawResponse: + def __init__(self, physical_cards: AsyncPhysicalCardsResource) -> None: self._physical_cards = physical_cards - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( physical_cards.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( physical_cards.retrieve, ) - self.update = _legacy_response.async_to_raw_response_wrapper( + self.update = async_to_raw_response_wrapper( physical_cards.update, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( physical_cards.list, ) -class PhysicalCardsWithStreamingResponse: - def __init__(self, physical_cards: PhysicalCards) -> None: +class PhysicalCardsResourceWithStreamingResponse: + def __init__(self, physical_cards: PhysicalCardsResource) -> None: self._physical_cards = physical_cards self.create = to_streamed_response_wrapper( @@ -514,8 +530,8 @@ def __init__(self, physical_cards: PhysicalCards) -> None: ) -class AsyncPhysicalCardsWithStreamingResponse: - def __init__(self, physical_cards: AsyncPhysicalCards) -> None: +class AsyncPhysicalCardsResourceWithStreamingResponse: + def __init__(self, physical_cards: AsyncPhysicalCardsResource) -> None: self._physical_cards = physical_cards self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/programs.py b/src/increase/resources/programs.py index c9f6c7afc..c23857191 100644 --- a/src/increase/resources/programs.py +++ b/src/increase/resources/programs.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import Program, program_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import program_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.program import Program -__all__ = ["Programs", "AsyncPrograms"] +__all__ = ["ProgramsResource", "AsyncProgramsResource"] -class Programs(SyncAPIResource): +class ProgramsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ProgramsWithRawResponse: - return ProgramsWithRawResponse(self) + def with_raw_response(self) -> ProgramsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ProgramsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProgramsWithStreamingResponse: - return ProgramsWithStreamingResponse(self) + def with_streaming_response(self) -> ProgramsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ProgramsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Program: """ Retrieve a Program @@ -57,7 +70,7 @@ def retrieve( if not program_id: raise ValueError(f"Expected a non-empty value for `program_id` but received {program_id!r}") return self._get( - f"/programs/{program_id}", + path_template("/programs/{program_id}", program_id=program_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -67,14 +80,14 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Program]: """ List Programs @@ -113,14 +126,25 @@ def list( ) -class AsyncPrograms(AsyncAPIResource): +class AsyncProgramsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncProgramsWithRawResponse: - return AsyncProgramsWithRawResponse(self) + def with_raw_response(self) -> AsyncProgramsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncProgramsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProgramsWithStreamingResponse: - return AsyncProgramsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProgramsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncProgramsResourceWithStreamingResponse(self) async def retrieve( self, @@ -131,7 +155,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Program: """ Retrieve a Program @@ -150,7 +174,7 @@ async def retrieve( if not program_id: raise ValueError(f"Expected a non-empty value for `program_id` but received {program_id!r}") return await self._get( - f"/programs/{program_id}", + path_template("/programs/{program_id}", program_id=program_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -160,14 +184,14 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Program, AsyncPage[Program]]: """ List Programs @@ -206,32 +230,32 @@ def list( ) -class ProgramsWithRawResponse: - def __init__(self, programs: Programs) -> None: +class ProgramsResourceWithRawResponse: + def __init__(self, programs: ProgramsResource) -> None: self._programs = programs - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( programs.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( programs.list, ) -class AsyncProgramsWithRawResponse: - def __init__(self, programs: AsyncPrograms) -> None: +class AsyncProgramsResourceWithRawResponse: + def __init__(self, programs: AsyncProgramsResource) -> None: self._programs = programs - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( programs.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( programs.list, ) -class ProgramsWithStreamingResponse: - def __init__(self, programs: Programs) -> None: +class ProgramsResourceWithStreamingResponse: + def __init__(self, programs: ProgramsResource) -> None: self._programs = programs self.retrieve = to_streamed_response_wrapper( @@ -242,8 +266,8 @@ def __init__(self, programs: Programs) -> None: ) -class AsyncProgramsWithStreamingResponse: - def __init__(self, programs: AsyncPrograms) -> None: +class AsyncProgramsResourceWithStreamingResponse: + def __init__(self, programs: AsyncProgramsResource) -> None: self._programs = programs self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/proof_of_authorization_request_submissions.py b/src/increase/resources/proof_of_authorization_request_submissions.py deleted file mode 100644 index 1026a6727..000000000 --- a/src/increase/resources/proof_of_authorization_request_submissions.py +++ /dev/null @@ -1,474 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime - -import httpx - -from .. import _legacy_response -from ..types import ( - ProofOfAuthorizationRequestSubmission, - proof_of_authorization_request_submission_list_params, - proof_of_authorization_request_submission_create_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) - -__all__ = ["ProofOfAuthorizationRequestSubmissions", "AsyncProofOfAuthorizationRequestSubmissions"] - - -class ProofOfAuthorizationRequestSubmissions(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProofOfAuthorizationRequestSubmissionsWithRawResponse: - return ProofOfAuthorizationRequestSubmissionsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProofOfAuthorizationRequestSubmissionsWithStreamingResponse: - return ProofOfAuthorizationRequestSubmissionsWithStreamingResponse(self) - - def create( - self, - *, - authorization_terms: str, - authorized_at: Union[str, datetime], - authorizer_email: str, - authorizer_name: str, - customer_has_been_offboarded: bool, - proof_of_authorization_request_id: str, - validated_account_ownership_via_credential: bool, - validated_account_ownership_with_account_statement: bool, - validated_account_ownership_with_microdeposit: bool, - authorizer_company: str | NotGiven = NOT_GIVEN, - authorizer_ip_address: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> ProofOfAuthorizationRequestSubmission: - """ - Submit Proof of Authorization - - Args: - authorization_terms: Terms of authorization. - - authorized_at: Time of authorization. - - authorizer_email: Email of the authorizer. - - authorizer_name: Name of the authorizer. - - customer_has_been_offboarded: Whether the customer has been offboarded or suspended. - - proof_of_authorization_request_id: ID of the proof of authorization request. - - validated_account_ownership_via_credential: Whether the account ownership was validated via credential (e.g. Plaid). - - validated_account_ownership_with_account_statement: Whether the account ownership was validated with an account statement. - - validated_account_ownership_with_microdeposit: Whether the account ownership was validated with a microdeposit. - - authorizer_company: Company of the authorizer. - - authorizer_ip_address: IP address of the authorizer. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/proof_of_authorization_request_submissions", - body=maybe_transform( - { - "authorization_terms": authorization_terms, - "authorized_at": authorized_at, - "authorizer_email": authorizer_email, - "authorizer_name": authorizer_name, - "customer_has_been_offboarded": customer_has_been_offboarded, - "proof_of_authorization_request_id": proof_of_authorization_request_id, - "validated_account_ownership_via_credential": validated_account_ownership_via_credential, - "validated_account_ownership_with_account_statement": validated_account_ownership_with_account_statement, - "validated_account_ownership_with_microdeposit": validated_account_ownership_with_microdeposit, - "authorizer_company": authorizer_company, - "authorizer_ip_address": authorizer_ip_address, - }, - proof_of_authorization_request_submission_create_params.ProofOfAuthorizationRequestSubmissionCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=ProofOfAuthorizationRequestSubmission, - ) - - def retrieve( - self, - proof_of_authorization_request_submission_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProofOfAuthorizationRequestSubmission: - """ - Retrieve a Proof of Authorization Request Submission - - Args: - proof_of_authorization_request_submission_id: The identifier of the Proof of Authorization Request Submission. - - 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 proof_of_authorization_request_submission_id: - raise ValueError( - f"Expected a non-empty value for `proof_of_authorization_request_submission_id` but received {proof_of_authorization_request_submission_id!r}" - ) - return self._get( - f"/proof_of_authorization_request_submissions/{proof_of_authorization_request_submission_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProofOfAuthorizationRequestSubmission, - ) - - def list( - self, - *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - proof_of_authorization_request_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncPage[ProofOfAuthorizationRequestSubmission]: - """ - List Proof of Authorization Request Submissions - - Args: - cursor: Return the page of entries after this one. - - idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for - that object. This value is unique across Increase and is used to ensure that a - request is only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - proof_of_authorization_request_id: ID of the proof of authorization request. - - 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 - """ - return self._get_api_list( - "/proof_of_authorization_request_submissions", - page=SyncPage[ProofOfAuthorizationRequestSubmission], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "cursor": cursor, - "idempotency_key": idempotency_key, - "limit": limit, - "proof_of_authorization_request_id": proof_of_authorization_request_id, - }, - proof_of_authorization_request_submission_list_params.ProofOfAuthorizationRequestSubmissionListParams, - ), - ), - model=ProofOfAuthorizationRequestSubmission, - ) - - -class AsyncProofOfAuthorizationRequestSubmissions(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProofOfAuthorizationRequestSubmissionsWithRawResponse: - return AsyncProofOfAuthorizationRequestSubmissionsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProofOfAuthorizationRequestSubmissionsWithStreamingResponse: - return AsyncProofOfAuthorizationRequestSubmissionsWithStreamingResponse(self) - - async def create( - self, - *, - authorization_terms: str, - authorized_at: Union[str, datetime], - authorizer_email: str, - authorizer_name: str, - customer_has_been_offboarded: bool, - proof_of_authorization_request_id: str, - validated_account_ownership_via_credential: bool, - validated_account_ownership_with_account_statement: bool, - validated_account_ownership_with_microdeposit: bool, - authorizer_company: str | NotGiven = NOT_GIVEN, - authorizer_ip_address: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> ProofOfAuthorizationRequestSubmission: - """ - Submit Proof of Authorization - - Args: - authorization_terms: Terms of authorization. - - authorized_at: Time of authorization. - - authorizer_email: Email of the authorizer. - - authorizer_name: Name of the authorizer. - - customer_has_been_offboarded: Whether the customer has been offboarded or suspended. - - proof_of_authorization_request_id: ID of the proof of authorization request. - - validated_account_ownership_via_credential: Whether the account ownership was validated via credential (e.g. Plaid). - - validated_account_ownership_with_account_statement: Whether the account ownership was validated with an account statement. - - validated_account_ownership_with_microdeposit: Whether the account ownership was validated with a microdeposit. - - authorizer_company: Company of the authorizer. - - authorizer_ip_address: IP address of the authorizer. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/proof_of_authorization_request_submissions", - body=await async_maybe_transform( - { - "authorization_terms": authorization_terms, - "authorized_at": authorized_at, - "authorizer_email": authorizer_email, - "authorizer_name": authorizer_name, - "customer_has_been_offboarded": customer_has_been_offboarded, - "proof_of_authorization_request_id": proof_of_authorization_request_id, - "validated_account_ownership_via_credential": validated_account_ownership_via_credential, - "validated_account_ownership_with_account_statement": validated_account_ownership_with_account_statement, - "validated_account_ownership_with_microdeposit": validated_account_ownership_with_microdeposit, - "authorizer_company": authorizer_company, - "authorizer_ip_address": authorizer_ip_address, - }, - proof_of_authorization_request_submission_create_params.ProofOfAuthorizationRequestSubmissionCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=ProofOfAuthorizationRequestSubmission, - ) - - async def retrieve( - self, - proof_of_authorization_request_submission_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProofOfAuthorizationRequestSubmission: - """ - Retrieve a Proof of Authorization Request Submission - - Args: - proof_of_authorization_request_submission_id: The identifier of the Proof of Authorization Request Submission. - - 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 proof_of_authorization_request_submission_id: - raise ValueError( - f"Expected a non-empty value for `proof_of_authorization_request_submission_id` but received {proof_of_authorization_request_submission_id!r}" - ) - return await self._get( - f"/proof_of_authorization_request_submissions/{proof_of_authorization_request_submission_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProofOfAuthorizationRequestSubmission, - ) - - def list( - self, - *, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - proof_of_authorization_request_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[ProofOfAuthorizationRequestSubmission, AsyncPage[ProofOfAuthorizationRequestSubmission]]: - """ - List Proof of Authorization Request Submissions - - Args: - cursor: Return the page of entries after this one. - - idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for - that object. This value is unique across Increase and is used to ensure that a - request is only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - proof_of_authorization_request_id: ID of the proof of authorization request. - - 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 - """ - return self._get_api_list( - "/proof_of_authorization_request_submissions", - page=AsyncPage[ProofOfAuthorizationRequestSubmission], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "cursor": cursor, - "idempotency_key": idempotency_key, - "limit": limit, - "proof_of_authorization_request_id": proof_of_authorization_request_id, - }, - proof_of_authorization_request_submission_list_params.ProofOfAuthorizationRequestSubmissionListParams, - ), - ), - model=ProofOfAuthorizationRequestSubmission, - ) - - -class ProofOfAuthorizationRequestSubmissionsWithRawResponse: - def __init__(self, proof_of_authorization_request_submissions: ProofOfAuthorizationRequestSubmissions) -> None: - self._proof_of_authorization_request_submissions = proof_of_authorization_request_submissions - - self.create = _legacy_response.to_raw_response_wrapper( - proof_of_authorization_request_submissions.create, - ) - self.retrieve = _legacy_response.to_raw_response_wrapper( - proof_of_authorization_request_submissions.retrieve, - ) - self.list = _legacy_response.to_raw_response_wrapper( - proof_of_authorization_request_submissions.list, - ) - - -class AsyncProofOfAuthorizationRequestSubmissionsWithRawResponse: - def __init__(self, proof_of_authorization_request_submissions: AsyncProofOfAuthorizationRequestSubmissions) -> None: - self._proof_of_authorization_request_submissions = proof_of_authorization_request_submissions - - self.create = _legacy_response.async_to_raw_response_wrapper( - proof_of_authorization_request_submissions.create, - ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - proof_of_authorization_request_submissions.retrieve, - ) - self.list = _legacy_response.async_to_raw_response_wrapper( - proof_of_authorization_request_submissions.list, - ) - - -class ProofOfAuthorizationRequestSubmissionsWithStreamingResponse: - def __init__(self, proof_of_authorization_request_submissions: ProofOfAuthorizationRequestSubmissions) -> None: - self._proof_of_authorization_request_submissions = proof_of_authorization_request_submissions - - self.create = to_streamed_response_wrapper( - proof_of_authorization_request_submissions.create, - ) - self.retrieve = to_streamed_response_wrapper( - proof_of_authorization_request_submissions.retrieve, - ) - self.list = to_streamed_response_wrapper( - proof_of_authorization_request_submissions.list, - ) - - -class AsyncProofOfAuthorizationRequestSubmissionsWithStreamingResponse: - def __init__(self, proof_of_authorization_request_submissions: AsyncProofOfAuthorizationRequestSubmissions) -> None: - self._proof_of_authorization_request_submissions = proof_of_authorization_request_submissions - - self.create = async_to_streamed_response_wrapper( - proof_of_authorization_request_submissions.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - proof_of_authorization_request_submissions.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - proof_of_authorization_request_submissions.list, - ) diff --git a/src/increase/resources/proof_of_authorization_requests.py b/src/increase/resources/proof_of_authorization_requests.py deleted file mode 100644 index 4177a0a8f..000000000 --- a/src/increase/resources/proof_of_authorization_requests.py +++ /dev/null @@ -1,262 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from .. import _legacy_response -from ..types import ProofOfAuthorizationRequest, proof_of_authorization_request_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) - -__all__ = ["ProofOfAuthorizationRequests", "AsyncProofOfAuthorizationRequests"] - - -class ProofOfAuthorizationRequests(SyncAPIResource): - @cached_property - def with_raw_response(self) -> ProofOfAuthorizationRequestsWithRawResponse: - return ProofOfAuthorizationRequestsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> ProofOfAuthorizationRequestsWithStreamingResponse: - return ProofOfAuthorizationRequestsWithStreamingResponse(self) - - def retrieve( - self, - proof_of_authorization_request_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProofOfAuthorizationRequest: - """ - Retrieve a Proof of Authorization Request - - Args: - proof_of_authorization_request_id: The identifier of the Proof of Authorization Request. - - 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 proof_of_authorization_request_id: - raise ValueError( - f"Expected a non-empty value for `proof_of_authorization_request_id` but received {proof_of_authorization_request_id!r}" - ) - return self._get( - f"/proof_of_authorization_requests/{proof_of_authorization_request_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProofOfAuthorizationRequest, - ) - - def list( - self, - *, - created_at: proof_of_authorization_request_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | 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, - ) -> SyncPage[ProofOfAuthorizationRequest]: - """ - List Proof of Authorization Requests - - Args: - cursor: Return the page of entries after this one. - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - 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 - """ - return self._get_api_list( - "/proof_of_authorization_requests", - page=SyncPage[ProofOfAuthorizationRequest], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "created_at": created_at, - "cursor": cursor, - "limit": limit, - }, - proof_of_authorization_request_list_params.ProofOfAuthorizationRequestListParams, - ), - ), - model=ProofOfAuthorizationRequest, - ) - - -class AsyncProofOfAuthorizationRequests(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncProofOfAuthorizationRequestsWithRawResponse: - return AsyncProofOfAuthorizationRequestsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncProofOfAuthorizationRequestsWithStreamingResponse: - return AsyncProofOfAuthorizationRequestsWithStreamingResponse(self) - - async def retrieve( - self, - proof_of_authorization_request_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> ProofOfAuthorizationRequest: - """ - Retrieve a Proof of Authorization Request - - Args: - proof_of_authorization_request_id: The identifier of the Proof of Authorization Request. - - 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 proof_of_authorization_request_id: - raise ValueError( - f"Expected a non-empty value for `proof_of_authorization_request_id` but received {proof_of_authorization_request_id!r}" - ) - return await self._get( - f"/proof_of_authorization_requests/{proof_of_authorization_request_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=ProofOfAuthorizationRequest, - ) - - def list( - self, - *, - created_at: proof_of_authorization_request_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | 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, - ) -> AsyncPaginator[ProofOfAuthorizationRequest, AsyncPage[ProofOfAuthorizationRequest]]: - """ - List Proof of Authorization Requests - - Args: - cursor: Return the page of entries after this one. - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - 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 - """ - return self._get_api_list( - "/proof_of_authorization_requests", - page=AsyncPage[ProofOfAuthorizationRequest], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "created_at": created_at, - "cursor": cursor, - "limit": limit, - }, - proof_of_authorization_request_list_params.ProofOfAuthorizationRequestListParams, - ), - ), - model=ProofOfAuthorizationRequest, - ) - - -class ProofOfAuthorizationRequestsWithRawResponse: - def __init__(self, proof_of_authorization_requests: ProofOfAuthorizationRequests) -> None: - self._proof_of_authorization_requests = proof_of_authorization_requests - - self.retrieve = _legacy_response.to_raw_response_wrapper( - proof_of_authorization_requests.retrieve, - ) - self.list = _legacy_response.to_raw_response_wrapper( - proof_of_authorization_requests.list, - ) - - -class AsyncProofOfAuthorizationRequestsWithRawResponse: - def __init__(self, proof_of_authorization_requests: AsyncProofOfAuthorizationRequests) -> None: - self._proof_of_authorization_requests = proof_of_authorization_requests - - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - proof_of_authorization_requests.retrieve, - ) - self.list = _legacy_response.async_to_raw_response_wrapper( - proof_of_authorization_requests.list, - ) - - -class ProofOfAuthorizationRequestsWithStreamingResponse: - def __init__(self, proof_of_authorization_requests: ProofOfAuthorizationRequests) -> None: - self._proof_of_authorization_requests = proof_of_authorization_requests - - self.retrieve = to_streamed_response_wrapper( - proof_of_authorization_requests.retrieve, - ) - self.list = to_streamed_response_wrapper( - proof_of_authorization_requests.list, - ) - - -class AsyncProofOfAuthorizationRequestsWithStreamingResponse: - def __init__(self, proof_of_authorization_requests: AsyncProofOfAuthorizationRequests) -> None: - self._proof_of_authorization_requests = proof_of_authorization_requests - - self.retrieve = async_to_streamed_response_wrapper( - proof_of_authorization_requests.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - proof_of_authorization_requests.list, - ) diff --git a/src/increase/resources/real_time_decisions.py b/src/increase/resources/real_time_decisions.py index ecf877efb..d89ee7339 100644 --- a/src/increase/resources/real_time_decisions.py +++ b/src/increase/resources/real_time_decisions.py @@ -4,31 +4,42 @@ import httpx -from .. import _legacy_response -from ..types import RealTimeDecision, real_time_decision_action_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import real_time_decision_action_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from .._base_client import ( - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from .._base_client import make_request_options +from ..types.real_time_decision import RealTimeDecision -__all__ = ["RealTimeDecisions", "AsyncRealTimeDecisions"] +__all__ = ["RealTimeDecisionsResource", "AsyncRealTimeDecisionsResource"] -class RealTimeDecisions(SyncAPIResource): +class RealTimeDecisionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RealTimeDecisionsWithRawResponse: - return RealTimeDecisionsWithRawResponse(self) + def with_raw_response(self) -> RealTimeDecisionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return RealTimeDecisionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RealTimeDecisionsWithStreamingResponse: - return RealTimeDecisionsWithStreamingResponse(self) + def with_streaming_response(self) -> RealTimeDecisionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return RealTimeDecisionsResourceWithStreamingResponse(self) def retrieve( self, @@ -39,7 +50,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RealTimeDecision: """ Retrieve a Real-Time Decision @@ -60,7 +71,7 @@ def retrieve( f"Expected a non-empty value for `real_time_decision_id` but received {real_time_decision_id!r}" ) return self._get( - f"/real_time_decisions/{real_time_decision_id}", + path_template("/real_time_decisions/{real_time_decision_id}", real_time_decision_id=real_time_decision_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -71,16 +82,18 @@ def action( self, real_time_decision_id: str, *, - card_authorization: real_time_decision_action_params.CardAuthorization | NotGiven = NOT_GIVEN, - digital_wallet_authentication: real_time_decision_action_params.DigitalWalletAuthentication - | NotGiven = NOT_GIVEN, - digital_wallet_token: real_time_decision_action_params.DigitalWalletToken | NotGiven = NOT_GIVEN, + card_authentication: real_time_decision_action_params.CardAuthentication | Omit = omit, + card_authentication_challenge: real_time_decision_action_params.CardAuthenticationChallenge | Omit = omit, + card_authorization: real_time_decision_action_params.CardAuthorization | Omit = omit, + card_balance_inquiry: real_time_decision_action_params.CardBalanceInquiry | Omit = omit, + digital_wallet_authentication: real_time_decision_action_params.DigitalWalletAuthentication | Omit = omit, + digital_wallet_token: real_time_decision_action_params.DigitalWalletToken | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> RealTimeDecision: """ @@ -89,9 +102,18 @@ def action( Args: real_time_decision_id: The identifier of the Real-Time Decision. + card_authentication: If the Real-Time Decision relates to a 3DS card authentication attempt, this + object contains your response to the authentication. + + card_authentication_challenge: If the Real-Time Decision relates to 3DS card authentication challenge delivery, + this object contains your response. + card_authorization: If the Real-Time Decision relates to a card authorization attempt, this object contains your response to the authorization. + card_balance_inquiry: If the Real-Time Decision relates to a card balance inquiry attempt, this object + contains your response to the inquiry. + digital_wallet_authentication: If the Real-Time Decision relates to a digital wallet authentication attempt, this object contains your response to the authentication. @@ -113,10 +135,15 @@ def action( f"Expected a non-empty value for `real_time_decision_id` but received {real_time_decision_id!r}" ) return self._post( - f"/real_time_decisions/{real_time_decision_id}/action", + path_template( + "/real_time_decisions/{real_time_decision_id}/action", real_time_decision_id=real_time_decision_id + ), body=maybe_transform( { + "card_authentication": card_authentication, + "card_authentication_challenge": card_authentication_challenge, "card_authorization": card_authorization, + "card_balance_inquiry": card_balance_inquiry, "digital_wallet_authentication": digital_wallet_authentication, "digital_wallet_token": digital_wallet_token, }, @@ -133,14 +160,25 @@ def action( ) -class AsyncRealTimeDecisions(AsyncAPIResource): +class AsyncRealTimeDecisionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRealTimeDecisionsWithRawResponse: - return AsyncRealTimeDecisionsWithRawResponse(self) + def with_raw_response(self) -> AsyncRealTimeDecisionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncRealTimeDecisionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRealTimeDecisionsWithStreamingResponse: - return AsyncRealTimeDecisionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRealTimeDecisionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncRealTimeDecisionsResourceWithStreamingResponse(self) async def retrieve( self, @@ -151,7 +189,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RealTimeDecision: """ Retrieve a Real-Time Decision @@ -172,7 +210,7 @@ async def retrieve( f"Expected a non-empty value for `real_time_decision_id` but received {real_time_decision_id!r}" ) return await self._get( - f"/real_time_decisions/{real_time_decision_id}", + path_template("/real_time_decisions/{real_time_decision_id}", real_time_decision_id=real_time_decision_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -183,16 +221,18 @@ async def action( self, real_time_decision_id: str, *, - card_authorization: real_time_decision_action_params.CardAuthorization | NotGiven = NOT_GIVEN, - digital_wallet_authentication: real_time_decision_action_params.DigitalWalletAuthentication - | NotGiven = NOT_GIVEN, - digital_wallet_token: real_time_decision_action_params.DigitalWalletToken | NotGiven = NOT_GIVEN, + card_authentication: real_time_decision_action_params.CardAuthentication | Omit = omit, + card_authentication_challenge: real_time_decision_action_params.CardAuthenticationChallenge | Omit = omit, + card_authorization: real_time_decision_action_params.CardAuthorization | Omit = omit, + card_balance_inquiry: real_time_decision_action_params.CardBalanceInquiry | Omit = omit, + digital_wallet_authentication: real_time_decision_action_params.DigitalWalletAuthentication | Omit = omit, + digital_wallet_token: real_time_decision_action_params.DigitalWalletToken | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> RealTimeDecision: """ @@ -201,9 +241,18 @@ async def action( Args: real_time_decision_id: The identifier of the Real-Time Decision. + card_authentication: If the Real-Time Decision relates to a 3DS card authentication attempt, this + object contains your response to the authentication. + + card_authentication_challenge: If the Real-Time Decision relates to 3DS card authentication challenge delivery, + this object contains your response. + card_authorization: If the Real-Time Decision relates to a card authorization attempt, this object contains your response to the authorization. + card_balance_inquiry: If the Real-Time Decision relates to a card balance inquiry attempt, this object + contains your response to the inquiry. + digital_wallet_authentication: If the Real-Time Decision relates to a digital wallet authentication attempt, this object contains your response to the authentication. @@ -225,10 +274,15 @@ async def action( f"Expected a non-empty value for `real_time_decision_id` but received {real_time_decision_id!r}" ) return await self._post( - f"/real_time_decisions/{real_time_decision_id}/action", + path_template( + "/real_time_decisions/{real_time_decision_id}/action", real_time_decision_id=real_time_decision_id + ), body=await async_maybe_transform( { + "card_authentication": card_authentication, + "card_authentication_challenge": card_authentication_challenge, "card_authorization": card_authorization, + "card_balance_inquiry": card_balance_inquiry, "digital_wallet_authentication": digital_wallet_authentication, "digital_wallet_token": digital_wallet_token, }, @@ -245,32 +299,32 @@ async def action( ) -class RealTimeDecisionsWithRawResponse: - def __init__(self, real_time_decisions: RealTimeDecisions) -> None: +class RealTimeDecisionsResourceWithRawResponse: + def __init__(self, real_time_decisions: RealTimeDecisionsResource) -> None: self._real_time_decisions = real_time_decisions - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( real_time_decisions.retrieve, ) - self.action = _legacy_response.to_raw_response_wrapper( + self.action = to_raw_response_wrapper( real_time_decisions.action, ) -class AsyncRealTimeDecisionsWithRawResponse: - def __init__(self, real_time_decisions: AsyncRealTimeDecisions) -> None: +class AsyncRealTimeDecisionsResourceWithRawResponse: + def __init__(self, real_time_decisions: AsyncRealTimeDecisionsResource) -> None: self._real_time_decisions = real_time_decisions - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( real_time_decisions.retrieve, ) - self.action = _legacy_response.async_to_raw_response_wrapper( + self.action = async_to_raw_response_wrapper( real_time_decisions.action, ) -class RealTimeDecisionsWithStreamingResponse: - def __init__(self, real_time_decisions: RealTimeDecisions) -> None: +class RealTimeDecisionsResourceWithStreamingResponse: + def __init__(self, real_time_decisions: RealTimeDecisionsResource) -> None: self._real_time_decisions = real_time_decisions self.retrieve = to_streamed_response_wrapper( @@ -281,8 +335,8 @@ def __init__(self, real_time_decisions: RealTimeDecisions) -> None: ) -class AsyncRealTimeDecisionsWithStreamingResponse: - def __init__(self, real_time_decisions: AsyncRealTimeDecisions) -> None: +class AsyncRealTimeDecisionsResourceWithStreamingResponse: + def __init__(self, real_time_decisions: AsyncRealTimeDecisionsResource) -> None: self._real_time_decisions = real_time_decisions self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/real_time_payments_request_for_payments.py b/src/increase/resources/real_time_payments_request_for_payments.py deleted file mode 100644 index af69ee11f..000000000 --- a/src/increase/resources/real_time_payments_request_for_payments.py +++ /dev/null @@ -1,452 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import date - -import httpx - -from .. import _legacy_response -from ..types import ( - RealTimePaymentsRequestForPayment, - real_time_payments_request_for_payment_list_params, - real_time_payments_request_for_payment_create_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) -from .._compat import cached_property -from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, -) - -__all__ = ["RealTimePaymentsRequestForPayments", "AsyncRealTimePaymentsRequestForPayments"] - - -class RealTimePaymentsRequestForPayments(SyncAPIResource): - @cached_property - def with_raw_response(self) -> RealTimePaymentsRequestForPaymentsWithRawResponse: - return RealTimePaymentsRequestForPaymentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> RealTimePaymentsRequestForPaymentsWithStreamingResponse: - return RealTimePaymentsRequestForPaymentsWithStreamingResponse(self) - - def create( - self, - *, - amount: int, - debtor: real_time_payments_request_for_payment_create_params.Debtor, - destination_account_number_id: str, - expires_at: Union[str, date], - remittance_information: str, - source_account_number: str, - source_routing_number: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> RealTimePaymentsRequestForPayment: - """ - Create a Real-Time Payments Request for Payment - - Args: - amount: The requested amount in USD cents. Must be positive. - - debtor: Details of the person being requested to pay. - - destination_account_number_id: The identifier of the Account Number where the funds will land. - - expires_at: The expiration time for this request, in UTC. The requestee will not be able to - pay after this date. - - remittance_information: Unstructured information that will show on the requestee's bank statement. - - source_account_number: The account number the funds will be requested from. - - source_routing_number: The requestee's American Bankers' Association (ABA) Routing Transit Number - (RTN). - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/real_time_payments_request_for_payments", - body=maybe_transform( - { - "amount": amount, - "debtor": debtor, - "destination_account_number_id": destination_account_number_id, - "expires_at": expires_at, - "remittance_information": remittance_information, - "source_account_number": source_account_number, - "source_routing_number": source_routing_number, - }, - real_time_payments_request_for_payment_create_params.RealTimePaymentsRequestForPaymentCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=RealTimePaymentsRequestForPayment, - ) - - def retrieve( - self, - request_for_payment_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RealTimePaymentsRequestForPayment: - """ - Retrieve a Real-Time Payments Request for Payment - - Args: - request_for_payment_id: The identifier of the Real-Time Payments Request for Payment. - - 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 request_for_payment_id: - raise ValueError( - f"Expected a non-empty value for `request_for_payment_id` but received {request_for_payment_id!r}" - ) - return self._get( - f"/real_time_payments_request_for_payments/{request_for_payment_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RealTimePaymentsRequestForPayment, - ) - - def list( - self, - *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: real_time_payments_request_for_payment_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | 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, - ) -> SyncPage[RealTimePaymentsRequestForPayment]: - """ - List Real-Time Payments Request for Payments - - Args: - account_id: Filter Real-Time Payments Request for Payments to those destined to the - specified Account. - - cursor: Return the page of entries after this one. - - idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for - that object. This value is unique across Increase and is used to ensure that a - request is only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - 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 - """ - return self._get_api_list( - "/real_time_payments_request_for_payments", - page=SyncPage[RealTimePaymentsRequestForPayment], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "account_id": account_id, - "created_at": created_at, - "cursor": cursor, - "idempotency_key": idempotency_key, - "limit": limit, - }, - real_time_payments_request_for_payment_list_params.RealTimePaymentsRequestForPaymentListParams, - ), - ), - model=RealTimePaymentsRequestForPayment, - ) - - -class AsyncRealTimePaymentsRequestForPayments(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncRealTimePaymentsRequestForPaymentsWithRawResponse: - return AsyncRealTimePaymentsRequestForPaymentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncRealTimePaymentsRequestForPaymentsWithStreamingResponse: - return AsyncRealTimePaymentsRequestForPaymentsWithStreamingResponse(self) - - async def create( - self, - *, - amount: int, - debtor: real_time_payments_request_for_payment_create_params.Debtor, - destination_account_number_id: str, - expires_at: Union[str, date], - remittance_information: str, - source_account_number: str, - source_routing_number: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> RealTimePaymentsRequestForPayment: - """ - Create a Real-Time Payments Request for Payment - - Args: - amount: The requested amount in USD cents. Must be positive. - - debtor: Details of the person being requested to pay. - - destination_account_number_id: The identifier of the Account Number where the funds will land. - - expires_at: The expiration time for this request, in UTC. The requestee will not be able to - pay after this date. - - remittance_information: Unstructured information that will show on the requestee's bank statement. - - source_account_number: The account number the funds will be requested from. - - source_routing_number: The requestee's American Bankers' Association (ABA) Routing Transit Number - (RTN). - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/real_time_payments_request_for_payments", - body=await async_maybe_transform( - { - "amount": amount, - "debtor": debtor, - "destination_account_number_id": destination_account_number_id, - "expires_at": expires_at, - "remittance_information": remittance_information, - "source_account_number": source_account_number, - "source_routing_number": source_routing_number, - }, - real_time_payments_request_for_payment_create_params.RealTimePaymentsRequestForPaymentCreateParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=RealTimePaymentsRequestForPayment, - ) - - async def retrieve( - self, - request_for_payment_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> RealTimePaymentsRequestForPayment: - """ - Retrieve a Real-Time Payments Request for Payment - - Args: - request_for_payment_id: The identifier of the Real-Time Payments Request for Payment. - - 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 request_for_payment_id: - raise ValueError( - f"Expected a non-empty value for `request_for_payment_id` but received {request_for_payment_id!r}" - ) - return await self._get( - f"/real_time_payments_request_for_payments/{request_for_payment_id}", - options=make_request_options( - extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout - ), - cast_to=RealTimePaymentsRequestForPayment, - ) - - def list( - self, - *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: real_time_payments_request_for_payment_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | 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, - ) -> AsyncPaginator[RealTimePaymentsRequestForPayment, AsyncPage[RealTimePaymentsRequestForPayment]]: - """ - List Real-Time Payments Request for Payments - - Args: - account_id: Filter Real-Time Payments Request for Payments to those destined to the - specified Account. - - cursor: Return the page of entries after this one. - - idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for - that object. This value is unique across Increase and is used to ensure that a - request is only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). - - limit: Limit the size of the list that is returned. The default (and maximum) is 100 - objects. - - 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 - """ - return self._get_api_list( - "/real_time_payments_request_for_payments", - page=AsyncPage[RealTimePaymentsRequestForPayment], - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - query=maybe_transform( - { - "account_id": account_id, - "created_at": created_at, - "cursor": cursor, - "idempotency_key": idempotency_key, - "limit": limit, - }, - real_time_payments_request_for_payment_list_params.RealTimePaymentsRequestForPaymentListParams, - ), - ), - model=RealTimePaymentsRequestForPayment, - ) - - -class RealTimePaymentsRequestForPaymentsWithRawResponse: - def __init__(self, real_time_payments_request_for_payments: RealTimePaymentsRequestForPayments) -> None: - self._real_time_payments_request_for_payments = real_time_payments_request_for_payments - - self.create = _legacy_response.to_raw_response_wrapper( - real_time_payments_request_for_payments.create, - ) - self.retrieve = _legacy_response.to_raw_response_wrapper( - real_time_payments_request_for_payments.retrieve, - ) - self.list = _legacy_response.to_raw_response_wrapper( - real_time_payments_request_for_payments.list, - ) - - -class AsyncRealTimePaymentsRequestForPaymentsWithRawResponse: - def __init__(self, real_time_payments_request_for_payments: AsyncRealTimePaymentsRequestForPayments) -> None: - self._real_time_payments_request_for_payments = real_time_payments_request_for_payments - - self.create = _legacy_response.async_to_raw_response_wrapper( - real_time_payments_request_for_payments.create, - ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( - real_time_payments_request_for_payments.retrieve, - ) - self.list = _legacy_response.async_to_raw_response_wrapper( - real_time_payments_request_for_payments.list, - ) - - -class RealTimePaymentsRequestForPaymentsWithStreamingResponse: - def __init__(self, real_time_payments_request_for_payments: RealTimePaymentsRequestForPayments) -> None: - self._real_time_payments_request_for_payments = real_time_payments_request_for_payments - - self.create = to_streamed_response_wrapper( - real_time_payments_request_for_payments.create, - ) - self.retrieve = to_streamed_response_wrapper( - real_time_payments_request_for_payments.retrieve, - ) - self.list = to_streamed_response_wrapper( - real_time_payments_request_for_payments.list, - ) - - -class AsyncRealTimePaymentsRequestForPaymentsWithStreamingResponse: - def __init__(self, real_time_payments_request_for_payments: AsyncRealTimePaymentsRequestForPayments) -> None: - self._real_time_payments_request_for_payments = real_time_payments_request_for_payments - - self.create = async_to_streamed_response_wrapper( - real_time_payments_request_for_payments.create, - ) - self.retrieve = async_to_streamed_response_wrapper( - real_time_payments_request_for_payments.retrieve, - ) - self.list = async_to_streamed_response_wrapper( - real_time_payments_request_for_payments.list, - ) diff --git a/src/increase/resources/real_time_payments_transfers.py b/src/increase/resources/real_time_payments_transfers.py index 2553ccaef..e0032105f 100644 --- a/src/increase/resources/real_time_payments_transfers.py +++ b/src/increase/resources/real_time_payments_transfers.py @@ -4,58 +4,64 @@ import httpx -from .. import _legacy_response -from ..types import ( - RealTimePaymentsTransfer, - real_time_payments_transfer_list_params, - real_time_payments_transfer_create_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import real_time_payments_transfer_list_params, real_time_payments_transfer_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.real_time_payments_transfer import RealTimePaymentsTransfer -__all__ = ["RealTimePaymentsTransfers", "AsyncRealTimePaymentsTransfers"] +__all__ = ["RealTimePaymentsTransfersResource", "AsyncRealTimePaymentsTransfersResource"] -class RealTimePaymentsTransfers(SyncAPIResource): +class RealTimePaymentsTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RealTimePaymentsTransfersWithRawResponse: - return RealTimePaymentsTransfersWithRawResponse(self) + def with_raw_response(self) -> RealTimePaymentsTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return RealTimePaymentsTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RealTimePaymentsTransfersWithStreamingResponse: - return RealTimePaymentsTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> RealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return RealTimePaymentsTransfersResourceWithStreamingResponse(self) def create( self, *, amount: int, creditor_name: str, - remittance_information: str, source_account_number_id: str, - debtor_name: str | NotGiven = NOT_GIVEN, - destination_account_number: str | NotGiven = NOT_GIVEN, - destination_routing_number: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, - ultimate_creditor_name: str | NotGiven = NOT_GIVEN, - ultimate_debtor_name: str | NotGiven = NOT_GIVEN, + unstructured_remittance_information: str, + account_number: str | Omit = omit, + debtor_name: str | Omit = omit, + external_account_id: str | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + ultimate_creditor_name: str | Omit = omit, + ultimate_debtor_name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> RealTimePaymentsTransfer: """ @@ -67,27 +73,28 @@ def create( creditor_name: The name of the transfer's recipient. - remittance_information: Unstructured information that will show on the recipient's bank statement. - source_account_number_id: The identifier of the Account Number from which to send the transfer. - debtor_name: The name of the transfer's sender. If not provided, the account's entity name - will be used. + unstructured_remittance_information: Unstructured information that will show on the recipient's bank statement. - destination_account_number: The destination account number. + account_number: The destination account number. - destination_routing_number: The destination American Bankers' Association (ABA) Routing Transit Number - (RTN). + debtor_name: The name of the transfer's sender. If not provided, defaults to the name of the + account's entity. external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is - provided, `destination_account_number` and `destination_routing_number` must be - absent. + provided, `account_number` and `routing_number` must be absent. require_approval: Whether the transfer requires explicit approval via the dashboard or API. - ultimate_creditor_name: The name of the party on whose behalf the creditor is receiving the payment. + routing_number: The destination American Bankers' Association (ABA) Routing Transit Number + (RTN). - ultimate_debtor_name: The name of the the party on whose behalf the debtor is instructing the payment. + ultimate_creditor_name: The name of the ultimate recipient of the transfer. Set this if the creditor is + an intermediary receiving the payment for someone else. + + ultimate_debtor_name: The name of the ultimate sender of the transfer. Set this if the funds are being + sent on behalf of someone who is not the account holder at Increase. extra_headers: Send extra headers @@ -105,13 +112,13 @@ def create( { "amount": amount, "creditor_name": creditor_name, - "remittance_information": remittance_information, "source_account_number_id": source_account_number_id, + "unstructured_remittance_information": unstructured_remittance_information, + "account_number": account_number, "debtor_name": debtor_name, - "destination_account_number": destination_account_number, - "destination_routing_number": destination_routing_number, "external_account_id": external_account_id, "require_approval": require_approval, + "routing_number": routing_number, "ultimate_creditor_name": ultimate_creditor_name, "ultimate_debtor_name": ultimate_debtor_name, }, @@ -136,7 +143,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RealTimePaymentsTransfer: """ Retrieve a Real-Time Payments Transfer @@ -157,7 +164,10 @@ def retrieve( f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" ) return self._get( - f"/real_time_payments_transfers/{real_time_payments_transfer_id}", + path_template( + "/real_time_payments_transfers/{real_time_payments_transfer_id}", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -167,18 +177,19 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: real_time_payments_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: real_time_payments_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: real_time_payments_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[RealTimePaymentsTransfer]: """ List Real-Time Payments Transfers @@ -223,6 +234,7 @@ def list( "external_account_id": external_account_id, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, real_time_payments_transfer_list_params.RealTimePaymentsTransferListParams, ), @@ -230,36 +242,141 @@ def list( model=RealTimePaymentsTransfer, ) + def approve( + self, + real_time_payments_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> RealTimePaymentsTransfer: + """ + Approves a Real-Time Payments Transfer in a pending_approval state. + + Args: + real_time_payments_transfer_id: The identifier of the Real-Time Payments Transfer to approve. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request -class AsyncRealTimePaymentsTransfers(AsyncAPIResource): + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not real_time_payments_transfer_id: + raise ValueError( + f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" + ) + return self._post( + path_template( + "/real_time_payments_transfers/{real_time_payments_transfer_id}/approve", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=RealTimePaymentsTransfer, + ) + + def cancel( + self, + real_time_payments_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> RealTimePaymentsTransfer: + """ + Cancels a Real-Time Payments Transfer in a pending_approval state. + + Args: + real_time_payments_transfer_id: The identifier of the pending Real-Time Payments Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not real_time_payments_transfer_id: + raise ValueError( + f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" + ) + return self._post( + path_template( + "/real_time_payments_transfers/{real_time_payments_transfer_id}/cancel", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=RealTimePaymentsTransfer, + ) + + +class AsyncRealTimePaymentsTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRealTimePaymentsTransfersWithRawResponse: - return AsyncRealTimePaymentsTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncRealTimePaymentsTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncRealTimePaymentsTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRealTimePaymentsTransfersWithStreamingResponse: - return AsyncRealTimePaymentsTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncRealTimePaymentsTransfersResourceWithStreamingResponse(self) async def create( self, *, amount: int, creditor_name: str, - remittance_information: str, source_account_number_id: str, - debtor_name: str | NotGiven = NOT_GIVEN, - destination_account_number: str | NotGiven = NOT_GIVEN, - destination_routing_number: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, - ultimate_creditor_name: str | NotGiven = NOT_GIVEN, - ultimate_debtor_name: str | NotGiven = NOT_GIVEN, + unstructured_remittance_information: str, + account_number: str | Omit = omit, + debtor_name: str | Omit = omit, + external_account_id: str | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + ultimate_creditor_name: str | Omit = omit, + ultimate_debtor_name: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> RealTimePaymentsTransfer: """ @@ -271,27 +388,28 @@ async def create( creditor_name: The name of the transfer's recipient. - remittance_information: Unstructured information that will show on the recipient's bank statement. - source_account_number_id: The identifier of the Account Number from which to send the transfer. - debtor_name: The name of the transfer's sender. If not provided, the account's entity name - will be used. + unstructured_remittance_information: Unstructured information that will show on the recipient's bank statement. - destination_account_number: The destination account number. + account_number: The destination account number. - destination_routing_number: The destination American Bankers' Association (ABA) Routing Transit Number - (RTN). + debtor_name: The name of the transfer's sender. If not provided, defaults to the name of the + account's entity. external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is - provided, `destination_account_number` and `destination_routing_number` must be - absent. + provided, `account_number` and `routing_number` must be absent. require_approval: Whether the transfer requires explicit approval via the dashboard or API. - ultimate_creditor_name: The name of the party on whose behalf the creditor is receiving the payment. + routing_number: The destination American Bankers' Association (ABA) Routing Transit Number + (RTN). - ultimate_debtor_name: The name of the the party on whose behalf the debtor is instructing the payment. + ultimate_creditor_name: The name of the ultimate recipient of the transfer. Set this if the creditor is + an intermediary receiving the payment for someone else. + + ultimate_debtor_name: The name of the ultimate sender of the transfer. Set this if the funds are being + sent on behalf of someone who is not the account holder at Increase. extra_headers: Send extra headers @@ -309,13 +427,13 @@ async def create( { "amount": amount, "creditor_name": creditor_name, - "remittance_information": remittance_information, "source_account_number_id": source_account_number_id, + "unstructured_remittance_information": unstructured_remittance_information, + "account_number": account_number, "debtor_name": debtor_name, - "destination_account_number": destination_account_number, - "destination_routing_number": destination_routing_number, "external_account_id": external_account_id, "require_approval": require_approval, + "routing_number": routing_number, "ultimate_creditor_name": ultimate_creditor_name, "ultimate_debtor_name": ultimate_debtor_name, }, @@ -340,7 +458,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> RealTimePaymentsTransfer: """ Retrieve a Real-Time Payments Transfer @@ -361,7 +479,10 @@ async def retrieve( f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" ) return await self._get( - f"/real_time_payments_transfers/{real_time_payments_transfer_id}", + path_template( + "/real_time_payments_transfers/{real_time_payments_transfer_id}", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -371,18 +492,19 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: real_time_payments_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: real_time_payments_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: real_time_payments_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[RealTimePaymentsTransfer, AsyncPage[RealTimePaymentsTransfer]]: """ List Real-Time Payments Transfers @@ -427,6 +549,7 @@ def list( "external_account_id": external_account_id, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, real_time_payments_transfer_list_params.RealTimePaymentsTransferListParams, ), @@ -434,39 +557,145 @@ def list( model=RealTimePaymentsTransfer, ) + async def approve( + self, + real_time_payments_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> RealTimePaymentsTransfer: + """ + Approves a Real-Time Payments Transfer in a pending_approval state. + + Args: + real_time_payments_transfer_id: The identifier of the Real-Time Payments Transfer to approve. -class RealTimePaymentsTransfersWithRawResponse: - def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfers) -> None: + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not real_time_payments_transfer_id: + raise ValueError( + f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" + ) + return await self._post( + path_template( + "/real_time_payments_transfers/{real_time_payments_transfer_id}/approve", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=RealTimePaymentsTransfer, + ) + + async def cancel( + self, + real_time_payments_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> RealTimePaymentsTransfer: + """ + Cancels a Real-Time Payments Transfer in a pending_approval state. + + Args: + real_time_payments_transfer_id: The identifier of the pending Real-Time Payments Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not real_time_payments_transfer_id: + raise ValueError( + f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" + ) + return await self._post( + path_template( + "/real_time_payments_transfers/{real_time_payments_transfer_id}/cancel", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=RealTimePaymentsTransfer, + ) + + +class RealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( real_time_payments_transfers.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( real_time_payments_transfers.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( real_time_payments_transfers.list, ) + self.approve = to_raw_response_wrapper( + real_time_payments_transfers.approve, + ) + self.cancel = to_raw_response_wrapper( + real_time_payments_transfers.cancel, + ) -class AsyncRealTimePaymentsTransfersWithRawResponse: - def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfers) -> None: +class AsyncRealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( real_time_payments_transfers.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( real_time_payments_transfers.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( real_time_payments_transfers.list, ) + self.approve = async_to_raw_response_wrapper( + real_time_payments_transfers.approve, + ) + self.cancel = async_to_raw_response_wrapper( + real_time_payments_transfers.cancel, + ) -class RealTimePaymentsTransfersWithStreamingResponse: - def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfers) -> None: +class RealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers self.create = to_streamed_response_wrapper( @@ -478,10 +707,16 @@ def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfers) -> N self.list = to_streamed_response_wrapper( real_time_payments_transfers.list, ) + self.approve = to_streamed_response_wrapper( + real_time_payments_transfers.approve, + ) + self.cancel = to_streamed_response_wrapper( + real_time_payments_transfers.cancel, + ) -class AsyncRealTimePaymentsTransfersWithStreamingResponse: - def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfers) -> None: +class AsyncRealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers self.create = async_to_streamed_response_wrapper( @@ -493,3 +728,9 @@ def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfers) self.list = async_to_streamed_response_wrapper( real_time_payments_transfers.list, ) + self.approve = async_to_streamed_response_wrapper( + real_time_payments_transfers.approve, + ) + self.cancel = async_to_streamed_response_wrapper( + real_time_payments_transfers.cancel, + ) diff --git a/src/increase/resources/routing_numbers.py b/src/increase/resources/routing_numbers.py index 59d017a62..569b565d2 100644 --- a/src/increase/resources/routing_numbers.py +++ b/src/increase/resources/routing_numbers.py @@ -4,44 +4,57 @@ import httpx -from .. import _legacy_response -from ..types import RoutingNumber, routing_number_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..types import routing_number_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given from .._utils import maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.routing_number_list_response import RoutingNumberListResponse -__all__ = ["RoutingNumbers", "AsyncRoutingNumbers"] +__all__ = ["RoutingNumbersResource", "AsyncRoutingNumbersResource"] -class RoutingNumbers(SyncAPIResource): +class RoutingNumbersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RoutingNumbersWithRawResponse: - return RoutingNumbersWithRawResponse(self) + def with_raw_response(self) -> RoutingNumbersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return RoutingNumbersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RoutingNumbersWithStreamingResponse: - return RoutingNumbersWithStreamingResponse(self) + def with_streaming_response(self) -> RoutingNumbersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return RoutingNumbersResourceWithStreamingResponse(self) def list( self, *, routing_number: str, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncPage[RoutingNumber]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[RoutingNumberListResponse]: """ You can use this API to confirm if a routing number is valid, such as when a user is providing you with bank account details. Since routing numbers uniquely @@ -66,7 +79,7 @@ def list( """ return self._get_api_list( "/routing_numbers", - page=SyncPage[RoutingNumber], + page=SyncPage[RoutingNumberListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -81,32 +94,43 @@ def list( routing_number_list_params.RoutingNumberListParams, ), ), - model=RoutingNumber, + model=RoutingNumberListResponse, ) -class AsyncRoutingNumbers(AsyncAPIResource): +class AsyncRoutingNumbersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRoutingNumbersWithRawResponse: - return AsyncRoutingNumbersWithRawResponse(self) + def with_raw_response(self) -> AsyncRoutingNumbersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncRoutingNumbersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncRoutingNumbersWithStreamingResponse: - return AsyncRoutingNumbersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncRoutingNumbersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncRoutingNumbersResourceWithStreamingResponse(self) def list( self, *, routing_number: str, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[RoutingNumber, AsyncPage[RoutingNumber]]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[RoutingNumberListResponse, AsyncPage[RoutingNumberListResponse]]: """ You can use this API to confirm if a routing number is valid, such as when a user is providing you with bank account details. Since routing numbers uniquely @@ -131,7 +155,7 @@ def list( """ return self._get_api_list( "/routing_numbers", - page=AsyncPage[RoutingNumber], + page=AsyncPage[RoutingNumberListResponse], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -146,30 +170,30 @@ def list( routing_number_list_params.RoutingNumberListParams, ), ), - model=RoutingNumber, + model=RoutingNumberListResponse, ) -class RoutingNumbersWithRawResponse: - def __init__(self, routing_numbers: RoutingNumbers) -> None: +class RoutingNumbersResourceWithRawResponse: + def __init__(self, routing_numbers: RoutingNumbersResource) -> None: self._routing_numbers = routing_numbers - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( routing_numbers.list, ) -class AsyncRoutingNumbersWithRawResponse: - def __init__(self, routing_numbers: AsyncRoutingNumbers) -> None: +class AsyncRoutingNumbersResourceWithRawResponse: + def __init__(self, routing_numbers: AsyncRoutingNumbersResource) -> None: self._routing_numbers = routing_numbers - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( routing_numbers.list, ) -class RoutingNumbersWithStreamingResponse: - def __init__(self, routing_numbers: RoutingNumbers) -> None: +class RoutingNumbersResourceWithStreamingResponse: + def __init__(self, routing_numbers: RoutingNumbersResource) -> None: self._routing_numbers = routing_numbers self.list = to_streamed_response_wrapper( @@ -177,8 +201,8 @@ def __init__(self, routing_numbers: RoutingNumbers) -> None: ) -class AsyncRoutingNumbersWithStreamingResponse: - def __init__(self, routing_numbers: AsyncRoutingNumbers) -> None: +class AsyncRoutingNumbersResourceWithStreamingResponse: + def __init__(self, routing_numbers: AsyncRoutingNumbersResource) -> None: self._routing_numbers = routing_numbers self.list = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/__init__.py b/src/increase/resources/simulations/__init__.py index a5b69dad3..b3c198a7a 100644 --- a/src/increase/resources/simulations/__init__.py +++ b/src/increase/resources/simulations/__init__.py @@ -1,257 +1,481 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from .cards import ( - Cards, - AsyncCards, - CardsWithRawResponse, - AsyncCardsWithRawResponse, - CardsWithStreamingResponse, - AsyncCardsWithStreamingResponse, +from .exports import ( + ExportsResource, + AsyncExportsResource, + ExportsResourceWithRawResponse, + AsyncExportsResourceWithRawResponse, + ExportsResourceWithStreamingResponse, + AsyncExportsResourceWithStreamingResponse, ) from .programs import ( - Programs, - AsyncPrograms, - ProgramsWithRawResponse, - AsyncProgramsWithRawResponse, - ProgramsWithStreamingResponse, - AsyncProgramsWithStreamingResponse, -) -from .documents import ( - Documents, - AsyncDocuments, - DocumentsWithRawResponse, - AsyncDocumentsWithRawResponse, - DocumentsWithStreamingResponse, - AsyncDocumentsWithStreamingResponse, + ProgramsResource, + AsyncProgramsResource, + ProgramsResourceWithRawResponse, + AsyncProgramsResourceWithRawResponse, + ProgramsResourceWithStreamingResponse, + AsyncProgramsResourceWithStreamingResponse, +) +from .card_tokens import ( + CardTokensResource, + AsyncCardTokensResource, + CardTokensResourceWithRawResponse, + AsyncCardTokensResourceWithRawResponse, + CardTokensResourceWithStreamingResponse, + AsyncCardTokensResourceWithStreamingResponse, ) from .simulations import ( - Simulations, - AsyncSimulations, - SimulationsWithRawResponse, - AsyncSimulationsWithRawResponse, - SimulationsWithStreamingResponse, - AsyncSimulationsWithStreamingResponse, + SimulationsResource, + AsyncSimulationsResource, + SimulationsResourceWithRawResponse, + AsyncSimulationsResourceWithRawResponse, + SimulationsResourceWithStreamingResponse, + AsyncSimulationsResourceWithStreamingResponse, ) from .card_refunds import ( - CardRefunds, - AsyncCardRefunds, - CardRefundsWithRawResponse, - AsyncCardRefundsWithRawResponse, - CardRefundsWithStreamingResponse, - AsyncCardRefundsWithStreamingResponse, + CardRefundsResource, + AsyncCardRefundsResource, + CardRefundsResourceWithRawResponse, + AsyncCardRefundsResourceWithRawResponse, + CardRefundsResourceWithStreamingResponse, + AsyncCardRefundsResourceWithStreamingResponse, ) from .ach_transfers import ( - ACHTransfers, - AsyncACHTransfers, - ACHTransfersWithRawResponse, - AsyncACHTransfersWithRawResponse, - ACHTransfersWithStreamingResponse, - AsyncACHTransfersWithStreamingResponse, + ACHTransfersResource, + AsyncACHTransfersResource, + ACHTransfersResourceWithRawResponse, + AsyncACHTransfersResourceWithRawResponse, + ACHTransfersResourceWithStreamingResponse, + AsyncACHTransfersResourceWithStreamingResponse, ) from .card_disputes import ( - CardDisputes, - AsyncCardDisputes, - CardDisputesWithRawResponse, - AsyncCardDisputesWithRawResponse, - CardDisputesWithStreamingResponse, - AsyncCardDisputesWithStreamingResponse, + CardDisputesResource, + AsyncCardDisputesResource, + CardDisputesResourceWithRawResponse, + AsyncCardDisputesResourceWithRawResponse, + CardDisputesResourceWithStreamingResponse, + AsyncCardDisputesResourceWithStreamingResponse, +) +from .card_reversals import ( + CardReversalsResource, + AsyncCardReversalsResource, + CardReversalsResourceWithRawResponse, + AsyncCardReversalsResourceWithRawResponse, + CardReversalsResourceWithStreamingResponse, + AsyncCardReversalsResourceWithStreamingResponse, ) from .check_deposits import ( - CheckDeposits, - AsyncCheckDeposits, - CheckDepositsWithRawResponse, - AsyncCheckDepositsWithRawResponse, - CheckDepositsWithStreamingResponse, - AsyncCheckDepositsWithStreamingResponse, + CheckDepositsResource, + AsyncCheckDepositsResource, + CheckDepositsResourceWithRawResponse, + AsyncCheckDepositsResourceWithRawResponse, + CheckDepositsResourceWithStreamingResponse, + AsyncCheckDepositsResourceWithStreamingResponse, ) from .physical_cards import ( - PhysicalCards, - AsyncPhysicalCards, - PhysicalCardsWithRawResponse, - AsyncPhysicalCardsWithRawResponse, - PhysicalCardsWithStreamingResponse, - AsyncPhysicalCardsWithStreamingResponse, + PhysicalCardsResource, + AsyncPhysicalCardsResource, + PhysicalCardsResourceWithRawResponse, + AsyncPhysicalCardsResourceWithRawResponse, + PhysicalCardsResourceWithStreamingResponse, + AsyncPhysicalCardsResourceWithStreamingResponse, ) from .wire_transfers import ( - WireTransfers, - AsyncWireTransfers, - WireTransfersWithRawResponse, - AsyncWireTransfersWithRawResponse, - WireTransfersWithStreamingResponse, - AsyncWireTransfersWithStreamingResponse, + WireTransfersResource, + AsyncWireTransfersResource, + WireTransfersResourceWithRawResponse, + AsyncWireTransfersResourceWithRawResponse, + WireTransfersResourceWithStreamingResponse, + AsyncWireTransfersResourceWithStreamingResponse, +) +from .card_increments import ( + CardIncrementsResource, + AsyncCardIncrementsResource, + CardIncrementsResourceWithRawResponse, + AsyncCardIncrementsResourceWithRawResponse, + CardIncrementsResourceWithStreamingResponse, + AsyncCardIncrementsResourceWithStreamingResponse, ) from .check_transfers import ( - CheckTransfers, - AsyncCheckTransfers, - CheckTransfersWithRawResponse, - AsyncCheckTransfersWithRawResponse, - CheckTransfersWithStreamingResponse, - AsyncCheckTransfersWithStreamingResponse, + CheckTransfersResource, + AsyncCheckTransfersResource, + CheckTransfersResourceWithRawResponse, + AsyncCheckTransfersResourceWithRawResponse, + CheckTransfersResourceWithStreamingResponse, + AsyncCheckTransfersResourceWithStreamingResponse, +) +from .card_settlements import ( + CardSettlementsResource, + AsyncCardSettlementsResource, + CardSettlementsResourceWithRawResponse, + AsyncCardSettlementsResourceWithRawResponse, + CardSettlementsResourceWithStreamingResponse, + AsyncCardSettlementsResourceWithStreamingResponse, ) from .account_transfers import ( - AccountTransfers, - AsyncAccountTransfers, - AccountTransfersWithRawResponse, - AsyncAccountTransfersWithRawResponse, - AccountTransfersWithStreamingResponse, - AsyncAccountTransfersWithStreamingResponse, + AccountTransfersResource, + AsyncAccountTransfersResource, + AccountTransfersResourceWithRawResponse, + AsyncAccountTransfersResourceWithRawResponse, + AccountTransfersResourceWithStreamingResponse, + AsyncAccountTransfersResourceWithStreamingResponse, ) from .interest_payments import ( - InterestPayments, - AsyncInterestPayments, - InterestPaymentsWithRawResponse, - AsyncInterestPaymentsWithRawResponse, - InterestPaymentsWithStreamingResponse, - AsyncInterestPaymentsWithStreamingResponse, + InterestPaymentsResource, + AsyncInterestPaymentsResource, + InterestPaymentsResourceWithRawResponse, + AsyncInterestPaymentsResourceWithRawResponse, + InterestPaymentsResourceWithStreamingResponse, + AsyncInterestPaymentsResourceWithStreamingResponse, ) from .account_statements import ( - AccountStatements, - AsyncAccountStatements, - AccountStatementsWithRawResponse, - AsyncAccountStatementsWithRawResponse, - AccountStatementsWithStreamingResponse, - AsyncAccountStatementsWithStreamingResponse, -) -from .inbound_funds_holds import ( - InboundFundsHolds, - AsyncInboundFundsHolds, - InboundFundsHoldsWithRawResponse, - AsyncInboundFundsHoldsWithRawResponse, - InboundFundsHoldsWithStreamingResponse, - AsyncInboundFundsHoldsWithStreamingResponse, + AccountStatementsResource, + AsyncAccountStatementsResource, + AccountStatementsResourceWithRawResponse, + AsyncAccountStatementsResourceWithRawResponse, + AccountStatementsResourceWithStreamingResponse, + AsyncAccountStatementsResourceWithStreamingResponse, +) +from .inbound_mail_items import ( + InboundMailItemsResource, + AsyncInboundMailItemsResource, + InboundMailItemsResourceWithRawResponse, + AsyncInboundMailItemsResourceWithRawResponse, + InboundMailItemsResourceWithStreamingResponse, + AsyncInboundMailItemsResourceWithStreamingResponse, +) +from .card_authorizations import ( + CardAuthorizationsResource, + AsyncCardAuthorizationsResource, + CardAuthorizationsResourceWithRawResponse, + AsyncCardAuthorizationsResourceWithRawResponse, + CardAuthorizationsResourceWithStreamingResponse, + AsyncCardAuthorizationsResourceWithStreamingResponse, +) +from .card_authentications import ( + CardAuthenticationsResource, + AsyncCardAuthenticationsResource, + CardAuthenticationsResourceWithRawResponse, + AsyncCardAuthenticationsResourceWithRawResponse, + CardAuthenticationsResourceWithStreamingResponse, + AsyncCardAuthenticationsResourceWithStreamingResponse, +) +from .pending_transactions import ( + PendingTransactionsResource, + AsyncPendingTransactionsResource, + PendingTransactionsResourceWithRawResponse, + AsyncPendingTransactionsResourceWithRawResponse, + PendingTransactionsResourceWithStreamingResponse, + AsyncPendingTransactionsResourceWithStreamingResponse, +) +from .inbound_ach_transfers import ( + InboundACHTransfersResource, + AsyncInboundACHTransfersResource, + InboundACHTransfersResourceWithRawResponse, + AsyncInboundACHTransfersResourceWithRawResponse, + InboundACHTransfersResourceWithStreamingResponse, + AsyncInboundACHTransfersResourceWithStreamingResponse, +) +from .card_balance_inquiries import ( + CardBalanceInquiriesResource, + AsyncCardBalanceInquiriesResource, + CardBalanceInquiriesResourceWithRawResponse, + AsyncCardBalanceInquiriesResourceWithRawResponse, + CardBalanceInquiriesResourceWithStreamingResponse, + AsyncCardBalanceInquiriesResourceWithStreamingResponse, +) +from .inbound_check_deposits import ( + InboundCheckDepositsResource, + AsyncInboundCheckDepositsResource, + InboundCheckDepositsResourceWithRawResponse, + AsyncInboundCheckDepositsResourceWithRawResponse, + InboundCheckDepositsResourceWithStreamingResponse, + AsyncInboundCheckDepositsResourceWithStreamingResponse, +) +from .inbound_wire_transfers import ( + InboundWireTransfersResource, + AsyncInboundWireTransfersResource, + InboundWireTransfersResourceWithRawResponse, + AsyncInboundWireTransfersResourceWithRawResponse, + InboundWireTransfersResourceWithStreamingResponse, + AsyncInboundWireTransfersResourceWithStreamingResponse, +) +from .wire_drawdown_requests import ( + WireDrawdownRequestsResource, + AsyncWireDrawdownRequestsResource, + WireDrawdownRequestsResourceWithRawResponse, + AsyncWireDrawdownRequestsResourceWithRawResponse, + WireDrawdownRequestsResourceWithStreamingResponse, + AsyncWireDrawdownRequestsResourceWithStreamingResponse, +) +from .card_fuel_confirmations import ( + CardFuelConfirmationsResource, + AsyncCardFuelConfirmationsResource, + CardFuelConfirmationsResourceWithRawResponse, + AsyncCardFuelConfirmationsResourceWithRawResponse, + CardFuelConfirmationsResourceWithStreamingResponse, + AsyncCardFuelConfirmationsResourceWithStreamingResponse, +) +from .inbound_fednow_transfers import ( + InboundFednowTransfersResource, + AsyncInboundFednowTransfersResource, + InboundFednowTransfersResourceWithRawResponse, + AsyncInboundFednowTransfersResourceWithRawResponse, + InboundFednowTransfersResourceWithStreamingResponse, + AsyncInboundFednowTransfersResourceWithStreamingResponse, +) +from .entity_onboarding_sessions import ( + EntityOnboardingSessionsResource, + AsyncEntityOnboardingSessionsResource, + EntityOnboardingSessionsResourceWithRawResponse, + AsyncEntityOnboardingSessionsResourceWithRawResponse, + EntityOnboardingSessionsResourceWithStreamingResponse, + AsyncEntityOnboardingSessionsResourceWithStreamingResponse, ) from .real_time_payments_transfers import ( - RealTimePaymentsTransfers, - AsyncRealTimePaymentsTransfers, - RealTimePaymentsTransfersWithRawResponse, - AsyncRealTimePaymentsTransfersWithRawResponse, - RealTimePaymentsTransfersWithStreamingResponse, - AsyncRealTimePaymentsTransfersWithStreamingResponse, + RealTimePaymentsTransfersResource, + AsyncRealTimePaymentsTransfersResource, + RealTimePaymentsTransfersResourceWithRawResponse, + AsyncRealTimePaymentsTransfersResourceWithRawResponse, + RealTimePaymentsTransfersResourceWithStreamingResponse, + AsyncRealTimePaymentsTransfersResourceWithStreamingResponse, ) from .digital_wallet_token_requests import ( - DigitalWalletTokenRequests, - AsyncDigitalWalletTokenRequests, - DigitalWalletTokenRequestsWithRawResponse, - AsyncDigitalWalletTokenRequestsWithRawResponse, - DigitalWalletTokenRequestsWithStreamingResponse, - AsyncDigitalWalletTokenRequestsWithStreamingResponse, + DigitalWalletTokenRequestsResource, + AsyncDigitalWalletTokenRequestsResource, + DigitalWalletTokenRequestsResourceWithRawResponse, + AsyncDigitalWalletTokenRequestsResourceWithRawResponse, + DigitalWalletTokenRequestsResourceWithStreamingResponse, + AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse, +) +from .card_authorization_expirations import ( + CardAuthorizationExpirationsResource, + AsyncCardAuthorizationExpirationsResource, + CardAuthorizationExpirationsResourceWithRawResponse, + AsyncCardAuthorizationExpirationsResourceWithRawResponse, + CardAuthorizationExpirationsResourceWithStreamingResponse, + AsyncCardAuthorizationExpirationsResourceWithStreamingResponse, ) from .inbound_wire_drawdown_requests import ( - InboundWireDrawdownRequests, - AsyncInboundWireDrawdownRequests, - InboundWireDrawdownRequestsWithRawResponse, - AsyncInboundWireDrawdownRequestsWithRawResponse, - InboundWireDrawdownRequestsWithStreamingResponse, - AsyncInboundWireDrawdownRequestsWithStreamingResponse, + InboundWireDrawdownRequestsResource, + AsyncInboundWireDrawdownRequestsResource, + InboundWireDrawdownRequestsResourceWithRawResponse, + AsyncInboundWireDrawdownRequestsResourceWithRawResponse, + InboundWireDrawdownRequestsResourceWithStreamingResponse, + AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse, +) +from .inbound_real_time_payments_transfers import ( + InboundRealTimePaymentsTransfersResource, + AsyncInboundRealTimePaymentsTransfersResource, + InboundRealTimePaymentsTransfersResourceWithRawResponse, + AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse, + InboundRealTimePaymentsTransfersResourceWithStreamingResponse, + AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse, ) __all__ = [ - "AccountTransfers", - "AsyncAccountTransfers", - "AccountTransfersWithRawResponse", - "AsyncAccountTransfersWithRawResponse", - "AccountTransfersWithStreamingResponse", - "AsyncAccountTransfersWithStreamingResponse", - "AccountStatements", - "AsyncAccountStatements", - "AccountStatementsWithRawResponse", - "AsyncAccountStatementsWithRawResponse", - "AccountStatementsWithStreamingResponse", - "AsyncAccountStatementsWithStreamingResponse", - "ACHTransfers", - "AsyncACHTransfers", - "ACHTransfersWithRawResponse", - "AsyncACHTransfersWithRawResponse", - "ACHTransfersWithStreamingResponse", - "AsyncACHTransfersWithStreamingResponse", - "CardDisputes", - "AsyncCardDisputes", - "CardDisputesWithRawResponse", - "AsyncCardDisputesWithRawResponse", - "CardDisputesWithStreamingResponse", - "AsyncCardDisputesWithStreamingResponse", - "CardRefunds", - "AsyncCardRefunds", - "CardRefundsWithRawResponse", - "AsyncCardRefundsWithRawResponse", - "CardRefundsWithStreamingResponse", - "AsyncCardRefundsWithStreamingResponse", - "CheckTransfers", - "AsyncCheckTransfers", - "CheckTransfersWithRawResponse", - "AsyncCheckTransfersWithRawResponse", - "CheckTransfersWithStreamingResponse", - "AsyncCheckTransfersWithStreamingResponse", - "Documents", - "AsyncDocuments", - "DocumentsWithRawResponse", - "AsyncDocumentsWithRawResponse", - "DocumentsWithStreamingResponse", - "AsyncDocumentsWithStreamingResponse", - "DigitalWalletTokenRequests", - "AsyncDigitalWalletTokenRequests", - "DigitalWalletTokenRequestsWithRawResponse", - "AsyncDigitalWalletTokenRequestsWithRawResponse", - "DigitalWalletTokenRequestsWithStreamingResponse", - "AsyncDigitalWalletTokenRequestsWithStreamingResponse", - "CheckDeposits", - "AsyncCheckDeposits", - "CheckDepositsWithRawResponse", - "AsyncCheckDepositsWithRawResponse", - "CheckDepositsWithStreamingResponse", - "AsyncCheckDepositsWithStreamingResponse", - "Programs", - "AsyncPrograms", - "ProgramsWithRawResponse", - "AsyncProgramsWithRawResponse", - "ProgramsWithStreamingResponse", - "AsyncProgramsWithStreamingResponse", - "InboundWireDrawdownRequests", - "AsyncInboundWireDrawdownRequests", - "InboundWireDrawdownRequestsWithRawResponse", - "AsyncInboundWireDrawdownRequestsWithRawResponse", - "InboundWireDrawdownRequestsWithStreamingResponse", - "AsyncInboundWireDrawdownRequestsWithStreamingResponse", - "InboundFundsHolds", - "AsyncInboundFundsHolds", - "InboundFundsHoldsWithRawResponse", - "AsyncInboundFundsHoldsWithRawResponse", - "InboundFundsHoldsWithStreamingResponse", - "AsyncInboundFundsHoldsWithStreamingResponse", - "InterestPayments", - "AsyncInterestPayments", - "InterestPaymentsWithRawResponse", - "AsyncInterestPaymentsWithRawResponse", - "InterestPaymentsWithStreamingResponse", - "AsyncInterestPaymentsWithStreamingResponse", - "WireTransfers", - "AsyncWireTransfers", - "WireTransfersWithRawResponse", - "AsyncWireTransfersWithRawResponse", - "WireTransfersWithStreamingResponse", - "AsyncWireTransfersWithStreamingResponse", - "Cards", - "AsyncCards", - "CardsWithRawResponse", - "AsyncCardsWithRawResponse", - "CardsWithStreamingResponse", - "AsyncCardsWithStreamingResponse", - "RealTimePaymentsTransfers", - "AsyncRealTimePaymentsTransfers", - "RealTimePaymentsTransfersWithRawResponse", - "AsyncRealTimePaymentsTransfersWithRawResponse", - "RealTimePaymentsTransfersWithStreamingResponse", - "AsyncRealTimePaymentsTransfersWithStreamingResponse", - "PhysicalCards", - "AsyncPhysicalCards", - "PhysicalCardsWithRawResponse", - "AsyncPhysicalCardsWithRawResponse", - "PhysicalCardsWithStreamingResponse", - "AsyncPhysicalCardsWithStreamingResponse", - "Simulations", - "AsyncSimulations", - "SimulationsWithRawResponse", - "AsyncSimulationsWithRawResponse", - "SimulationsWithStreamingResponse", - "AsyncSimulationsWithStreamingResponse", + "InterestPaymentsResource", + "AsyncInterestPaymentsResource", + "InterestPaymentsResourceWithRawResponse", + "AsyncInterestPaymentsResourceWithRawResponse", + "InterestPaymentsResourceWithStreamingResponse", + "AsyncInterestPaymentsResourceWithStreamingResponse", + "AccountTransfersResource", + "AsyncAccountTransfersResource", + "AccountTransfersResourceWithRawResponse", + "AsyncAccountTransfersResourceWithRawResponse", + "AccountTransfersResourceWithStreamingResponse", + "AsyncAccountTransfersResourceWithStreamingResponse", + "CardAuthorizationsResource", + "AsyncCardAuthorizationsResource", + "CardAuthorizationsResourceWithRawResponse", + "AsyncCardAuthorizationsResourceWithRawResponse", + "CardAuthorizationsResourceWithStreamingResponse", + "AsyncCardAuthorizationsResourceWithStreamingResponse", + "CardBalanceInquiriesResource", + "AsyncCardBalanceInquiriesResource", + "CardBalanceInquiriesResourceWithRawResponse", + "AsyncCardBalanceInquiriesResourceWithRawResponse", + "CardBalanceInquiriesResourceWithStreamingResponse", + "AsyncCardBalanceInquiriesResourceWithStreamingResponse", + "CardAuthorizationExpirationsResource", + "AsyncCardAuthorizationExpirationsResource", + "CardAuthorizationExpirationsResourceWithRawResponse", + "AsyncCardAuthorizationExpirationsResourceWithRawResponse", + "CardAuthorizationExpirationsResourceWithStreamingResponse", + "AsyncCardAuthorizationExpirationsResourceWithStreamingResponse", + "CardSettlementsResource", + "AsyncCardSettlementsResource", + "CardSettlementsResourceWithRawResponse", + "AsyncCardSettlementsResourceWithRawResponse", + "CardSettlementsResourceWithStreamingResponse", + "AsyncCardSettlementsResourceWithStreamingResponse", + "CardReversalsResource", + "AsyncCardReversalsResource", + "CardReversalsResourceWithRawResponse", + "AsyncCardReversalsResourceWithRawResponse", + "CardReversalsResourceWithStreamingResponse", + "AsyncCardReversalsResourceWithStreamingResponse", + "CardIncrementsResource", + "AsyncCardIncrementsResource", + "CardIncrementsResourceWithRawResponse", + "AsyncCardIncrementsResourceWithRawResponse", + "CardIncrementsResourceWithStreamingResponse", + "AsyncCardIncrementsResourceWithStreamingResponse", + "CardFuelConfirmationsResource", + "AsyncCardFuelConfirmationsResource", + "CardFuelConfirmationsResourceWithRawResponse", + "AsyncCardFuelConfirmationsResourceWithRawResponse", + "CardFuelConfirmationsResourceWithStreamingResponse", + "AsyncCardFuelConfirmationsResourceWithStreamingResponse", + "CardRefundsResource", + "AsyncCardRefundsResource", + "CardRefundsResourceWithRawResponse", + "AsyncCardRefundsResourceWithRawResponse", + "CardRefundsResourceWithStreamingResponse", + "AsyncCardRefundsResourceWithStreamingResponse", + "CardAuthenticationsResource", + "AsyncCardAuthenticationsResource", + "CardAuthenticationsResourceWithRawResponse", + "AsyncCardAuthenticationsResourceWithRawResponse", + "CardAuthenticationsResourceWithStreamingResponse", + "AsyncCardAuthenticationsResourceWithStreamingResponse", + "CardDisputesResource", + "AsyncCardDisputesResource", + "CardDisputesResourceWithRawResponse", + "AsyncCardDisputesResourceWithRawResponse", + "CardDisputesResourceWithStreamingResponse", + "AsyncCardDisputesResourceWithStreamingResponse", + "PhysicalCardsResource", + "AsyncPhysicalCardsResource", + "PhysicalCardsResourceWithRawResponse", + "AsyncPhysicalCardsResourceWithRawResponse", + "PhysicalCardsResourceWithStreamingResponse", + "AsyncPhysicalCardsResourceWithStreamingResponse", + "DigitalWalletTokenRequestsResource", + "AsyncDigitalWalletTokenRequestsResource", + "DigitalWalletTokenRequestsResourceWithRawResponse", + "AsyncDigitalWalletTokenRequestsResourceWithRawResponse", + "DigitalWalletTokenRequestsResourceWithStreamingResponse", + "AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse", + "PendingTransactionsResource", + "AsyncPendingTransactionsResource", + "PendingTransactionsResourceWithRawResponse", + "AsyncPendingTransactionsResourceWithRawResponse", + "PendingTransactionsResourceWithStreamingResponse", + "AsyncPendingTransactionsResourceWithStreamingResponse", + "ACHTransfersResource", + "AsyncACHTransfersResource", + "ACHTransfersResourceWithRawResponse", + "AsyncACHTransfersResourceWithRawResponse", + "ACHTransfersResourceWithStreamingResponse", + "AsyncACHTransfersResourceWithStreamingResponse", + "InboundACHTransfersResource", + "AsyncInboundACHTransfersResource", + "InboundACHTransfersResourceWithRawResponse", + "AsyncInboundACHTransfersResourceWithRawResponse", + "InboundACHTransfersResourceWithStreamingResponse", + "AsyncInboundACHTransfersResourceWithStreamingResponse", + "WireTransfersResource", + "AsyncWireTransfersResource", + "WireTransfersResourceWithRawResponse", + "AsyncWireTransfersResourceWithRawResponse", + "WireTransfersResourceWithStreamingResponse", + "AsyncWireTransfersResourceWithStreamingResponse", + "InboundWireTransfersResource", + "AsyncInboundWireTransfersResource", + "InboundWireTransfersResourceWithRawResponse", + "AsyncInboundWireTransfersResourceWithRawResponse", + "InboundWireTransfersResourceWithStreamingResponse", + "AsyncInboundWireTransfersResourceWithStreamingResponse", + "WireDrawdownRequestsResource", + "AsyncWireDrawdownRequestsResource", + "WireDrawdownRequestsResourceWithRawResponse", + "AsyncWireDrawdownRequestsResourceWithRawResponse", + "WireDrawdownRequestsResourceWithStreamingResponse", + "AsyncWireDrawdownRequestsResourceWithStreamingResponse", + "InboundWireDrawdownRequestsResource", + "AsyncInboundWireDrawdownRequestsResource", + "InboundWireDrawdownRequestsResourceWithRawResponse", + "AsyncInboundWireDrawdownRequestsResourceWithRawResponse", + "InboundWireDrawdownRequestsResourceWithStreamingResponse", + "AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse", + "CheckTransfersResource", + "AsyncCheckTransfersResource", + "CheckTransfersResourceWithRawResponse", + "AsyncCheckTransfersResourceWithRawResponse", + "CheckTransfersResourceWithStreamingResponse", + "AsyncCheckTransfersResourceWithStreamingResponse", + "InboundCheckDepositsResource", + "AsyncInboundCheckDepositsResource", + "InboundCheckDepositsResourceWithRawResponse", + "AsyncInboundCheckDepositsResourceWithRawResponse", + "InboundCheckDepositsResourceWithStreamingResponse", + "AsyncInboundCheckDepositsResourceWithStreamingResponse", + "RealTimePaymentsTransfersResource", + "AsyncRealTimePaymentsTransfersResource", + "RealTimePaymentsTransfersResourceWithRawResponse", + "AsyncRealTimePaymentsTransfersResourceWithRawResponse", + "RealTimePaymentsTransfersResourceWithStreamingResponse", + "AsyncRealTimePaymentsTransfersResourceWithStreamingResponse", + "InboundRealTimePaymentsTransfersResource", + "AsyncInboundRealTimePaymentsTransfersResource", + "InboundRealTimePaymentsTransfersResourceWithRawResponse", + "AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse", + "InboundRealTimePaymentsTransfersResourceWithStreamingResponse", + "AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse", + "InboundFednowTransfersResource", + "AsyncInboundFednowTransfersResource", + "InboundFednowTransfersResourceWithRawResponse", + "AsyncInboundFednowTransfersResourceWithRawResponse", + "InboundFednowTransfersResourceWithStreamingResponse", + "AsyncInboundFednowTransfersResourceWithStreamingResponse", + "CheckDepositsResource", + "AsyncCheckDepositsResource", + "CheckDepositsResourceWithRawResponse", + "AsyncCheckDepositsResourceWithRawResponse", + "CheckDepositsResourceWithStreamingResponse", + "AsyncCheckDepositsResourceWithStreamingResponse", + "InboundMailItemsResource", + "AsyncInboundMailItemsResource", + "InboundMailItemsResourceWithRawResponse", + "AsyncInboundMailItemsResourceWithRawResponse", + "InboundMailItemsResourceWithStreamingResponse", + "AsyncInboundMailItemsResourceWithStreamingResponse", + "EntityOnboardingSessionsResource", + "AsyncEntityOnboardingSessionsResource", + "EntityOnboardingSessionsResourceWithRawResponse", + "AsyncEntityOnboardingSessionsResourceWithRawResponse", + "EntityOnboardingSessionsResourceWithStreamingResponse", + "AsyncEntityOnboardingSessionsResourceWithStreamingResponse", + "ProgramsResource", + "AsyncProgramsResource", + "ProgramsResourceWithRawResponse", + "AsyncProgramsResourceWithRawResponse", + "ProgramsResourceWithStreamingResponse", + "AsyncProgramsResourceWithStreamingResponse", + "AccountStatementsResource", + "AsyncAccountStatementsResource", + "AccountStatementsResourceWithRawResponse", + "AsyncAccountStatementsResourceWithRawResponse", + "AccountStatementsResourceWithStreamingResponse", + "AsyncAccountStatementsResourceWithStreamingResponse", + "ExportsResource", + "AsyncExportsResource", + "ExportsResourceWithRawResponse", + "AsyncExportsResourceWithRawResponse", + "ExportsResourceWithStreamingResponse", + "AsyncExportsResourceWithStreamingResponse", + "CardTokensResource", + "AsyncCardTokensResource", + "CardTokensResourceWithRawResponse", + "AsyncCardTokensResourceWithRawResponse", + "CardTokensResourceWithStreamingResponse", + "AsyncCardTokensResourceWithStreamingResponse", + "SimulationsResource", + "AsyncSimulationsResource", + "SimulationsResourceWithRawResponse", + "AsyncSimulationsResourceWithRawResponse", + "SimulationsResourceWithStreamingResponse", + "AsyncSimulationsResourceWithStreamingResponse", ] diff --git a/src/increase/resources/simulations/account_statements.py b/src/increase/resources/simulations/account_statements.py index e30c2b3db..723749793 100644 --- a/src/increase/resources/simulations/account_statements.py +++ b/src/increase/resources/simulations/account_statements.py @@ -4,32 +4,42 @@ import httpx -from ... import _legacy_response -from ...types import AccountStatement -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options from ...types.simulations import account_statement_create_params +from ...types.account_statement import AccountStatement -__all__ = ["AccountStatements", "AsyncAccountStatements"] +__all__ = ["AccountStatementsResource", "AsyncAccountStatementsResource"] -class AccountStatements(SyncAPIResource): +class AccountStatementsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountStatementsWithRawResponse: - return AccountStatementsWithRawResponse(self) + def with_raw_response(self) -> AccountStatementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AccountStatementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountStatementsWithStreamingResponse: - return AccountStatementsWithStreamingResponse(self) + def with_streaming_response(self) -> AccountStatementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AccountStatementsResourceWithStreamingResponse(self) def create( self, @@ -40,7 +50,7 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountStatement: """ @@ -76,14 +86,25 @@ def create( ) -class AsyncAccountStatements(AsyncAPIResource): +class AsyncAccountStatementsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountStatementsWithRawResponse: - return AsyncAccountStatementsWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountStatementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountStatementsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountStatementsWithStreamingResponse: - return AsyncAccountStatementsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountStatementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncAccountStatementsResourceWithStreamingResponse(self) async def create( self, @@ -94,7 +115,7 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountStatement: """ @@ -130,26 +151,26 @@ async def create( ) -class AccountStatementsWithRawResponse: - def __init__(self, account_statements: AccountStatements) -> None: +class AccountStatementsResourceWithRawResponse: + def __init__(self, account_statements: AccountStatementsResource) -> None: self._account_statements = account_statements - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( account_statements.create, ) -class AsyncAccountStatementsWithRawResponse: - def __init__(self, account_statements: AsyncAccountStatements) -> None: +class AsyncAccountStatementsResourceWithRawResponse: + def __init__(self, account_statements: AsyncAccountStatementsResource) -> None: self._account_statements = account_statements - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( account_statements.create, ) -class AccountStatementsWithStreamingResponse: - def __init__(self, account_statements: AccountStatements) -> None: +class AccountStatementsResourceWithStreamingResponse: + def __init__(self, account_statements: AccountStatementsResource) -> None: self._account_statements = account_statements self.create = to_streamed_response_wrapper( @@ -157,8 +178,8 @@ def __init__(self, account_statements: AccountStatements) -> None: ) -class AsyncAccountStatementsWithStreamingResponse: - def __init__(self, account_statements: AsyncAccountStatements) -> None: +class AsyncAccountStatementsResourceWithStreamingResponse: + def __init__(self, account_statements: AsyncAccountStatementsResource) -> None: self._account_statements = account_statements self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/account_transfers.py b/src/increase/resources/simulations/account_transfers.py index 0bd6c2793..969c1b7ca 100644 --- a/src/increase/resources/simulations/account_transfers.py +++ b/src/increase/resources/simulations/account_transfers.py @@ -4,27 +4,41 @@ import httpx -from ... import _legacy_response -from ...types import AccountTransfer -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options +from ...types.account_transfer import AccountTransfer -__all__ = ["AccountTransfers", "AsyncAccountTransfers"] +__all__ = ["AccountTransfersResource", "AsyncAccountTransfersResource"] -class AccountTransfers(SyncAPIResource): +class AccountTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> AccountTransfersWithRawResponse: - return AccountTransfersWithRawResponse(self) + def with_raw_response(self) -> AccountTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AccountTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AccountTransfersWithStreamingResponse: - return AccountTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AccountTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AccountTransfersResourceWithStreamingResponse(self) def complete( self, @@ -35,7 +49,7 @@ def complete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ @@ -62,7 +76,9 @@ def complete( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return self._post( - f"/simulations/account_transfers/{account_transfer_id}/complete", + path_template( + "/simulations/account_transfers/{account_transfer_id}/complete", account_transfer_id=account_transfer_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -74,14 +90,25 @@ def complete( ) -class AsyncAccountTransfers(AsyncAPIResource): +class AsyncAccountTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncAccountTransfersWithRawResponse: - return AsyncAccountTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncAccountTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncAccountTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncAccountTransfersWithStreamingResponse: - return AsyncAccountTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncAccountTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncAccountTransfersResourceWithStreamingResponse(self) async def complete( self, @@ -92,7 +119,7 @@ async def complete( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> AccountTransfer: """ @@ -119,7 +146,9 @@ async def complete( f"Expected a non-empty value for `account_transfer_id` but received {account_transfer_id!r}" ) return await self._post( - f"/simulations/account_transfers/{account_transfer_id}/complete", + path_template( + "/simulations/account_transfers/{account_transfer_id}/complete", account_transfer_id=account_transfer_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -131,26 +160,26 @@ async def complete( ) -class AccountTransfersWithRawResponse: - def __init__(self, account_transfers: AccountTransfers) -> None: +class AccountTransfersResourceWithRawResponse: + def __init__(self, account_transfers: AccountTransfersResource) -> None: self._account_transfers = account_transfers - self.complete = _legacy_response.to_raw_response_wrapper( + self.complete = to_raw_response_wrapper( account_transfers.complete, ) -class AsyncAccountTransfersWithRawResponse: - def __init__(self, account_transfers: AsyncAccountTransfers) -> None: +class AsyncAccountTransfersResourceWithRawResponse: + def __init__(self, account_transfers: AsyncAccountTransfersResource) -> None: self._account_transfers = account_transfers - self.complete = _legacy_response.async_to_raw_response_wrapper( + self.complete = async_to_raw_response_wrapper( account_transfers.complete, ) -class AccountTransfersWithStreamingResponse: - def __init__(self, account_transfers: AccountTransfers) -> None: +class AccountTransfersResourceWithStreamingResponse: + def __init__(self, account_transfers: AccountTransfersResource) -> None: self._account_transfers = account_transfers self.complete = to_streamed_response_wrapper( @@ -158,8 +187,8 @@ def __init__(self, account_transfers: AccountTransfers) -> None: ) -class AsyncAccountTransfersWithStreamingResponse: - def __init__(self, account_transfers: AsyncAccountTransfers) -> None: +class AsyncAccountTransfersResourceWithStreamingResponse: + def __init__(self, account_transfers: AsyncAccountTransfersResource) -> None: self._account_transfers = account_transfers self.complete = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/ach_transfers.py b/src/increase/resources/simulations/ach_transfers.py index c1e2a27a5..1d9712bd5 100644 --- a/src/increase/resources/simulations/ach_transfers.py +++ b/src/increase/resources/simulations/ach_transfers.py @@ -2,96 +2,178 @@ from __future__ import annotations -from typing import Union -from datetime import datetime from typing_extensions import Literal import httpx -from ... import _legacy_response -from ...types import ACHTransfer, InboundACHTransfer -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import ( + ach_transfer_return_params, + ach_transfer_settle_params, + ach_transfer_create_notification_of_change_params, ) -from ...types.simulations import ach_transfer_return_params, ach_transfer_create_inbound_params +from ...types.ach_transfer import ACHTransfer -__all__ = ["ACHTransfers", "AsyncACHTransfers"] +__all__ = ["ACHTransfersResource", "AsyncACHTransfersResource"] -class ACHTransfers(SyncAPIResource): +class ACHTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ACHTransfersWithRawResponse: - return ACHTransfersWithRawResponse(self) + def with_raw_response(self) -> ACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ACHTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ACHTransfersWithStreamingResponse: - return ACHTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> ACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - def create_inbound( + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ACHTransfersResourceWithStreamingResponse(self) + + def acknowledge( self, + ach_transfer_id: str, *, - account_number_id: str, - amount: int, - company_descriptive_date: str | NotGiven = NOT_GIVEN, - company_discretionary_data: str | NotGiven = NOT_GIVEN, - company_entry_description: str | NotGiven = NOT_GIVEN, - company_id: str | NotGiven = NOT_GIVEN, - company_name: str | NotGiven = NOT_GIVEN, - receiver_id_number: str | NotGiven = NOT_GIVEN, - receiver_name: str | NotGiven = NOT_GIVEN, - resolve_at: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> InboundACHTransfer: - """Simulates an inbound ACH transfer to your account. - - This imitates initiating a - transfer to an Increase account from a different financial institution. The - transfer may be either a credit or a debit depending on if the `amount` is - positive or negative. The result of calling this API will contain the created - transfer. You can pass a `resolve_at` parameter to allow for a window to - [action on the Inbound ACH Transfer](https://increase.com/documentation/inbound-ach-transfers#inbound-ach-transfers). - Alternatively, if you don't pass the `resolve_at` parameter the result will - contain either a [Transaction](#transactions) or a - [Declined Transaction](#declined-transactions) depending on whether or not the - transfer is allowed. + ) -> ACHTransfer: + """ + Simulates the acknowledgement of an [ACH Transfer](#ach-transfers) by the + Federal Reserve. This transfer must first have a `status` of `submitted`. In + production, the Federal Reserve generally acknowledges submitted ACH files + within 30 minutes. Since sandbox ACH Transfers are not submitted to the Federal + Reserve, this endpoint allows you to skip that delay and add the acknowledgement + subresource to the ACH Transfer. Args: - account_number_id: The identifier of the Account Number the inbound ACH Transfer is for. - - amount: The transfer amount in cents. A positive amount originates a credit transfer - pushing funds to the receiving account. A negative amount originates a debit - transfer pulling funds from the receiving account. + ach_transfer_id: The identifier of the ACH Transfer you wish to become acknowledged. - company_descriptive_date: The description of the date of the transfer. - - company_discretionary_data: Data associated with the transfer set by the sender. + extra_headers: Send extra headers - company_entry_description: The description of the transfer set by the sender. + extra_query: Add additional query parameters to the request - company_id: The sender's company ID. + extra_body: Add additional JSON properties to the request - company_name: The name of the sender. + timeout: Override the client-level default timeout for this request, in seconds - receiver_id_number: The ID of the receiver of the transfer. + idempotency_key: Specify a custom idempotency key for this request + """ + if not ach_transfer_id: + raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") + return self._post( + path_template("/simulations/ach_transfers/{ach_transfer_id}/acknowledge", ach_transfer_id=ach_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=ACHTransfer, + ) - receiver_name: The name of the receiver of the transfer. + def create_notification_of_change( + self, + ach_transfer_id: str, + *, + change_code: Literal[ + "incorrect_account_number", + "incorrect_routing_number", + "incorrect_routing_number_and_account_number", + "incorrect_transaction_code", + "incorrect_account_number_and_transaction_code", + "incorrect_routing_number_account_number_and_transaction_code", + "incorrect_receiving_depository_financial_institution_identification", + "incorrect_individual_identification_number", + "addenda_format_error", + "incorrect_standard_entry_class_code_for_outbound_international_payment", + "misrouted_notification_of_change", + "incorrect_trace_number", + "incorrect_company_identification_number", + "incorrect_identification_number", + "incorrectly_formatted_corrected_data", + "incorrect_discretionary_data", + "routing_number_not_from_original_entry_detail_record", + "depository_financial_institution_account_number_not_from_original_entry_detail_record", + "incorrect_transaction_code_by_originating_depository_financial_institution", + ], + corrected_data: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> ACHTransfer: + """ + Simulates receiving a Notification of Change for an + [ACH Transfer](#ach-transfers). - resolve_at: The time at which the transfer should be resolved. If not provided will resolve - immediately. + Args: + ach_transfer_id: The identifier of the ACH Transfer you wish to create a notification of change + for. + + change_code: The reason for the notification of change. + + - `incorrect_account_number` - The account number was incorrect. + - `incorrect_routing_number` - The routing number was incorrect. + - `incorrect_routing_number_and_account_number` - Both the routing number and + the account number were incorrect. + - `incorrect_transaction_code` - The transaction code was incorrect. Try + changing the `funding` parameter from checking to savings or vice-versa. + - `incorrect_account_number_and_transaction_code` - The account number and the + transaction code were incorrect. + - `incorrect_routing_number_account_number_and_transaction_code` - The routing + number, account number, and transaction code were incorrect. + - `incorrect_receiving_depository_financial_institution_identification` - The + receiving depository financial institution identification was incorrect. + - `incorrect_individual_identification_number` - The individual identification + number was incorrect. + - `addenda_format_error` - The addenda had an incorrect format. + - `incorrect_standard_entry_class_code_for_outbound_international_payment` - The + standard entry class code was incorrect for an outbound international payment. + - `misrouted_notification_of_change` - The notification of change was misrouted. + - `incorrect_trace_number` - The trace number was incorrect. + - `incorrect_company_identification_number` - The company identification number + was incorrect. + - `incorrect_identification_number` - The individual identification number or + identification number was incorrect. + - `incorrectly_formatted_corrected_data` - The corrected data was incorrectly + formatted. + - `incorrect_discretionary_data` - The discretionary data was incorrect. + - `routing_number_not_from_original_entry_detail_record` - The routing number + was not from the original entry detail record. + - `depository_financial_institution_account_number_not_from_original_entry_detail_record` - + The depository financial institution account number was not from the original + entry detail record. + - `incorrect_transaction_code_by_originating_depository_financial_institution` - + The transaction code was incorrect, initiated by the originating depository + financial institution. + + corrected_data: The corrected data for the notification of change (e.g., a new routing number). extra_headers: Send extra headers @@ -103,22 +185,19 @@ def create_inbound( idempotency_key: Specify a custom idempotency key for this request """ + if not ach_transfer_id: + raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return self._post( - "/simulations/inbound_ach_transfers", + path_template( + "/simulations/ach_transfers/{ach_transfer_id}/create_notification_of_change", + ach_transfer_id=ach_transfer_id, + ), body=maybe_transform( { - "account_number_id": account_number_id, - "amount": amount, - "company_descriptive_date": company_descriptive_date, - "company_discretionary_data": company_discretionary_data, - "company_entry_description": company_entry_description, - "company_id": company_id, - "company_name": company_name, - "receiver_id_number": receiver_id_number, - "receiver_name": receiver_name, - "resolve_at": resolve_at, + "change_code": change_code, + "corrected_data": corrected_data, }, - ach_transfer_create_inbound_params.ACHTransferCreateInboundParams, + ach_transfer_create_notification_of_change_params.ACHTransferCreateNotificationOfChangeParams, ), options=make_request_options( extra_headers=extra_headers, @@ -127,7 +206,7 @@ def create_inbound( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=InboundACHTransfer, + cast_to=ACHTransfer, ) def return_( @@ -206,13 +285,13 @@ def return_( "untimely_dishonored_return", "untimely_return", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -227,24 +306,28 @@ def return_( Defaults to `no_account`. - `insufficient_fund` - Code R01. Insufficient funds in the receiving account. - Sometimes abbreviated to NSF. + Sometimes abbreviated to "NSF." - `no_account` - Code R03. The account does not exist or the receiving bank was unable to locate it. - `account_closed` - Code R02. The account is closed at the receiving bank. - `invalid_account_number_structure` - Code R04. The account number is invalid at the receiving bank. - - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. The account - at the receiving bank was frozen per the Office of Foreign Assets Control. - - `credit_entry_refused_by_receiver` - Code R23. The receiving bank account - refused a credit transfer. + - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. This return + code has two separate meanings. (1) The receiving bank froze the account or + (2) the Office of Foreign Assets Control (OFAC) instructed the receiving bank + to return the entry. + - `credit_entry_refused_by_receiver` - Code R23. The receiving bank refused the + credit transfer. - `unauthorized_debit_to_consumer_account_using_corporate_sec_code` - Code R05. The receiving bank rejected because of an incorrect Standard Entry Class code. + Consumer accounts cannot be debited as `corporate_credit_or_debit` or + `corporate_trade_exchange`. - `corporate_customer_advised_not_authorized` - Code R29. The corporate customer at the receiving bank reversed the transfer. - `payment_stopped` - Code R08. The receiving bank stopped payment on this transfer. - - `non_transaction_account` - Code R20. The receiving bank account does not - perform transfers. + - `non_transaction_account` - Code R20. The account is not eligible for ACH, + such as a savings account with transaction limits. - `uncollected_funds` - Code R09. The receiving bank account does not have enough available balance for the transfer. - `routing_number_check_digit_error` - Code R28. The routing number is @@ -252,14 +335,13 @@ def return_( - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - Code R10. The customer at the receiving bank reversed the transfer. - `amount_field_error` - Code R19. The amount field is incorrect or too large. - - `authorization_revoked_by_customer` - Code R07. The customer at the receiving - institution informed their bank that they have revoked authorization for a - previously authorized transfer. + - `authorization_revoked_by_customer` - Code R07. The customer revoked their + authorization for a previously authorized transfer. - `invalid_ach_routing_number` - Code R13. The routing number is invalid. - `file_record_edit_criteria` - Code R17. The receiving bank is unable to process a field in the transfer. - - `enr_invalid_individual_name` - Code R45. The individual name field was - invalid. + - `enr_invalid_individual_name` - Code R45. A rare return reason. The individual + name field was invalid. - `returned_per_odfi_request` - Code R06. The originating financial institution asked for this transfer to be returned. The receiving bank is complying with the request. @@ -354,8 +436,8 @@ def return_( a malformed credit entry. - `return_of_improper_debit_entry` - Code R35. A rare return reason. Return of a malformed debit entry. - - `return_of_xck_entry` - Code R33. A rare return reason. Return of a Destroyed - Check ("XKC") entry. + - `return_of_xck_entry` - Code R33. A rare return reason. Return of a destroyed + check ("XCK") entry. - `source_document_presented_for_payment` - Code R37. A rare return reason. The source document related to this ACH, usually an ACH check conversion, was presented to the bank. @@ -387,7 +469,7 @@ def return_( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return self._post( - f"/simulations/ach_transfers/{ach_transfer_id}/return", + path_template("/simulations/ach_transfers/{ach_transfer_id}/return", ach_transfer_id=ach_transfer_id), body=maybe_transform({"reason": reason}, ach_transfer_return_params.ACHTransferReturnParams), options=make_request_options( extra_headers=extra_headers, @@ -399,6 +481,69 @@ def return_( cast_to=ACHTransfer, ) + def settle( + self, + ach_transfer_id: str, + *, + inbound_funds_hold_behavior: Literal["release_immediately", "release_on_default_schedule"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> ACHTransfer: + """ + Simulates the settlement of an [ACH Transfer](#ach-transfers) by the Federal + Reserve. This transfer must first have a `status` of `pending_submission` or + `submitted`. For convenience, if the transfer is in `status`: + `pending_submission`, the simulation will also submit the transfer. Without this + simulation the transfer will eventually settle on its own following the same + Federal Reserve timeline as in production. Additionally, you can specify the + behavior of the inbound funds hold that is created when the ACH Transfer is + settled. If no behavior is specified, the inbound funds hold will be released + immediately in order for the funds to be available for use. + + Args: + ach_transfer_id: The identifier of the ACH Transfer you wish to become settled. + + inbound_funds_hold_behavior: The behavior of the inbound funds hold that is created when the ACH Transfer is + settled. If no behavior is specified, the inbound funds hold will be released + immediately in order for the funds to be available for use. + + - `release_immediately` - Release the inbound funds hold immediately. + - `release_on_default_schedule` - Release the inbound funds hold on the default + schedule. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not ach_transfer_id: + raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") + return self._post( + path_template("/simulations/ach_transfers/{ach_transfer_id}/settle", ach_transfer_id=ach_transfer_id), + body=maybe_transform( + {"inbound_funds_hold_behavior": inbound_funds_hold_behavior}, + ach_transfer_settle_params.ACHTransferSettleParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=ACHTransfer, + ) + def submit( self, ach_transfer_id: str, @@ -408,7 +553,7 @@ def submit( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -435,7 +580,7 @@ def submit( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return self._post( - f"/simulations/ach_transfers/{ach_transfer_id}/submit", + path_template("/simulations/ach_transfers/{ach_transfer_id}/submit", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -447,72 +592,153 @@ def submit( ) -class AsyncACHTransfers(AsyncAPIResource): +class AsyncACHTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncACHTransfersWithRawResponse: - return AsyncACHTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncACHTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncACHTransfersWithStreamingResponse: - return AsyncACHTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncACHTransfersResourceWithStreamingResponse(self) - async def create_inbound( + async def acknowledge( self, + ach_transfer_id: str, *, - account_number_id: str, - amount: int, - company_descriptive_date: str | NotGiven = NOT_GIVEN, - company_discretionary_data: str | NotGiven = NOT_GIVEN, - company_entry_description: str | NotGiven = NOT_GIVEN, - company_id: str | NotGiven = NOT_GIVEN, - company_name: str | NotGiven = NOT_GIVEN, - receiver_id_number: str | NotGiven = NOT_GIVEN, - receiver_name: str | NotGiven = NOT_GIVEN, - resolve_at: Union[str, datetime] | 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> InboundACHTransfer: - """Simulates an inbound ACH transfer to your account. - - This imitates initiating a - transfer to an Increase account from a different financial institution. The - transfer may be either a credit or a debit depending on if the `amount` is - positive or negative. The result of calling this API will contain the created - transfer. You can pass a `resolve_at` parameter to allow for a window to - [action on the Inbound ACH Transfer](https://increase.com/documentation/inbound-ach-transfers#inbound-ach-transfers). - Alternatively, if you don't pass the `resolve_at` parameter the result will - contain either a [Transaction](#transactions) or a - [Declined Transaction](#declined-transactions) depending on whether or not the - transfer is allowed. + ) -> ACHTransfer: + """ + Simulates the acknowledgement of an [ACH Transfer](#ach-transfers) by the + Federal Reserve. This transfer must first have a `status` of `submitted`. In + production, the Federal Reserve generally acknowledges submitted ACH files + within 30 minutes. Since sandbox ACH Transfers are not submitted to the Federal + Reserve, this endpoint allows you to skip that delay and add the acknowledgement + subresource to the ACH Transfer. Args: - account_number_id: The identifier of the Account Number the inbound ACH Transfer is for. + ach_transfer_id: The identifier of the ACH Transfer you wish to become acknowledged. - amount: The transfer amount in cents. A positive amount originates a credit transfer - pushing funds to the receiving account. A negative amount originates a debit - transfer pulling funds from the receiving account. - - company_descriptive_date: The description of the date of the transfer. - - company_discretionary_data: Data associated with the transfer set by the sender. + extra_headers: Send extra headers - company_entry_description: The description of the transfer set by the sender. + extra_query: Add additional query parameters to the request - company_id: The sender's company ID. + extra_body: Add additional JSON properties to the request - company_name: The name of the sender. + timeout: Override the client-level default timeout for this request, in seconds - receiver_id_number: The ID of the receiver of the transfer. + idempotency_key: Specify a custom idempotency key for this request + """ + if not ach_transfer_id: + raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") + return await self._post( + path_template("/simulations/ach_transfers/{ach_transfer_id}/acknowledge", ach_transfer_id=ach_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=ACHTransfer, + ) - receiver_name: The name of the receiver of the transfer. + async def create_notification_of_change( + self, + ach_transfer_id: str, + *, + change_code: Literal[ + "incorrect_account_number", + "incorrect_routing_number", + "incorrect_routing_number_and_account_number", + "incorrect_transaction_code", + "incorrect_account_number_and_transaction_code", + "incorrect_routing_number_account_number_and_transaction_code", + "incorrect_receiving_depository_financial_institution_identification", + "incorrect_individual_identification_number", + "addenda_format_error", + "incorrect_standard_entry_class_code_for_outbound_international_payment", + "misrouted_notification_of_change", + "incorrect_trace_number", + "incorrect_company_identification_number", + "incorrect_identification_number", + "incorrectly_formatted_corrected_data", + "incorrect_discretionary_data", + "routing_number_not_from_original_entry_detail_record", + "depository_financial_institution_account_number_not_from_original_entry_detail_record", + "incorrect_transaction_code_by_originating_depository_financial_institution", + ], + corrected_data: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> ACHTransfer: + """ + Simulates receiving a Notification of Change for an + [ACH Transfer](#ach-transfers). - resolve_at: The time at which the transfer should be resolved. If not provided will resolve - immediately. + Args: + ach_transfer_id: The identifier of the ACH Transfer you wish to create a notification of change + for. + + change_code: The reason for the notification of change. + + - `incorrect_account_number` - The account number was incorrect. + - `incorrect_routing_number` - The routing number was incorrect. + - `incorrect_routing_number_and_account_number` - Both the routing number and + the account number were incorrect. + - `incorrect_transaction_code` - The transaction code was incorrect. Try + changing the `funding` parameter from checking to savings or vice-versa. + - `incorrect_account_number_and_transaction_code` - The account number and the + transaction code were incorrect. + - `incorrect_routing_number_account_number_and_transaction_code` - The routing + number, account number, and transaction code were incorrect. + - `incorrect_receiving_depository_financial_institution_identification` - The + receiving depository financial institution identification was incorrect. + - `incorrect_individual_identification_number` - The individual identification + number was incorrect. + - `addenda_format_error` - The addenda had an incorrect format. + - `incorrect_standard_entry_class_code_for_outbound_international_payment` - The + standard entry class code was incorrect for an outbound international payment. + - `misrouted_notification_of_change` - The notification of change was misrouted. + - `incorrect_trace_number` - The trace number was incorrect. + - `incorrect_company_identification_number` - The company identification number + was incorrect. + - `incorrect_identification_number` - The individual identification number or + identification number was incorrect. + - `incorrectly_formatted_corrected_data` - The corrected data was incorrectly + formatted. + - `incorrect_discretionary_data` - The discretionary data was incorrect. + - `routing_number_not_from_original_entry_detail_record` - The routing number + was not from the original entry detail record. + - `depository_financial_institution_account_number_not_from_original_entry_detail_record` - + The depository financial institution account number was not from the original + entry detail record. + - `incorrect_transaction_code_by_originating_depository_financial_institution` - + The transaction code was incorrect, initiated by the originating depository + financial institution. + + corrected_data: The corrected data for the notification of change (e.g., a new routing number). extra_headers: Send extra headers @@ -524,22 +750,19 @@ async def create_inbound( idempotency_key: Specify a custom idempotency key for this request """ + if not ach_transfer_id: + raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return await self._post( - "/simulations/inbound_ach_transfers", + path_template( + "/simulations/ach_transfers/{ach_transfer_id}/create_notification_of_change", + ach_transfer_id=ach_transfer_id, + ), body=await async_maybe_transform( { - "account_number_id": account_number_id, - "amount": amount, - "company_descriptive_date": company_descriptive_date, - "company_discretionary_data": company_discretionary_data, - "company_entry_description": company_entry_description, - "company_id": company_id, - "company_name": company_name, - "receiver_id_number": receiver_id_number, - "receiver_name": receiver_name, - "resolve_at": resolve_at, + "change_code": change_code, + "corrected_data": corrected_data, }, - ach_transfer_create_inbound_params.ACHTransferCreateInboundParams, + ach_transfer_create_notification_of_change_params.ACHTransferCreateNotificationOfChangeParams, ), options=make_request_options( extra_headers=extra_headers, @@ -548,7 +771,7 @@ async def create_inbound( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=InboundACHTransfer, + cast_to=ACHTransfer, ) async def return_( @@ -627,13 +850,13 @@ async def return_( "untimely_dishonored_return", "untimely_return", ] - | NotGiven = NOT_GIVEN, + | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -648,24 +871,28 @@ async def return_( Defaults to `no_account`. - `insufficient_fund` - Code R01. Insufficient funds in the receiving account. - Sometimes abbreviated to NSF. + Sometimes abbreviated to "NSF." - `no_account` - Code R03. The account does not exist or the receiving bank was unable to locate it. - `account_closed` - Code R02. The account is closed at the receiving bank. - `invalid_account_number_structure` - Code R04. The account number is invalid at the receiving bank. - - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. The account - at the receiving bank was frozen per the Office of Foreign Assets Control. - - `credit_entry_refused_by_receiver` - Code R23. The receiving bank account - refused a credit transfer. + - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. This return + code has two separate meanings. (1) The receiving bank froze the account or + (2) the Office of Foreign Assets Control (OFAC) instructed the receiving bank + to return the entry. + - `credit_entry_refused_by_receiver` - Code R23. The receiving bank refused the + credit transfer. - `unauthorized_debit_to_consumer_account_using_corporate_sec_code` - Code R05. The receiving bank rejected because of an incorrect Standard Entry Class code. + Consumer accounts cannot be debited as `corporate_credit_or_debit` or + `corporate_trade_exchange`. - `corporate_customer_advised_not_authorized` - Code R29. The corporate customer at the receiving bank reversed the transfer. - `payment_stopped` - Code R08. The receiving bank stopped payment on this transfer. - - `non_transaction_account` - Code R20. The receiving bank account does not - perform transfers. + - `non_transaction_account` - Code R20. The account is not eligible for ACH, + such as a savings account with transaction limits. - `uncollected_funds` - Code R09. The receiving bank account does not have enough available balance for the transfer. - `routing_number_check_digit_error` - Code R28. The routing number is @@ -673,14 +900,13 @@ async def return_( - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - Code R10. The customer at the receiving bank reversed the transfer. - `amount_field_error` - Code R19. The amount field is incorrect or too large. - - `authorization_revoked_by_customer` - Code R07. The customer at the receiving - institution informed their bank that they have revoked authorization for a - previously authorized transfer. + - `authorization_revoked_by_customer` - Code R07. The customer revoked their + authorization for a previously authorized transfer. - `invalid_ach_routing_number` - Code R13. The routing number is invalid. - `file_record_edit_criteria` - Code R17. The receiving bank is unable to process a field in the transfer. - - `enr_invalid_individual_name` - Code R45. The individual name field was - invalid. + - `enr_invalid_individual_name` - Code R45. A rare return reason. The individual + name field was invalid. - `returned_per_odfi_request` - Code R06. The originating financial institution asked for this transfer to be returned. The receiving bank is complying with the request. @@ -775,8 +1001,8 @@ async def return_( a malformed credit entry. - `return_of_improper_debit_entry` - Code R35. A rare return reason. Return of a malformed debit entry. - - `return_of_xck_entry` - Code R33. A rare return reason. Return of a Destroyed - Check ("XKC") entry. + - `return_of_xck_entry` - Code R33. A rare return reason. Return of a destroyed + check ("XCK") entry. - `source_document_presented_for_payment` - Code R37. A rare return reason. The source document related to this ACH, usually an ACH check conversion, was presented to the bank. @@ -808,7 +1034,7 @@ async def return_( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return await self._post( - f"/simulations/ach_transfers/{ach_transfer_id}/return", + path_template("/simulations/ach_transfers/{ach_transfer_id}/return", ach_transfer_id=ach_transfer_id), body=await async_maybe_transform({"reason": reason}, ach_transfer_return_params.ACHTransferReturnParams), options=make_request_options( extra_headers=extra_headers, @@ -820,6 +1046,69 @@ async def return_( cast_to=ACHTransfer, ) + async def settle( + self, + ach_transfer_id: str, + *, + inbound_funds_hold_behavior: Literal["release_immediately", "release_on_default_schedule"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> ACHTransfer: + """ + Simulates the settlement of an [ACH Transfer](#ach-transfers) by the Federal + Reserve. This transfer must first have a `status` of `pending_submission` or + `submitted`. For convenience, if the transfer is in `status`: + `pending_submission`, the simulation will also submit the transfer. Without this + simulation the transfer will eventually settle on its own following the same + Federal Reserve timeline as in production. Additionally, you can specify the + behavior of the inbound funds hold that is created when the ACH Transfer is + settled. If no behavior is specified, the inbound funds hold will be released + immediately in order for the funds to be available for use. + + Args: + ach_transfer_id: The identifier of the ACH Transfer you wish to become settled. + + inbound_funds_hold_behavior: The behavior of the inbound funds hold that is created when the ACH Transfer is + settled. If no behavior is specified, the inbound funds hold will be released + immediately in order for the funds to be available for use. + + - `release_immediately` - Release the inbound funds hold immediately. + - `release_on_default_schedule` - Release the inbound funds hold on the default + schedule. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not ach_transfer_id: + raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") + return await self._post( + path_template("/simulations/ach_transfers/{ach_transfer_id}/settle", ach_transfer_id=ach_transfer_id), + body=await async_maybe_transform( + {"inbound_funds_hold_behavior": inbound_funds_hold_behavior}, + ach_transfer_settle_params.ACHTransferSettleParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=ACHTransfer, + ) + async def submit( self, ach_transfer_id: str, @@ -829,7 +1118,7 @@ async def submit( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> ACHTransfer: """ @@ -856,7 +1145,7 @@ async def submit( if not ach_transfer_id: raise ValueError(f"Expected a non-empty value for `ach_transfer_id` but received {ach_transfer_id!r}") return await self._post( - f"/simulations/ach_transfers/{ach_transfer_id}/submit", + path_template("/simulations/ach_transfers/{ach_transfer_id}/submit", ach_transfer_id=ach_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -868,61 +1157,85 @@ async def submit( ) -class ACHTransfersWithRawResponse: - def __init__(self, ach_transfers: ACHTransfers) -> None: +class ACHTransfersResourceWithRawResponse: + def __init__(self, ach_transfers: ACHTransfersResource) -> None: self._ach_transfers = ach_transfers - self.create_inbound = _legacy_response.to_raw_response_wrapper( - ach_transfers.create_inbound, + self.acknowledge = to_raw_response_wrapper( + ach_transfers.acknowledge, ) - self.return_ = _legacy_response.to_raw_response_wrapper( + self.create_notification_of_change = to_raw_response_wrapper( + ach_transfers.create_notification_of_change, + ) + self.return_ = to_raw_response_wrapper( ach_transfers.return_, ) - self.submit = _legacy_response.to_raw_response_wrapper( + self.settle = to_raw_response_wrapper( + ach_transfers.settle, + ) + self.submit = to_raw_response_wrapper( ach_transfers.submit, ) -class AsyncACHTransfersWithRawResponse: - def __init__(self, ach_transfers: AsyncACHTransfers) -> None: +class AsyncACHTransfersResourceWithRawResponse: + def __init__(self, ach_transfers: AsyncACHTransfersResource) -> None: self._ach_transfers = ach_transfers - self.create_inbound = _legacy_response.async_to_raw_response_wrapper( - ach_transfers.create_inbound, + self.acknowledge = async_to_raw_response_wrapper( + ach_transfers.acknowledge, + ) + self.create_notification_of_change = async_to_raw_response_wrapper( + ach_transfers.create_notification_of_change, ) - self.return_ = _legacy_response.async_to_raw_response_wrapper( + self.return_ = async_to_raw_response_wrapper( ach_transfers.return_, ) - self.submit = _legacy_response.async_to_raw_response_wrapper( + self.settle = async_to_raw_response_wrapper( + ach_transfers.settle, + ) + self.submit = async_to_raw_response_wrapper( ach_transfers.submit, ) -class ACHTransfersWithStreamingResponse: - def __init__(self, ach_transfers: ACHTransfers) -> None: +class ACHTransfersResourceWithStreamingResponse: + def __init__(self, ach_transfers: ACHTransfersResource) -> None: self._ach_transfers = ach_transfers - self.create_inbound = to_streamed_response_wrapper( - ach_transfers.create_inbound, + self.acknowledge = to_streamed_response_wrapper( + ach_transfers.acknowledge, + ) + self.create_notification_of_change = to_streamed_response_wrapper( + ach_transfers.create_notification_of_change, ) self.return_ = to_streamed_response_wrapper( ach_transfers.return_, ) + self.settle = to_streamed_response_wrapper( + ach_transfers.settle, + ) self.submit = to_streamed_response_wrapper( ach_transfers.submit, ) -class AsyncACHTransfersWithStreamingResponse: - def __init__(self, ach_transfers: AsyncACHTransfers) -> None: +class AsyncACHTransfersResourceWithStreamingResponse: + def __init__(self, ach_transfers: AsyncACHTransfersResource) -> None: self._ach_transfers = ach_transfers - self.create_inbound = async_to_streamed_response_wrapper( - ach_transfers.create_inbound, + self.acknowledge = async_to_streamed_response_wrapper( + ach_transfers.acknowledge, + ) + self.create_notification_of_change = async_to_streamed_response_wrapper( + ach_transfers.create_notification_of_change, ) self.return_ = async_to_streamed_response_wrapper( ach_transfers.return_, ) + self.settle = async_to_streamed_response_wrapper( + ach_transfers.settle, + ) self.submit = async_to_streamed_response_wrapper( ach_transfers.submit, ) diff --git a/src/increase/resources/simulations/card_authentications.py b/src/increase/resources/simulations/card_authentications.py new file mode 100644 index 000000000..bbc362b79 --- /dev/null +++ b/src/increase/resources/simulations/card_authentications.py @@ -0,0 +1,511 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_authentication_create_params, card_authentication_challenge_attempts_params +from ...types.card_payment import CardPayment + +__all__ = ["CardAuthenticationsResource", "AsyncCardAuthenticationsResource"] + + +class CardAuthenticationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardAuthenticationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardAuthenticationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardAuthenticationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardAuthenticationsResourceWithStreamingResponse(self) + + def create( + self, + *, + card_id: str, + category: Literal["payment_authentication", "non_payment_authentication"] | Omit = omit, + device_channel: Literal["app", "browser", "three_ds_requestor_initiated"] | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_name: str | Omit = omit, + purchase_amount: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates a Card Authentication attempt on a [Card](#cards). + + The attempt always + results in a [Card Payment](#card_payments) being created, either with a status + that allows further action or a terminal failed status. + + Args: + card_id: The identifier of the Card to be authorized. + + category: The category of the card authentication attempt. + + - `payment_authentication` - The authentication attempt is for a payment. + - `non_payment_authentication` - The authentication attempt is not for a + payment. + + device_channel: The device channel of the card authentication attempt. + + - `app` - The authentication attempt was made from an app. + - `browser` - The authentication attempt was made from a browser. + - `three_ds_requestor_initiated` - The authentication attempt was initiated by + the 3DS Requestor. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_country: The country the merchant resides in. + + merchant_name: The name of the merchant + + purchase_amount: The purchase amount in cents. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_authentications", + body=maybe_transform( + { + "card_id": card_id, + "category": category, + "device_channel": device_channel, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_country": merchant_country, + "merchant_name": merchant_name, + "purchase_amount": purchase_amount, + }, + card_authentication_create_params.CardAuthenticationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + def challenge_attempts( + self, + card_payment_id: str, + *, + one_time_code: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates an attempt at a Card Authentication Challenge. + + This updates the + `card_authentications` object under the [Card Payment](#card_payments). You can + also attempt the challenge by navigating to + https://dashboard.increase.com/card_authentication_simulation/:card_payment_id. + + Args: + card_payment_id: The identifier of the Card Payment to be challenged. + + one_time_code: The one-time code to be validated. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_payment_id: + raise ValueError(f"Expected a non-empty value for `card_payment_id` but received {card_payment_id!r}") + return self._post( + path_template( + "/simulations/card_authentications/{card_payment_id}/challenge_attempts", + card_payment_id=card_payment_id, + ), + body=maybe_transform( + {"one_time_code": one_time_code}, + card_authentication_challenge_attempts_params.CardAuthenticationChallengeAttemptsParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + def challenges( + self, + card_payment_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates starting a Card Authentication Challenge for an existing Card + Authentication. This updates the `card_authentications` object under the + [Card Payment](#card_payments). To attempt the challenge, use the + `/simulations/card_authentications/:card_payment_id/challenge_attempts` endpoint + or navigate to + https://dashboard.increase.com/card_authentication_simulation/:card_payment_id. + + Args: + card_payment_id: The identifier of the Card Payment to be challenged. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_payment_id: + raise ValueError(f"Expected a non-empty value for `card_payment_id` but received {card_payment_id!r}") + return self._post( + path_template( + "/simulations/card_authentications/{card_payment_id}/challenges", card_payment_id=card_payment_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class AsyncCardAuthenticationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardAuthenticationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardAuthenticationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardAuthenticationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardAuthenticationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + card_id: str, + category: Literal["payment_authentication", "non_payment_authentication"] | Omit = omit, + device_channel: Literal["app", "browser", "three_ds_requestor_initiated"] | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_name: str | Omit = omit, + purchase_amount: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates a Card Authentication attempt on a [Card](#cards). + + The attempt always + results in a [Card Payment](#card_payments) being created, either with a status + that allows further action or a terminal failed status. + + Args: + card_id: The identifier of the Card to be authorized. + + category: The category of the card authentication attempt. + + - `payment_authentication` - The authentication attempt is for a payment. + - `non_payment_authentication` - The authentication attempt is not for a + payment. + + device_channel: The device channel of the card authentication attempt. + + - `app` - The authentication attempt was made from an app. + - `browser` - The authentication attempt was made from a browser. + - `three_ds_requestor_initiated` - The authentication attempt was initiated by + the 3DS Requestor. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_country: The country the merchant resides in. + + merchant_name: The name of the merchant + + purchase_amount: The purchase amount in cents. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_authentications", + body=await async_maybe_transform( + { + "card_id": card_id, + "category": category, + "device_channel": device_channel, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_country": merchant_country, + "merchant_name": merchant_name, + "purchase_amount": purchase_amount, + }, + card_authentication_create_params.CardAuthenticationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + async def challenge_attempts( + self, + card_payment_id: str, + *, + one_time_code: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates an attempt at a Card Authentication Challenge. + + This updates the + `card_authentications` object under the [Card Payment](#card_payments). You can + also attempt the challenge by navigating to + https://dashboard.increase.com/card_authentication_simulation/:card_payment_id. + + Args: + card_payment_id: The identifier of the Card Payment to be challenged. + + one_time_code: The one-time code to be validated. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_payment_id: + raise ValueError(f"Expected a non-empty value for `card_payment_id` but received {card_payment_id!r}") + return await self._post( + path_template( + "/simulations/card_authentications/{card_payment_id}/challenge_attempts", + card_payment_id=card_payment_id, + ), + body=await async_maybe_transform( + {"one_time_code": one_time_code}, + card_authentication_challenge_attempts_params.CardAuthenticationChallengeAttemptsParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + async def challenges( + self, + card_payment_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates starting a Card Authentication Challenge for an existing Card + Authentication. This updates the `card_authentications` object under the + [Card Payment](#card_payments). To attempt the challenge, use the + `/simulations/card_authentications/:card_payment_id/challenge_attempts` endpoint + or navigate to + https://dashboard.increase.com/card_authentication_simulation/:card_payment_id. + + Args: + card_payment_id: The identifier of the Card Payment to be challenged. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_payment_id: + raise ValueError(f"Expected a non-empty value for `card_payment_id` but received {card_payment_id!r}") + return await self._post( + path_template( + "/simulations/card_authentications/{card_payment_id}/challenges", card_payment_id=card_payment_id + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class CardAuthenticationsResourceWithRawResponse: + def __init__(self, card_authentications: CardAuthenticationsResource) -> None: + self._card_authentications = card_authentications + + self.create = to_raw_response_wrapper( + card_authentications.create, + ) + self.challenge_attempts = to_raw_response_wrapper( + card_authentications.challenge_attempts, + ) + self.challenges = to_raw_response_wrapper( + card_authentications.challenges, + ) + + +class AsyncCardAuthenticationsResourceWithRawResponse: + def __init__(self, card_authentications: AsyncCardAuthenticationsResource) -> None: + self._card_authentications = card_authentications + + self.create = async_to_raw_response_wrapper( + card_authentications.create, + ) + self.challenge_attempts = async_to_raw_response_wrapper( + card_authentications.challenge_attempts, + ) + self.challenges = async_to_raw_response_wrapper( + card_authentications.challenges, + ) + + +class CardAuthenticationsResourceWithStreamingResponse: + def __init__(self, card_authentications: CardAuthenticationsResource) -> None: + self._card_authentications = card_authentications + + self.create = to_streamed_response_wrapper( + card_authentications.create, + ) + self.challenge_attempts = to_streamed_response_wrapper( + card_authentications.challenge_attempts, + ) + self.challenges = to_streamed_response_wrapper( + card_authentications.challenges, + ) + + +class AsyncCardAuthenticationsResourceWithStreamingResponse: + def __init__(self, card_authentications: AsyncCardAuthenticationsResource) -> None: + self._card_authentications = card_authentications + + self.create = async_to_streamed_response_wrapper( + card_authentications.create, + ) + self.challenge_attempts = async_to_streamed_response_wrapper( + card_authentications.challenge_attempts, + ) + self.challenges = async_to_streamed_response_wrapper( + card_authentications.challenges, + ) diff --git a/src/increase/resources/simulations/card_authorization_expirations.py b/src/increase/resources/simulations/card_authorization_expirations.py new file mode 100644 index 000000000..9442f22bd --- /dev/null +++ b/src/increase/resources/simulations/card_authorization_expirations.py @@ -0,0 +1,187 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_authorization_expiration_create_params +from ...types.card_payment import CardPayment + +__all__ = ["CardAuthorizationExpirationsResource", "AsyncCardAuthorizationExpirationsResource"] + + +class CardAuthorizationExpirationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardAuthorizationExpirationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardAuthorizationExpirationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardAuthorizationExpirationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardAuthorizationExpirationsResourceWithStreamingResponse(self) + + def create( + self, + *, + card_payment_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates expiring a Card Authorization immediately. + + Args: + card_payment_id: The identifier of the Card Payment to expire. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_authorization_expirations", + body=maybe_transform( + {"card_payment_id": card_payment_id}, + card_authorization_expiration_create_params.CardAuthorizationExpirationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class AsyncCardAuthorizationExpirationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardAuthorizationExpirationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardAuthorizationExpirationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardAuthorizationExpirationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardAuthorizationExpirationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + card_payment_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates expiring a Card Authorization immediately. + + Args: + card_payment_id: The identifier of the Card Payment to expire. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_authorization_expirations", + body=await async_maybe_transform( + {"card_payment_id": card_payment_id}, + card_authorization_expiration_create_params.CardAuthorizationExpirationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class CardAuthorizationExpirationsResourceWithRawResponse: + def __init__(self, card_authorization_expirations: CardAuthorizationExpirationsResource) -> None: + self._card_authorization_expirations = card_authorization_expirations + + self.create = to_raw_response_wrapper( + card_authorization_expirations.create, + ) + + +class AsyncCardAuthorizationExpirationsResourceWithRawResponse: + def __init__(self, card_authorization_expirations: AsyncCardAuthorizationExpirationsResource) -> None: + self._card_authorization_expirations = card_authorization_expirations + + self.create = async_to_raw_response_wrapper( + card_authorization_expirations.create, + ) + + +class CardAuthorizationExpirationsResourceWithStreamingResponse: + def __init__(self, card_authorization_expirations: CardAuthorizationExpirationsResource) -> None: + self._card_authorization_expirations = card_authorization_expirations + + self.create = to_streamed_response_wrapper( + card_authorization_expirations.create, + ) + + +class AsyncCardAuthorizationExpirationsResourceWithStreamingResponse: + def __init__(self, card_authorization_expirations: AsyncCardAuthorizationExpirationsResource) -> None: + self._card_authorization_expirations = card_authorization_expirations + + self.create = async_to_streamed_response_wrapper( + card_authorization_expirations.create, + ) diff --git a/src/increase/resources/simulations/card_authorizations.py b/src/increase/resources/simulations/card_authorizations.py new file mode 100644 index 000000000..6c281fdeb --- /dev/null +++ b/src/increase/resources/simulations/card_authorizations.py @@ -0,0 +1,465 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_authorization_create_params +from ...types.simulations.card_authorization_create_response import CardAuthorizationCreateResponse + +__all__ = ["CardAuthorizationsResource", "AsyncCardAuthorizationsResource"] + + +class CardAuthorizationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardAuthorizationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardAuthorizationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardAuthorizationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardAuthorizationsResourceWithStreamingResponse(self) + + def create( + self, + *, + amount: int, + authenticated_card_payment_id: str | Omit = omit, + card_id: str | Omit = omit, + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + | Omit = omit, + digital_wallet_token_id: str | Omit = omit, + event_subscription_id: str | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_city: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_descriptor: str | Omit = omit, + merchant_state: str | Omit = omit, + network_details: card_authorization_create_params.NetworkDetails | Omit = omit, + network_risk_score: int | Omit = omit, + physical_card_id: str | Omit = omit, + processing_category: card_authorization_create_params.ProcessingCategory | Omit = omit, + terminal_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardAuthorizationCreateResponse: + """Simulates a purchase authorization on a [Card](#cards). + + Depending on the balance + available to the card and the `amount` submitted, the authorization activity + will result in a [Pending Transaction](#pending-transactions) of type + `card_authorization` or a [Declined Transaction](#declined-transactions) of type + `card_decline`. You can pass either a Card id or a + [Digital Wallet Token](#digital-wallet-tokens) id to simulate the two different + ways purchases can be made. + + Args: + amount: The authorization amount in cents. + + authenticated_card_payment_id: The identifier of a Card Payment with a `card_authentication` if you want to + simulate an authenticated authorization. + + card_id: The identifier of the Card to be authorized. + + decline_reason: Forces a card decline with a specific reason. No real time decision will be + sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + + digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_city: The city the merchant resides in. + + merchant_country: The country the merchant resides in. + + merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. + + merchant_state: The state the merchant resides in. + + network_details: Fields specific to a given card network. + + network_risk_score: The risk score generated by the card network. For Visa this is the Visa Advanced + Authorization risk score, from 0 to 99, where 99 is the riskiest. + + physical_card_id: The identifier of the Physical Card to be authorized. + + processing_category: Fields specific to a specific type of authorization, such as Automatic Fuel + Dispensers, Refund Authorizations, or Cash Disbursements. + + terminal_id: The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_authorizations", + body=maybe_transform( + { + "amount": amount, + "authenticated_card_payment_id": authenticated_card_payment_id, + "card_id": card_id, + "decline_reason": decline_reason, + "digital_wallet_token_id": digital_wallet_token_id, + "event_subscription_id": event_subscription_id, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_city": merchant_city, + "merchant_country": merchant_country, + "merchant_descriptor": merchant_descriptor, + "merchant_state": merchant_state, + "network_details": network_details, + "network_risk_score": network_risk_score, + "physical_card_id": physical_card_id, + "processing_category": processing_category, + "terminal_id": terminal_id, + }, + card_authorization_create_params.CardAuthorizationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardAuthorizationCreateResponse, + ) + + +class AsyncCardAuthorizationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardAuthorizationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardAuthorizationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardAuthorizationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardAuthorizationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + amount: int, + authenticated_card_payment_id: str | Omit = omit, + card_id: str | Omit = omit, + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + | Omit = omit, + digital_wallet_token_id: str | Omit = omit, + event_subscription_id: str | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_city: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_descriptor: str | Omit = omit, + merchant_state: str | Omit = omit, + network_details: card_authorization_create_params.NetworkDetails | Omit = omit, + network_risk_score: int | Omit = omit, + physical_card_id: str | Omit = omit, + processing_category: card_authorization_create_params.ProcessingCategory | Omit = omit, + terminal_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardAuthorizationCreateResponse: + """Simulates a purchase authorization on a [Card](#cards). + + Depending on the balance + available to the card and the `amount` submitted, the authorization activity + will result in a [Pending Transaction](#pending-transactions) of type + `card_authorization` or a [Declined Transaction](#declined-transactions) of type + `card_decline`. You can pass either a Card id or a + [Digital Wallet Token](#digital-wallet-tokens) id to simulate the two different + ways purchases can be made. + + Args: + amount: The authorization amount in cents. + + authenticated_card_payment_id: The identifier of a Card Payment with a `card_authentication` if you want to + simulate an authenticated authorization. + + card_id: The identifier of the Card to be authorized. + + decline_reason: Forces a card decline with a specific reason. No real time decision will be + sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + + digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_city: The city the merchant resides in. + + merchant_country: The country the merchant resides in. + + merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. + + merchant_state: The state the merchant resides in. + + network_details: Fields specific to a given card network. + + network_risk_score: The risk score generated by the card network. For Visa this is the Visa Advanced + Authorization risk score, from 0 to 99, where 99 is the riskiest. + + physical_card_id: The identifier of the Physical Card to be authorized. + + processing_category: Fields specific to a specific type of authorization, such as Automatic Fuel + Dispensers, Refund Authorizations, or Cash Disbursements. + + terminal_id: The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_authorizations", + body=await async_maybe_transform( + { + "amount": amount, + "authenticated_card_payment_id": authenticated_card_payment_id, + "card_id": card_id, + "decline_reason": decline_reason, + "digital_wallet_token_id": digital_wallet_token_id, + "event_subscription_id": event_subscription_id, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_city": merchant_city, + "merchant_country": merchant_country, + "merchant_descriptor": merchant_descriptor, + "merchant_state": merchant_state, + "network_details": network_details, + "network_risk_score": network_risk_score, + "physical_card_id": physical_card_id, + "processing_category": processing_category, + "terminal_id": terminal_id, + }, + card_authorization_create_params.CardAuthorizationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardAuthorizationCreateResponse, + ) + + +class CardAuthorizationsResourceWithRawResponse: + def __init__(self, card_authorizations: CardAuthorizationsResource) -> None: + self._card_authorizations = card_authorizations + + self.create = to_raw_response_wrapper( + card_authorizations.create, + ) + + +class AsyncCardAuthorizationsResourceWithRawResponse: + def __init__(self, card_authorizations: AsyncCardAuthorizationsResource) -> None: + self._card_authorizations = card_authorizations + + self.create = async_to_raw_response_wrapper( + card_authorizations.create, + ) + + +class CardAuthorizationsResourceWithStreamingResponse: + def __init__(self, card_authorizations: CardAuthorizationsResource) -> None: + self._card_authorizations = card_authorizations + + self.create = to_streamed_response_wrapper( + card_authorizations.create, + ) + + +class AsyncCardAuthorizationsResourceWithStreamingResponse: + def __init__(self, card_authorizations: AsyncCardAuthorizationsResource) -> None: + self._card_authorizations = card_authorizations + + self.create = async_to_streamed_response_wrapper( + card_authorizations.create, + ) diff --git a/src/increase/resources/simulations/card_balance_inquiries.py b/src/increase/resources/simulations/card_balance_inquiries.py new file mode 100644 index 000000000..a7541cb66 --- /dev/null +++ b/src/increase/resources/simulations/card_balance_inquiries.py @@ -0,0 +1,431 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_balance_inquiry_create_params +from ...types.card_payment import CardPayment + +__all__ = ["CardBalanceInquiriesResource", "AsyncCardBalanceInquiriesResource"] + + +class CardBalanceInquiriesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardBalanceInquiriesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardBalanceInquiriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardBalanceInquiriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardBalanceInquiriesResourceWithStreamingResponse(self) + + def create( + self, + *, + balance: int | Omit = omit, + card_id: str | Omit = omit, + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + | Omit = omit, + digital_wallet_token_id: str | Omit = omit, + event_subscription_id: str | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_city: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_descriptor: str | Omit = omit, + merchant_state: str | Omit = omit, + network_details: card_balance_inquiry_create_params.NetworkDetails | Omit = omit, + network_risk_score: int | Omit = omit, + physical_card_id: str | Omit = omit, + terminal_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates a balance inquiry on a [Card](#cards). + + Args: + balance: The balance amount in cents. The account balance will be used if not provided. + + card_id: The identifier of the Card to be authorized. + + decline_reason: Forces a card decline with a specific reason. No real time decision will be + sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + + digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_city: The city the merchant resides in. + + merchant_country: The country the merchant resides in. + + merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. + + merchant_state: The state the merchant resides in. + + network_details: Fields specific to a given card network. + + network_risk_score: The risk score generated by the card network. For Visa this is the Visa Advanced + Authorization risk score, from 0 to 99, where 99 is the riskiest. + + physical_card_id: The identifier of the Physical Card to be authorized. + + terminal_id: The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_balance_inquiries", + body=maybe_transform( + { + "balance": balance, + "card_id": card_id, + "decline_reason": decline_reason, + "digital_wallet_token_id": digital_wallet_token_id, + "event_subscription_id": event_subscription_id, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_city": merchant_city, + "merchant_country": merchant_country, + "merchant_descriptor": merchant_descriptor, + "merchant_state": merchant_state, + "network_details": network_details, + "network_risk_score": network_risk_score, + "physical_card_id": physical_card_id, + "terminal_id": terminal_id, + }, + card_balance_inquiry_create_params.CardBalanceInquiryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class AsyncCardBalanceInquiriesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardBalanceInquiriesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardBalanceInquiriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardBalanceInquiriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardBalanceInquiriesResourceWithStreamingResponse(self) + + async def create( + self, + *, + balance: int | Omit = omit, + card_id: str | Omit = omit, + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + | Omit = omit, + digital_wallet_token_id: str | Omit = omit, + event_subscription_id: str | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_city: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_descriptor: str | Omit = omit, + merchant_state: str | Omit = omit, + network_details: card_balance_inquiry_create_params.NetworkDetails | Omit = omit, + network_risk_score: int | Omit = omit, + physical_card_id: str | Omit = omit, + terminal_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates a balance inquiry on a [Card](#cards). + + Args: + balance: The balance amount in cents. The account balance will be used if not provided. + + card_id: The identifier of the Card to be authorized. + + decline_reason: Forces a card decline with a specific reason. No real time decision will be + sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + + digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_city: The city the merchant resides in. + + merchant_country: The country the merchant resides in. + + merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. + + merchant_state: The state the merchant resides in. + + network_details: Fields specific to a given card network. + + network_risk_score: The risk score generated by the card network. For Visa this is the Visa Advanced + Authorization risk score, from 0 to 99, where 99 is the riskiest. + + physical_card_id: The identifier of the Physical Card to be authorized. + + terminal_id: The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_balance_inquiries", + body=await async_maybe_transform( + { + "balance": balance, + "card_id": card_id, + "decline_reason": decline_reason, + "digital_wallet_token_id": digital_wallet_token_id, + "event_subscription_id": event_subscription_id, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_city": merchant_city, + "merchant_country": merchant_country, + "merchant_descriptor": merchant_descriptor, + "merchant_state": merchant_state, + "network_details": network_details, + "network_risk_score": network_risk_score, + "physical_card_id": physical_card_id, + "terminal_id": terminal_id, + }, + card_balance_inquiry_create_params.CardBalanceInquiryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class CardBalanceInquiriesResourceWithRawResponse: + def __init__(self, card_balance_inquiries: CardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = to_raw_response_wrapper( + card_balance_inquiries.create, + ) + + +class AsyncCardBalanceInquiriesResourceWithRawResponse: + def __init__(self, card_balance_inquiries: AsyncCardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = async_to_raw_response_wrapper( + card_balance_inquiries.create, + ) + + +class CardBalanceInquiriesResourceWithStreamingResponse: + def __init__(self, card_balance_inquiries: CardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = to_streamed_response_wrapper( + card_balance_inquiries.create, + ) + + +class AsyncCardBalanceInquiriesResourceWithStreamingResponse: + def __init__(self, card_balance_inquiries: AsyncCardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = async_to_streamed_response_wrapper( + card_balance_inquiries.create, + ) diff --git a/src/increase/resources/simulations/card_disputes.py b/src/increase/resources/simulations/card_disputes.py index 3b4c26c0e..e4c09ed56 100644 --- a/src/increase/resources/simulations/card_disputes.py +++ b/src/increase/resources/simulations/card_disputes.py @@ -6,63 +6,73 @@ import httpx -from ... import _legacy_response -from ...types import CardDispute -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options from ...types.simulations import card_dispute_action_params +from ...types.card_dispute import CardDispute -__all__ = ["CardDisputes", "AsyncCardDisputes"] +__all__ = ["CardDisputesResource", "AsyncCardDisputesResource"] -class CardDisputes(SyncAPIResource): +class CardDisputesResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CardDisputesWithRawResponse: - return CardDisputesWithRawResponse(self) + def with_raw_response(self) -> CardDisputesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardDisputesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CardDisputesWithStreamingResponse: - return CardDisputesWithStreamingResponse(self) + def with_streaming_response(self) -> CardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardDisputesResourceWithStreamingResponse(self) def action( self, card_dispute_id: str, *, - status: Literal["accepted", "rejected"], - explanation: str | NotGiven = NOT_GIVEN, + network: Literal["visa"], + visa: card_dispute_action_params.Visa | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CardDispute: """ After a [Card Dispute](#card-disputes) is created in production, the dispute - will be reviewed. Since no review happens in sandbox, this endpoint simulates - moving a Card Dispute into a rejected or accepted state. A Card Dispute can only - be actioned one time and must have a status of `pending_reviewing`. + will initially be in a `pending_user_submission_reviewing` state. Since no + review or further action happens in sandbox, this endpoint simulates moving a + Card Dispute through its various states. Args: card_dispute_id: The dispute you would like to action. - status: The status to move the dispute to. + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. - - `accepted` - The Card Dispute has been accepted and your funds have been - returned. - - `rejected` - The Card Dispute has been rejected. + - `visa` - Visa - explanation: Why the dispute was rejected. Not required for accepting disputes. + visa: The Visa-specific parameters for the taking action on the dispute. Required if + and only if `network` is `visa`. extra_headers: Send extra headers @@ -77,11 +87,11 @@ def action( if not card_dispute_id: raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") return self._post( - f"/simulations/card_disputes/{card_dispute_id}/action", + path_template("/simulations/card_disputes/{card_dispute_id}/action", card_dispute_id=card_dispute_id), body=maybe_transform( { - "status": status, - "explanation": explanation, + "network": network, + "visa": visa, }, card_dispute_action_params.CardDisputeActionParams, ), @@ -96,45 +106,56 @@ def action( ) -class AsyncCardDisputes(AsyncAPIResource): +class AsyncCardDisputesResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCardDisputesWithRawResponse: - return AsyncCardDisputesWithRawResponse(self) + def with_raw_response(self) -> AsyncCardDisputesResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardDisputesResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCardDisputesWithStreamingResponse: - return AsyncCardDisputesWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardDisputesResourceWithStreamingResponse(self) async def action( self, card_dispute_id: str, *, - status: Literal["accepted", "rejected"], - explanation: str | NotGiven = NOT_GIVEN, + network: Literal["visa"], + visa: card_dispute_action_params.Visa | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CardDispute: """ After a [Card Dispute](#card-disputes) is created in production, the dispute - will be reviewed. Since no review happens in sandbox, this endpoint simulates - moving a Card Dispute into a rejected or accepted state. A Card Dispute can only - be actioned one time and must have a status of `pending_reviewing`. + will initially be in a `pending_user_submission_reviewing` state. Since no + review or further action happens in sandbox, this endpoint simulates moving a + Card Dispute through its various states. Args: card_dispute_id: The dispute you would like to action. - status: The status to move the dispute to. + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. - - `accepted` - The Card Dispute has been accepted and your funds have been - returned. - - `rejected` - The Card Dispute has been rejected. + - `visa` - Visa - explanation: Why the dispute was rejected. Not required for accepting disputes. + visa: The Visa-specific parameters for the taking action on the dispute. Required if + and only if `network` is `visa`. extra_headers: Send extra headers @@ -149,11 +170,11 @@ async def action( if not card_dispute_id: raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") return await self._post( - f"/simulations/card_disputes/{card_dispute_id}/action", + path_template("/simulations/card_disputes/{card_dispute_id}/action", card_dispute_id=card_dispute_id), body=await async_maybe_transform( { - "status": status, - "explanation": explanation, + "network": network, + "visa": visa, }, card_dispute_action_params.CardDisputeActionParams, ), @@ -168,26 +189,26 @@ async def action( ) -class CardDisputesWithRawResponse: - def __init__(self, card_disputes: CardDisputes) -> None: +class CardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: self._card_disputes = card_disputes - self.action = _legacy_response.to_raw_response_wrapper( + self.action = to_raw_response_wrapper( card_disputes.action, ) -class AsyncCardDisputesWithRawResponse: - def __init__(self, card_disputes: AsyncCardDisputes) -> None: +class AsyncCardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: self._card_disputes = card_disputes - self.action = _legacy_response.async_to_raw_response_wrapper( + self.action = async_to_raw_response_wrapper( card_disputes.action, ) -class CardDisputesWithStreamingResponse: - def __init__(self, card_disputes: CardDisputes) -> None: +class CardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: self._card_disputes = card_disputes self.action = to_streamed_response_wrapper( @@ -195,8 +216,8 @@ def __init__(self, card_disputes: CardDisputes) -> None: ) -class AsyncCardDisputesWithStreamingResponse: - def __init__(self, card_disputes: AsyncCardDisputes) -> None: +class AsyncCardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: self._card_disputes = card_disputes self.action = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/card_fuel_confirmations.py b/src/increase/resources/simulations/card_fuel_confirmations.py new file mode 100644 index 000000000..6477b2746 --- /dev/null +++ b/src/increase/resources/simulations/card_fuel_confirmations.py @@ -0,0 +1,207 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_fuel_confirmation_create_params +from ...types.card_payment import CardPayment + +__all__ = ["CardFuelConfirmationsResource", "AsyncCardFuelConfirmationsResource"] + + +class CardFuelConfirmationsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardFuelConfirmationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardFuelConfirmationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardFuelConfirmationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardFuelConfirmationsResourceWithStreamingResponse(self) + + def create( + self, + *, + amount: int, + card_payment_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates the fuel confirmation of an authorization by a card acquirer. + + This + happens asynchronously right after a fuel pump transaction is completed. A fuel + confirmation can only happen once per authorization. + + Args: + amount: The amount of the fuel_confirmation in minor units in the card authorization's + currency. + + card_payment_id: The identifier of the Card Payment to create a fuel_confirmation on. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_fuel_confirmations", + body=maybe_transform( + { + "amount": amount, + "card_payment_id": card_payment_id, + }, + card_fuel_confirmation_create_params.CardFuelConfirmationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class AsyncCardFuelConfirmationsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardFuelConfirmationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardFuelConfirmationsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardFuelConfirmationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardFuelConfirmationsResourceWithStreamingResponse(self) + + async def create( + self, + *, + amount: int, + card_payment_id: str, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates the fuel confirmation of an authorization by a card acquirer. + + This + happens asynchronously right after a fuel pump transaction is completed. A fuel + confirmation can only happen once per authorization. + + Args: + amount: The amount of the fuel_confirmation in minor units in the card authorization's + currency. + + card_payment_id: The identifier of the Card Payment to create a fuel_confirmation on. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_fuel_confirmations", + body=await async_maybe_transform( + { + "amount": amount, + "card_payment_id": card_payment_id, + }, + card_fuel_confirmation_create_params.CardFuelConfirmationCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class CardFuelConfirmationsResourceWithRawResponse: + def __init__(self, card_fuel_confirmations: CardFuelConfirmationsResource) -> None: + self._card_fuel_confirmations = card_fuel_confirmations + + self.create = to_raw_response_wrapper( + card_fuel_confirmations.create, + ) + + +class AsyncCardFuelConfirmationsResourceWithRawResponse: + def __init__(self, card_fuel_confirmations: AsyncCardFuelConfirmationsResource) -> None: + self._card_fuel_confirmations = card_fuel_confirmations + + self.create = async_to_raw_response_wrapper( + card_fuel_confirmations.create, + ) + + +class CardFuelConfirmationsResourceWithStreamingResponse: + def __init__(self, card_fuel_confirmations: CardFuelConfirmationsResource) -> None: + self._card_fuel_confirmations = card_fuel_confirmations + + self.create = to_streamed_response_wrapper( + card_fuel_confirmations.create, + ) + + +class AsyncCardFuelConfirmationsResourceWithStreamingResponse: + def __init__(self, card_fuel_confirmations: AsyncCardFuelConfirmationsResource) -> None: + self._card_fuel_confirmations = card_fuel_confirmations + + self.create = async_to_streamed_response_wrapper( + card_fuel_confirmations.create, + ) diff --git a/src/increase/resources/simulations/card_increments.py b/src/increase/resources/simulations/card_increments.py new file mode 100644 index 000000000..b89372e8c --- /dev/null +++ b/src/increase/resources/simulations/card_increments.py @@ -0,0 +1,217 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_increment_create_params +from ...types.card_payment import CardPayment + +__all__ = ["CardIncrementsResource", "AsyncCardIncrementsResource"] + + +class CardIncrementsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardIncrementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardIncrementsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardIncrementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardIncrementsResourceWithStreamingResponse(self) + + def create( + self, + *, + amount: int, + card_payment_id: str, + event_subscription_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates the increment of an authorization by a card acquirer. + + An authorization + can be incremented multiple times. + + Args: + amount: The amount of the increment in minor units in the card authorization's currency. + + card_payment_id: The identifier of the Card Payment to create an increment on. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_increments", + body=maybe_transform( + { + "amount": amount, + "card_payment_id": card_payment_id, + "event_subscription_id": event_subscription_id, + }, + card_increment_create_params.CardIncrementCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class AsyncCardIncrementsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardIncrementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardIncrementsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardIncrementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardIncrementsResourceWithStreamingResponse(self) + + async def create( + self, + *, + amount: int, + card_payment_id: str, + event_subscription_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates the increment of an authorization by a card acquirer. + + An authorization + can be incremented multiple times. + + Args: + amount: The amount of the increment in minor units in the card authorization's currency. + + card_payment_id: The identifier of the Card Payment to create an increment on. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_increments", + body=await async_maybe_transform( + { + "amount": amount, + "card_payment_id": card_payment_id, + "event_subscription_id": event_subscription_id, + }, + card_increment_create_params.CardIncrementCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class CardIncrementsResourceWithRawResponse: + def __init__(self, card_increments: CardIncrementsResource) -> None: + self._card_increments = card_increments + + self.create = to_raw_response_wrapper( + card_increments.create, + ) + + +class AsyncCardIncrementsResourceWithRawResponse: + def __init__(self, card_increments: AsyncCardIncrementsResource) -> None: + self._card_increments = card_increments + + self.create = async_to_raw_response_wrapper( + card_increments.create, + ) + + +class CardIncrementsResourceWithStreamingResponse: + def __init__(self, card_increments: CardIncrementsResource) -> None: + self._card_increments = card_increments + + self.create = to_streamed_response_wrapper( + card_increments.create, + ) + + +class AsyncCardIncrementsResourceWithStreamingResponse: + def __init__(self, card_increments: AsyncCardIncrementsResource) -> None: + self._card_increments = card_increments + + self.create = async_to_streamed_response_wrapper( + card_increments.create, + ) diff --git a/src/increase/resources/simulations/card_refunds.py b/src/increase/resources/simulations/card_refunds.py index 4e32c21ee..cf9fa8569 100644 --- a/src/increase/resources/simulations/card_refunds.py +++ b/src/increase/resources/simulations/card_refunds.py @@ -4,43 +4,55 @@ import httpx -from ... import _legacy_response -from ...types import Transaction -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options from ...types.simulations import card_refund_create_params +from ...types.transaction import Transaction -__all__ = ["CardRefunds", "AsyncCardRefunds"] +__all__ = ["CardRefundsResource", "AsyncCardRefundsResource"] -class CardRefunds(SyncAPIResource): +class CardRefundsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CardRefundsWithRawResponse: - return CardRefundsWithRawResponse(self) + def with_raw_response(self) -> CardRefundsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardRefundsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CardRefundsWithStreamingResponse: - return CardRefundsWithStreamingResponse(self) + def with_streaming_response(self) -> CardRefundsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardRefundsResourceWithStreamingResponse(self) def create( self, *, - transaction_id: str, + amount: int | Omit = omit, + pending_transaction_id: str | Omit = omit, + transaction_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Transaction: """Simulates refunding a card transaction. @@ -49,6 +61,13 @@ def create( transaction is refunded. Args: + amount: The refund amount in cents. Pulled off the `pending_transaction` or the + `transaction` if not provided. + + pending_transaction_id: The identifier of the Pending Transaction for the refund authorization. If this + is provided, `transaction` must not be provided as a refund with a refund + authorized can not be linked to a regular transaction. + transaction_id: The identifier for the Transaction to refund. The Transaction's source must have a category of card_settlement. @@ -64,7 +83,14 @@ def create( """ return self._post( "/simulations/card_refunds", - body=maybe_transform({"transaction_id": transaction_id}, card_refund_create_params.CardRefundCreateParams), + body=maybe_transform( + { + "amount": amount, + "pending_transaction_id": pending_transaction_id, + "transaction_id": transaction_id, + }, + card_refund_create_params.CardRefundCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -76,25 +102,38 @@ def create( ) -class AsyncCardRefunds(AsyncAPIResource): +class AsyncCardRefundsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCardRefundsWithRawResponse: - return AsyncCardRefundsWithRawResponse(self) + def with_raw_response(self) -> AsyncCardRefundsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardRefundsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCardRefundsWithStreamingResponse: - return AsyncCardRefundsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCardRefundsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardRefundsResourceWithStreamingResponse(self) async def create( self, *, - transaction_id: str, + amount: int | Omit = omit, + pending_transaction_id: str | Omit = omit, + transaction_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Transaction: """Simulates refunding a card transaction. @@ -103,6 +142,13 @@ async def create( transaction is refunded. Args: + amount: The refund amount in cents. Pulled off the `pending_transaction` or the + `transaction` if not provided. + + pending_transaction_id: The identifier of the Pending Transaction for the refund authorization. If this + is provided, `transaction` must not be provided as a refund with a refund + authorized can not be linked to a regular transaction. + transaction_id: The identifier for the Transaction to refund. The Transaction's source must have a category of card_settlement. @@ -119,7 +165,12 @@ async def create( return await self._post( "/simulations/card_refunds", body=await async_maybe_transform( - {"transaction_id": transaction_id}, card_refund_create_params.CardRefundCreateParams + { + "amount": amount, + "pending_transaction_id": pending_transaction_id, + "transaction_id": transaction_id, + }, + card_refund_create_params.CardRefundCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -132,26 +183,26 @@ async def create( ) -class CardRefundsWithRawResponse: - def __init__(self, card_refunds: CardRefunds) -> None: +class CardRefundsResourceWithRawResponse: + def __init__(self, card_refunds: CardRefundsResource) -> None: self._card_refunds = card_refunds - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( card_refunds.create, ) -class AsyncCardRefundsWithRawResponse: - def __init__(self, card_refunds: AsyncCardRefunds) -> None: +class AsyncCardRefundsResourceWithRawResponse: + def __init__(self, card_refunds: AsyncCardRefundsResource) -> None: self._card_refunds = card_refunds - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( card_refunds.create, ) -class CardRefundsWithStreamingResponse: - def __init__(self, card_refunds: CardRefunds) -> None: +class CardRefundsResourceWithStreamingResponse: + def __init__(self, card_refunds: CardRefundsResource) -> None: self._card_refunds = card_refunds self.create = to_streamed_response_wrapper( @@ -159,8 +210,8 @@ def __init__(self, card_refunds: CardRefunds) -> None: ) -class AsyncCardRefundsWithStreamingResponse: - def __init__(self, card_refunds: AsyncCardRefunds) -> None: +class AsyncCardRefundsResourceWithStreamingResponse: + def __init__(self, card_refunds: AsyncCardRefundsResource) -> None: self._card_refunds = card_refunds self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/card_reversals.py b/src/increase/resources/simulations/card_reversals.py new file mode 100644 index 000000000..7224c6c2c --- /dev/null +++ b/src/increase/resources/simulations/card_reversals.py @@ -0,0 +1,209 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_reversal_create_params +from ...types.card_payment import CardPayment + +__all__ = ["CardReversalsResource", "AsyncCardReversalsResource"] + + +class CardReversalsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardReversalsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardReversalsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardReversalsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardReversalsResourceWithStreamingResponse(self) + + def create( + self, + *, + card_payment_id: str, + amount: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates the reversal of an authorization by a card acquirer. + + An authorization + can be partially reversed multiple times, up until the total authorized amount. + Marks the pending transaction as complete if the authorization is fully + reversed. + + Args: + card_payment_id: The identifier of the Card Payment to create a reversal on. + + amount: The amount of the reversal in minor units in the card authorization's currency. + This defaults to the authorization amount. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_reversals", + body=maybe_transform( + { + "card_payment_id": card_payment_id, + "amount": amount, + }, + card_reversal_create_params.CardReversalCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class AsyncCardReversalsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardReversalsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardReversalsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardReversalsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardReversalsResourceWithStreamingResponse(self) + + async def create( + self, + *, + card_payment_id: str, + amount: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """Simulates the reversal of an authorization by a card acquirer. + + An authorization + can be partially reversed multiple times, up until the total authorized amount. + Marks the pending transaction as complete if the authorization is fully + reversed. + + Args: + card_payment_id: The identifier of the Card Payment to create a reversal on. + + amount: The amount of the reversal in minor units in the card authorization's currency. + This defaults to the authorization amount. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_reversals", + body=await async_maybe_transform( + { + "card_payment_id": card_payment_id, + "amount": amount, + }, + card_reversal_create_params.CardReversalCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class CardReversalsResourceWithRawResponse: + def __init__(self, card_reversals: CardReversalsResource) -> None: + self._card_reversals = card_reversals + + self.create = to_raw_response_wrapper( + card_reversals.create, + ) + + +class AsyncCardReversalsResourceWithRawResponse: + def __init__(self, card_reversals: AsyncCardReversalsResource) -> None: + self._card_reversals = card_reversals + + self.create = async_to_raw_response_wrapper( + card_reversals.create, + ) + + +class CardReversalsResourceWithStreamingResponse: + def __init__(self, card_reversals: CardReversalsResource) -> None: + self._card_reversals = card_reversals + + self.create = to_streamed_response_wrapper( + card_reversals.create, + ) + + +class AsyncCardReversalsResourceWithStreamingResponse: + def __init__(self, card_reversals: AsyncCardReversalsResource) -> None: + self._card_reversals = card_reversals + + self.create = async_to_streamed_response_wrapper( + card_reversals.create, + ) diff --git a/src/increase/resources/simulations/card_settlements.py b/src/increase/resources/simulations/card_settlements.py new file mode 100644 index 000000000..de0c38637 --- /dev/null +++ b/src/increase/resources/simulations/card_settlements.py @@ -0,0 +1,221 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_settlement_create_params +from ...types.transaction import Transaction + +__all__ = ["CardSettlementsResource", "AsyncCardSettlementsResource"] + + +class CardSettlementsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardSettlementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardSettlementsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardSettlementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardSettlementsResourceWithStreamingResponse(self) + + def create( + self, + *, + card_id: str, + pending_transaction_id: str, + amount: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Transaction: + """Simulates the settlement of an authorization by a card acquirer. + + After a card + authorization is created, the merchant will eventually send a settlement. This + simulates that event, which may occur many days after the purchase in + production. The amount settled can be different from the amount originally + authorized, for example, when adding a tip to a restaurant bill. + + Args: + card_id: The identifier of the Card to create a settlement on. + + pending_transaction_id: The identifier of the Pending Transaction for the Card Authorization you wish to + settle. + + amount: The amount to be settled. This defaults to the amount of the Pending Transaction + being settled. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_settlements", + body=maybe_transform( + { + "card_id": card_id, + "pending_transaction_id": pending_transaction_id, + "amount": amount, + }, + card_settlement_create_params.CardSettlementCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Transaction, + ) + + +class AsyncCardSettlementsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardSettlementsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardSettlementsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardSettlementsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardSettlementsResourceWithStreamingResponse(self) + + async def create( + self, + *, + card_id: str, + pending_transaction_id: str, + amount: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Transaction: + """Simulates the settlement of an authorization by a card acquirer. + + After a card + authorization is created, the merchant will eventually send a settlement. This + simulates that event, which may occur many days after the purchase in + production. The amount settled can be different from the amount originally + authorized, for example, when adding a tip to a restaurant bill. + + Args: + card_id: The identifier of the Card to create a settlement on. + + pending_transaction_id: The identifier of the Pending Transaction for the Card Authorization you wish to + settle. + + amount: The amount to be settled. This defaults to the amount of the Pending Transaction + being settled. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_settlements", + body=await async_maybe_transform( + { + "card_id": card_id, + "pending_transaction_id": pending_transaction_id, + "amount": amount, + }, + card_settlement_create_params.CardSettlementCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Transaction, + ) + + +class CardSettlementsResourceWithRawResponse: + def __init__(self, card_settlements: CardSettlementsResource) -> None: + self._card_settlements = card_settlements + + self.create = to_raw_response_wrapper( + card_settlements.create, + ) + + +class AsyncCardSettlementsResourceWithRawResponse: + def __init__(self, card_settlements: AsyncCardSettlementsResource) -> None: + self._card_settlements = card_settlements + + self.create = async_to_raw_response_wrapper( + card_settlements.create, + ) + + +class CardSettlementsResourceWithStreamingResponse: + def __init__(self, card_settlements: CardSettlementsResource) -> None: + self._card_settlements = card_settlements + + self.create = to_streamed_response_wrapper( + card_settlements.create, + ) + + +class AsyncCardSettlementsResourceWithStreamingResponse: + def __init__(self, card_settlements: AsyncCardSettlementsResource) -> None: + self._card_settlements = card_settlements + + self.create = async_to_streamed_response_wrapper( + card_settlements.create, + ) diff --git a/src/increase/resources/simulations/card_tokens.py b/src/increase/resources/simulations/card_tokens.py new file mode 100644 index 000000000..758640cdc --- /dev/null +++ b/src/increase/resources/simulations/card_tokens.py @@ -0,0 +1,234 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.card_token import CardToken +from ...types.simulations import card_token_create_params + +__all__ = ["CardTokensResource", "AsyncCardTokensResource"] + + +class CardTokensResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardTokensResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardTokensResourceWithStreamingResponse(self) + + def create( + self, + *, + capabilities: Iterable[card_token_create_params.Capability] | Omit = omit, + expiration: Union[str, date] | Omit = omit, + last4: str | Omit = omit, + outcome: card_token_create_params.Outcome | Omit = omit, + prefix: str | Omit = omit, + primary_account_number_length: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardToken: + """ + Simulates tokenizing a card in the sandbox environment. + + Args: + capabilities: The capabilities of the outbound card token. + + expiration: The expiration date of the card. + + last4: The last 4 digits of the card number. + + outcome: The outcome to simulate for card push transfers using this token. + + prefix: The prefix of the card number, usually the first 8 digits. + + primary_account_number_length: The total length of the card number, including prefix and last4. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_tokens", + body=maybe_transform( + { + "capabilities": capabilities, + "expiration": expiration, + "last4": last4, + "outcome": outcome, + "prefix": prefix, + "primary_account_number_length": primary_account_number_length, + }, + card_token_create_params.CardTokenCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardToken, + ) + + +class AsyncCardTokensResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardTokensResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardTokensResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardTokensResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardTokensResourceWithStreamingResponse(self) + + async def create( + self, + *, + capabilities: Iterable[card_token_create_params.Capability] | Omit = omit, + expiration: Union[str, date] | Omit = omit, + last4: str | Omit = omit, + outcome: card_token_create_params.Outcome | Omit = omit, + prefix: str | Omit = omit, + primary_account_number_length: int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardToken: + """ + Simulates tokenizing a card in the sandbox environment. + + Args: + capabilities: The capabilities of the outbound card token. + + expiration: The expiration date of the card. + + last4: The last 4 digits of the card number. + + outcome: The outcome to simulate for card push transfers using this token. + + prefix: The prefix of the card number, usually the first 8 digits. + + primary_account_number_length: The total length of the card number, including prefix and last4. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_tokens", + body=await async_maybe_transform( + { + "capabilities": capabilities, + "expiration": expiration, + "last4": last4, + "outcome": outcome, + "prefix": prefix, + "primary_account_number_length": primary_account_number_length, + }, + card_token_create_params.CardTokenCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardToken, + ) + + +class CardTokensResourceWithRawResponse: + def __init__(self, card_tokens: CardTokensResource) -> None: + self._card_tokens = card_tokens + + self.create = to_raw_response_wrapper( + card_tokens.create, + ) + + +class AsyncCardTokensResourceWithRawResponse: + def __init__(self, card_tokens: AsyncCardTokensResource) -> None: + self._card_tokens = card_tokens + + self.create = async_to_raw_response_wrapper( + card_tokens.create, + ) + + +class CardTokensResourceWithStreamingResponse: + def __init__(self, card_tokens: CardTokensResource) -> None: + self._card_tokens = card_tokens + + self.create = to_streamed_response_wrapper( + card_tokens.create, + ) + + +class AsyncCardTokensResourceWithStreamingResponse: + def __init__(self, card_tokens: AsyncCardTokensResource) -> None: + self._card_tokens = card_tokens + + self.create = async_to_streamed_response_wrapper( + card_tokens.create, + ) diff --git a/src/increase/resources/simulations/cards.py b/src/increase/resources/simulations/cards.py deleted file mode 100644 index 27ca9cb8e..000000000 --- a/src/increase/resources/simulations/cards.py +++ /dev/null @@ -1,400 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ... import _legacy_response -from ...types import Transaction -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) -from ...types.simulations import CardAuthorizationSimulation, card_authorize_params, card_settlement_params - -__all__ = ["Cards", "AsyncCards"] - - -class Cards(SyncAPIResource): - @cached_property - def with_raw_response(self) -> CardsWithRawResponse: - return CardsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CardsWithStreamingResponse: - return CardsWithStreamingResponse(self) - - def authorize( - self, - *, - amount: int, - card_id: str | NotGiven = NOT_GIVEN, - digital_wallet_token_id: str | NotGiven = NOT_GIVEN, - event_subscription_id: str | NotGiven = NOT_GIVEN, - merchant_acceptor_id: str | NotGiven = NOT_GIVEN, - merchant_category_code: str | NotGiven = NOT_GIVEN, - merchant_city: str | NotGiven = NOT_GIVEN, - merchant_country: str | NotGiven = NOT_GIVEN, - merchant_descriptor: str | NotGiven = NOT_GIVEN, - physical_card_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardAuthorizationSimulation: - """Simulates a purchase authorization on a [Card](#cards). - - Depending on the balance - available to the card and the `amount` submitted, the authorization activity - will result in a [Pending Transaction](#pending-transactions) of type - `card_authorization` or a [Declined Transaction](#declined-transactions) of type - `card_decline`. You can pass either a Card id or a - [Digital Wallet Token](#digital-wallet-tokens) id to simulate the two different - ways purchases can be made. - - Args: - amount: The authorization amount in cents. - - card_id: The identifier of the Card to be authorized. - - digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. - - event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the - default real time event subscription. Because you can only create one real time - decision event subscription, you can use this field to route events to any - specified event subscription for testing purposes. - - merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - - merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the - card is transacting with. - - merchant_city: The city the merchant resides in. - - merchant_country: The country the merchant resides in. - - merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. - - physical_card_id: The identifier of the Physical Card to be authorized. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/simulations/card_authorizations", - body=maybe_transform( - { - "amount": amount, - "card_id": card_id, - "digital_wallet_token_id": digital_wallet_token_id, - "event_subscription_id": event_subscription_id, - "merchant_acceptor_id": merchant_acceptor_id, - "merchant_category_code": merchant_category_code, - "merchant_city": merchant_city, - "merchant_country": merchant_country, - "merchant_descriptor": merchant_descriptor, - "physical_card_id": physical_card_id, - }, - card_authorize_params.CardAuthorizeParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardAuthorizationSimulation, - ) - - def settlement( - self, - *, - card_id: str, - pending_transaction_id: str, - amount: int | 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, - idempotency_key: str | None = None, - ) -> Transaction: - """Simulates the settlement of an authorization by a card acquirer. - - After a card - authorization is created, the merchant will eventually send a settlement. This - simulates that event, which may occur many days after the purchase in - production. The amount settled can be different from the amount originally - authorized, for example, when adding a tip to a restaurant bill. - - Args: - card_id: The identifier of the Card to create a settlement on. - - pending_transaction_id: The identifier of the Pending Transaction for the Card Authorization you wish to - settle. - - amount: The amount to be settled. This defaults to the amount of the Pending Transaction - being settled. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/simulations/card_settlements", - body=maybe_transform( - { - "card_id": card_id, - "pending_transaction_id": pending_transaction_id, - "amount": amount, - }, - card_settlement_params.CardSettlementParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Transaction, - ) - - -class AsyncCards(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCardsWithRawResponse: - return AsyncCardsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncCardsWithStreamingResponse: - return AsyncCardsWithStreamingResponse(self) - - async def authorize( - self, - *, - amount: int, - card_id: str | NotGiven = NOT_GIVEN, - digital_wallet_token_id: str | NotGiven = NOT_GIVEN, - event_subscription_id: str | NotGiven = NOT_GIVEN, - merchant_acceptor_id: str | NotGiven = NOT_GIVEN, - merchant_category_code: str | NotGiven = NOT_GIVEN, - merchant_city: str | NotGiven = NOT_GIVEN, - merchant_country: str | NotGiven = NOT_GIVEN, - merchant_descriptor: str | NotGiven = NOT_GIVEN, - physical_card_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardAuthorizationSimulation: - """Simulates a purchase authorization on a [Card](#cards). - - Depending on the balance - available to the card and the `amount` submitted, the authorization activity - will result in a [Pending Transaction](#pending-transactions) of type - `card_authorization` or a [Declined Transaction](#declined-transactions) of type - `card_decline`. You can pass either a Card id or a - [Digital Wallet Token](#digital-wallet-tokens) id to simulate the two different - ways purchases can be made. - - Args: - amount: The authorization amount in cents. - - card_id: The identifier of the Card to be authorized. - - digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. - - event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the - default real time event subscription. Because you can only create one real time - decision event subscription, you can use this field to route events to any - specified event subscription for testing purposes. - - merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - - merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the - card is transacting with. - - merchant_city: The city the merchant resides in. - - merchant_country: The country the merchant resides in. - - merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. - - physical_card_id: The identifier of the Physical Card to be authorized. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/card_authorizations", - body=await async_maybe_transform( - { - "amount": amount, - "card_id": card_id, - "digital_wallet_token_id": digital_wallet_token_id, - "event_subscription_id": event_subscription_id, - "merchant_acceptor_id": merchant_acceptor_id, - "merchant_category_code": merchant_category_code, - "merchant_city": merchant_city, - "merchant_country": merchant_country, - "merchant_descriptor": merchant_descriptor, - "physical_card_id": physical_card_id, - }, - card_authorize_params.CardAuthorizeParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardAuthorizationSimulation, - ) - - async def settlement( - self, - *, - card_id: str, - pending_transaction_id: str, - amount: int | 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, - idempotency_key: str | None = None, - ) -> Transaction: - """Simulates the settlement of an authorization by a card acquirer. - - After a card - authorization is created, the merchant will eventually send a settlement. This - simulates that event, which may occur many days after the purchase in - production. The amount settled can be different from the amount originally - authorized, for example, when adding a tip to a restaurant bill. - - Args: - card_id: The identifier of the Card to create a settlement on. - - pending_transaction_id: The identifier of the Pending Transaction for the Card Authorization you wish to - settle. - - amount: The amount to be settled. This defaults to the amount of the Pending Transaction - being settled. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/card_settlements", - body=await async_maybe_transform( - { - "card_id": card_id, - "pending_transaction_id": pending_transaction_id, - "amount": amount, - }, - card_settlement_params.CardSettlementParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Transaction, - ) - - -class CardsWithRawResponse: - def __init__(self, cards: Cards) -> None: - self._cards = cards - - self.authorize = _legacy_response.to_raw_response_wrapper( - cards.authorize, - ) - self.settlement = _legacy_response.to_raw_response_wrapper( - cards.settlement, - ) - - -class AsyncCardsWithRawResponse: - def __init__(self, cards: AsyncCards) -> None: - self._cards = cards - - self.authorize = _legacy_response.async_to_raw_response_wrapper( - cards.authorize, - ) - self.settlement = _legacy_response.async_to_raw_response_wrapper( - cards.settlement, - ) - - -class CardsWithStreamingResponse: - def __init__(self, cards: Cards) -> None: - self._cards = cards - - self.authorize = to_streamed_response_wrapper( - cards.authorize, - ) - self.settlement = to_streamed_response_wrapper( - cards.settlement, - ) - - -class AsyncCardsWithStreamingResponse: - def __init__(self, cards: AsyncCards) -> None: - self._cards = cards - - self.authorize = async_to_streamed_response_wrapper( - cards.authorize, - ) - self.settlement = async_to_streamed_response_wrapper( - cards.settlement, - ) diff --git a/src/increase/resources/simulations/check_deposits.py b/src/increase/resources/simulations/check_deposits.py index 66e77f8c4..f323e52cf 100644 --- a/src/increase/resources/simulations/check_deposits.py +++ b/src/increase/resources/simulations/check_deposits.py @@ -2,29 +2,122 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx -from ... import _legacy_response -from ...types import CheckDeposit -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options +from ...types.simulations import check_deposit_submit_params, check_deposit_adjustment_params +from ...types.check_deposit import CheckDeposit -__all__ = ["CheckDeposits", "AsyncCheckDeposits"] +__all__ = ["CheckDepositsResource", "AsyncCheckDepositsResource"] -class CheckDeposits(SyncAPIResource): +class CheckDepositsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CheckDepositsWithRawResponse: - return CheckDepositsWithRawResponse(self) + def with_raw_response(self) -> CheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CheckDepositsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> CheckDepositsWithStreamingResponse: - return CheckDepositsWithStreamingResponse(self) + def with_streaming_response(self) -> CheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CheckDepositsResourceWithStreamingResponse(self) + + def adjustment( + self, + check_deposit_id: str, + *, + amount: int | Omit = omit, + reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CheckDeposit: + """ + Simulates the creation of a + [Check Deposit Adjustment](#check-deposit-adjustments) on a + [Check Deposit](#check-deposits). This Check Deposit must first have a `status` + of `submitted`. + + Args: + check_deposit_id: The identifier of the Check Deposit you wish to adjust. + + amount: The adjustment amount in the minor unit of the Check Deposit's currency (e.g., + cents). A negative amount means that the funds are being clawed back by the + other bank and is a debit to your account. Defaults to the negative of the Check + Deposit amount. + + reason: The reason for the adjustment. Defaults to `non_conforming_item`, which is often + used for a low quality image that the recipient wasn't able to handle. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not check_deposit_id: + raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") + return self._post( + path_template( + "/simulations/check_deposits/{check_deposit_id}/adjustment", check_deposit_id=check_deposit_id + ), + body=maybe_transform( + { + "amount": amount, + "reason": reason, + }, + check_deposit_adjustment_params.CheckDepositAdjustmentParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CheckDeposit, + ) def reject( self, @@ -35,7 +128,7 @@ def reject( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """ @@ -59,7 +152,7 @@ def reject( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return self._post( - f"/simulations/check_deposits/{check_deposit_id}/reject", + path_template("/simulations/check_deposits/{check_deposit_id}/reject", check_deposit_id=check_deposit_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -79,7 +172,7 @@ def return_( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """Simulates the return of a [Check Deposit](#check-deposits). @@ -103,7 +196,7 @@ def return_( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return self._post( - f"/simulations/check_deposits/{check_deposit_id}/return", + path_template("/simulations/check_deposits/{check_deposit_id}/return", check_deposit_id=check_deposit_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -118,12 +211,13 @@ def submit( self, check_deposit_id: str, *, + scan: check_deposit_submit_params.Scan | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """ @@ -133,6 +227,8 @@ def submit( Args: check_deposit_id: The identifier of the Check Deposit you wish to submit. + scan: If set, the simulation will use these values for the check's scanned MICR data. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -146,7 +242,8 @@ def submit( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return self._post( - f"/simulations/check_deposits/{check_deposit_id}/submit", + path_template("/simulations/check_deposits/{check_deposit_id}/submit", check_deposit_id=check_deposit_id), + body=maybe_transform({"scan": scan}, check_deposit_submit_params.CheckDepositSubmitParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -158,14 +255,101 @@ def submit( ) -class AsyncCheckDeposits(AsyncAPIResource): +class AsyncCheckDepositsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncCheckDepositsWithRawResponse: - return AsyncCheckDepositsWithRawResponse(self) + def with_raw_response(self) -> AsyncCheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCheckDepositsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncCheckDepositsWithStreamingResponse: - return AsyncCheckDepositsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncCheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCheckDepositsResourceWithStreamingResponse(self) + + async def adjustment( + self, + check_deposit_id: str, + *, + amount: int | Omit = omit, + reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CheckDeposit: + """ + Simulates the creation of a + [Check Deposit Adjustment](#check-deposit-adjustments) on a + [Check Deposit](#check-deposits). This Check Deposit must first have a `status` + of `submitted`. + + Args: + check_deposit_id: The identifier of the Check Deposit you wish to adjust. + + amount: The adjustment amount in the minor unit of the Check Deposit's currency (e.g., + cents). A negative amount means that the funds are being clawed back by the + other bank and is a debit to your account. Defaults to the negative of the Check + Deposit amount. + + reason: The reason for the adjustment. Defaults to `non_conforming_item`, which is often + used for a low quality image that the recipient wasn't able to handle. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not check_deposit_id: + raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") + return await self._post( + path_template( + "/simulations/check_deposits/{check_deposit_id}/adjustment", check_deposit_id=check_deposit_id + ), + body=await async_maybe_transform( + { + "amount": amount, + "reason": reason, + }, + check_deposit_adjustment_params.CheckDepositAdjustmentParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CheckDeposit, + ) async def reject( self, @@ -176,7 +360,7 @@ async def reject( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """ @@ -200,7 +384,7 @@ async def reject( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return await self._post( - f"/simulations/check_deposits/{check_deposit_id}/reject", + path_template("/simulations/check_deposits/{check_deposit_id}/reject", check_deposit_id=check_deposit_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -220,7 +404,7 @@ async def return_( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """Simulates the return of a [Check Deposit](#check-deposits). @@ -244,7 +428,7 @@ async def return_( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return await self._post( - f"/simulations/check_deposits/{check_deposit_id}/return", + path_template("/simulations/check_deposits/{check_deposit_id}/return", check_deposit_id=check_deposit_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -259,12 +443,13 @@ async def submit( self, check_deposit_id: str, *, + scan: check_deposit_submit_params.Scan | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckDeposit: """ @@ -274,6 +459,8 @@ async def submit( Args: check_deposit_id: The identifier of the Check Deposit you wish to submit. + scan: If set, the simulation will use these values for the check's scanned MICR data. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -287,7 +474,8 @@ async def submit( if not check_deposit_id: raise ValueError(f"Expected a non-empty value for `check_deposit_id` but received {check_deposit_id!r}") return await self._post( - f"/simulations/check_deposits/{check_deposit_id}/submit", + path_template("/simulations/check_deposits/{check_deposit_id}/submit", check_deposit_id=check_deposit_id), + body=await async_maybe_transform({"scan": scan}, check_deposit_submit_params.CheckDepositSubmitParams), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -299,40 +487,49 @@ async def submit( ) -class CheckDepositsWithRawResponse: - def __init__(self, check_deposits: CheckDeposits) -> None: +class CheckDepositsResourceWithRawResponse: + def __init__(self, check_deposits: CheckDepositsResource) -> None: self._check_deposits = check_deposits - self.reject = _legacy_response.to_raw_response_wrapper( + self.adjustment = to_raw_response_wrapper( + check_deposits.adjustment, + ) + self.reject = to_raw_response_wrapper( check_deposits.reject, ) - self.return_ = _legacy_response.to_raw_response_wrapper( + self.return_ = to_raw_response_wrapper( check_deposits.return_, ) - self.submit = _legacy_response.to_raw_response_wrapper( + self.submit = to_raw_response_wrapper( check_deposits.submit, ) -class AsyncCheckDepositsWithRawResponse: - def __init__(self, check_deposits: AsyncCheckDeposits) -> None: +class AsyncCheckDepositsResourceWithRawResponse: + def __init__(self, check_deposits: AsyncCheckDepositsResource) -> None: self._check_deposits = check_deposits - self.reject = _legacy_response.async_to_raw_response_wrapper( + self.adjustment = async_to_raw_response_wrapper( + check_deposits.adjustment, + ) + self.reject = async_to_raw_response_wrapper( check_deposits.reject, ) - self.return_ = _legacy_response.async_to_raw_response_wrapper( + self.return_ = async_to_raw_response_wrapper( check_deposits.return_, ) - self.submit = _legacy_response.async_to_raw_response_wrapper( + self.submit = async_to_raw_response_wrapper( check_deposits.submit, ) -class CheckDepositsWithStreamingResponse: - def __init__(self, check_deposits: CheckDeposits) -> None: +class CheckDepositsResourceWithStreamingResponse: + def __init__(self, check_deposits: CheckDepositsResource) -> None: self._check_deposits = check_deposits + self.adjustment = to_streamed_response_wrapper( + check_deposits.adjustment, + ) self.reject = to_streamed_response_wrapper( check_deposits.reject, ) @@ -344,10 +541,13 @@ def __init__(self, check_deposits: CheckDeposits) -> None: ) -class AsyncCheckDepositsWithStreamingResponse: - def __init__(self, check_deposits: AsyncCheckDeposits) -> None: +class AsyncCheckDepositsResourceWithStreamingResponse: + def __init__(self, check_deposits: AsyncCheckDepositsResource) -> None: self._check_deposits = check_deposits + self.adjustment = async_to_streamed_response_wrapper( + check_deposits.adjustment, + ) self.reject = async_to_streamed_response_wrapper( check_deposits.reject, ) diff --git a/src/increase/resources/simulations/check_transfers.py b/src/increase/resources/simulations/check_transfers.py index f04195670..e0f4e0e80 100644 --- a/src/increase/resources/simulations/check_transfers.py +++ b/src/increase/resources/simulations/check_transfers.py @@ -4,71 +4,41 @@ import httpx -from ... import _legacy_response -from ...types import CheckTransfer -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options +from ...types.check_transfer import CheckTransfer -__all__ = ["CheckTransfers", "AsyncCheckTransfers"] +__all__ = ["CheckTransfersResource", "AsyncCheckTransfersResource"] -class CheckTransfers(SyncAPIResource): +class CheckTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> CheckTransfersWithRawResponse: - return CheckTransfersWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> CheckTransfersWithStreamingResponse: - return CheckTransfersWithStreamingResponse(self) - - def deposit( - self, - check_transfer_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CheckTransfer: - """Simulates a [Check Transfer](#check-transfers) being deposited at a bank. - - This - transfer must first have a `status` of `mailed`. - - Args: - check_transfer_id: The identifier of the Check Transfer you wish to mark deposited. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request + def with_raw_response(self) -> CheckTransfersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. - extra_body: Add additional JSON properties to the request + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CheckTransfersResourceWithRawResponse(self) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def with_streaming_response(self) -> CheckTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - idempotency_key: Specify a custom idempotency key for this request + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response """ - if not check_transfer_id: - raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") - return self._post( - f"/simulations/check_transfers/{check_transfer_id}/deposit", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CheckTransfer, - ) + return CheckTransfersResourceWithStreamingResponse(self) def mail( self, @@ -79,13 +49,14 @@ def mail( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ Simulates the mailing of a [Check Transfer](#check-transfers), which happens - once per weekday in production but can be sped up in sandbox. This transfer must - first have a `status` of `pending_approval` or `pending_submission`. + periodically throughout the day in production but can be sped up in sandbox. + This transfer must first have a `status` of `pending_approval` or + `pending_submission`. Args: check_transfer_id: The identifier of the Check Transfer you wish to mail. @@ -103,7 +74,7 @@ def mail( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return self._post( - f"/simulations/check_transfers/{check_transfer_id}/mail", + path_template("/simulations/check_transfers/{check_transfer_id}/mail", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -115,58 +86,25 @@ def mail( ) -class AsyncCheckTransfers(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncCheckTransfersWithRawResponse: - return AsyncCheckTransfersWithRawResponse(self) - +class AsyncCheckTransfersResource(AsyncAPIResource): @cached_property - def with_streaming_response(self) -> AsyncCheckTransfersWithStreamingResponse: - return AsyncCheckTransfersWithStreamingResponse(self) - - async def deposit( - self, - check_transfer_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CheckTransfer: - """Simulates a [Check Transfer](#check-transfers) being deposited at a bank. - - This - transfer must first have a `status` of `mailed`. - - Args: - check_transfer_id: The identifier of the Check Transfer you wish to mark deposited. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request + def with_raw_response(self) -> AsyncCheckTransfersResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. - extra_body: Add additional JSON properties to the request + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCheckTransfersResourceWithRawResponse(self) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def with_streaming_response(self) -> AsyncCheckTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - idempotency_key: Specify a custom idempotency key for this request + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response """ - if not check_transfer_id: - raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") - return await self._post( - f"/simulations/check_transfers/{check_transfer_id}/deposit", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CheckTransfer, - ) + return AsyncCheckTransfersResourceWithStreamingResponse(self) async def mail( self, @@ -177,13 +115,14 @@ async def mail( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> CheckTransfer: """ Simulates the mailing of a [Check Transfer](#check-transfers), which happens - once per weekday in production but can be sped up in sandbox. This transfer must - first have a `status` of `pending_approval` or `pending_submission`. + periodically throughout the day in production but can be sped up in sandbox. + This transfer must first have a `status` of `pending_approval` or + `pending_submission`. Args: check_transfer_id: The identifier of the Check Transfer you wish to mail. @@ -201,7 +140,7 @@ async def mail( if not check_transfer_id: raise ValueError(f"Expected a non-empty value for `check_transfer_id` but received {check_transfer_id!r}") return await self._post( - f"/simulations/check_transfers/{check_transfer_id}/mail", + path_template("/simulations/check_transfers/{check_transfer_id}/mail", check_transfer_id=check_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -213,49 +152,37 @@ async def mail( ) -class CheckTransfersWithRawResponse: - def __init__(self, check_transfers: CheckTransfers) -> None: +class CheckTransfersResourceWithRawResponse: + def __init__(self, check_transfers: CheckTransfersResource) -> None: self._check_transfers = check_transfers - self.deposit = _legacy_response.to_raw_response_wrapper( - check_transfers.deposit, - ) - self.mail = _legacy_response.to_raw_response_wrapper( + self.mail = to_raw_response_wrapper( check_transfers.mail, ) -class AsyncCheckTransfersWithRawResponse: - def __init__(self, check_transfers: AsyncCheckTransfers) -> None: +class AsyncCheckTransfersResourceWithRawResponse: + def __init__(self, check_transfers: AsyncCheckTransfersResource) -> None: self._check_transfers = check_transfers - self.deposit = _legacy_response.async_to_raw_response_wrapper( - check_transfers.deposit, - ) - self.mail = _legacy_response.async_to_raw_response_wrapper( + self.mail = async_to_raw_response_wrapper( check_transfers.mail, ) -class CheckTransfersWithStreamingResponse: - def __init__(self, check_transfers: CheckTransfers) -> None: +class CheckTransfersResourceWithStreamingResponse: + def __init__(self, check_transfers: CheckTransfersResource) -> None: self._check_transfers = check_transfers - self.deposit = to_streamed_response_wrapper( - check_transfers.deposit, - ) self.mail = to_streamed_response_wrapper( check_transfers.mail, ) -class AsyncCheckTransfersWithStreamingResponse: - def __init__(self, check_transfers: AsyncCheckTransfers) -> None: +class AsyncCheckTransfersResourceWithStreamingResponse: + def __init__(self, check_transfers: AsyncCheckTransfersResource) -> None: self._check_transfers = check_transfers - self.deposit = async_to_streamed_response_wrapper( - check_transfers.deposit, - ) self.mail = async_to_streamed_response_wrapper( check_transfers.mail, ) diff --git a/src/increase/resources/simulations/digital_wallet_token_requests.py b/src/increase/resources/simulations/digital_wallet_token_requests.py index 77b883baf..e7ff2dbb9 100644 --- a/src/increase/resources/simulations/digital_wallet_token_requests.py +++ b/src/increase/resources/simulations/digital_wallet_token_requests.py @@ -4,31 +4,42 @@ import httpx -from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) -from ...types.simulations import DigitalWalletTokenRequestCreateResponse, digital_wallet_token_request_create_params +from ..._base_client import make_request_options +from ...types.simulations import digital_wallet_token_request_create_params +from ...types.simulations.digital_wallet_token_request_create_response import DigitalWalletTokenRequestCreateResponse -__all__ = ["DigitalWalletTokenRequests", "AsyncDigitalWalletTokenRequests"] +__all__ = ["DigitalWalletTokenRequestsResource", "AsyncDigitalWalletTokenRequestsResource"] -class DigitalWalletTokenRequests(SyncAPIResource): +class DigitalWalletTokenRequestsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> DigitalWalletTokenRequestsWithRawResponse: - return DigitalWalletTokenRequestsWithRawResponse(self) + def with_raw_response(self) -> DigitalWalletTokenRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return DigitalWalletTokenRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> DigitalWalletTokenRequestsWithStreamingResponse: - return DigitalWalletTokenRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> DigitalWalletTokenRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return DigitalWalletTokenRequestsResourceWithStreamingResponse(self) def create( self, @@ -39,11 +50,11 @@ def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalWalletTokenRequestCreateResponse: """ - Simulates a user attempting add a [Card](#cards) to a digital wallet such as + Simulates a user attempting to add a [Card](#cards) to a digital wallet such as Apple Pay. Args: @@ -75,14 +86,25 @@ def create( ) -class AsyncDigitalWalletTokenRequests(AsyncAPIResource): +class AsyncDigitalWalletTokenRequestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncDigitalWalletTokenRequestsWithRawResponse: - return AsyncDigitalWalletTokenRequestsWithRawResponse(self) + def with_raw_response(self) -> AsyncDigitalWalletTokenRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncDigitalWalletTokenRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncDigitalWalletTokenRequestsWithStreamingResponse: - return AsyncDigitalWalletTokenRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse(self) async def create( self, @@ -93,11 +115,11 @@ async def create( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> DigitalWalletTokenRequestCreateResponse: """ - Simulates a user attempting add a [Card](#cards) to a digital wallet such as + Simulates a user attempting to add a [Card](#cards) to a digital wallet such as Apple Pay. Args: @@ -129,26 +151,26 @@ async def create( ) -class DigitalWalletTokenRequestsWithRawResponse: - def __init__(self, digital_wallet_token_requests: DigitalWalletTokenRequests) -> None: +class DigitalWalletTokenRequestsResourceWithRawResponse: + def __init__(self, digital_wallet_token_requests: DigitalWalletTokenRequestsResource) -> None: self._digital_wallet_token_requests = digital_wallet_token_requests - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( digital_wallet_token_requests.create, ) -class AsyncDigitalWalletTokenRequestsWithRawResponse: - def __init__(self, digital_wallet_token_requests: AsyncDigitalWalletTokenRequests) -> None: +class AsyncDigitalWalletTokenRequestsResourceWithRawResponse: + def __init__(self, digital_wallet_token_requests: AsyncDigitalWalletTokenRequestsResource) -> None: self._digital_wallet_token_requests = digital_wallet_token_requests - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( digital_wallet_token_requests.create, ) -class DigitalWalletTokenRequestsWithStreamingResponse: - def __init__(self, digital_wallet_token_requests: DigitalWalletTokenRequests) -> None: +class DigitalWalletTokenRequestsResourceWithStreamingResponse: + def __init__(self, digital_wallet_token_requests: DigitalWalletTokenRequestsResource) -> None: self._digital_wallet_token_requests = digital_wallet_token_requests self.create = to_streamed_response_wrapper( @@ -156,8 +178,8 @@ def __init__(self, digital_wallet_token_requests: DigitalWalletTokenRequests) -> ) -class AsyncDigitalWalletTokenRequestsWithStreamingResponse: - def __init__(self, digital_wallet_token_requests: AsyncDigitalWalletTokenRequests) -> None: +class AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse: + def __init__(self, digital_wallet_token_requests: AsyncDigitalWalletTokenRequestsResource) -> None: self._digital_wallet_token_requests = digital_wallet_token_requests self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/documents.py b/src/increase/resources/simulations/documents.py deleted file mode 100644 index 08f239992..000000000 --- a/src/increase/resources/simulations/documents.py +++ /dev/null @@ -1,160 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ... import _legacy_response -from ...types import Document -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) -from ...types.simulations import document_create_params - -__all__ = ["Documents", "AsyncDocuments"] - - -class Documents(SyncAPIResource): - @cached_property - def with_raw_response(self) -> DocumentsWithRawResponse: - return DocumentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> DocumentsWithStreamingResponse: - return DocumentsWithStreamingResponse(self) - - def create( - self, - *, - account_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Document: - """ - Simulates an tax document being created for an account. - - Args: - account_id: The identifier of the Account the tax document is for. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/simulations/documents", - body=maybe_transform({"account_id": account_id}, document_create_params.DocumentCreateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Document, - ) - - -class AsyncDocuments(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncDocumentsWithRawResponse: - return AsyncDocumentsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncDocumentsWithStreamingResponse: - return AsyncDocumentsWithStreamingResponse(self) - - async def create( - self, - *, - account_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> Document: - """ - Simulates an tax document being created for an account. - - Args: - account_id: The identifier of the Account the tax document is for. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/documents", - body=await async_maybe_transform({"account_id": account_id}, document_create_params.DocumentCreateParams), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=Document, - ) - - -class DocumentsWithRawResponse: - def __init__(self, documents: Documents) -> None: - self._documents = documents - - self.create = _legacy_response.to_raw_response_wrapper( - documents.create, - ) - - -class AsyncDocumentsWithRawResponse: - def __init__(self, documents: AsyncDocuments) -> None: - self._documents = documents - - self.create = _legacy_response.async_to_raw_response_wrapper( - documents.create, - ) - - -class DocumentsWithStreamingResponse: - def __init__(self, documents: Documents) -> None: - self._documents = documents - - self.create = to_streamed_response_wrapper( - documents.create, - ) - - -class AsyncDocumentsWithStreamingResponse: - def __init__(self, documents: AsyncDocuments) -> None: - self._documents = documents - - self.create = async_to_streamed_response_wrapper( - documents.create, - ) diff --git a/src/increase/resources/simulations/entity_onboarding_sessions.py b/src/increase/resources/simulations/entity_onboarding_sessions.py new file mode 100644 index 000000000..102b851eb --- /dev/null +++ b/src/increase/resources/simulations/entity_onboarding_sessions.py @@ -0,0 +1,198 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.entity_onboarding_session import EntityOnboardingSession + +__all__ = ["EntityOnboardingSessionsResource", "AsyncEntityOnboardingSessionsResource"] + + +class EntityOnboardingSessionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> EntityOnboardingSessionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return EntityOnboardingSessionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> EntityOnboardingSessionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return EntityOnboardingSessionsResourceWithStreamingResponse(self) + + def submit( + self, + entity_onboarding_session_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityOnboardingSession: + """ + Simulates the submission of an + [Entity Onboarding Session](#entity-onboarding-sessions). This session must have + a `status` of `active`. After submission, the session will transition to + `expired` and a new Entity will be created. + + Args: + entity_onboarding_session_id: The identifier of the Entity Onboarding Session you wish to submit. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_onboarding_session_id: + raise ValueError( + f"Expected a non-empty value for `entity_onboarding_session_id` but received {entity_onboarding_session_id!r}" + ) + return self._post( + path_template( + "/simulations/entity_onboarding_sessions/{entity_onboarding_session_id}/submit", + entity_onboarding_session_id=entity_onboarding_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityOnboardingSession, + ) + + +class AsyncEntityOnboardingSessionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncEntityOnboardingSessionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncEntityOnboardingSessionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncEntityOnboardingSessionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncEntityOnboardingSessionsResourceWithStreamingResponse(self) + + async def submit( + self, + entity_onboarding_session_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> EntityOnboardingSession: + """ + Simulates the submission of an + [Entity Onboarding Session](#entity-onboarding-sessions). This session must have + a `status` of `active`. After submission, the session will transition to + `expired` and a new Entity will be created. + + Args: + entity_onboarding_session_id: The identifier of the Entity Onboarding Session you wish to submit. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not entity_onboarding_session_id: + raise ValueError( + f"Expected a non-empty value for `entity_onboarding_session_id` but received {entity_onboarding_session_id!r}" + ) + return await self._post( + path_template( + "/simulations/entity_onboarding_sessions/{entity_onboarding_session_id}/submit", + entity_onboarding_session_id=entity_onboarding_session_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=EntityOnboardingSession, + ) + + +class EntityOnboardingSessionsResourceWithRawResponse: + def __init__(self, entity_onboarding_sessions: EntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.submit = to_raw_response_wrapper( + entity_onboarding_sessions.submit, + ) + + +class AsyncEntityOnboardingSessionsResourceWithRawResponse: + def __init__(self, entity_onboarding_sessions: AsyncEntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.submit = async_to_raw_response_wrapper( + entity_onboarding_sessions.submit, + ) + + +class EntityOnboardingSessionsResourceWithStreamingResponse: + def __init__(self, entity_onboarding_sessions: EntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.submit = to_streamed_response_wrapper( + entity_onboarding_sessions.submit, + ) + + +class AsyncEntityOnboardingSessionsResourceWithStreamingResponse: + def __init__(self, entity_onboarding_sessions: AsyncEntityOnboardingSessionsResource) -> None: + self._entity_onboarding_sessions = entity_onboarding_sessions + + self.submit = async_to_streamed_response_wrapper( + entity_onboarding_sessions.submit, + ) diff --git a/src/increase/resources/simulations/exports.py b/src/increase/resources/simulations/exports.py new file mode 100644 index 000000000..2ff9a2b66 --- /dev/null +++ b/src/increase/resources/simulations/exports.py @@ -0,0 +1,215 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.export import Export +from ...types.simulations import export_create_params + +__all__ = ["ExportsResource", "AsyncExportsResource"] + + +class ExportsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> ExportsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ExportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> ExportsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ExportsResourceWithStreamingResponse(self) + + def create( + self, + *, + category: Literal["form_1099_int"], + form_1099_int: export_create_params.Form1099Int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Export: + """Many exports are created by you via POST /exports or in the Dashboard. + + Some + exports are created automatically by Increase. For example, tax documents are + published once a year. In sandbox, you can trigger the arrival of an export that + would normally only be created automatically via this simulation. + + Args: + category: The type of Export to create. + + - `form_1099_int` - A PDF of an Internal Revenue Service Form 1099-INT. + + form_1099_int: Options for the created export. Required if `category` is equal to + `form_1099_int`. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/exports", + body=maybe_transform( + { + "category": category, + "form_1099_int": form_1099_int, + }, + export_create_params.ExportCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Export, + ) + + +class AsyncExportsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncExportsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncExportsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncExportsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncExportsResourceWithStreamingResponse(self) + + async def create( + self, + *, + category: Literal["form_1099_int"], + form_1099_int: export_create_params.Form1099Int | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> Export: + """Many exports are created by you via POST /exports or in the Dashboard. + + Some + exports are created automatically by Increase. For example, tax documents are + published once a year. In sandbox, you can trigger the arrival of an export that + would normally only be created automatically via this simulation. + + Args: + category: The type of Export to create. + + - `form_1099_int` - A PDF of an Internal Revenue Service Form 1099-INT. + + form_1099_int: Options for the created export. Required if `category` is equal to + `form_1099_int`. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/exports", + body=await async_maybe_transform( + { + "category": category, + "form_1099_int": form_1099_int, + }, + export_create_params.ExportCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=Export, + ) + + +class ExportsResourceWithRawResponse: + def __init__(self, exports: ExportsResource) -> None: + self._exports = exports + + self.create = to_raw_response_wrapper( + exports.create, + ) + + +class AsyncExportsResourceWithRawResponse: + def __init__(self, exports: AsyncExportsResource) -> None: + self._exports = exports + + self.create = async_to_raw_response_wrapper( + exports.create, + ) + + +class ExportsResourceWithStreamingResponse: + def __init__(self, exports: ExportsResource) -> None: + self._exports = exports + + self.create = to_streamed_response_wrapper( + exports.create, + ) + + +class AsyncExportsResourceWithStreamingResponse: + def __init__(self, exports: AsyncExportsResource) -> None: + self._exports = exports + + self.create = async_to_streamed_response_wrapper( + exports.create, + ) diff --git a/src/increase/resources/simulations/inbound_ach_transfers.py b/src/increase/resources/simulations/inbound_ach_transfers.py new file mode 100644 index 000000000..2b1997530 --- /dev/null +++ b/src/increase/resources/simulations/inbound_ach_transfers.py @@ -0,0 +1,379 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import inbound_ach_transfer_create_params +from ...types.inbound_ach_transfer import InboundACHTransfer + +__all__ = ["InboundACHTransfersResource", "AsyncInboundACHTransfersResource"] + + +class InboundACHTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundACHTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundACHTransfersResourceWithStreamingResponse(self) + + def create( + self, + *, + account_number_id: str, + amount: int, + addenda: inbound_ach_transfer_create_params.Addenda | Omit = omit, + company_descriptive_date: str | Omit = omit, + company_discretionary_data: str | Omit = omit, + company_entry_description: str | Omit = omit, + company_id: str | Omit = omit, + company_name: str | Omit = omit, + receiver_id_number: str | Omit = omit, + receiver_name: str | Omit = omit, + resolve_at: Union[str, datetime] | Omit = omit, + standard_entry_class_code: Literal[ + "corporate_credit_or_debit", + "corporate_trade_exchange", + "prearranged_payments_and_deposit", + "internet_initiated", + "point_of_sale", + "telephone_initiated", + "customer_initiated", + "accounts_receivable", + "machine_transfer", + "shared_network_transaction", + "represented_check", + "back_office_conversion", + "point_of_purchase", + "check_truncation", + "destroyed_check", + "international_ach_transaction", + ] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundACHTransfer: + """Simulates an inbound ACH transfer to your account. + + This imitates initiating a + transfer to an Increase account from a different financial institution. The + transfer may be either a credit or a debit depending on if the `amount` is + positive or negative. The result of calling this API will contain the created + transfer. You can pass a `resolve_at` parameter to allow for a window to + [action on the Inbound ACH Transfer](https://increase.com/documentation/receiving-ach-transfers). + Alternatively, if you don't pass the `resolve_at` parameter the result will + contain either a [Transaction](#transactions) or a + [Declined Transaction](#declined-transactions) depending on whether or not the + transfer is allowed. + + Args: + account_number_id: The identifier of the Account Number the inbound ACH Transfer is for. + + amount: The transfer amount in cents. A positive amount originates a credit transfer + pushing funds to the receiving account. A negative amount originates a debit + transfer pulling funds from the receiving account. + + addenda: Additional information to include in the transfer. + + company_descriptive_date: The description of the date of the transfer. + + company_discretionary_data: Data associated with the transfer set by the sender. + + company_entry_description: The description of the transfer set by the sender. + + company_id: The sender's company ID. + + company_name: The name of the sender. + + receiver_id_number: The ID of the receiver of the transfer. + + receiver_name: The name of the receiver of the transfer. + + resolve_at: The time at which the transfer should be resolved. If not provided will resolve + immediately. + + standard_entry_class_code: The standard entry class code for the transfer. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). + - `internet_initiated` - Internet Initiated (WEB). + - `point_of_sale` - Point of Sale (POS). + - `telephone_initiated` - Telephone Initiated (TEL). + - `customer_initiated` - Customer Initiated (CIE). + - `accounts_receivable` - Accounts Receivable (ARC). + - `machine_transfer` - Machine Transfer (MTE). + - `shared_network_transaction` - Shared Network Transaction (SHR). + - `represented_check` - Represented Check (RCK). + - `back_office_conversion` - Back Office Conversion (BOC). + - `point_of_purchase` - Point of Purchase (POP). + - `check_truncation` - Check Truncation (TRC). + - `destroyed_check` - Destroyed Check (XCK). + - `international_ach_transaction` - International ACH Transaction (IAT). + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/inbound_ach_transfers", + body=maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "addenda": addenda, + "company_descriptive_date": company_descriptive_date, + "company_discretionary_data": company_discretionary_data, + "company_entry_description": company_entry_description, + "company_id": company_id, + "company_name": company_name, + "receiver_id_number": receiver_id_number, + "receiver_name": receiver_name, + "resolve_at": resolve_at, + "standard_entry_class_code": standard_entry_class_code, + }, + inbound_ach_transfer_create_params.InboundACHTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundACHTransfer, + ) + + +class AsyncInboundACHTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundACHTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundACHTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundACHTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundACHTransfersResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_number_id: str, + amount: int, + addenda: inbound_ach_transfer_create_params.Addenda | Omit = omit, + company_descriptive_date: str | Omit = omit, + company_discretionary_data: str | Omit = omit, + company_entry_description: str | Omit = omit, + company_id: str | Omit = omit, + company_name: str | Omit = omit, + receiver_id_number: str | Omit = omit, + receiver_name: str | Omit = omit, + resolve_at: Union[str, datetime] | Omit = omit, + standard_entry_class_code: Literal[ + "corporate_credit_or_debit", + "corporate_trade_exchange", + "prearranged_payments_and_deposit", + "internet_initiated", + "point_of_sale", + "telephone_initiated", + "customer_initiated", + "accounts_receivable", + "machine_transfer", + "shared_network_transaction", + "represented_check", + "back_office_conversion", + "point_of_purchase", + "check_truncation", + "destroyed_check", + "international_ach_transaction", + ] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundACHTransfer: + """Simulates an inbound ACH transfer to your account. + + This imitates initiating a + transfer to an Increase account from a different financial institution. The + transfer may be either a credit or a debit depending on if the `amount` is + positive or negative. The result of calling this API will contain the created + transfer. You can pass a `resolve_at` parameter to allow for a window to + [action on the Inbound ACH Transfer](https://increase.com/documentation/receiving-ach-transfers). + Alternatively, if you don't pass the `resolve_at` parameter the result will + contain either a [Transaction](#transactions) or a + [Declined Transaction](#declined-transactions) depending on whether or not the + transfer is allowed. + + Args: + account_number_id: The identifier of the Account Number the inbound ACH Transfer is for. + + amount: The transfer amount in cents. A positive amount originates a credit transfer + pushing funds to the receiving account. A negative amount originates a debit + transfer pulling funds from the receiving account. + + addenda: Additional information to include in the transfer. + + company_descriptive_date: The description of the date of the transfer. + + company_discretionary_data: Data associated with the transfer set by the sender. + + company_entry_description: The description of the transfer set by the sender. + + company_id: The sender's company ID. + + company_name: The name of the sender. + + receiver_id_number: The ID of the receiver of the transfer. + + receiver_name: The name of the receiver of the transfer. + + resolve_at: The time at which the transfer should be resolved. If not provided will resolve + immediately. + + standard_entry_class_code: The standard entry class code for the transfer. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). + - `internet_initiated` - Internet Initiated (WEB). + - `point_of_sale` - Point of Sale (POS). + - `telephone_initiated` - Telephone Initiated (TEL). + - `customer_initiated` - Customer Initiated (CIE). + - `accounts_receivable` - Accounts Receivable (ARC). + - `machine_transfer` - Machine Transfer (MTE). + - `shared_network_transaction` - Shared Network Transaction (SHR). + - `represented_check` - Represented Check (RCK). + - `back_office_conversion` - Back Office Conversion (BOC). + - `point_of_purchase` - Point of Purchase (POP). + - `check_truncation` - Check Truncation (TRC). + - `destroyed_check` - Destroyed Check (XCK). + - `international_ach_transaction` - International ACH Transaction (IAT). + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/inbound_ach_transfers", + body=await async_maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "addenda": addenda, + "company_descriptive_date": company_descriptive_date, + "company_discretionary_data": company_discretionary_data, + "company_entry_description": company_entry_description, + "company_id": company_id, + "company_name": company_name, + "receiver_id_number": receiver_id_number, + "receiver_name": receiver_name, + "resolve_at": resolve_at, + "standard_entry_class_code": standard_entry_class_code, + }, + inbound_ach_transfer_create_params.InboundACHTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundACHTransfer, + ) + + +class InboundACHTransfersResourceWithRawResponse: + def __init__(self, inbound_ach_transfers: InboundACHTransfersResource) -> None: + self._inbound_ach_transfers = inbound_ach_transfers + + self.create = to_raw_response_wrapper( + inbound_ach_transfers.create, + ) + + +class AsyncInboundACHTransfersResourceWithRawResponse: + def __init__(self, inbound_ach_transfers: AsyncInboundACHTransfersResource) -> None: + self._inbound_ach_transfers = inbound_ach_transfers + + self.create = async_to_raw_response_wrapper( + inbound_ach_transfers.create, + ) + + +class InboundACHTransfersResourceWithStreamingResponse: + def __init__(self, inbound_ach_transfers: InboundACHTransfersResource) -> None: + self._inbound_ach_transfers = inbound_ach_transfers + + self.create = to_streamed_response_wrapper( + inbound_ach_transfers.create, + ) + + +class AsyncInboundACHTransfersResourceWithStreamingResponse: + def __init__(self, inbound_ach_transfers: AsyncInboundACHTransfersResource) -> None: + self._inbound_ach_transfers = inbound_ach_transfers + + self.create = async_to_streamed_response_wrapper( + inbound_ach_transfers.create, + ) diff --git a/src/increase/resources/simulations/inbound_check_deposits.py b/src/increase/resources/simulations/inbound_check_deposits.py new file mode 100644 index 000000000..1b748944e --- /dev/null +++ b/src/increase/resources/simulations/inbound_check_deposits.py @@ -0,0 +1,407 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import inbound_check_deposit_create_params, inbound_check_deposit_adjustment_params +from ...types.inbound_check_deposit import InboundCheckDeposit + +__all__ = ["InboundCheckDepositsResource", "AsyncInboundCheckDepositsResource"] + + +class InboundCheckDepositsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundCheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundCheckDepositsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundCheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundCheckDepositsResourceWithStreamingResponse(self) + + def create( + self, + *, + account_number_id: str, + amount: int, + check_number: str, + payee_name_analysis: Literal["name_matches", "does_not_match", "not_evaluated"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """Simulates an Inbound Check Deposit against your account. + + This imitates someone + depositing a check at their bank that was issued from your account. It may or + may not be associated with a Check Transfer. Increase will evaluate the Inbound + Check Deposit as we would in production and either create a Transaction or a + Declined Transaction as a result. You can inspect the resulting Inbound Check + Deposit object to see the result. + + Args: + account_number_id: The identifier of the Account Number the Inbound Check Deposit will be against. + + amount: The check amount in cents. + + check_number: The check number on the check to be deposited. + + payee_name_analysis: Simulate the outcome of + [payee name checking](https://increase.com/documentation/positive-pay#payee-name-mismatches). + Defaults to `not_evaluated`. + + - `name_matches` - The details on the check match the recipient name of the + check transfer. + - `does_not_match` - The details on the check do not match the recipient name of + the check transfer. + - `not_evaluated` - The payee name analysis was not evaluated. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/inbound_check_deposits", + body=maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "check_number": check_number, + "payee_name_analysis": payee_name_analysis, + }, + inbound_check_deposit_create_params.InboundCheckDepositCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + def adjustment( + self, + inbound_check_deposit_id: str, + *, + amount: int | Omit = omit, + reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """Simulates an adjustment on an Inbound Check Deposit. + + The Inbound Check Deposit + must have a `status` of `accepted`. + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to adjust. + + amount: The adjustment amount in cents. Defaults to the amount of the Inbound Check + Deposit. + + reason: The reason for the adjustment. Defaults to `wrong_payee_credit`. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return self._post( + path_template( + "/simulations/inbound_check_deposits/{inbound_check_deposit_id}/adjustment", + inbound_check_deposit_id=inbound_check_deposit_id, + ), + body=maybe_transform( + { + "amount": amount, + "reason": reason, + }, + inbound_check_deposit_adjustment_params.InboundCheckDepositAdjustmentParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + +class AsyncInboundCheckDepositsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundCheckDepositsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundCheckDepositsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundCheckDepositsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundCheckDepositsResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_number_id: str, + amount: int, + check_number: str, + payee_name_analysis: Literal["name_matches", "does_not_match", "not_evaluated"] | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """Simulates an Inbound Check Deposit against your account. + + This imitates someone + depositing a check at their bank that was issued from your account. It may or + may not be associated with a Check Transfer. Increase will evaluate the Inbound + Check Deposit as we would in production and either create a Transaction or a + Declined Transaction as a result. You can inspect the resulting Inbound Check + Deposit object to see the result. + + Args: + account_number_id: The identifier of the Account Number the Inbound Check Deposit will be against. + + amount: The check amount in cents. + + check_number: The check number on the check to be deposited. + + payee_name_analysis: Simulate the outcome of + [payee name checking](https://increase.com/documentation/positive-pay#payee-name-mismatches). + Defaults to `not_evaluated`. + + - `name_matches` - The details on the check match the recipient name of the + check transfer. + - `does_not_match` - The details on the check do not match the recipient name of + the check transfer. + - `not_evaluated` - The payee name analysis was not evaluated. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/inbound_check_deposits", + body=await async_maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "check_number": check_number, + "payee_name_analysis": payee_name_analysis, + }, + inbound_check_deposit_create_params.InboundCheckDepositCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + async def adjustment( + self, + inbound_check_deposit_id: str, + *, + amount: int | Omit = omit, + reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"] + | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundCheckDeposit: + """Simulates an adjustment on an Inbound Check Deposit. + + The Inbound Check Deposit + must have a `status` of `accepted`. + + Args: + inbound_check_deposit_id: The identifier of the Inbound Check Deposit to adjust. + + amount: The adjustment amount in cents. Defaults to the amount of the Inbound Check + Deposit. + + reason: The reason for the adjustment. Defaults to `wrong_payee_credit`. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not inbound_check_deposit_id: + raise ValueError( + f"Expected a non-empty value for `inbound_check_deposit_id` but received {inbound_check_deposit_id!r}" + ) + return await self._post( + path_template( + "/simulations/inbound_check_deposits/{inbound_check_deposit_id}/adjustment", + inbound_check_deposit_id=inbound_check_deposit_id, + ), + body=await async_maybe_transform( + { + "amount": amount, + "reason": reason, + }, + inbound_check_deposit_adjustment_params.InboundCheckDepositAdjustmentParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundCheckDeposit, + ) + + +class InboundCheckDepositsResourceWithRawResponse: + def __init__(self, inbound_check_deposits: InboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.create = to_raw_response_wrapper( + inbound_check_deposits.create, + ) + self.adjustment = to_raw_response_wrapper( + inbound_check_deposits.adjustment, + ) + + +class AsyncInboundCheckDepositsResourceWithRawResponse: + def __init__(self, inbound_check_deposits: AsyncInboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.create = async_to_raw_response_wrapper( + inbound_check_deposits.create, + ) + self.adjustment = async_to_raw_response_wrapper( + inbound_check_deposits.adjustment, + ) + + +class InboundCheckDepositsResourceWithStreamingResponse: + def __init__(self, inbound_check_deposits: InboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.create = to_streamed_response_wrapper( + inbound_check_deposits.create, + ) + self.adjustment = to_streamed_response_wrapper( + inbound_check_deposits.adjustment, + ) + + +class AsyncInboundCheckDepositsResourceWithStreamingResponse: + def __init__(self, inbound_check_deposits: AsyncInboundCheckDepositsResource) -> None: + self._inbound_check_deposits = inbound_check_deposits + + self.create = async_to_streamed_response_wrapper( + inbound_check_deposits.create, + ) + self.adjustment = async_to_streamed_response_wrapper( + inbound_check_deposits.adjustment, + ) diff --git a/src/increase/resources/simulations/inbound_fednow_transfers.py b/src/increase/resources/simulations/inbound_fednow_transfers.py new file mode 100644 index 000000000..013c5e352 --- /dev/null +++ b/src/increase/resources/simulations/inbound_fednow_transfers.py @@ -0,0 +1,233 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import inbound_fednow_transfer_create_params +from ...types.inbound_fednow_transfer import InboundFednowTransfer + +__all__ = ["InboundFednowTransfersResource", "AsyncInboundFednowTransfersResource"] + + +class InboundFednowTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundFednowTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundFednowTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundFednowTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundFednowTransfersResourceWithStreamingResponse(self) + + def create( + self, + *, + account_number_id: str, + amount: int, + debtor_account_number: str | Omit = omit, + debtor_name: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundFednowTransfer: + """ + Simulates an [Inbound FedNow Transfer](#inbound-fednow-transfers) to your + account. + + Args: + account_number_id: The identifier of the Account Number the inbound FedNow Transfer is for. + + amount: The transfer amount in USD cents. Must be positive. + + debtor_account_number: The account number of the account that sent the transfer. + + debtor_name: The name provided by the sender of the transfer. + + debtor_routing_number: The routing number of the account that sent the transfer. + + unstructured_remittance_information: Additional information included with the transfer. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/inbound_fednow_transfers", + body=maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "debtor_account_number": debtor_account_number, + "debtor_name": debtor_name, + "debtor_routing_number": debtor_routing_number, + "unstructured_remittance_information": unstructured_remittance_information, + }, + inbound_fednow_transfer_create_params.InboundFednowTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundFednowTransfer, + ) + + +class AsyncInboundFednowTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundFednowTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundFednowTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundFednowTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundFednowTransfersResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_number_id: str, + amount: int, + debtor_account_number: str | Omit = omit, + debtor_name: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundFednowTransfer: + """ + Simulates an [Inbound FedNow Transfer](#inbound-fednow-transfers) to your + account. + + Args: + account_number_id: The identifier of the Account Number the inbound FedNow Transfer is for. + + amount: The transfer amount in USD cents. Must be positive. + + debtor_account_number: The account number of the account that sent the transfer. + + debtor_name: The name provided by the sender of the transfer. + + debtor_routing_number: The routing number of the account that sent the transfer. + + unstructured_remittance_information: Additional information included with the transfer. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/inbound_fednow_transfers", + body=await async_maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "debtor_account_number": debtor_account_number, + "debtor_name": debtor_name, + "debtor_routing_number": debtor_routing_number, + "unstructured_remittance_information": unstructured_remittance_information, + }, + inbound_fednow_transfer_create_params.InboundFednowTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundFednowTransfer, + ) + + +class InboundFednowTransfersResourceWithRawResponse: + def __init__(self, inbound_fednow_transfers: InboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.create = to_raw_response_wrapper( + inbound_fednow_transfers.create, + ) + + +class AsyncInboundFednowTransfersResourceWithRawResponse: + def __init__(self, inbound_fednow_transfers: AsyncInboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.create = async_to_raw_response_wrapper( + inbound_fednow_transfers.create, + ) + + +class InboundFednowTransfersResourceWithStreamingResponse: + def __init__(self, inbound_fednow_transfers: InboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.create = to_streamed_response_wrapper( + inbound_fednow_transfers.create, + ) + + +class AsyncInboundFednowTransfersResourceWithStreamingResponse: + def __init__(self, inbound_fednow_transfers: AsyncInboundFednowTransfersResource) -> None: + self._inbound_fednow_transfers = inbound_fednow_transfers + + self.create = async_to_streamed_response_wrapper( + inbound_fednow_transfers.create, + ) diff --git a/src/increase/resources/simulations/inbound_funds_holds.py b/src/increase/resources/simulations/inbound_funds_holds.py deleted file mode 100644 index 8a245107d..000000000 --- a/src/increase/resources/simulations/inbound_funds_holds.py +++ /dev/null @@ -1,163 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import httpx - -from ... import _legacy_response -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) -from ...types.simulations import InboundFundsHoldReleaseResponse - -__all__ = ["InboundFundsHolds", "AsyncInboundFundsHolds"] - - -class InboundFundsHolds(SyncAPIResource): - @cached_property - def with_raw_response(self) -> InboundFundsHoldsWithRawResponse: - return InboundFundsHoldsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> InboundFundsHoldsWithStreamingResponse: - return InboundFundsHoldsWithStreamingResponse(self) - - def release( - self, - inbound_funds_hold_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> InboundFundsHoldReleaseResponse: - """ - This endpoint simulates immediately releasing an inbound funds hold, which might - be created as a result of e.g., an ACH debit. - - Args: - inbound_funds_hold_id: The inbound funds hold to release. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - if not inbound_funds_hold_id: - raise ValueError( - f"Expected a non-empty value for `inbound_funds_hold_id` but received {inbound_funds_hold_id!r}" - ) - return self._post( - f"/simulations/inbound_funds_holds/{inbound_funds_hold_id}/release", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=InboundFundsHoldReleaseResponse, - ) - - -class AsyncInboundFundsHolds(AsyncAPIResource): - @cached_property - def with_raw_response(self) -> AsyncInboundFundsHoldsWithRawResponse: - return AsyncInboundFundsHoldsWithRawResponse(self) - - @cached_property - def with_streaming_response(self) -> AsyncInboundFundsHoldsWithStreamingResponse: - return AsyncInboundFundsHoldsWithStreamingResponse(self) - - async def release( - self, - inbound_funds_hold_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> InboundFundsHoldReleaseResponse: - """ - This endpoint simulates immediately releasing an inbound funds hold, which might - be created as a result of e.g., an ACH debit. - - Args: - inbound_funds_hold_id: The inbound funds hold to release. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - if not inbound_funds_hold_id: - raise ValueError( - f"Expected a non-empty value for `inbound_funds_hold_id` but received {inbound_funds_hold_id!r}" - ) - return await self._post( - f"/simulations/inbound_funds_holds/{inbound_funds_hold_id}/release", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=InboundFundsHoldReleaseResponse, - ) - - -class InboundFundsHoldsWithRawResponse: - def __init__(self, inbound_funds_holds: InboundFundsHolds) -> None: - self._inbound_funds_holds = inbound_funds_holds - - self.release = _legacy_response.to_raw_response_wrapper( - inbound_funds_holds.release, - ) - - -class AsyncInboundFundsHoldsWithRawResponse: - def __init__(self, inbound_funds_holds: AsyncInboundFundsHolds) -> None: - self._inbound_funds_holds = inbound_funds_holds - - self.release = _legacy_response.async_to_raw_response_wrapper( - inbound_funds_holds.release, - ) - - -class InboundFundsHoldsWithStreamingResponse: - def __init__(self, inbound_funds_holds: InboundFundsHolds) -> None: - self._inbound_funds_holds = inbound_funds_holds - - self.release = to_streamed_response_wrapper( - inbound_funds_holds.release, - ) - - -class AsyncInboundFundsHoldsWithStreamingResponse: - def __init__(self, inbound_funds_holds: AsyncInboundFundsHolds) -> None: - self._inbound_funds_holds = inbound_funds_holds - - self.release = async_to_streamed_response_wrapper( - inbound_funds_holds.release, - ) diff --git a/src/increase/resources/simulations/inbound_mail_items.py b/src/increase/resources/simulations/inbound_mail_items.py new file mode 100755 index 000000000..3439589af --- /dev/null +++ b/src/increase/resources/simulations/inbound_mail_items.py @@ -0,0 +1,211 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import inbound_mail_item_create_params +from ...types.inbound_mail_item import InboundMailItem + +__all__ = ["InboundMailItemsResource", "AsyncInboundMailItemsResource"] + + +class InboundMailItemsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundMailItemsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundMailItemsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundMailItemsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundMailItemsResourceWithStreamingResponse(self) + + def create( + self, + *, + amount: int, + lockbox_id: str, + contents_file_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundMailItem: + """ + Simulates an inbound mail item to your account, as if someone had mailed a + physical check to one of your account's Lockboxes. + + Args: + amount: The amount of the check to be simulated, in cents. + + lockbox_id: The identifier of the Lockbox to simulate inbound mail to. + + contents_file_id: The file containing the PDF contents. If not present, a default check image file + will be used. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/inbound_mail_items", + body=maybe_transform( + { + "amount": amount, + "lockbox_id": lockbox_id, + "contents_file_id": contents_file_id, + }, + inbound_mail_item_create_params.InboundMailItemCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundMailItem, + ) + + +class AsyncInboundMailItemsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundMailItemsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundMailItemsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundMailItemsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundMailItemsResourceWithStreamingResponse(self) + + async def create( + self, + *, + amount: int, + lockbox_id: str, + contents_file_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundMailItem: + """ + Simulates an inbound mail item to your account, as if someone had mailed a + physical check to one of your account's Lockboxes. + + Args: + amount: The amount of the check to be simulated, in cents. + + lockbox_id: The identifier of the Lockbox to simulate inbound mail to. + + contents_file_id: The file containing the PDF contents. If not present, a default check image file + will be used. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/inbound_mail_items", + body=await async_maybe_transform( + { + "amount": amount, + "lockbox_id": lockbox_id, + "contents_file_id": contents_file_id, + }, + inbound_mail_item_create_params.InboundMailItemCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundMailItem, + ) + + +class InboundMailItemsResourceWithRawResponse: + def __init__(self, inbound_mail_items: InboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.create = to_raw_response_wrapper( + inbound_mail_items.create, + ) + + +class AsyncInboundMailItemsResourceWithRawResponse: + def __init__(self, inbound_mail_items: AsyncInboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.create = async_to_raw_response_wrapper( + inbound_mail_items.create, + ) + + +class InboundMailItemsResourceWithStreamingResponse: + def __init__(self, inbound_mail_items: InboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.create = to_streamed_response_wrapper( + inbound_mail_items.create, + ) + + +class AsyncInboundMailItemsResourceWithStreamingResponse: + def __init__(self, inbound_mail_items: AsyncInboundMailItemsResource) -> None: + self._inbound_mail_items = inbound_mail_items + + self.create = async_to_streamed_response_wrapper( + inbound_mail_items.create, + ) diff --git a/src/increase/resources/simulations/inbound_real_time_payments_transfers.py b/src/increase/resources/simulations/inbound_real_time_payments_transfers.py new file mode 100644 index 000000000..91f7ecb5e --- /dev/null +++ b/src/increase/resources/simulations/inbound_real_time_payments_transfers.py @@ -0,0 +1,245 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import inbound_real_time_payments_transfer_create_params +from ...types.inbound_real_time_payments_transfer import InboundRealTimePaymentsTransfer + +__all__ = ["InboundRealTimePaymentsTransfersResource", "AsyncInboundRealTimePaymentsTransfersResource"] + + +class InboundRealTimePaymentsTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundRealTimePaymentsTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundRealTimePaymentsTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundRealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundRealTimePaymentsTransfersResourceWithStreamingResponse(self) + + def create( + self, + *, + account_number_id: str, + amount: int, + debtor_account_number: str | Omit = omit, + debtor_name: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + request_for_payment_id: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundRealTimePaymentsTransfer: + """ + Simulates an + [Inbound Real-Time Payments Transfer](#inbound-real-time-payments-transfers) to + your account. Real-Time Payments are a beta feature. + + Args: + account_number_id: The identifier of the Account Number the inbound Real-Time Payments Transfer is + for. + + amount: The transfer amount in USD cents. Must be positive. + + debtor_account_number: The account number of the account that sent the transfer. + + debtor_name: The name provided by the sender of the transfer. + + debtor_routing_number: The routing number of the account that sent the transfer. + + request_for_payment_id: The identifier of a pending Request for Payment that this transfer will fulfill. + + unstructured_remittance_information: Additional information included with the transfer. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/inbound_real_time_payments_transfers", + body=maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "debtor_account_number": debtor_account_number, + "debtor_name": debtor_name, + "debtor_routing_number": debtor_routing_number, + "request_for_payment_id": request_for_payment_id, + "unstructured_remittance_information": unstructured_remittance_information, + }, + inbound_real_time_payments_transfer_create_params.InboundRealTimePaymentsTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundRealTimePaymentsTransfer, + ) + + +class AsyncInboundRealTimePaymentsTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_number_id: str, + amount: int, + debtor_account_number: str | Omit = omit, + debtor_name: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + request_for_payment_id: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundRealTimePaymentsTransfer: + """ + Simulates an + [Inbound Real-Time Payments Transfer](#inbound-real-time-payments-transfers) to + your account. Real-Time Payments are a beta feature. + + Args: + account_number_id: The identifier of the Account Number the inbound Real-Time Payments Transfer is + for. + + amount: The transfer amount in USD cents. Must be positive. + + debtor_account_number: The account number of the account that sent the transfer. + + debtor_name: The name provided by the sender of the transfer. + + debtor_routing_number: The routing number of the account that sent the transfer. + + request_for_payment_id: The identifier of a pending Request for Payment that this transfer will fulfill. + + unstructured_remittance_information: Additional information included with the transfer. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/inbound_real_time_payments_transfers", + body=await async_maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "debtor_account_number": debtor_account_number, + "debtor_name": debtor_name, + "debtor_routing_number": debtor_routing_number, + "request_for_payment_id": request_for_payment_id, + "unstructured_remittance_information": unstructured_remittance_information, + }, + inbound_real_time_payments_transfer_create_params.InboundRealTimePaymentsTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundRealTimePaymentsTransfer, + ) + + +class InboundRealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, inbound_real_time_payments_transfers: InboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.create = to_raw_response_wrapper( + inbound_real_time_payments_transfers.create, + ) + + +class AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, inbound_real_time_payments_transfers: AsyncInboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.create = async_to_raw_response_wrapper( + inbound_real_time_payments_transfers.create, + ) + + +class InboundRealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, inbound_real_time_payments_transfers: InboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.create = to_streamed_response_wrapper( + inbound_real_time_payments_transfers.create, + ) + + +class AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, inbound_real_time_payments_transfers: AsyncInboundRealTimePaymentsTransfersResource) -> None: + self._inbound_real_time_payments_transfers = inbound_real_time_payments_transfers + + self.create = async_to_streamed_response_wrapper( + inbound_real_time_payments_transfers.create, + ) diff --git a/src/increase/resources/simulations/inbound_wire_drawdown_requests.py b/src/increase/resources/simulations/inbound_wire_drawdown_requests.py index 457dc4051..12f0842c7 100644 --- a/src/increase/resources/simulations/inbound_wire_drawdown_requests.py +++ b/src/increase/resources/simulations/inbound_wire_drawdown_requests.py @@ -4,62 +4,71 @@ import httpx -from ... import _legacy_response -from ...types import InboundWireDrawdownRequest -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options from ...types.simulations import inbound_wire_drawdown_request_create_params +from ...types.inbound_wire_drawdown_request import InboundWireDrawdownRequest -__all__ = ["InboundWireDrawdownRequests", "AsyncInboundWireDrawdownRequests"] +__all__ = ["InboundWireDrawdownRequestsResource", "AsyncInboundWireDrawdownRequestsResource"] -class InboundWireDrawdownRequests(SyncAPIResource): +class InboundWireDrawdownRequestsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> InboundWireDrawdownRequestsWithRawResponse: - return InboundWireDrawdownRequestsWithRawResponse(self) + def with_raw_response(self) -> InboundWireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundWireDrawdownRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> InboundWireDrawdownRequestsWithStreamingResponse: - return InboundWireDrawdownRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> InboundWireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundWireDrawdownRequestsResourceWithStreamingResponse(self) def create( self, *, amount: int, - beneficiary_account_number: str, - beneficiary_routing_number: str, + creditor_account_number: str, + creditor_routing_number: str, currency: str, - message_to_recipient: str, - originator_account_number: str, - originator_routing_number: str, recipient_account_number_id: str, - beneficiary_address_line1: str | NotGiven = NOT_GIVEN, - beneficiary_address_line2: str | NotGiven = NOT_GIVEN, - beneficiary_address_line3: str | NotGiven = NOT_GIVEN, - beneficiary_name: str | NotGiven = NOT_GIVEN, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line1: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line2: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line3: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line4: str | NotGiven = NOT_GIVEN, + creditor_address_line1: str | Omit = omit, + creditor_address_line2: str | Omit = omit, + creditor_address_line3: str | Omit = omit, + creditor_name: str | Omit = omit, + debtor_account_number: str | Omit = omit, + debtor_address_line1: str | Omit = omit, + debtor_address_line2: str | Omit = omit, + debtor_address_line3: str | Omit = omit, + debtor_name: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + end_to_end_identification: str | Omit = omit, + instruction_identification: str | Omit = omit, + unique_end_to_end_transaction_reference: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundWireDrawdownRequest: """ @@ -69,49 +78,50 @@ def create( Args: amount: The amount being requested in cents. - beneficiary_account_number: The drawdown request's beneficiary's account number. + creditor_account_number: The creditor's account number. - beneficiary_routing_number: The drawdown request's beneficiary's routing number. + creditor_routing_number: The creditor's routing number. currency: The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the amount being requested. Will always be "USD". - message_to_recipient: A message from the drawdown request's originator. - - originator_account_number: The drawdown request's originator's account number. - - originator_routing_number: The drawdown request's originator's routing number. - recipient_account_number_id: The Account Number to which the recipient of this request is being requested to send funds from. - beneficiary_address_line1: Line 1 of the drawdown request's beneficiary's address. + creditor_address_line1: A free-form address field set by the sender representing the first line of the + creditor's address. + + creditor_address_line2: A free-form address field set by the sender representing the second line of the + creditor's address. + + creditor_address_line3: A free-form address field set by the sender representing the third line of the + creditor's address. - beneficiary_address_line2: Line 2 of the drawdown request's beneficiary's address. + creditor_name: A free-form name field set by the sender representing the creditor's name. - beneficiary_address_line3: Line 3 of the drawdown request's beneficiary's address. + debtor_account_number: The debtor's account number. - beneficiary_name: The drawdown request's beneficiary's name. + debtor_address_line1: A free-form address field set by the sender representing the first line of the + debtor's address. - originator_address_line1: Line 1 of the drawdown request's originator's address. + debtor_address_line2: A free-form address field set by the sender representing the second line of the + debtor's address. - originator_address_line2: Line 2 of the drawdown request's originator's address. + debtor_address_line3: A free-form address field set by the sender. - originator_address_line3: Line 3 of the drawdown request's originator's address. + debtor_name: A free-form name field set by the sender representing the debtor's name. - originator_name: The drawdown request's originator's name. + debtor_routing_number: The debtor's routing number. - originator_to_beneficiary_information_line1: Line 1 of the information conveyed from the originator of the message to the - beneficiary. + end_to_end_identification: A free-form reference string set by the sender, to help identify the transfer. - originator_to_beneficiary_information_line2: Line 2 of the information conveyed from the originator of the message to the - beneficiary. + instruction_identification: The sending bank's identifier for the wire transfer. - originator_to_beneficiary_information_line3: Line 3 of the information conveyed from the originator of the message to the - beneficiary. + unique_end_to_end_transaction_reference: The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + of the transfer. - originator_to_beneficiary_information_line4: Line 4 of the information conveyed from the originator of the message to the - beneficiary. + unstructured_remittance_information: A free-form message set by the sender. extra_headers: Send extra headers @@ -128,25 +138,24 @@ def create( body=maybe_transform( { "amount": amount, - "beneficiary_account_number": beneficiary_account_number, - "beneficiary_routing_number": beneficiary_routing_number, + "creditor_account_number": creditor_account_number, + "creditor_routing_number": creditor_routing_number, "currency": currency, - "message_to_recipient": message_to_recipient, - "originator_account_number": originator_account_number, - "originator_routing_number": originator_routing_number, "recipient_account_number_id": recipient_account_number_id, - "beneficiary_address_line1": beneficiary_address_line1, - "beneficiary_address_line2": beneficiary_address_line2, - "beneficiary_address_line3": beneficiary_address_line3, - "beneficiary_name": beneficiary_name, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, - "originator_to_beneficiary_information_line1": originator_to_beneficiary_information_line1, - "originator_to_beneficiary_information_line2": originator_to_beneficiary_information_line2, - "originator_to_beneficiary_information_line3": originator_to_beneficiary_information_line3, - "originator_to_beneficiary_information_line4": originator_to_beneficiary_information_line4, + "creditor_address_line1": creditor_address_line1, + "creditor_address_line2": creditor_address_line2, + "creditor_address_line3": creditor_address_line3, + "creditor_name": creditor_name, + "debtor_account_number": debtor_account_number, + "debtor_address_line1": debtor_address_line1, + "debtor_address_line2": debtor_address_line2, + "debtor_address_line3": debtor_address_line3, + "debtor_name": debtor_name, + "debtor_routing_number": debtor_routing_number, + "end_to_end_identification": end_to_end_identification, + "instruction_identification": instruction_identification, + "unique_end_to_end_transaction_reference": unique_end_to_end_transaction_reference, + "unstructured_remittance_information": unstructured_remittance_information, }, inbound_wire_drawdown_request_create_params.InboundWireDrawdownRequestCreateParams, ), @@ -161,44 +170,54 @@ def create( ) -class AsyncInboundWireDrawdownRequests(AsyncAPIResource): +class AsyncInboundWireDrawdownRequestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncInboundWireDrawdownRequestsWithRawResponse: - return AsyncInboundWireDrawdownRequestsWithRawResponse(self) + def with_raw_response(self) -> AsyncInboundWireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundWireDrawdownRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncInboundWireDrawdownRequestsWithStreamingResponse: - return AsyncInboundWireDrawdownRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse(self) async def create( self, *, amount: int, - beneficiary_account_number: str, - beneficiary_routing_number: str, + creditor_account_number: str, + creditor_routing_number: str, currency: str, - message_to_recipient: str, - originator_account_number: str, - originator_routing_number: str, recipient_account_number_id: str, - beneficiary_address_line1: str | NotGiven = NOT_GIVEN, - beneficiary_address_line2: str | NotGiven = NOT_GIVEN, - beneficiary_address_line3: str | NotGiven = NOT_GIVEN, - beneficiary_name: str | NotGiven = NOT_GIVEN, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line1: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line2: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line3: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line4: str | NotGiven = NOT_GIVEN, + creditor_address_line1: str | Omit = omit, + creditor_address_line2: str | Omit = omit, + creditor_address_line3: str | Omit = omit, + creditor_name: str | Omit = omit, + debtor_account_number: str | Omit = omit, + debtor_address_line1: str | Omit = omit, + debtor_address_line2: str | Omit = omit, + debtor_address_line3: str | Omit = omit, + debtor_name: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + end_to_end_identification: str | Omit = omit, + instruction_identification: str | Omit = omit, + unique_end_to_end_transaction_reference: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> InboundWireDrawdownRequest: """ @@ -208,49 +227,50 @@ async def create( Args: amount: The amount being requested in cents. - beneficiary_account_number: The drawdown request's beneficiary's account number. + creditor_account_number: The creditor's account number. - beneficiary_routing_number: The drawdown request's beneficiary's routing number. + creditor_routing_number: The creditor's routing number. currency: The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the amount being requested. Will always be "USD". - message_to_recipient: A message from the drawdown request's originator. - - originator_account_number: The drawdown request's originator's account number. - - originator_routing_number: The drawdown request's originator's routing number. - recipient_account_number_id: The Account Number to which the recipient of this request is being requested to send funds from. - beneficiary_address_line1: Line 1 of the drawdown request's beneficiary's address. + creditor_address_line1: A free-form address field set by the sender representing the first line of the + creditor's address. + + creditor_address_line2: A free-form address field set by the sender representing the second line of the + creditor's address. + + creditor_address_line3: A free-form address field set by the sender representing the third line of the + creditor's address. - beneficiary_address_line2: Line 2 of the drawdown request's beneficiary's address. + creditor_name: A free-form name field set by the sender representing the creditor's name. - beneficiary_address_line3: Line 3 of the drawdown request's beneficiary's address. + debtor_account_number: The debtor's account number. - beneficiary_name: The drawdown request's beneficiary's name. + debtor_address_line1: A free-form address field set by the sender representing the first line of the + debtor's address. - originator_address_line1: Line 1 of the drawdown request's originator's address. + debtor_address_line2: A free-form address field set by the sender representing the second line of the + debtor's address. - originator_address_line2: Line 2 of the drawdown request's originator's address. + debtor_address_line3: A free-form address field set by the sender. - originator_address_line3: Line 3 of the drawdown request's originator's address. + debtor_name: A free-form name field set by the sender representing the debtor's name. - originator_name: The drawdown request's originator's name. + debtor_routing_number: The debtor's routing number. - originator_to_beneficiary_information_line1: Line 1 of the information conveyed from the originator of the message to the - beneficiary. + end_to_end_identification: A free-form reference string set by the sender, to help identify the transfer. - originator_to_beneficiary_information_line2: Line 2 of the information conveyed from the originator of the message to the - beneficiary. + instruction_identification: The sending bank's identifier for the wire transfer. - originator_to_beneficiary_information_line3: Line 3 of the information conveyed from the originator of the message to the - beneficiary. + unique_end_to_end_transaction_reference: The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + of the transfer. - originator_to_beneficiary_information_line4: Line 4 of the information conveyed from the originator of the message to the - beneficiary. + unstructured_remittance_information: A free-form message set by the sender. extra_headers: Send extra headers @@ -267,25 +287,24 @@ async def create( body=await async_maybe_transform( { "amount": amount, - "beneficiary_account_number": beneficiary_account_number, - "beneficiary_routing_number": beneficiary_routing_number, + "creditor_account_number": creditor_account_number, + "creditor_routing_number": creditor_routing_number, "currency": currency, - "message_to_recipient": message_to_recipient, - "originator_account_number": originator_account_number, - "originator_routing_number": originator_routing_number, "recipient_account_number_id": recipient_account_number_id, - "beneficiary_address_line1": beneficiary_address_line1, - "beneficiary_address_line2": beneficiary_address_line2, - "beneficiary_address_line3": beneficiary_address_line3, - "beneficiary_name": beneficiary_name, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, - "originator_to_beneficiary_information_line1": originator_to_beneficiary_information_line1, - "originator_to_beneficiary_information_line2": originator_to_beneficiary_information_line2, - "originator_to_beneficiary_information_line3": originator_to_beneficiary_information_line3, - "originator_to_beneficiary_information_line4": originator_to_beneficiary_information_line4, + "creditor_address_line1": creditor_address_line1, + "creditor_address_line2": creditor_address_line2, + "creditor_address_line3": creditor_address_line3, + "creditor_name": creditor_name, + "debtor_account_number": debtor_account_number, + "debtor_address_line1": debtor_address_line1, + "debtor_address_line2": debtor_address_line2, + "debtor_address_line3": debtor_address_line3, + "debtor_name": debtor_name, + "debtor_routing_number": debtor_routing_number, + "end_to_end_identification": end_to_end_identification, + "instruction_identification": instruction_identification, + "unique_end_to_end_transaction_reference": unique_end_to_end_transaction_reference, + "unstructured_remittance_information": unstructured_remittance_information, }, inbound_wire_drawdown_request_create_params.InboundWireDrawdownRequestCreateParams, ), @@ -300,26 +319,26 @@ async def create( ) -class InboundWireDrawdownRequestsWithRawResponse: - def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequests) -> None: +class InboundWireDrawdownRequestsResourceWithRawResponse: + def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( inbound_wire_drawdown_requests.create, ) -class AsyncInboundWireDrawdownRequestsWithRawResponse: - def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequests) -> None: +class AsyncInboundWireDrawdownRequestsResourceWithRawResponse: + def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( inbound_wire_drawdown_requests.create, ) -class InboundWireDrawdownRequestsWithStreamingResponse: - def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequests) -> None: +class InboundWireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests self.create = to_streamed_response_wrapper( @@ -327,8 +346,8 @@ def __init__(self, inbound_wire_drawdown_requests: InboundWireDrawdownRequests) ) -class AsyncInboundWireDrawdownRequestsWithStreamingResponse: - def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequests) -> None: +class AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, inbound_wire_drawdown_requests: AsyncInboundWireDrawdownRequestsResource) -> None: self._inbound_wire_drawdown_requests = inbound_wire_drawdown_requests self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/inbound_wire_transfers.py b/src/increase/resources/simulations/inbound_wire_transfers.py new file mode 100644 index 000000000..06c7372b3 --- /dev/null +++ b/src/increase/resources/simulations/inbound_wire_transfers.py @@ -0,0 +1,339 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import inbound_wire_transfer_create_params +from ...types.inbound_wire_transfer import InboundWireTransfer + +__all__ = ["InboundWireTransfersResource", "AsyncInboundWireTransfersResource"] + + +class InboundWireTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> InboundWireTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InboundWireTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> InboundWireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InboundWireTransfersResourceWithStreamingResponse(self) + + def create( + self, + *, + account_number_id: str, + amount: int, + creditor_address_line1: str | Omit = omit, + creditor_address_line2: str | Omit = omit, + creditor_address_line3: str | Omit = omit, + creditor_name: str | Omit = omit, + debtor_address_line1: str | Omit = omit, + debtor_address_line2: str | Omit = omit, + debtor_address_line3: str | Omit = omit, + debtor_name: str | Omit = omit, + end_to_end_identification: str | Omit = omit, + instructing_agent_routing_number: str | Omit = omit, + instruction_identification: str | Omit = omit, + unique_end_to_end_transaction_reference: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, + wire_drawdown_request_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundWireTransfer: + """ + Simulates an [Inbound Wire Transfer](#inbound-wire-transfers) to your account. + + Args: + account_number_id: The identifier of the Account Number the inbound Wire Transfer is for. + + amount: The transfer amount in cents. Must be positive. + + creditor_address_line1: The sending bank will set creditor_address_line1 in production. You can simulate + any value here. + + creditor_address_line2: The sending bank will set creditor_address_line2 in production. You can simulate + any value here. + + creditor_address_line3: The sending bank will set creditor_address_line3 in production. You can simulate + any value here. + + creditor_name: The sending bank will set creditor_name in production. You can simulate any + value here. + + debtor_address_line1: The sending bank will set debtor_address_line1 in production. You can simulate + any value here. + + debtor_address_line2: The sending bank will set debtor_address_line2 in production. You can simulate + any value here. + + debtor_address_line3: The sending bank will set debtor_address_line3 in production. You can simulate + any value here. + + debtor_name: The sending bank will set debtor_name in production. You can simulate any value + here. + + end_to_end_identification: The sending bank will set end_to_end_identification in production. You can + simulate any value here. + + instructing_agent_routing_number: The sending bank will set instructing_agent_routing_number in production. You + can simulate any value here. + + instruction_identification: The sending bank will set instruction_identification in production. You can + simulate any value here. + + unique_end_to_end_transaction_reference: The sending bank will set unique_end_to_end_transaction_reference in production. + You can simulate any value here. + + unstructured_remittance_information: The sending bank will set unstructured_remittance_information in production. You + can simulate any value here. + + wire_drawdown_request_id: The identifier of a Wire Drawdown Request the inbound Wire Transfer is + fulfilling. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/inbound_wire_transfers", + body=maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "creditor_address_line1": creditor_address_line1, + "creditor_address_line2": creditor_address_line2, + "creditor_address_line3": creditor_address_line3, + "creditor_name": creditor_name, + "debtor_address_line1": debtor_address_line1, + "debtor_address_line2": debtor_address_line2, + "debtor_address_line3": debtor_address_line3, + "debtor_name": debtor_name, + "end_to_end_identification": end_to_end_identification, + "instructing_agent_routing_number": instructing_agent_routing_number, + "instruction_identification": instruction_identification, + "unique_end_to_end_transaction_reference": unique_end_to_end_transaction_reference, + "unstructured_remittance_information": unstructured_remittance_information, + "wire_drawdown_request_id": wire_drawdown_request_id, + }, + inbound_wire_transfer_create_params.InboundWireTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundWireTransfer, + ) + + +class AsyncInboundWireTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncInboundWireTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInboundWireTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncInboundWireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInboundWireTransfersResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_number_id: str, + amount: int, + creditor_address_line1: str | Omit = omit, + creditor_address_line2: str | Omit = omit, + creditor_address_line3: str | Omit = omit, + creditor_name: str | Omit = omit, + debtor_address_line1: str | Omit = omit, + debtor_address_line2: str | Omit = omit, + debtor_address_line3: str | Omit = omit, + debtor_name: str | Omit = omit, + end_to_end_identification: str | Omit = omit, + instructing_agent_routing_number: str | Omit = omit, + instruction_identification: str | Omit = omit, + unique_end_to_end_transaction_reference: str | Omit = omit, + unstructured_remittance_information: str | Omit = omit, + wire_drawdown_request_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> InboundWireTransfer: + """ + Simulates an [Inbound Wire Transfer](#inbound-wire-transfers) to your account. + + Args: + account_number_id: The identifier of the Account Number the inbound Wire Transfer is for. + + amount: The transfer amount in cents. Must be positive. + + creditor_address_line1: The sending bank will set creditor_address_line1 in production. You can simulate + any value here. + + creditor_address_line2: The sending bank will set creditor_address_line2 in production. You can simulate + any value here. + + creditor_address_line3: The sending bank will set creditor_address_line3 in production. You can simulate + any value here. + + creditor_name: The sending bank will set creditor_name in production. You can simulate any + value here. + + debtor_address_line1: The sending bank will set debtor_address_line1 in production. You can simulate + any value here. + + debtor_address_line2: The sending bank will set debtor_address_line2 in production. You can simulate + any value here. + + debtor_address_line3: The sending bank will set debtor_address_line3 in production. You can simulate + any value here. + + debtor_name: The sending bank will set debtor_name in production. You can simulate any value + here. + + end_to_end_identification: The sending bank will set end_to_end_identification in production. You can + simulate any value here. + + instructing_agent_routing_number: The sending bank will set instructing_agent_routing_number in production. You + can simulate any value here. + + instruction_identification: The sending bank will set instruction_identification in production. You can + simulate any value here. + + unique_end_to_end_transaction_reference: The sending bank will set unique_end_to_end_transaction_reference in production. + You can simulate any value here. + + unstructured_remittance_information: The sending bank will set unstructured_remittance_information in production. You + can simulate any value here. + + wire_drawdown_request_id: The identifier of a Wire Drawdown Request the inbound Wire Transfer is + fulfilling. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/inbound_wire_transfers", + body=await async_maybe_transform( + { + "account_number_id": account_number_id, + "amount": amount, + "creditor_address_line1": creditor_address_line1, + "creditor_address_line2": creditor_address_line2, + "creditor_address_line3": creditor_address_line3, + "creditor_name": creditor_name, + "debtor_address_line1": debtor_address_line1, + "debtor_address_line2": debtor_address_line2, + "debtor_address_line3": debtor_address_line3, + "debtor_name": debtor_name, + "end_to_end_identification": end_to_end_identification, + "instructing_agent_routing_number": instructing_agent_routing_number, + "instruction_identification": instruction_identification, + "unique_end_to_end_transaction_reference": unique_end_to_end_transaction_reference, + "unstructured_remittance_information": unstructured_remittance_information, + "wire_drawdown_request_id": wire_drawdown_request_id, + }, + inbound_wire_transfer_create_params.InboundWireTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=InboundWireTransfer, + ) + + +class InboundWireTransfersResourceWithRawResponse: + def __init__(self, inbound_wire_transfers: InboundWireTransfersResource) -> None: + self._inbound_wire_transfers = inbound_wire_transfers + + self.create = to_raw_response_wrapper( + inbound_wire_transfers.create, + ) + + +class AsyncInboundWireTransfersResourceWithRawResponse: + def __init__(self, inbound_wire_transfers: AsyncInboundWireTransfersResource) -> None: + self._inbound_wire_transfers = inbound_wire_transfers + + self.create = async_to_raw_response_wrapper( + inbound_wire_transfers.create, + ) + + +class InboundWireTransfersResourceWithStreamingResponse: + def __init__(self, inbound_wire_transfers: InboundWireTransfersResource) -> None: + self._inbound_wire_transfers = inbound_wire_transfers + + self.create = to_streamed_response_wrapper( + inbound_wire_transfers.create, + ) + + +class AsyncInboundWireTransfersResourceWithStreamingResponse: + def __init__(self, inbound_wire_transfers: AsyncInboundWireTransfersResource) -> None: + self._inbound_wire_transfers = inbound_wire_transfers + + self.create = async_to_streamed_response_wrapper( + inbound_wire_transfers.create, + ) diff --git a/src/increase/resources/simulations/interest_payments.py b/src/increase/resources/simulations/interest_payments.py index c3c7aff2f..afa6f2f3b 100644 --- a/src/increase/resources/simulations/interest_payments.py +++ b/src/increase/resources/simulations/interest_payments.py @@ -7,46 +7,57 @@ import httpx -from ... import _legacy_response -from ...types import Transaction -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options from ...types.simulations import interest_payment_create_params +from ...types.transaction import Transaction -__all__ = ["InterestPayments", "AsyncInterestPayments"] +__all__ = ["InterestPaymentsResource", "AsyncInterestPaymentsResource"] -class InterestPayments(SyncAPIResource): +class InterestPaymentsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> InterestPaymentsWithRawResponse: - return InterestPaymentsWithRawResponse(self) + def with_raw_response(self) -> InterestPaymentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return InterestPaymentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> InterestPaymentsWithStreamingResponse: - return InterestPaymentsWithStreamingResponse(self) + def with_streaming_response(self) -> InterestPaymentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return InterestPaymentsResourceWithStreamingResponse(self) def create( self, *, account_id: str, amount: int, - period_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - period_start: Union[str, datetime] | NotGiven = NOT_GIVEN, + accrued_on_account_id: str | Omit = omit, + period_end: Union[str, datetime] | Omit = omit, + period_start: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Transaction: """Simulates an interest payment to your account. @@ -55,10 +66,12 @@ def create( automatically on the first of each month. Args: - account_id: The identifier of the Account Number the Interest Payment is for. + account_id: The identifier of the Account the Interest Payment should be paid to is for. amount: The interest amount in cents. Must be positive. + accrued_on_account_id: The identifier of the Account the Interest accrued on. Defaults to `account_id`. + period_end: The end of the interest period. If not provided, defaults to the current time. period_start: The start of the interest period. If not provided, defaults to the current time. @@ -74,11 +87,12 @@ def create( idempotency_key: Specify a custom idempotency key for this request """ return self._post( - "/simulations/interest_payment", + "/simulations/interest_payments", body=maybe_transform( { "account_id": account_id, "amount": amount, + "accrued_on_account_id": accrued_on_account_id, "period_end": period_end, "period_start": period_start, }, @@ -95,28 +109,40 @@ def create( ) -class AsyncInterestPayments(AsyncAPIResource): +class AsyncInterestPaymentsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncInterestPaymentsWithRawResponse: - return AsyncInterestPaymentsWithRawResponse(self) + def with_raw_response(self) -> AsyncInterestPaymentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncInterestPaymentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncInterestPaymentsWithStreamingResponse: - return AsyncInterestPaymentsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncInterestPaymentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncInterestPaymentsResourceWithStreamingResponse(self) async def create( self, *, account_id: str, amount: int, - period_end: Union[str, datetime] | NotGiven = NOT_GIVEN, - period_start: Union[str, datetime] | NotGiven = NOT_GIVEN, + accrued_on_account_id: str | Omit = omit, + period_end: Union[str, datetime] | Omit = omit, + period_start: Union[str, datetime] | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Transaction: """Simulates an interest payment to your account. @@ -125,10 +151,12 @@ async def create( automatically on the first of each month. Args: - account_id: The identifier of the Account Number the Interest Payment is for. + account_id: The identifier of the Account the Interest Payment should be paid to is for. amount: The interest amount in cents. Must be positive. + accrued_on_account_id: The identifier of the Account the Interest accrued on. Defaults to `account_id`. + period_end: The end of the interest period. If not provided, defaults to the current time. period_start: The start of the interest period. If not provided, defaults to the current time. @@ -144,11 +172,12 @@ async def create( idempotency_key: Specify a custom idempotency key for this request """ return await self._post( - "/simulations/interest_payment", + "/simulations/interest_payments", body=await async_maybe_transform( { "account_id": account_id, "amount": amount, + "accrued_on_account_id": accrued_on_account_id, "period_end": period_end, "period_start": period_start, }, @@ -165,26 +194,26 @@ async def create( ) -class InterestPaymentsWithRawResponse: - def __init__(self, interest_payments: InterestPayments) -> None: +class InterestPaymentsResourceWithRawResponse: + def __init__(self, interest_payments: InterestPaymentsResource) -> None: self._interest_payments = interest_payments - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( interest_payments.create, ) -class AsyncInterestPaymentsWithRawResponse: - def __init__(self, interest_payments: AsyncInterestPayments) -> None: +class AsyncInterestPaymentsResourceWithRawResponse: + def __init__(self, interest_payments: AsyncInterestPaymentsResource) -> None: self._interest_payments = interest_payments - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( interest_payments.create, ) -class InterestPaymentsWithStreamingResponse: - def __init__(self, interest_payments: InterestPayments) -> None: +class InterestPaymentsResourceWithStreamingResponse: + def __init__(self, interest_payments: InterestPaymentsResource) -> None: self._interest_payments = interest_payments self.create = to_streamed_response_wrapper( @@ -192,8 +221,8 @@ def __init__(self, interest_payments: InterestPayments) -> None: ) -class AsyncInterestPaymentsWithStreamingResponse: - def __init__(self, interest_payments: AsyncInterestPayments) -> None: +class AsyncInterestPaymentsResourceWithStreamingResponse: + def __init__(self, interest_payments: AsyncInterestPaymentsResource) -> None: self._interest_payments = interest_payments self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/pending_transactions.py b/src/increase/resources/simulations/pending_transactions.py new file mode 100644 index 000000000..179c20420 --- /dev/null +++ b/src/increase/resources/simulations/pending_transactions.py @@ -0,0 +1,196 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.pending_transaction import PendingTransaction + +__all__ = ["PendingTransactionsResource", "AsyncPendingTransactionsResource"] + + +class PendingTransactionsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> PendingTransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return PendingTransactionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> PendingTransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return PendingTransactionsResourceWithStreamingResponse(self) + + def release_inbound_funds_hold( + self, + pending_transaction_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PendingTransaction: + """ + This endpoint simulates immediately releasing an Inbound Funds Hold, which might + be created as a result of, for example, an ACH debit. + + Args: + pending_transaction_id: The pending transaction to release. The pending transaction must have a + `inbound_funds_hold` source. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not pending_transaction_id: + raise ValueError( + f"Expected a non-empty value for `pending_transaction_id` but received {pending_transaction_id!r}" + ) + return self._post( + path_template( + "/simulations/pending_transactions/{pending_transaction_id}/release_inbound_funds_hold", + pending_transaction_id=pending_transaction_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PendingTransaction, + ) + + +class AsyncPendingTransactionsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncPendingTransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncPendingTransactionsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncPendingTransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncPendingTransactionsResourceWithStreamingResponse(self) + + async def release_inbound_funds_hold( + self, + pending_transaction_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PendingTransaction: + """ + This endpoint simulates immediately releasing an Inbound Funds Hold, which might + be created as a result of, for example, an ACH debit. + + Args: + pending_transaction_id: The pending transaction to release. The pending transaction must have a + `inbound_funds_hold` source. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not pending_transaction_id: + raise ValueError( + f"Expected a non-empty value for `pending_transaction_id` but received {pending_transaction_id!r}" + ) + return await self._post( + path_template( + "/simulations/pending_transactions/{pending_transaction_id}/release_inbound_funds_hold", + pending_transaction_id=pending_transaction_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PendingTransaction, + ) + + +class PendingTransactionsResourceWithRawResponse: + def __init__(self, pending_transactions: PendingTransactionsResource) -> None: + self._pending_transactions = pending_transactions + + self.release_inbound_funds_hold = to_raw_response_wrapper( + pending_transactions.release_inbound_funds_hold, + ) + + +class AsyncPendingTransactionsResourceWithRawResponse: + def __init__(self, pending_transactions: AsyncPendingTransactionsResource) -> None: + self._pending_transactions = pending_transactions + + self.release_inbound_funds_hold = async_to_raw_response_wrapper( + pending_transactions.release_inbound_funds_hold, + ) + + +class PendingTransactionsResourceWithStreamingResponse: + def __init__(self, pending_transactions: PendingTransactionsResource) -> None: + self._pending_transactions = pending_transactions + + self.release_inbound_funds_hold = to_streamed_response_wrapper( + pending_transactions.release_inbound_funds_hold, + ) + + +class AsyncPendingTransactionsResourceWithStreamingResponse: + def __init__(self, pending_transactions: AsyncPendingTransactionsResource) -> None: + self._pending_transactions = pending_transactions + + self.release_inbound_funds_hold = async_to_streamed_response_wrapper( + pending_transactions.release_inbound_funds_hold, + ) diff --git a/src/increase/resources/simulations/physical_cards.py b/src/increase/resources/simulations/physical_cards.py index 06585b4eb..6a2ed3b35 100644 --- a/src/increase/resources/simulations/physical_cards.py +++ b/src/increase/resources/simulations/physical_cards.py @@ -2,48 +2,142 @@ from __future__ import annotations +from typing import Union +from datetime import datetime from typing_extensions import Literal import httpx -from ... import _legacy_response -from ...types import PhysicalCard -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) -from ...types.simulations import physical_card_shipment_advance_params +from ..._base_client import make_request_options +from ...types.simulations import physical_card_create_params, physical_card_advance_shipment_params +from ...types.physical_card import PhysicalCard -__all__ = ["PhysicalCards", "AsyncPhysicalCards"] +__all__ = ["PhysicalCardsResource", "AsyncPhysicalCardsResource"] -class PhysicalCards(SyncAPIResource): +class PhysicalCardsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> PhysicalCardsWithRawResponse: - return PhysicalCardsWithRawResponse(self) + def with_raw_response(self) -> PhysicalCardsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return PhysicalCardsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> PhysicalCardsWithStreamingResponse: - return PhysicalCardsWithStreamingResponse(self) + def with_streaming_response(self) -> PhysicalCardsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return PhysicalCardsResourceWithStreamingResponse(self) - def shipment_advance( + def create( self, physical_card_id: str, *, - shipment_status: Literal["pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned"], + category: Literal["in_transit", "processed_for_delivery", "delivered", "delivery_issue", "returned_to_sender"], + carrier_estimated_delivery_at: Union[str, datetime] | Omit = omit, + city: str | Omit = omit, + postal_code: str | Omit = omit, + state: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PhysicalCard: + """ + This endpoint allows you to simulate receiving a tracking update for a Physical + Card, to simulate the progress of a shipment. + + Args: + physical_card_id: The Physical Card you would like to action. + + category: The type of tracking event. + + - `in_transit` - The physical card is in transit. + - `processed_for_delivery` - The physical card has been processed for delivery. + - `delivered` - The physical card has been delivered. + - `delivery_issue` - There is an issue preventing delivery. The delivery will be + attempted again if possible. If the issue cannot be resolved, the physical + card will be returned to sender. + - `returned_to_sender` - Delivery failed and the physical card was returned to + sender. + + carrier_estimated_delivery_at: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time when the + carrier expects the card to be delivered. + + city: The city where the event took place. + + postal_code: The postal code where the event took place. + + state: The state where the event took place. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not physical_card_id: + raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") + return self._post( + path_template( + "/simulations/physical_cards/{physical_card_id}/tracking_updates", physical_card_id=physical_card_id + ), + body=maybe_transform( + { + "category": category, + "carrier_estimated_delivery_at": carrier_estimated_delivery_at, + "city": city, + "postal_code": postal_code, + "state": state, + }, + physical_card_create_params.PhysicalCardCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PhysicalCard, + ) + + def advance_shipment( + self, + physical_card_id: str, + *, + shipment_status: Literal[ + "pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned", "requires_attention" + ], + # 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, idempotency_key: str | None = None, ) -> PhysicalCard: """ @@ -67,6 +161,8 @@ def shipment_advance( - `shipped` - The physical card has been shipped. - `returned` - The physical card shipment was returned to the sender and destroyed by the production facility. + - `requires_attention` - The physical card shipment requires attention from + Increase before progressing. extra_headers: Send extra headers @@ -81,10 +177,12 @@ def shipment_advance( if not physical_card_id: raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") return self._post( - f"/simulations/physical_cards/{physical_card_id}/shipment_advance", + path_template( + "/simulations/physical_cards/{physical_card_id}/advance_shipment", physical_card_id=physical_card_id + ), body=maybe_transform( {"shipment_status": shipment_status}, - physical_card_shipment_advance_params.PhysicalCardShipmentAdvanceParams, + physical_card_advance_shipment_params.PhysicalCardAdvanceShipmentParams, ), options=make_request_options( extra_headers=extra_headers, @@ -97,26 +195,119 @@ def shipment_advance( ) -class AsyncPhysicalCards(AsyncAPIResource): +class AsyncPhysicalCardsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncPhysicalCardsWithRawResponse: - return AsyncPhysicalCardsWithRawResponse(self) + def with_raw_response(self) -> AsyncPhysicalCardsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncPhysicalCardsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncPhysicalCardsWithStreamingResponse: - return AsyncPhysicalCardsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncPhysicalCardsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncPhysicalCardsResourceWithStreamingResponse(self) + + async def create( + self, + physical_card_id: str, + *, + category: Literal["in_transit", "processed_for_delivery", "delivered", "delivery_issue", "returned_to_sender"], + carrier_estimated_delivery_at: Union[str, datetime] | Omit = omit, + city: str | Omit = omit, + postal_code: str | Omit = omit, + state: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> PhysicalCard: + """ + This endpoint allows you to simulate receiving a tracking update for a Physical + Card, to simulate the progress of a shipment. + + Args: + physical_card_id: The Physical Card you would like to action. + + category: The type of tracking event. + + - `in_transit` - The physical card is in transit. + - `processed_for_delivery` - The physical card has been processed for delivery. + - `delivered` - The physical card has been delivered. + - `delivery_issue` - There is an issue preventing delivery. The delivery will be + attempted again if possible. If the issue cannot be resolved, the physical + card will be returned to sender. + - `returned_to_sender` - Delivery failed and the physical card was returned to + sender. + + carrier_estimated_delivery_at: The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time when the + carrier expects the card to be delivered. + + city: The city where the event took place. + + postal_code: The postal code where the event took place. + + state: The state where the event took place. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not physical_card_id: + raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") + return await self._post( + path_template( + "/simulations/physical_cards/{physical_card_id}/tracking_updates", physical_card_id=physical_card_id + ), + body=await async_maybe_transform( + { + "category": category, + "carrier_estimated_delivery_at": carrier_estimated_delivery_at, + "city": city, + "postal_code": postal_code, + "state": state, + }, + physical_card_create_params.PhysicalCardCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=PhysicalCard, + ) - async def shipment_advance( + async def advance_shipment( self, physical_card_id: str, *, - shipment_status: Literal["pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned"], + shipment_status: Literal[ + "pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned", "requires_attention" + ], # 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, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> PhysicalCard: """ @@ -140,6 +331,8 @@ async def shipment_advance( - `shipped` - The physical card has been shipped. - `returned` - The physical card shipment was returned to the sender and destroyed by the production facility. + - `requires_attention` - The physical card shipment requires attention from + Increase before progressing. extra_headers: Send extra headers @@ -154,10 +347,12 @@ async def shipment_advance( if not physical_card_id: raise ValueError(f"Expected a non-empty value for `physical_card_id` but received {physical_card_id!r}") return await self._post( - f"/simulations/physical_cards/{physical_card_id}/shipment_advance", + path_template( + "/simulations/physical_cards/{physical_card_id}/advance_shipment", physical_card_id=physical_card_id + ), body=await async_maybe_transform( {"shipment_status": shipment_status}, - physical_card_shipment_advance_params.PhysicalCardShipmentAdvanceParams, + physical_card_advance_shipment_params.PhysicalCardAdvanceShipmentParams, ), options=make_request_options( extra_headers=extra_headers, @@ -170,37 +365,49 @@ async def shipment_advance( ) -class PhysicalCardsWithRawResponse: - def __init__(self, physical_cards: PhysicalCards) -> None: +class PhysicalCardsResourceWithRawResponse: + def __init__(self, physical_cards: PhysicalCardsResource) -> None: self._physical_cards = physical_cards - self.shipment_advance = _legacy_response.to_raw_response_wrapper( - physical_cards.shipment_advance, + self.create = to_raw_response_wrapper( + physical_cards.create, + ) + self.advance_shipment = to_raw_response_wrapper( + physical_cards.advance_shipment, ) -class AsyncPhysicalCardsWithRawResponse: - def __init__(self, physical_cards: AsyncPhysicalCards) -> None: +class AsyncPhysicalCardsResourceWithRawResponse: + def __init__(self, physical_cards: AsyncPhysicalCardsResource) -> None: self._physical_cards = physical_cards - self.shipment_advance = _legacy_response.async_to_raw_response_wrapper( - physical_cards.shipment_advance, + self.create = async_to_raw_response_wrapper( + physical_cards.create, + ) + self.advance_shipment = async_to_raw_response_wrapper( + physical_cards.advance_shipment, ) -class PhysicalCardsWithStreamingResponse: - def __init__(self, physical_cards: PhysicalCards) -> None: +class PhysicalCardsResourceWithStreamingResponse: + def __init__(self, physical_cards: PhysicalCardsResource) -> None: self._physical_cards = physical_cards - self.shipment_advance = to_streamed_response_wrapper( - physical_cards.shipment_advance, + self.create = to_streamed_response_wrapper( + physical_cards.create, + ) + self.advance_shipment = to_streamed_response_wrapper( + physical_cards.advance_shipment, ) -class AsyncPhysicalCardsWithStreamingResponse: - def __init__(self, physical_cards: AsyncPhysicalCards) -> None: +class AsyncPhysicalCardsResourceWithStreamingResponse: + def __init__(self, physical_cards: AsyncPhysicalCardsResource) -> None: self._physical_cards = physical_cards - self.shipment_advance = async_to_streamed_response_wrapper( - physical_cards.shipment_advance, + self.create = async_to_streamed_response_wrapper( + physical_cards.create, + ) + self.advance_shipment = async_to_streamed_response_wrapper( + physical_cards.advance_shipment, ) diff --git a/src/increase/resources/simulations/programs.py b/src/increase/resources/simulations/programs.py index bece6693e..abf50b7f7 100644 --- a/src/increase/resources/simulations/programs.py +++ b/src/increase/resources/simulations/programs.py @@ -2,56 +2,83 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx -from ... import _legacy_response -from ...types import Program -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options +from ...types.program import Program from ...types.simulations import program_create_params -__all__ = ["Programs", "AsyncPrograms"] +__all__ = ["ProgramsResource", "AsyncProgramsResource"] -class Programs(SyncAPIResource): +class ProgramsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> ProgramsWithRawResponse: - return ProgramsWithRawResponse(self) + def with_raw_response(self) -> ProgramsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return ProgramsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> ProgramsWithStreamingResponse: - return ProgramsWithStreamingResponse(self) + def with_streaming_response(self) -> ProgramsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return ProgramsResourceWithStreamingResponse(self) def create( self, *, name: str, + bank: Literal["core_bank", "first_internet_bank", "grasshopper_bank", "twin_city_bank"] | Omit = omit, + lending_maximum_extendable_credit: int | Omit = omit, + reserve_account_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Program: - """Simulates a program being created in your group. + """Simulates a [Program](#programs) being created in your group. - By default, your group has one - program called Commercial Banking. Note that when your group operates more than - one program, `program_id` is a required field when creating accounts. + By default, your + group has one program called Commercial Banking. Note that when your group + operates more than one program, `program_id` is a required field when creating + accounts. Args: name: The name of the program being added. + bank: The bank for the program's accounts, defaults to First Internet Bank. + + - `core_bank` - Core Bank + - `first_internet_bank` - First Internet Bank of Indiana + - `grasshopper_bank` - Grasshopper Bank + - `twin_city_bank` - Twin City Bank + + lending_maximum_extendable_credit: The maximum extendable credit of the program being added. + + reserve_account_id: The identifier of the Account the Program should be added to is for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -64,7 +91,15 @@ def create( """ return self._post( "/simulations/programs", - body=maybe_transform({"name": name}, program_create_params.ProgramCreateParams), + body=maybe_transform( + { + "name": name, + "bank": bank, + "lending_maximum_extendable_credit": lending_maximum_extendable_credit, + "reserve_account_id": reserve_account_id, + }, + program_create_params.ProgramCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -76,36 +111,62 @@ def create( ) -class AsyncPrograms(AsyncAPIResource): +class AsyncProgramsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncProgramsWithRawResponse: - return AsyncProgramsWithRawResponse(self) + def with_raw_response(self) -> AsyncProgramsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncProgramsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncProgramsWithStreamingResponse: - return AsyncProgramsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncProgramsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncProgramsResourceWithStreamingResponse(self) async def create( self, *, name: str, + bank: Literal["core_bank", "first_internet_bank", "grasshopper_bank", "twin_city_bank"] | Omit = omit, + lending_maximum_extendable_credit: int | Omit = omit, + reserve_account_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> Program: - """Simulates a program being created in your group. + """Simulates a [Program](#programs) being created in your group. - By default, your group has one - program called Commercial Banking. Note that when your group operates more than - one program, `program_id` is a required field when creating accounts. + By default, your + group has one program called Commercial Banking. Note that when your group + operates more than one program, `program_id` is a required field when creating + accounts. Args: name: The name of the program being added. + bank: The bank for the program's accounts, defaults to First Internet Bank. + + - `core_bank` - Core Bank + - `first_internet_bank` - First Internet Bank of Indiana + - `grasshopper_bank` - Grasshopper Bank + - `twin_city_bank` - Twin City Bank + + lending_maximum_extendable_credit: The maximum extendable credit of the program being added. + + reserve_account_id: The identifier of the Account the Program should be added to is for. + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -118,7 +179,15 @@ async def create( """ return await self._post( "/simulations/programs", - body=await async_maybe_transform({"name": name}, program_create_params.ProgramCreateParams), + body=await async_maybe_transform( + { + "name": name, + "bank": bank, + "lending_maximum_extendable_credit": lending_maximum_extendable_credit, + "reserve_account_id": reserve_account_id, + }, + program_create_params.ProgramCreateParams, + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -130,26 +199,26 @@ async def create( ) -class ProgramsWithRawResponse: - def __init__(self, programs: Programs) -> None: +class ProgramsResourceWithRawResponse: + def __init__(self, programs: ProgramsResource) -> None: self._programs = programs - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( programs.create, ) -class AsyncProgramsWithRawResponse: - def __init__(self, programs: AsyncPrograms) -> None: +class AsyncProgramsResourceWithRawResponse: + def __init__(self, programs: AsyncProgramsResource) -> None: self._programs = programs - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( programs.create, ) -class ProgramsWithStreamingResponse: - def __init__(self, programs: Programs) -> None: +class ProgramsResourceWithStreamingResponse: + def __init__(self, programs: ProgramsResource) -> None: self._programs = programs self.create = to_streamed_response_wrapper( @@ -157,8 +226,8 @@ def __init__(self, programs: Programs) -> None: ) -class AsyncProgramsWithStreamingResponse: - def __init__(self, programs: AsyncPrograms) -> None: +class AsyncProgramsResourceWithStreamingResponse: + def __init__(self, programs: AsyncProgramsResource) -> None: self._programs = programs self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/simulations/real_time_payments_transfers.py b/src/increase/resources/simulations/real_time_payments_transfers.py index 5dac2857d..a093e3042 100644 --- a/src/increase/resources/simulations/real_time_payments_transfers.py +++ b/src/increase/resources/simulations/real_time_payments_transfers.py @@ -4,54 +4,61 @@ import httpx -from ... import _legacy_response -from ...types import RealTimePaymentsTransfer -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import path_template, maybe_transform, async_maybe_transform from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, -) -from ...types.simulations import ( - InboundRealTimePaymentsTransferSimulationResult, - real_time_payments_transfer_complete_params, - real_time_payments_transfer_create_inbound_params, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..._base_client import make_request_options +from ...types.simulations import real_time_payments_transfer_complete_params +from ...types.real_time_payments_transfer import RealTimePaymentsTransfer -__all__ = ["RealTimePaymentsTransfers", "AsyncRealTimePaymentsTransfers"] +__all__ = ["RealTimePaymentsTransfersResource", "AsyncRealTimePaymentsTransfersResource"] -class RealTimePaymentsTransfers(SyncAPIResource): +class RealTimePaymentsTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> RealTimePaymentsTransfersWithRawResponse: - return RealTimePaymentsTransfersWithRawResponse(self) + def with_raw_response(self) -> RealTimePaymentsTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return RealTimePaymentsTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> RealTimePaymentsTransfersWithStreamingResponse: - return RealTimePaymentsTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> RealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return RealTimePaymentsTransfersResourceWithStreamingResponse(self) def complete( self, real_time_payments_transfer_id: str, *, - rejection: real_time_payments_transfer_complete_params.Rejection | NotGiven = NOT_GIVEN, + rejection: real_time_payments_transfer_complete_params.Rejection | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> RealTimePaymentsTransfer: """ - Simulates submission of a Real-Time Payments transfer and handling the response - from the destination financial institution. This transfer must first have a - `status` of `pending_submission`. + Simulates submission of a + [Real-Time Payments Transfer](#real-time-payments-transfers) and handling the + response from the destination financial institution. This transfer must first + have a `status` of `pending_submission`. Args: real_time_payments_transfer_id: The identifier of the Real-Time Payments Transfer you wish to complete. @@ -73,7 +80,10 @@ def complete( f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" ) return self._post( - f"/simulations/real_time_payments_transfers/{real_time_payments_transfer_id}/complete", + path_template( + "/simulations/real_time_payments_transfers/{real_time_payments_transfer_id}/complete", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), body=maybe_transform( {"rejection": rejection}, real_time_payments_transfer_complete_params.RealTimePaymentsTransferCompleteParams, @@ -88,106 +98,45 @@ def complete( cast_to=RealTimePaymentsTransfer, ) - def create_inbound( - self, - *, - account_number_id: str, - amount: int, - debtor_account_number: str | NotGiven = NOT_GIVEN, - debtor_name: str | NotGiven = NOT_GIVEN, - debtor_routing_number: str | NotGiven = NOT_GIVEN, - remittance_information: str | NotGiven = NOT_GIVEN, - request_for_payment_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> InboundRealTimePaymentsTransferSimulationResult: - """Simulates an inbound Real-Time Payments transfer to your account. - - Real-Time - Payments are a beta feature. - - Args: - account_number_id: The identifier of the Account Number the inbound Real-Time Payments Transfer is - for. - - amount: The transfer amount in USD cents. Must be positive. - - debtor_account_number: The account number of the account that sent the transfer. - - debtor_name: The name provided by the sender of the transfer. - - debtor_routing_number: The routing number of the account that sent the transfer. - remittance_information: Additional information included with the transfer. - - request_for_payment_id: The identifier of a pending Request for Payment that this transfer will fulfill. - - 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 - - idempotency_key: Specify a custom idempotency key for this request +class AsyncRealTimePaymentsTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncRealTimePaymentsTransfersResourceWithRawResponse: """ - return self._post( - "/simulations/inbound_real_time_payments_transfers", - body=maybe_transform( - { - "account_number_id": account_number_id, - "amount": amount, - "debtor_account_number": debtor_account_number, - "debtor_name": debtor_name, - "debtor_routing_number": debtor_routing_number, - "remittance_information": remittance_information, - "request_for_payment_id": request_for_payment_id, - }, - real_time_payments_transfer_create_inbound_params.RealTimePaymentsTransferCreateInboundParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=InboundRealTimePaymentsTransferSimulationResult, - ) + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncRealTimePaymentsTransfersResourceWithRawResponse(self) -class AsyncRealTimePaymentsTransfers(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncRealTimePaymentsTransfersWithRawResponse: - return AsyncRealTimePaymentsTransfersWithRawResponse(self) + def with_streaming_response(self) -> AsyncRealTimePaymentsTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - @cached_property - def with_streaming_response(self) -> AsyncRealTimePaymentsTransfersWithStreamingResponse: - return AsyncRealTimePaymentsTransfersWithStreamingResponse(self) + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncRealTimePaymentsTransfersResourceWithStreamingResponse(self) async def complete( self, real_time_payments_transfer_id: str, *, - rejection: real_time_payments_transfer_complete_params.Rejection | NotGiven = NOT_GIVEN, + rejection: real_time_payments_transfer_complete_params.Rejection | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> RealTimePaymentsTransfer: """ - Simulates submission of a Real-Time Payments transfer and handling the response - from the destination financial institution. This transfer must first have a - `status` of `pending_submission`. + Simulates submission of a + [Real-Time Payments Transfer](#real-time-payments-transfers) and handling the + response from the destination financial institution. This transfer must first + have a `status` of `pending_submission`. Args: real_time_payments_transfer_id: The identifier of the Real-Time Payments Transfer you wish to complete. @@ -209,7 +158,10 @@ async def complete( f"Expected a non-empty value for `real_time_payments_transfer_id` but received {real_time_payments_transfer_id!r}" ) return await self._post( - f"/simulations/real_time_payments_transfers/{real_time_payments_transfer_id}/complete", + path_template( + "/simulations/real_time_payments_transfers/{real_time_payments_transfer_id}/complete", + real_time_payments_transfer_id=real_time_payments_transfer_id, + ), body=await async_maybe_transform( {"rejection": rejection}, real_time_payments_transfer_complete_params.RealTimePaymentsTransferCompleteParams, @@ -224,123 +176,38 @@ async def complete( cast_to=RealTimePaymentsTransfer, ) - async def create_inbound( - self, - *, - account_number_id: str, - amount: int, - debtor_account_number: str | NotGiven = NOT_GIVEN, - debtor_name: str | NotGiven = NOT_GIVEN, - debtor_routing_number: str | NotGiven = NOT_GIVEN, - remittance_information: str | NotGiven = NOT_GIVEN, - request_for_payment_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> InboundRealTimePaymentsTransferSimulationResult: - """Simulates an inbound Real-Time Payments transfer to your account. - - Real-Time - Payments are a beta feature. - - Args: - account_number_id: The identifier of the Account Number the inbound Real-Time Payments Transfer is - for. - - amount: The transfer amount in USD cents. Must be positive. - - debtor_account_number: The account number of the account that sent the transfer. - - debtor_name: The name provided by the sender of the transfer. - - debtor_routing_number: The routing number of the account that sent the transfer. - - remittance_information: Additional information included with the transfer. - - request_for_payment_id: The identifier of a pending Request for Payment that this transfer will fulfill. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/inbound_real_time_payments_transfers", - body=await async_maybe_transform( - { - "account_number_id": account_number_id, - "amount": amount, - "debtor_account_number": debtor_account_number, - "debtor_name": debtor_name, - "debtor_routing_number": debtor_routing_number, - "remittance_information": remittance_information, - "request_for_payment_id": request_for_payment_id, - }, - real_time_payments_transfer_create_inbound_params.RealTimePaymentsTransferCreateInboundParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=InboundRealTimePaymentsTransferSimulationResult, - ) - -class RealTimePaymentsTransfersWithRawResponse: - def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfers) -> None: +class RealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers - self.complete = _legacy_response.to_raw_response_wrapper( + self.complete = to_raw_response_wrapper( real_time_payments_transfers.complete, ) - self.create_inbound = _legacy_response.to_raw_response_wrapper( - real_time_payments_transfers.create_inbound, - ) -class AsyncRealTimePaymentsTransfersWithRawResponse: - def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfers) -> None: +class AsyncRealTimePaymentsTransfersResourceWithRawResponse: + def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers - self.complete = _legacy_response.async_to_raw_response_wrapper( + self.complete = async_to_raw_response_wrapper( real_time_payments_transfers.complete, ) - self.create_inbound = _legacy_response.async_to_raw_response_wrapper( - real_time_payments_transfers.create_inbound, - ) -class RealTimePaymentsTransfersWithStreamingResponse: - def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfers) -> None: +class RealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, real_time_payments_transfers: RealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers self.complete = to_streamed_response_wrapper( real_time_payments_transfers.complete, ) - self.create_inbound = to_streamed_response_wrapper( - real_time_payments_transfers.create_inbound, - ) -class AsyncRealTimePaymentsTransfersWithStreamingResponse: - def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfers) -> None: +class AsyncRealTimePaymentsTransfersResourceWithStreamingResponse: + def __init__(self, real_time_payments_transfers: AsyncRealTimePaymentsTransfersResource) -> None: self._real_time_payments_transfers = real_time_payments_transfers self.complete = async_to_streamed_response_wrapper( real_time_payments_transfers.complete, ) - self.create_inbound = async_to_streamed_response_wrapper( - real_time_payments_transfers.create_inbound, - ) diff --git a/src/increase/resources/simulations/simulations.py b/src/increase/resources/simulations/simulations.py index 4e37f18ec..3051441c6 100644 --- a/src/increase/resources/simulations/simulations.py +++ b/src/increase/resources/simulations/simulations.py @@ -2,1086 +2,1149 @@ from __future__ import annotations -import httpx - -from ... import _legacy_response -from .cards import ( - Cards, - AsyncCards, - CardsWithRawResponse, - AsyncCardsWithRawResponse, - CardsWithStreamingResponse, - AsyncCardsWithStreamingResponse, -) -from ...types import ( - CardPayment, - simulation_card_reversals_params, - simulation_card_increments_params, - simulation_card_fuel_confirmations_params, - simulation_card_authorization_expirations_params, -) -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, +from .exports import ( + ExportsResource, + AsyncExportsResource, + ExportsResourceWithRawResponse, + AsyncExportsResourceWithRawResponse, + ExportsResourceWithStreamingResponse, + AsyncExportsResourceWithStreamingResponse, ) from .programs import ( - Programs, - AsyncPrograms, - ProgramsWithRawResponse, - AsyncProgramsWithRawResponse, - ProgramsWithStreamingResponse, - AsyncProgramsWithStreamingResponse, + ProgramsResource, + AsyncProgramsResource, + ProgramsResourceWithRawResponse, + AsyncProgramsResourceWithRawResponse, + ProgramsResourceWithStreamingResponse, + AsyncProgramsResourceWithStreamingResponse, ) from ..._compat import cached_property -from .documents import ( - Documents, - AsyncDocuments, - DocumentsWithRawResponse, - AsyncDocumentsWithRawResponse, - DocumentsWithStreamingResponse, - AsyncDocumentsWithStreamingResponse, -) from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper +from .card_tokens import ( + CardTokensResource, + AsyncCardTokensResource, + CardTokensResourceWithRawResponse, + AsyncCardTokensResourceWithRawResponse, + CardTokensResourceWithStreamingResponse, + AsyncCardTokensResourceWithStreamingResponse, +) from .card_refunds import ( - CardRefunds, - AsyncCardRefunds, - CardRefundsWithRawResponse, - AsyncCardRefundsWithRawResponse, - CardRefundsWithStreamingResponse, - AsyncCardRefundsWithStreamingResponse, + CardRefundsResource, + AsyncCardRefundsResource, + CardRefundsResourceWithRawResponse, + AsyncCardRefundsResourceWithRawResponse, + CardRefundsResourceWithStreamingResponse, + AsyncCardRefundsResourceWithStreamingResponse, ) from .ach_transfers import ( - ACHTransfers, - AsyncACHTransfers, - ACHTransfersWithRawResponse, - AsyncACHTransfersWithRawResponse, - ACHTransfersWithStreamingResponse, - AsyncACHTransfersWithStreamingResponse, + ACHTransfersResource, + AsyncACHTransfersResource, + ACHTransfersResourceWithRawResponse, + AsyncACHTransfersResourceWithRawResponse, + ACHTransfersResourceWithStreamingResponse, + AsyncACHTransfersResourceWithStreamingResponse, ) from .card_disputes import ( - CardDisputes, - AsyncCardDisputes, - CardDisputesWithRawResponse, - AsyncCardDisputesWithRawResponse, - CardDisputesWithStreamingResponse, - AsyncCardDisputesWithStreamingResponse, + CardDisputesResource, + AsyncCardDisputesResource, + CardDisputesResourceWithRawResponse, + AsyncCardDisputesResourceWithRawResponse, + CardDisputesResourceWithStreamingResponse, + AsyncCardDisputesResourceWithStreamingResponse, ) -from ..._base_client import ( - make_request_options, +from .card_reversals import ( + CardReversalsResource, + AsyncCardReversalsResource, + CardReversalsResourceWithRawResponse, + AsyncCardReversalsResourceWithRawResponse, + CardReversalsResourceWithStreamingResponse, + AsyncCardReversalsResourceWithStreamingResponse, ) from .check_deposits import ( - CheckDeposits, - AsyncCheckDeposits, - CheckDepositsWithRawResponse, - AsyncCheckDepositsWithRawResponse, - CheckDepositsWithStreamingResponse, - AsyncCheckDepositsWithStreamingResponse, + CheckDepositsResource, + AsyncCheckDepositsResource, + CheckDepositsResourceWithRawResponse, + AsyncCheckDepositsResourceWithRawResponse, + CheckDepositsResourceWithStreamingResponse, + AsyncCheckDepositsResourceWithStreamingResponse, ) from .physical_cards import ( - PhysicalCards, - AsyncPhysicalCards, - PhysicalCardsWithRawResponse, - AsyncPhysicalCardsWithRawResponse, - PhysicalCardsWithStreamingResponse, - AsyncPhysicalCardsWithStreamingResponse, + PhysicalCardsResource, + AsyncPhysicalCardsResource, + PhysicalCardsResourceWithRawResponse, + AsyncPhysicalCardsResourceWithRawResponse, + PhysicalCardsResourceWithStreamingResponse, + AsyncPhysicalCardsResourceWithStreamingResponse, ) from .wire_transfers import ( - WireTransfers, - AsyncWireTransfers, - WireTransfersWithRawResponse, - AsyncWireTransfersWithRawResponse, - WireTransfersWithStreamingResponse, - AsyncWireTransfersWithStreamingResponse, + WireTransfersResource, + AsyncWireTransfersResource, + WireTransfersResourceWithRawResponse, + AsyncWireTransfersResourceWithRawResponse, + WireTransfersResourceWithStreamingResponse, + AsyncWireTransfersResourceWithStreamingResponse, +) +from .card_increments import ( + CardIncrementsResource, + AsyncCardIncrementsResource, + CardIncrementsResourceWithRawResponse, + AsyncCardIncrementsResourceWithRawResponse, + CardIncrementsResourceWithStreamingResponse, + AsyncCardIncrementsResourceWithStreamingResponse, ) from .check_transfers import ( - CheckTransfers, - AsyncCheckTransfers, - CheckTransfersWithRawResponse, - AsyncCheckTransfersWithRawResponse, - CheckTransfersWithStreamingResponse, - AsyncCheckTransfersWithStreamingResponse, + CheckTransfersResource, + AsyncCheckTransfersResource, + CheckTransfersResourceWithRawResponse, + AsyncCheckTransfersResourceWithRawResponse, + CheckTransfersResourceWithStreamingResponse, + AsyncCheckTransfersResourceWithStreamingResponse, +) +from .card_settlements import ( + CardSettlementsResource, + AsyncCardSettlementsResource, + CardSettlementsResourceWithRawResponse, + AsyncCardSettlementsResourceWithRawResponse, + CardSettlementsResourceWithStreamingResponse, + AsyncCardSettlementsResourceWithStreamingResponse, ) from .account_transfers import ( - AccountTransfers, - AsyncAccountTransfers, - AccountTransfersWithRawResponse, - AsyncAccountTransfersWithRawResponse, - AccountTransfersWithStreamingResponse, - AsyncAccountTransfersWithStreamingResponse, + AccountTransfersResource, + AsyncAccountTransfersResource, + AccountTransfersResourceWithRawResponse, + AsyncAccountTransfersResourceWithRawResponse, + AccountTransfersResourceWithStreamingResponse, + AsyncAccountTransfersResourceWithStreamingResponse, ) from .interest_payments import ( - InterestPayments, - AsyncInterestPayments, - InterestPaymentsWithRawResponse, - AsyncInterestPaymentsWithRawResponse, - InterestPaymentsWithStreamingResponse, - AsyncInterestPaymentsWithStreamingResponse, + InterestPaymentsResource, + AsyncInterestPaymentsResource, + InterestPaymentsResourceWithRawResponse, + AsyncInterestPaymentsResourceWithRawResponse, + InterestPaymentsResourceWithStreamingResponse, + AsyncInterestPaymentsResourceWithStreamingResponse, ) from .account_statements import ( - AccountStatements, - AsyncAccountStatements, - AccountStatementsWithRawResponse, - AsyncAccountStatementsWithRawResponse, - AccountStatementsWithStreamingResponse, - AsyncAccountStatementsWithStreamingResponse, + AccountStatementsResource, + AsyncAccountStatementsResource, + AccountStatementsResourceWithRawResponse, + AsyncAccountStatementsResourceWithRawResponse, + AccountStatementsResourceWithStreamingResponse, + AsyncAccountStatementsResourceWithStreamingResponse, +) +from .inbound_mail_items import ( + InboundMailItemsResource, + AsyncInboundMailItemsResource, + InboundMailItemsResourceWithRawResponse, + AsyncInboundMailItemsResourceWithRawResponse, + InboundMailItemsResourceWithStreamingResponse, + AsyncInboundMailItemsResourceWithStreamingResponse, +) +from .card_authorizations import ( + CardAuthorizationsResource, + AsyncCardAuthorizationsResource, + CardAuthorizationsResourceWithRawResponse, + AsyncCardAuthorizationsResourceWithRawResponse, + CardAuthorizationsResourceWithStreamingResponse, + AsyncCardAuthorizationsResourceWithStreamingResponse, +) +from .card_authentications import ( + CardAuthenticationsResource, + AsyncCardAuthenticationsResource, + CardAuthenticationsResourceWithRawResponse, + AsyncCardAuthenticationsResourceWithRawResponse, + CardAuthenticationsResourceWithStreamingResponse, + AsyncCardAuthenticationsResourceWithStreamingResponse, +) +from .pending_transactions import ( + PendingTransactionsResource, + AsyncPendingTransactionsResource, + PendingTransactionsResourceWithRawResponse, + AsyncPendingTransactionsResourceWithRawResponse, + PendingTransactionsResourceWithStreamingResponse, + AsyncPendingTransactionsResourceWithStreamingResponse, +) +from .inbound_ach_transfers import ( + InboundACHTransfersResource, + AsyncInboundACHTransfersResource, + InboundACHTransfersResourceWithRawResponse, + AsyncInboundACHTransfersResourceWithRawResponse, + InboundACHTransfersResourceWithStreamingResponse, + AsyncInboundACHTransfersResourceWithStreamingResponse, +) +from .card_balance_inquiries import ( + CardBalanceInquiriesResource, + AsyncCardBalanceInquiriesResource, + CardBalanceInquiriesResourceWithRawResponse, + AsyncCardBalanceInquiriesResourceWithRawResponse, + CardBalanceInquiriesResourceWithStreamingResponse, + AsyncCardBalanceInquiriesResourceWithStreamingResponse, +) +from .inbound_check_deposits import ( + InboundCheckDepositsResource, + AsyncInboundCheckDepositsResource, + InboundCheckDepositsResourceWithRawResponse, + AsyncInboundCheckDepositsResourceWithRawResponse, + InboundCheckDepositsResourceWithStreamingResponse, + AsyncInboundCheckDepositsResourceWithStreamingResponse, ) -from .inbound_funds_holds import ( - InboundFundsHolds, - AsyncInboundFundsHolds, - InboundFundsHoldsWithRawResponse, - AsyncInboundFundsHoldsWithRawResponse, - InboundFundsHoldsWithStreamingResponse, - AsyncInboundFundsHoldsWithStreamingResponse, +from .inbound_wire_transfers import ( + InboundWireTransfersResource, + AsyncInboundWireTransfersResource, + InboundWireTransfersResourceWithRawResponse, + AsyncInboundWireTransfersResourceWithRawResponse, + InboundWireTransfersResourceWithStreamingResponse, + AsyncInboundWireTransfersResourceWithStreamingResponse, +) +from .wire_drawdown_requests import ( + WireDrawdownRequestsResource, + AsyncWireDrawdownRequestsResource, + WireDrawdownRequestsResourceWithRawResponse, + AsyncWireDrawdownRequestsResourceWithRawResponse, + WireDrawdownRequestsResourceWithStreamingResponse, + AsyncWireDrawdownRequestsResourceWithStreamingResponse, +) +from .card_fuel_confirmations import ( + CardFuelConfirmationsResource, + AsyncCardFuelConfirmationsResource, + CardFuelConfirmationsResourceWithRawResponse, + AsyncCardFuelConfirmationsResourceWithRawResponse, + CardFuelConfirmationsResourceWithStreamingResponse, + AsyncCardFuelConfirmationsResourceWithStreamingResponse, +) +from .inbound_fednow_transfers import ( + InboundFednowTransfersResource, + AsyncInboundFednowTransfersResource, + InboundFednowTransfersResourceWithRawResponse, + AsyncInboundFednowTransfersResourceWithRawResponse, + InboundFednowTransfersResourceWithStreamingResponse, + AsyncInboundFednowTransfersResourceWithStreamingResponse, +) +from .entity_onboarding_sessions import ( + EntityOnboardingSessionsResource, + AsyncEntityOnboardingSessionsResource, + EntityOnboardingSessionsResourceWithRawResponse, + AsyncEntityOnboardingSessionsResourceWithRawResponse, + EntityOnboardingSessionsResourceWithStreamingResponse, + AsyncEntityOnboardingSessionsResourceWithStreamingResponse, ) from .real_time_payments_transfers import ( - RealTimePaymentsTransfers, - AsyncRealTimePaymentsTransfers, - RealTimePaymentsTransfersWithRawResponse, - AsyncRealTimePaymentsTransfersWithRawResponse, - RealTimePaymentsTransfersWithStreamingResponse, - AsyncRealTimePaymentsTransfersWithStreamingResponse, + RealTimePaymentsTransfersResource, + AsyncRealTimePaymentsTransfersResource, + RealTimePaymentsTransfersResourceWithRawResponse, + AsyncRealTimePaymentsTransfersResourceWithRawResponse, + RealTimePaymentsTransfersResourceWithStreamingResponse, + AsyncRealTimePaymentsTransfersResourceWithStreamingResponse, ) from .digital_wallet_token_requests import ( - DigitalWalletTokenRequests, - AsyncDigitalWalletTokenRequests, - DigitalWalletTokenRequestsWithRawResponse, - AsyncDigitalWalletTokenRequestsWithRawResponse, - DigitalWalletTokenRequestsWithStreamingResponse, - AsyncDigitalWalletTokenRequestsWithStreamingResponse, + DigitalWalletTokenRequestsResource, + AsyncDigitalWalletTokenRequestsResource, + DigitalWalletTokenRequestsResourceWithRawResponse, + AsyncDigitalWalletTokenRequestsResourceWithRawResponse, + DigitalWalletTokenRequestsResourceWithStreamingResponse, + AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse, +) +from .card_authorization_expirations import ( + CardAuthorizationExpirationsResource, + AsyncCardAuthorizationExpirationsResource, + CardAuthorizationExpirationsResourceWithRawResponse, + AsyncCardAuthorizationExpirationsResourceWithRawResponse, + CardAuthorizationExpirationsResourceWithStreamingResponse, + AsyncCardAuthorizationExpirationsResourceWithStreamingResponse, ) from .inbound_wire_drawdown_requests import ( - InboundWireDrawdownRequests, - AsyncInboundWireDrawdownRequests, - InboundWireDrawdownRequestsWithRawResponse, - AsyncInboundWireDrawdownRequestsWithRawResponse, - InboundWireDrawdownRequestsWithStreamingResponse, - AsyncInboundWireDrawdownRequestsWithStreamingResponse, + InboundWireDrawdownRequestsResource, + AsyncInboundWireDrawdownRequestsResource, + InboundWireDrawdownRequestsResourceWithRawResponse, + AsyncInboundWireDrawdownRequestsResourceWithRawResponse, + InboundWireDrawdownRequestsResourceWithStreamingResponse, + AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse, +) +from .inbound_real_time_payments_transfers import ( + InboundRealTimePaymentsTransfersResource, + AsyncInboundRealTimePaymentsTransfersResource, + InboundRealTimePaymentsTransfersResourceWithRawResponse, + AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse, + InboundRealTimePaymentsTransfersResourceWithStreamingResponse, + AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse, ) -__all__ = ["Simulations", "AsyncSimulations"] +__all__ = ["SimulationsResource", "AsyncSimulationsResource"] -class Simulations(SyncAPIResource): +class SimulationsResource(SyncAPIResource): @cached_property - def account_transfers(self) -> AccountTransfers: - return AccountTransfers(self._client) + def interest_payments(self) -> InterestPaymentsResource: + return InterestPaymentsResource(self._client) @cached_property - def account_statements(self) -> AccountStatements: - return AccountStatements(self._client) + def account_transfers(self) -> AccountTransfersResource: + return AccountTransfersResource(self._client) @cached_property - def ach_transfers(self) -> ACHTransfers: - return ACHTransfers(self._client) + def card_authorizations(self) -> CardAuthorizationsResource: + return CardAuthorizationsResource(self._client) @cached_property - def card_disputes(self) -> CardDisputes: - return CardDisputes(self._client) + def card_balance_inquiries(self) -> CardBalanceInquiriesResource: + return CardBalanceInquiriesResource(self._client) @cached_property - def card_refunds(self) -> CardRefunds: - return CardRefunds(self._client) + def card_authorization_expirations(self) -> CardAuthorizationExpirationsResource: + return CardAuthorizationExpirationsResource(self._client) @cached_property - def check_transfers(self) -> CheckTransfers: - return CheckTransfers(self._client) + def card_settlements(self) -> CardSettlementsResource: + return CardSettlementsResource(self._client) @cached_property - def documents(self) -> Documents: - return Documents(self._client) + def card_reversals(self) -> CardReversalsResource: + return CardReversalsResource(self._client) @cached_property - def digital_wallet_token_requests(self) -> DigitalWalletTokenRequests: - return DigitalWalletTokenRequests(self._client) + def card_increments(self) -> CardIncrementsResource: + return CardIncrementsResource(self._client) @cached_property - def check_deposits(self) -> CheckDeposits: - return CheckDeposits(self._client) + def card_fuel_confirmations(self) -> CardFuelConfirmationsResource: + return CardFuelConfirmationsResource(self._client) @cached_property - def programs(self) -> Programs: - return Programs(self._client) + def card_refunds(self) -> CardRefundsResource: + return CardRefundsResource(self._client) @cached_property - def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequests: - return InboundWireDrawdownRequests(self._client) + def card_authentications(self) -> CardAuthenticationsResource: + return CardAuthenticationsResource(self._client) @cached_property - def inbound_funds_holds(self) -> InboundFundsHolds: - return InboundFundsHolds(self._client) + def card_disputes(self) -> CardDisputesResource: + return CardDisputesResource(self._client) @cached_property - def interest_payments(self) -> InterestPayments: - return InterestPayments(self._client) + def physical_cards(self) -> PhysicalCardsResource: + return PhysicalCardsResource(self._client) @cached_property - def wire_transfers(self) -> WireTransfers: - return WireTransfers(self._client) + def digital_wallet_token_requests(self) -> DigitalWalletTokenRequestsResource: + return DigitalWalletTokenRequestsResource(self._client) @cached_property - def cards(self) -> Cards: - return Cards(self._client) + def pending_transactions(self) -> PendingTransactionsResource: + return PendingTransactionsResource(self._client) @cached_property - def real_time_payments_transfers(self) -> RealTimePaymentsTransfers: - return RealTimePaymentsTransfers(self._client) + def ach_transfers(self) -> ACHTransfersResource: + return ACHTransfersResource(self._client) @cached_property - def physical_cards(self) -> PhysicalCards: - return PhysicalCards(self._client) + def inbound_ach_transfers(self) -> InboundACHTransfersResource: + return InboundACHTransfersResource(self._client) @cached_property - def with_raw_response(self) -> SimulationsWithRawResponse: - return SimulationsWithRawResponse(self) + def wire_transfers(self) -> WireTransfersResource: + return WireTransfersResource(self._client) @cached_property - def with_streaming_response(self) -> SimulationsWithStreamingResponse: - return SimulationsWithStreamingResponse(self) + def inbound_wire_transfers(self) -> InboundWireTransfersResource: + return InboundWireTransfersResource(self._client) - def card_authorization_expirations( - self, - *, - card_payment_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardPayment: - """ - Simulates expiring a card authorization immediately. - - Args: - card_payment_id: The identifier of the Card Payment to expire. + @cached_property + def wire_drawdown_requests(self) -> WireDrawdownRequestsResource: + return WireDrawdownRequestsResource(self._client) - extra_headers: Send extra headers + @cached_property + def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsResource: + return InboundWireDrawdownRequestsResource(self._client) - extra_query: Add additional query parameters to the request + @cached_property + def check_transfers(self) -> CheckTransfersResource: + return CheckTransfersResource(self._client) - extra_body: Add additional JSON properties to the request + @cached_property + def inbound_check_deposits(self) -> InboundCheckDepositsResource: + return InboundCheckDepositsResource(self._client) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def real_time_payments_transfers(self) -> RealTimePaymentsTransfersResource: + return RealTimePaymentsTransfersResource(self._client) - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/simulations/card_authorization_expirations", - body=maybe_transform( - {"card_payment_id": card_payment_id}, - simulation_card_authorization_expirations_params.SimulationCardAuthorizationExpirationsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + @cached_property + def inbound_real_time_payments_transfers(self) -> InboundRealTimePaymentsTransfersResource: + return InboundRealTimePaymentsTransfersResource(self._client) - def card_fuel_confirmations( - self, - *, - amount: int, - card_payment_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardPayment: - """Simulates the fuel confirmation of an authorization by a card acquirer. + @cached_property + def inbound_fednow_transfers(self) -> InboundFednowTransfersResource: + return InboundFednowTransfersResource(self._client) - This - happens asynchronously right after a fuel pump transaction is completed. A fuel - confirmation can only happen once per authorization. + @cached_property + def check_deposits(self) -> CheckDepositsResource: + return CheckDepositsResource(self._client) - Args: - amount: The amount of the fuel_confirmation in minor units in the card authorization's - currency. + @cached_property + def inbound_mail_items(self) -> InboundMailItemsResource: + return InboundMailItemsResource(self._client) - card_payment_id: The identifier of the Card Payment to create a fuel_confirmation on. + @cached_property + def entity_onboarding_sessions(self) -> EntityOnboardingSessionsResource: + return EntityOnboardingSessionsResource(self._client) - extra_headers: Send extra headers + @cached_property + def programs(self) -> ProgramsResource: + return ProgramsResource(self._client) - extra_query: Add additional query parameters to the request + @cached_property + def account_statements(self) -> AccountStatementsResource: + return AccountStatementsResource(self._client) - extra_body: Add additional JSON properties to the request + @cached_property + def exports(self) -> ExportsResource: + return ExportsResource(self._client) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def card_tokens(self) -> CardTokensResource: + return CardTokensResource(self._client) - idempotency_key: Specify a custom idempotency key for this request + @cached_property + def with_raw_response(self) -> SimulationsResourceWithRawResponse: """ - return self._post( - "/simulations/card_fuel_confirmations", - body=maybe_transform( - { - "amount": amount, - "card_payment_id": card_payment_id, - }, - simulation_card_fuel_confirmations_params.SimulationCardFuelConfirmationsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. - def card_increments( - self, - *, - amount: int, - card_payment_id: str, - event_subscription_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardPayment: - """Simulates the increment of an authorization by a card acquirer. + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return SimulationsResourceWithRawResponse(self) - An authorization - can be incremented multiple times. + @cached_property + def with_streaming_response(self) -> SimulationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - Args: - amount: The amount of the increment in minor units in the card authorization's currency. + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return SimulationsResourceWithStreamingResponse(self) - card_payment_id: The identifier of the Card Payment to create a increment on. - event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the - default real time event subscription. Because you can only create one real time - decision event subscription, you can use this field to route events to any - specified event subscription for testing purposes. +class AsyncSimulationsResource(AsyncAPIResource): + @cached_property + def interest_payments(self) -> AsyncInterestPaymentsResource: + return AsyncInterestPaymentsResource(self._client) - extra_headers: Send extra headers + @cached_property + def account_transfers(self) -> AsyncAccountTransfersResource: + return AsyncAccountTransfersResource(self._client) - extra_query: Add additional query parameters to the request + @cached_property + def card_authorizations(self) -> AsyncCardAuthorizationsResource: + return AsyncCardAuthorizationsResource(self._client) - extra_body: Add additional JSON properties to the request + @cached_property + def card_balance_inquiries(self) -> AsyncCardBalanceInquiriesResource: + return AsyncCardBalanceInquiriesResource(self._client) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def card_authorization_expirations(self) -> AsyncCardAuthorizationExpirationsResource: + return AsyncCardAuthorizationExpirationsResource(self._client) - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/simulations/card_increments", - body=maybe_transform( - { - "amount": amount, - "card_payment_id": card_payment_id, - "event_subscription_id": event_subscription_id, - }, - simulation_card_increments_params.SimulationCardIncrementsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + @cached_property + def card_settlements(self) -> AsyncCardSettlementsResource: + return AsyncCardSettlementsResource(self._client) - def card_reversals( - self, - *, - card_payment_id: str, - amount: int | 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, - idempotency_key: str | None = None, - ) -> CardPayment: - """Simulates the reversal of an authorization by a card acquirer. + @cached_property + def card_reversals(self) -> AsyncCardReversalsResource: + return AsyncCardReversalsResource(self._client) - An authorization - can be partially reversed multiple times, up until the total authorized amount. - Marks the pending transaction as complete if the authorization is fully - reversed. + @cached_property + def card_increments(self) -> AsyncCardIncrementsResource: + return AsyncCardIncrementsResource(self._client) - Args: - card_payment_id: The identifier of the Card Payment to create a reversal on. + @cached_property + def card_fuel_confirmations(self) -> AsyncCardFuelConfirmationsResource: + return AsyncCardFuelConfirmationsResource(self._client) - amount: The amount of the reversal in minor units in the card authorization's currency. - This defaults to the authorization amount. + @cached_property + def card_refunds(self) -> AsyncCardRefundsResource: + return AsyncCardRefundsResource(self._client) - extra_headers: Send extra headers + @cached_property + def card_authentications(self) -> AsyncCardAuthenticationsResource: + return AsyncCardAuthenticationsResource(self._client) - extra_query: Add additional query parameters to the request + @cached_property + def card_disputes(self) -> AsyncCardDisputesResource: + return AsyncCardDisputesResource(self._client) - extra_body: Add additional JSON properties to the request + @cached_property + def physical_cards(self) -> AsyncPhysicalCardsResource: + return AsyncPhysicalCardsResource(self._client) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def digital_wallet_token_requests(self) -> AsyncDigitalWalletTokenRequestsResource: + return AsyncDigitalWalletTokenRequestsResource(self._client) - idempotency_key: Specify a custom idempotency key for this request - """ - return self._post( - "/simulations/card_reversals", - body=maybe_transform( - { - "card_payment_id": card_payment_id, - "amount": amount, - }, - simulation_card_reversals_params.SimulationCardReversalsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + @cached_property + def pending_transactions(self) -> AsyncPendingTransactionsResource: + return AsyncPendingTransactionsResource(self._client) + @cached_property + def ach_transfers(self) -> AsyncACHTransfersResource: + return AsyncACHTransfersResource(self._client) -class AsyncSimulations(AsyncAPIResource): @cached_property - def account_transfers(self) -> AsyncAccountTransfers: - return AsyncAccountTransfers(self._client) + def inbound_ach_transfers(self) -> AsyncInboundACHTransfersResource: + return AsyncInboundACHTransfersResource(self._client) @cached_property - def account_statements(self) -> AsyncAccountStatements: - return AsyncAccountStatements(self._client) + def wire_transfers(self) -> AsyncWireTransfersResource: + return AsyncWireTransfersResource(self._client) @cached_property - def ach_transfers(self) -> AsyncACHTransfers: - return AsyncACHTransfers(self._client) + def inbound_wire_transfers(self) -> AsyncInboundWireTransfersResource: + return AsyncInboundWireTransfersResource(self._client) @cached_property - def card_disputes(self) -> AsyncCardDisputes: - return AsyncCardDisputes(self._client) + def wire_drawdown_requests(self) -> AsyncWireDrawdownRequestsResource: + return AsyncWireDrawdownRequestsResource(self._client) @cached_property - def card_refunds(self) -> AsyncCardRefunds: - return AsyncCardRefunds(self._client) + def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsResource: + return AsyncInboundWireDrawdownRequestsResource(self._client) @cached_property - def check_transfers(self) -> AsyncCheckTransfers: - return AsyncCheckTransfers(self._client) + def check_transfers(self) -> AsyncCheckTransfersResource: + return AsyncCheckTransfersResource(self._client) @cached_property - def documents(self) -> AsyncDocuments: - return AsyncDocuments(self._client) + def inbound_check_deposits(self) -> AsyncInboundCheckDepositsResource: + return AsyncInboundCheckDepositsResource(self._client) @cached_property - def digital_wallet_token_requests(self) -> AsyncDigitalWalletTokenRequests: - return AsyncDigitalWalletTokenRequests(self._client) + def real_time_payments_transfers(self) -> AsyncRealTimePaymentsTransfersResource: + return AsyncRealTimePaymentsTransfersResource(self._client) @cached_property - def check_deposits(self) -> AsyncCheckDeposits: - return AsyncCheckDeposits(self._client) + def inbound_real_time_payments_transfers(self) -> AsyncInboundRealTimePaymentsTransfersResource: + return AsyncInboundRealTimePaymentsTransfersResource(self._client) @cached_property - def programs(self) -> AsyncPrograms: - return AsyncPrograms(self._client) + def inbound_fednow_transfers(self) -> AsyncInboundFednowTransfersResource: + return AsyncInboundFednowTransfersResource(self._client) @cached_property - def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequests: - return AsyncInboundWireDrawdownRequests(self._client) + def check_deposits(self) -> AsyncCheckDepositsResource: + return AsyncCheckDepositsResource(self._client) @cached_property - def inbound_funds_holds(self) -> AsyncInboundFundsHolds: - return AsyncInboundFundsHolds(self._client) + def inbound_mail_items(self) -> AsyncInboundMailItemsResource: + return AsyncInboundMailItemsResource(self._client) @cached_property - def interest_payments(self) -> AsyncInterestPayments: - return AsyncInterestPayments(self._client) + def entity_onboarding_sessions(self) -> AsyncEntityOnboardingSessionsResource: + return AsyncEntityOnboardingSessionsResource(self._client) @cached_property - def wire_transfers(self) -> AsyncWireTransfers: - return AsyncWireTransfers(self._client) + def programs(self) -> AsyncProgramsResource: + return AsyncProgramsResource(self._client) @cached_property - def cards(self) -> AsyncCards: - return AsyncCards(self._client) + def account_statements(self) -> AsyncAccountStatementsResource: + return AsyncAccountStatementsResource(self._client) @cached_property - def real_time_payments_transfers(self) -> AsyncRealTimePaymentsTransfers: - return AsyncRealTimePaymentsTransfers(self._client) + def exports(self) -> AsyncExportsResource: + return AsyncExportsResource(self._client) @cached_property - def physical_cards(self) -> AsyncPhysicalCards: - return AsyncPhysicalCards(self._client) + def card_tokens(self) -> AsyncCardTokensResource: + return AsyncCardTokensResource(self._client) @cached_property - def with_raw_response(self) -> AsyncSimulationsWithRawResponse: - return AsyncSimulationsWithRawResponse(self) + def with_raw_response(self) -> AsyncSimulationsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncSimulationsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSimulationsWithStreamingResponse: - return AsyncSimulationsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSimulationsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - async def card_authorization_expirations( - self, - *, - card_payment_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardPayment: + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response """ - Simulates expiring a card authorization immediately. + return AsyncSimulationsResourceWithStreamingResponse(self) - Args: - card_payment_id: The identifier of the Card Payment to expire. - extra_headers: Send extra headers +class SimulationsResourceWithRawResponse: + def __init__(self, simulations: SimulationsResource) -> None: + self._simulations = simulations - extra_query: Add additional query parameters to the request + @cached_property + def interest_payments(self) -> InterestPaymentsResourceWithRawResponse: + return InterestPaymentsResourceWithRawResponse(self._simulations.interest_payments) - extra_body: Add additional JSON properties to the request + @cached_property + def account_transfers(self) -> AccountTransfersResourceWithRawResponse: + return AccountTransfersResourceWithRawResponse(self._simulations.account_transfers) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def card_authorizations(self) -> CardAuthorizationsResourceWithRawResponse: + return CardAuthorizationsResourceWithRawResponse(self._simulations.card_authorizations) - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/card_authorization_expirations", - body=await async_maybe_transform( - {"card_payment_id": card_payment_id}, - simulation_card_authorization_expirations_params.SimulationCardAuthorizationExpirationsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + @cached_property + def card_balance_inquiries(self) -> CardBalanceInquiriesResourceWithRawResponse: + return CardBalanceInquiriesResourceWithRawResponse(self._simulations.card_balance_inquiries) - async def card_fuel_confirmations( - self, - *, - amount: int, - card_payment_id: str, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardPayment: - """Simulates the fuel confirmation of an authorization by a card acquirer. + @cached_property + def card_authorization_expirations(self) -> CardAuthorizationExpirationsResourceWithRawResponse: + return CardAuthorizationExpirationsResourceWithRawResponse(self._simulations.card_authorization_expirations) - This - happens asynchronously right after a fuel pump transaction is completed. A fuel - confirmation can only happen once per authorization. + @cached_property + def card_settlements(self) -> CardSettlementsResourceWithRawResponse: + return CardSettlementsResourceWithRawResponse(self._simulations.card_settlements) - Args: - amount: The amount of the fuel_confirmation in minor units in the card authorization's - currency. + @cached_property + def card_reversals(self) -> CardReversalsResourceWithRawResponse: + return CardReversalsResourceWithRawResponse(self._simulations.card_reversals) - card_payment_id: The identifier of the Card Payment to create a fuel_confirmation on. + @cached_property + def card_increments(self) -> CardIncrementsResourceWithRawResponse: + return CardIncrementsResourceWithRawResponse(self._simulations.card_increments) - extra_headers: Send extra headers + @cached_property + def card_fuel_confirmations(self) -> CardFuelConfirmationsResourceWithRawResponse: + return CardFuelConfirmationsResourceWithRawResponse(self._simulations.card_fuel_confirmations) - extra_query: Add additional query parameters to the request + @cached_property + def card_refunds(self) -> CardRefundsResourceWithRawResponse: + return CardRefundsResourceWithRawResponse(self._simulations.card_refunds) - extra_body: Add additional JSON properties to the request + @cached_property + def card_authentications(self) -> CardAuthenticationsResourceWithRawResponse: + return CardAuthenticationsResourceWithRawResponse(self._simulations.card_authentications) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def card_disputes(self) -> CardDisputesResourceWithRawResponse: + return CardDisputesResourceWithRawResponse(self._simulations.card_disputes) - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/card_fuel_confirmations", - body=await async_maybe_transform( - { - "amount": amount, - "card_payment_id": card_payment_id, - }, - simulation_card_fuel_confirmations_params.SimulationCardFuelConfirmationsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + @cached_property + def physical_cards(self) -> PhysicalCardsResourceWithRawResponse: + return PhysicalCardsResourceWithRawResponse(self._simulations.physical_cards) - async def card_increments( - self, - *, - amount: int, - card_payment_id: str, - event_subscription_id: 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, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> CardPayment: - """Simulates the increment of an authorization by a card acquirer. + @cached_property + def digital_wallet_token_requests(self) -> DigitalWalletTokenRequestsResourceWithRawResponse: + return DigitalWalletTokenRequestsResourceWithRawResponse(self._simulations.digital_wallet_token_requests) - An authorization - can be incremented multiple times. + @cached_property + def pending_transactions(self) -> PendingTransactionsResourceWithRawResponse: + return PendingTransactionsResourceWithRawResponse(self._simulations.pending_transactions) - Args: - amount: The amount of the increment in minor units in the card authorization's currency. + @cached_property + def ach_transfers(self) -> ACHTransfersResourceWithRawResponse: + return ACHTransfersResourceWithRawResponse(self._simulations.ach_transfers) - card_payment_id: The identifier of the Card Payment to create a increment on. + @cached_property + def inbound_ach_transfers(self) -> InboundACHTransfersResourceWithRawResponse: + return InboundACHTransfersResourceWithRawResponse(self._simulations.inbound_ach_transfers) - event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the - default real time event subscription. Because you can only create one real time - decision event subscription, you can use this field to route events to any - specified event subscription for testing purposes. + @cached_property + def wire_transfers(self) -> WireTransfersResourceWithRawResponse: + return WireTransfersResourceWithRawResponse(self._simulations.wire_transfers) - extra_headers: Send extra headers + @cached_property + def inbound_wire_transfers(self) -> InboundWireTransfersResourceWithRawResponse: + return InboundWireTransfersResourceWithRawResponse(self._simulations.inbound_wire_transfers) - extra_query: Add additional query parameters to the request + @cached_property + def wire_drawdown_requests(self) -> WireDrawdownRequestsResourceWithRawResponse: + return WireDrawdownRequestsResourceWithRawResponse(self._simulations.wire_drawdown_requests) - extra_body: Add additional JSON properties to the request + @cached_property + def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsResourceWithRawResponse: + return InboundWireDrawdownRequestsResourceWithRawResponse(self._simulations.inbound_wire_drawdown_requests) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def check_transfers(self) -> CheckTransfersResourceWithRawResponse: + return CheckTransfersResourceWithRawResponse(self._simulations.check_transfers) - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/card_increments", - body=await async_maybe_transform( - { - "amount": amount, - "card_payment_id": card_payment_id, - "event_subscription_id": event_subscription_id, - }, - simulation_card_increments_params.SimulationCardIncrementsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + @cached_property + def inbound_check_deposits(self) -> InboundCheckDepositsResourceWithRawResponse: + return InboundCheckDepositsResourceWithRawResponse(self._simulations.inbound_check_deposits) - async def card_reversals( - self, - *, - card_payment_id: str, - amount: int | 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, - idempotency_key: str | None = None, - ) -> CardPayment: - """Simulates the reversal of an authorization by a card acquirer. + @cached_property + def real_time_payments_transfers(self) -> RealTimePaymentsTransfersResourceWithRawResponse: + return RealTimePaymentsTransfersResourceWithRawResponse(self._simulations.real_time_payments_transfers) - An authorization - can be partially reversed multiple times, up until the total authorized amount. - Marks the pending transaction as complete if the authorization is fully - reversed. + @cached_property + def inbound_real_time_payments_transfers(self) -> InboundRealTimePaymentsTransfersResourceWithRawResponse: + return InboundRealTimePaymentsTransfersResourceWithRawResponse( + self._simulations.inbound_real_time_payments_transfers + ) - Args: - card_payment_id: The identifier of the Card Payment to create a reversal on. + @cached_property + def inbound_fednow_transfers(self) -> InboundFednowTransfersResourceWithRawResponse: + return InboundFednowTransfersResourceWithRawResponse(self._simulations.inbound_fednow_transfers) - amount: The amount of the reversal in minor units in the card authorization's currency. - This defaults to the authorization amount. + @cached_property + def check_deposits(self) -> CheckDepositsResourceWithRawResponse: + return CheckDepositsResourceWithRawResponse(self._simulations.check_deposits) - extra_headers: Send extra headers + @cached_property + def inbound_mail_items(self) -> InboundMailItemsResourceWithRawResponse: + return InboundMailItemsResourceWithRawResponse(self._simulations.inbound_mail_items) - extra_query: Add additional query parameters to the request + @cached_property + def entity_onboarding_sessions(self) -> EntityOnboardingSessionsResourceWithRawResponse: + return EntityOnboardingSessionsResourceWithRawResponse(self._simulations.entity_onboarding_sessions) - extra_body: Add additional JSON properties to the request + @cached_property + def programs(self) -> ProgramsResourceWithRawResponse: + return ProgramsResourceWithRawResponse(self._simulations.programs) - timeout: Override the client-level default timeout for this request, in seconds + @cached_property + def account_statements(self) -> AccountStatementsResourceWithRawResponse: + return AccountStatementsResourceWithRawResponse(self._simulations.account_statements) - idempotency_key: Specify a custom idempotency key for this request - """ - return await self._post( - "/simulations/card_reversals", - body=await async_maybe_transform( - { - "card_payment_id": card_payment_id, - "amount": amount, - }, - simulation_card_reversals_params.SimulationCardReversalsParams, - ), - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=CardPayment, - ) + @cached_property + def exports(self) -> ExportsResourceWithRawResponse: + return ExportsResourceWithRawResponse(self._simulations.exports) + + @cached_property + def card_tokens(self) -> CardTokensResourceWithRawResponse: + return CardTokensResourceWithRawResponse(self._simulations.card_tokens) -class SimulationsWithRawResponse: - def __init__(self, simulations: Simulations) -> None: +class AsyncSimulationsResourceWithRawResponse: + def __init__(self, simulations: AsyncSimulationsResource) -> None: self._simulations = simulations - self.card_authorization_expirations = _legacy_response.to_raw_response_wrapper( - simulations.card_authorization_expirations, - ) - self.card_fuel_confirmations = _legacy_response.to_raw_response_wrapper( - simulations.card_fuel_confirmations, - ) - self.card_increments = _legacy_response.to_raw_response_wrapper( - simulations.card_increments, - ) - self.card_reversals = _legacy_response.to_raw_response_wrapper( - simulations.card_reversals, + @cached_property + def interest_payments(self) -> AsyncInterestPaymentsResourceWithRawResponse: + return AsyncInterestPaymentsResourceWithRawResponse(self._simulations.interest_payments) + + @cached_property + def account_transfers(self) -> AsyncAccountTransfersResourceWithRawResponse: + return AsyncAccountTransfersResourceWithRawResponse(self._simulations.account_transfers) + + @cached_property + def card_authorizations(self) -> AsyncCardAuthorizationsResourceWithRawResponse: + return AsyncCardAuthorizationsResourceWithRawResponse(self._simulations.card_authorizations) + + @cached_property + def card_balance_inquiries(self) -> AsyncCardBalanceInquiriesResourceWithRawResponse: + return AsyncCardBalanceInquiriesResourceWithRawResponse(self._simulations.card_balance_inquiries) + + @cached_property + def card_authorization_expirations(self) -> AsyncCardAuthorizationExpirationsResourceWithRawResponse: + return AsyncCardAuthorizationExpirationsResourceWithRawResponse( + self._simulations.card_authorization_expirations ) @cached_property - def account_transfers(self) -> AccountTransfersWithRawResponse: - return AccountTransfersWithRawResponse(self._simulations.account_transfers) + def card_settlements(self) -> AsyncCardSettlementsResourceWithRawResponse: + return AsyncCardSettlementsResourceWithRawResponse(self._simulations.card_settlements) @cached_property - def account_statements(self) -> AccountStatementsWithRawResponse: - return AccountStatementsWithRawResponse(self._simulations.account_statements) + def card_reversals(self) -> AsyncCardReversalsResourceWithRawResponse: + return AsyncCardReversalsResourceWithRawResponse(self._simulations.card_reversals) @cached_property - def ach_transfers(self) -> ACHTransfersWithRawResponse: - return ACHTransfersWithRawResponse(self._simulations.ach_transfers) + def card_increments(self) -> AsyncCardIncrementsResourceWithRawResponse: + return AsyncCardIncrementsResourceWithRawResponse(self._simulations.card_increments) @cached_property - def card_disputes(self) -> CardDisputesWithRawResponse: - return CardDisputesWithRawResponse(self._simulations.card_disputes) + def card_fuel_confirmations(self) -> AsyncCardFuelConfirmationsResourceWithRawResponse: + return AsyncCardFuelConfirmationsResourceWithRawResponse(self._simulations.card_fuel_confirmations) @cached_property - def card_refunds(self) -> CardRefundsWithRawResponse: - return CardRefundsWithRawResponse(self._simulations.card_refunds) + def card_refunds(self) -> AsyncCardRefundsResourceWithRawResponse: + return AsyncCardRefundsResourceWithRawResponse(self._simulations.card_refunds) @cached_property - def check_transfers(self) -> CheckTransfersWithRawResponse: - return CheckTransfersWithRawResponse(self._simulations.check_transfers) + def card_authentications(self) -> AsyncCardAuthenticationsResourceWithRawResponse: + return AsyncCardAuthenticationsResourceWithRawResponse(self._simulations.card_authentications) @cached_property - def documents(self) -> DocumentsWithRawResponse: - return DocumentsWithRawResponse(self._simulations.documents) + def card_disputes(self) -> AsyncCardDisputesResourceWithRawResponse: + return AsyncCardDisputesResourceWithRawResponse(self._simulations.card_disputes) @cached_property - def digital_wallet_token_requests(self) -> DigitalWalletTokenRequestsWithRawResponse: - return DigitalWalletTokenRequestsWithRawResponse(self._simulations.digital_wallet_token_requests) + def physical_cards(self) -> AsyncPhysicalCardsResourceWithRawResponse: + return AsyncPhysicalCardsResourceWithRawResponse(self._simulations.physical_cards) @cached_property - def check_deposits(self) -> CheckDepositsWithRawResponse: - return CheckDepositsWithRawResponse(self._simulations.check_deposits) + def digital_wallet_token_requests(self) -> AsyncDigitalWalletTokenRequestsResourceWithRawResponse: + return AsyncDigitalWalletTokenRequestsResourceWithRawResponse(self._simulations.digital_wallet_token_requests) @cached_property - def programs(self) -> ProgramsWithRawResponse: - return ProgramsWithRawResponse(self._simulations.programs) + def pending_transactions(self) -> AsyncPendingTransactionsResourceWithRawResponse: + return AsyncPendingTransactionsResourceWithRawResponse(self._simulations.pending_transactions) @cached_property - def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsWithRawResponse: - return InboundWireDrawdownRequestsWithRawResponse(self._simulations.inbound_wire_drawdown_requests) + def ach_transfers(self) -> AsyncACHTransfersResourceWithRawResponse: + return AsyncACHTransfersResourceWithRawResponse(self._simulations.ach_transfers) @cached_property - def inbound_funds_holds(self) -> InboundFundsHoldsWithRawResponse: - return InboundFundsHoldsWithRawResponse(self._simulations.inbound_funds_holds) + def inbound_ach_transfers(self) -> AsyncInboundACHTransfersResourceWithRawResponse: + return AsyncInboundACHTransfersResourceWithRawResponse(self._simulations.inbound_ach_transfers) @cached_property - def interest_payments(self) -> InterestPaymentsWithRawResponse: - return InterestPaymentsWithRawResponse(self._simulations.interest_payments) + def wire_transfers(self) -> AsyncWireTransfersResourceWithRawResponse: + return AsyncWireTransfersResourceWithRawResponse(self._simulations.wire_transfers) @cached_property - def wire_transfers(self) -> WireTransfersWithRawResponse: - return WireTransfersWithRawResponse(self._simulations.wire_transfers) + def inbound_wire_transfers(self) -> AsyncInboundWireTransfersResourceWithRawResponse: + return AsyncInboundWireTransfersResourceWithRawResponse(self._simulations.inbound_wire_transfers) @cached_property - def cards(self) -> CardsWithRawResponse: - return CardsWithRawResponse(self._simulations.cards) + def wire_drawdown_requests(self) -> AsyncWireDrawdownRequestsResourceWithRawResponse: + return AsyncWireDrawdownRequestsResourceWithRawResponse(self._simulations.wire_drawdown_requests) @cached_property - def real_time_payments_transfers(self) -> RealTimePaymentsTransfersWithRawResponse: - return RealTimePaymentsTransfersWithRawResponse(self._simulations.real_time_payments_transfers) + def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsResourceWithRawResponse: + return AsyncInboundWireDrawdownRequestsResourceWithRawResponse(self._simulations.inbound_wire_drawdown_requests) @cached_property - def physical_cards(self) -> PhysicalCardsWithRawResponse: - return PhysicalCardsWithRawResponse(self._simulations.physical_cards) + def check_transfers(self) -> AsyncCheckTransfersResourceWithRawResponse: + return AsyncCheckTransfersResourceWithRawResponse(self._simulations.check_transfers) + @cached_property + def inbound_check_deposits(self) -> AsyncInboundCheckDepositsResourceWithRawResponse: + return AsyncInboundCheckDepositsResourceWithRawResponse(self._simulations.inbound_check_deposits) -class AsyncSimulationsWithRawResponse: - def __init__(self, simulations: AsyncSimulations) -> None: - self._simulations = simulations + @cached_property + def real_time_payments_transfers(self) -> AsyncRealTimePaymentsTransfersResourceWithRawResponse: + return AsyncRealTimePaymentsTransfersResourceWithRawResponse(self._simulations.real_time_payments_transfers) - self.card_authorization_expirations = _legacy_response.async_to_raw_response_wrapper( - simulations.card_authorization_expirations, - ) - self.card_fuel_confirmations = _legacy_response.async_to_raw_response_wrapper( - simulations.card_fuel_confirmations, - ) - self.card_increments = _legacy_response.async_to_raw_response_wrapper( - simulations.card_increments, - ) - self.card_reversals = _legacy_response.async_to_raw_response_wrapper( - simulations.card_reversals, + @cached_property + def inbound_real_time_payments_transfers(self) -> AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse: + return AsyncInboundRealTimePaymentsTransfersResourceWithRawResponse( + self._simulations.inbound_real_time_payments_transfers ) @cached_property - def account_transfers(self) -> AsyncAccountTransfersWithRawResponse: - return AsyncAccountTransfersWithRawResponse(self._simulations.account_transfers) + def inbound_fednow_transfers(self) -> AsyncInboundFednowTransfersResourceWithRawResponse: + return AsyncInboundFednowTransfersResourceWithRawResponse(self._simulations.inbound_fednow_transfers) @cached_property - def account_statements(self) -> AsyncAccountStatementsWithRawResponse: - return AsyncAccountStatementsWithRawResponse(self._simulations.account_statements) + def check_deposits(self) -> AsyncCheckDepositsResourceWithRawResponse: + return AsyncCheckDepositsResourceWithRawResponse(self._simulations.check_deposits) @cached_property - def ach_transfers(self) -> AsyncACHTransfersWithRawResponse: - return AsyncACHTransfersWithRawResponse(self._simulations.ach_transfers) + def inbound_mail_items(self) -> AsyncInboundMailItemsResourceWithRawResponse: + return AsyncInboundMailItemsResourceWithRawResponse(self._simulations.inbound_mail_items) @cached_property - def card_disputes(self) -> AsyncCardDisputesWithRawResponse: - return AsyncCardDisputesWithRawResponse(self._simulations.card_disputes) + def entity_onboarding_sessions(self) -> AsyncEntityOnboardingSessionsResourceWithRawResponse: + return AsyncEntityOnboardingSessionsResourceWithRawResponse(self._simulations.entity_onboarding_sessions) @cached_property - def card_refunds(self) -> AsyncCardRefundsWithRawResponse: - return AsyncCardRefundsWithRawResponse(self._simulations.card_refunds) + def programs(self) -> AsyncProgramsResourceWithRawResponse: + return AsyncProgramsResourceWithRawResponse(self._simulations.programs) @cached_property - def check_transfers(self) -> AsyncCheckTransfersWithRawResponse: - return AsyncCheckTransfersWithRawResponse(self._simulations.check_transfers) + def account_statements(self) -> AsyncAccountStatementsResourceWithRawResponse: + return AsyncAccountStatementsResourceWithRawResponse(self._simulations.account_statements) @cached_property - def documents(self) -> AsyncDocumentsWithRawResponse: - return AsyncDocumentsWithRawResponse(self._simulations.documents) + def exports(self) -> AsyncExportsResourceWithRawResponse: + return AsyncExportsResourceWithRawResponse(self._simulations.exports) @cached_property - def digital_wallet_token_requests(self) -> AsyncDigitalWalletTokenRequestsWithRawResponse: - return AsyncDigitalWalletTokenRequestsWithRawResponse(self._simulations.digital_wallet_token_requests) + def card_tokens(self) -> AsyncCardTokensResourceWithRawResponse: + return AsyncCardTokensResourceWithRawResponse(self._simulations.card_tokens) + + +class SimulationsResourceWithStreamingResponse: + def __init__(self, simulations: SimulationsResource) -> None: + self._simulations = simulations @cached_property - def check_deposits(self) -> AsyncCheckDepositsWithRawResponse: - return AsyncCheckDepositsWithRawResponse(self._simulations.check_deposits) + def interest_payments(self) -> InterestPaymentsResourceWithStreamingResponse: + return InterestPaymentsResourceWithStreamingResponse(self._simulations.interest_payments) @cached_property - def programs(self) -> AsyncProgramsWithRawResponse: - return AsyncProgramsWithRawResponse(self._simulations.programs) + def account_transfers(self) -> AccountTransfersResourceWithStreamingResponse: + return AccountTransfersResourceWithStreamingResponse(self._simulations.account_transfers) @cached_property - def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsWithRawResponse: - return AsyncInboundWireDrawdownRequestsWithRawResponse(self._simulations.inbound_wire_drawdown_requests) + def card_authorizations(self) -> CardAuthorizationsResourceWithStreamingResponse: + return CardAuthorizationsResourceWithStreamingResponse(self._simulations.card_authorizations) @cached_property - def inbound_funds_holds(self) -> AsyncInboundFundsHoldsWithRawResponse: - return AsyncInboundFundsHoldsWithRawResponse(self._simulations.inbound_funds_holds) + def card_balance_inquiries(self) -> CardBalanceInquiriesResourceWithStreamingResponse: + return CardBalanceInquiriesResourceWithStreamingResponse(self._simulations.card_balance_inquiries) @cached_property - def interest_payments(self) -> AsyncInterestPaymentsWithRawResponse: - return AsyncInterestPaymentsWithRawResponse(self._simulations.interest_payments) + def card_authorization_expirations(self) -> CardAuthorizationExpirationsResourceWithStreamingResponse: + return CardAuthorizationExpirationsResourceWithStreamingResponse( + self._simulations.card_authorization_expirations + ) @cached_property - def wire_transfers(self) -> AsyncWireTransfersWithRawResponse: - return AsyncWireTransfersWithRawResponse(self._simulations.wire_transfers) + def card_settlements(self) -> CardSettlementsResourceWithStreamingResponse: + return CardSettlementsResourceWithStreamingResponse(self._simulations.card_settlements) @cached_property - def cards(self) -> AsyncCardsWithRawResponse: - return AsyncCardsWithRawResponse(self._simulations.cards) + def card_reversals(self) -> CardReversalsResourceWithStreamingResponse: + return CardReversalsResourceWithStreamingResponse(self._simulations.card_reversals) @cached_property - def real_time_payments_transfers(self) -> AsyncRealTimePaymentsTransfersWithRawResponse: - return AsyncRealTimePaymentsTransfersWithRawResponse(self._simulations.real_time_payments_transfers) + def card_increments(self) -> CardIncrementsResourceWithStreamingResponse: + return CardIncrementsResourceWithStreamingResponse(self._simulations.card_increments) @cached_property - def physical_cards(self) -> AsyncPhysicalCardsWithRawResponse: - return AsyncPhysicalCardsWithRawResponse(self._simulations.physical_cards) + def card_fuel_confirmations(self) -> CardFuelConfirmationsResourceWithStreamingResponse: + return CardFuelConfirmationsResourceWithStreamingResponse(self._simulations.card_fuel_confirmations) + @cached_property + def card_refunds(self) -> CardRefundsResourceWithStreamingResponse: + return CardRefundsResourceWithStreamingResponse(self._simulations.card_refunds) -class SimulationsWithStreamingResponse: - def __init__(self, simulations: Simulations) -> None: - self._simulations = simulations + @cached_property + def card_authentications(self) -> CardAuthenticationsResourceWithStreamingResponse: + return CardAuthenticationsResourceWithStreamingResponse(self._simulations.card_authentications) - self.card_authorization_expirations = to_streamed_response_wrapper( - simulations.card_authorization_expirations, - ) - self.card_fuel_confirmations = to_streamed_response_wrapper( - simulations.card_fuel_confirmations, - ) - self.card_increments = to_streamed_response_wrapper( - simulations.card_increments, - ) - self.card_reversals = to_streamed_response_wrapper( - simulations.card_reversals, - ) + @cached_property + def card_disputes(self) -> CardDisputesResourceWithStreamingResponse: + return CardDisputesResourceWithStreamingResponse(self._simulations.card_disputes) @cached_property - def account_transfers(self) -> AccountTransfersWithStreamingResponse: - return AccountTransfersWithStreamingResponse(self._simulations.account_transfers) + def physical_cards(self) -> PhysicalCardsResourceWithStreamingResponse: + return PhysicalCardsResourceWithStreamingResponse(self._simulations.physical_cards) @cached_property - def account_statements(self) -> AccountStatementsWithStreamingResponse: - return AccountStatementsWithStreamingResponse(self._simulations.account_statements) + def digital_wallet_token_requests(self) -> DigitalWalletTokenRequestsResourceWithStreamingResponse: + return DigitalWalletTokenRequestsResourceWithStreamingResponse(self._simulations.digital_wallet_token_requests) @cached_property - def ach_transfers(self) -> ACHTransfersWithStreamingResponse: - return ACHTransfersWithStreamingResponse(self._simulations.ach_transfers) + def pending_transactions(self) -> PendingTransactionsResourceWithStreamingResponse: + return PendingTransactionsResourceWithStreamingResponse(self._simulations.pending_transactions) @cached_property - def card_disputes(self) -> CardDisputesWithStreamingResponse: - return CardDisputesWithStreamingResponse(self._simulations.card_disputes) + def ach_transfers(self) -> ACHTransfersResourceWithStreamingResponse: + return ACHTransfersResourceWithStreamingResponse(self._simulations.ach_transfers) @cached_property - def card_refunds(self) -> CardRefundsWithStreamingResponse: - return CardRefundsWithStreamingResponse(self._simulations.card_refunds) + def inbound_ach_transfers(self) -> InboundACHTransfersResourceWithStreamingResponse: + return InboundACHTransfersResourceWithStreamingResponse(self._simulations.inbound_ach_transfers) @cached_property - def check_transfers(self) -> CheckTransfersWithStreamingResponse: - return CheckTransfersWithStreamingResponse(self._simulations.check_transfers) + def wire_transfers(self) -> WireTransfersResourceWithStreamingResponse: + return WireTransfersResourceWithStreamingResponse(self._simulations.wire_transfers) @cached_property - def documents(self) -> DocumentsWithStreamingResponse: - return DocumentsWithStreamingResponse(self._simulations.documents) + def inbound_wire_transfers(self) -> InboundWireTransfersResourceWithStreamingResponse: + return InboundWireTransfersResourceWithStreamingResponse(self._simulations.inbound_wire_transfers) @cached_property - def digital_wallet_token_requests(self) -> DigitalWalletTokenRequestsWithStreamingResponse: - return DigitalWalletTokenRequestsWithStreamingResponse(self._simulations.digital_wallet_token_requests) + def wire_drawdown_requests(self) -> WireDrawdownRequestsResourceWithStreamingResponse: + return WireDrawdownRequestsResourceWithStreamingResponse(self._simulations.wire_drawdown_requests) @cached_property - def check_deposits(self) -> CheckDepositsWithStreamingResponse: - return CheckDepositsWithStreamingResponse(self._simulations.check_deposits) + def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsResourceWithStreamingResponse: + return InboundWireDrawdownRequestsResourceWithStreamingResponse( + self._simulations.inbound_wire_drawdown_requests + ) @cached_property - def programs(self) -> ProgramsWithStreamingResponse: - return ProgramsWithStreamingResponse(self._simulations.programs) + def check_transfers(self) -> CheckTransfersResourceWithStreamingResponse: + return CheckTransfersResourceWithStreamingResponse(self._simulations.check_transfers) @cached_property - def inbound_wire_drawdown_requests(self) -> InboundWireDrawdownRequestsWithStreamingResponse: - return InboundWireDrawdownRequestsWithStreamingResponse(self._simulations.inbound_wire_drawdown_requests) + def inbound_check_deposits(self) -> InboundCheckDepositsResourceWithStreamingResponse: + return InboundCheckDepositsResourceWithStreamingResponse(self._simulations.inbound_check_deposits) @cached_property - def inbound_funds_holds(self) -> InboundFundsHoldsWithStreamingResponse: - return InboundFundsHoldsWithStreamingResponse(self._simulations.inbound_funds_holds) + def real_time_payments_transfers(self) -> RealTimePaymentsTransfersResourceWithStreamingResponse: + return RealTimePaymentsTransfersResourceWithStreamingResponse(self._simulations.real_time_payments_transfers) @cached_property - def interest_payments(self) -> InterestPaymentsWithStreamingResponse: - return InterestPaymentsWithStreamingResponse(self._simulations.interest_payments) + def inbound_real_time_payments_transfers(self) -> InboundRealTimePaymentsTransfersResourceWithStreamingResponse: + return InboundRealTimePaymentsTransfersResourceWithStreamingResponse( + self._simulations.inbound_real_time_payments_transfers + ) @cached_property - def wire_transfers(self) -> WireTransfersWithStreamingResponse: - return WireTransfersWithStreamingResponse(self._simulations.wire_transfers) + def inbound_fednow_transfers(self) -> InboundFednowTransfersResourceWithStreamingResponse: + return InboundFednowTransfersResourceWithStreamingResponse(self._simulations.inbound_fednow_transfers) @cached_property - def cards(self) -> CardsWithStreamingResponse: - return CardsWithStreamingResponse(self._simulations.cards) + def check_deposits(self) -> CheckDepositsResourceWithStreamingResponse: + return CheckDepositsResourceWithStreamingResponse(self._simulations.check_deposits) @cached_property - def real_time_payments_transfers(self) -> RealTimePaymentsTransfersWithStreamingResponse: - return RealTimePaymentsTransfersWithStreamingResponse(self._simulations.real_time_payments_transfers) + def inbound_mail_items(self) -> InboundMailItemsResourceWithStreamingResponse: + return InboundMailItemsResourceWithStreamingResponse(self._simulations.inbound_mail_items) @cached_property - def physical_cards(self) -> PhysicalCardsWithStreamingResponse: - return PhysicalCardsWithStreamingResponse(self._simulations.physical_cards) + def entity_onboarding_sessions(self) -> EntityOnboardingSessionsResourceWithStreamingResponse: + return EntityOnboardingSessionsResourceWithStreamingResponse(self._simulations.entity_onboarding_sessions) + @cached_property + def programs(self) -> ProgramsResourceWithStreamingResponse: + return ProgramsResourceWithStreamingResponse(self._simulations.programs) + + @cached_property + def account_statements(self) -> AccountStatementsResourceWithStreamingResponse: + return AccountStatementsResourceWithStreamingResponse(self._simulations.account_statements) -class AsyncSimulationsWithStreamingResponse: - def __init__(self, simulations: AsyncSimulations) -> None: + @cached_property + def exports(self) -> ExportsResourceWithStreamingResponse: + return ExportsResourceWithStreamingResponse(self._simulations.exports) + + @cached_property + def card_tokens(self) -> CardTokensResourceWithStreamingResponse: + return CardTokensResourceWithStreamingResponse(self._simulations.card_tokens) + + +class AsyncSimulationsResourceWithStreamingResponse: + def __init__(self, simulations: AsyncSimulationsResource) -> None: self._simulations = simulations - self.card_authorization_expirations = async_to_streamed_response_wrapper( - simulations.card_authorization_expirations, - ) - self.card_fuel_confirmations = async_to_streamed_response_wrapper( - simulations.card_fuel_confirmations, - ) - self.card_increments = async_to_streamed_response_wrapper( - simulations.card_increments, + @cached_property + def interest_payments(self) -> AsyncInterestPaymentsResourceWithStreamingResponse: + return AsyncInterestPaymentsResourceWithStreamingResponse(self._simulations.interest_payments) + + @cached_property + def account_transfers(self) -> AsyncAccountTransfersResourceWithStreamingResponse: + return AsyncAccountTransfersResourceWithStreamingResponse(self._simulations.account_transfers) + + @cached_property + def card_authorizations(self) -> AsyncCardAuthorizationsResourceWithStreamingResponse: + return AsyncCardAuthorizationsResourceWithStreamingResponse(self._simulations.card_authorizations) + + @cached_property + def card_balance_inquiries(self) -> AsyncCardBalanceInquiriesResourceWithStreamingResponse: + return AsyncCardBalanceInquiriesResourceWithStreamingResponse(self._simulations.card_balance_inquiries) + + @cached_property + def card_authorization_expirations(self) -> AsyncCardAuthorizationExpirationsResourceWithStreamingResponse: + return AsyncCardAuthorizationExpirationsResourceWithStreamingResponse( + self._simulations.card_authorization_expirations ) - self.card_reversals = async_to_streamed_response_wrapper( - simulations.card_reversals, + + @cached_property + def card_settlements(self) -> AsyncCardSettlementsResourceWithStreamingResponse: + return AsyncCardSettlementsResourceWithStreamingResponse(self._simulations.card_settlements) + + @cached_property + def card_reversals(self) -> AsyncCardReversalsResourceWithStreamingResponse: + return AsyncCardReversalsResourceWithStreamingResponse(self._simulations.card_reversals) + + @cached_property + def card_increments(self) -> AsyncCardIncrementsResourceWithStreamingResponse: + return AsyncCardIncrementsResourceWithStreamingResponse(self._simulations.card_increments) + + @cached_property + def card_fuel_confirmations(self) -> AsyncCardFuelConfirmationsResourceWithStreamingResponse: + return AsyncCardFuelConfirmationsResourceWithStreamingResponse(self._simulations.card_fuel_confirmations) + + @cached_property + def card_refunds(self) -> AsyncCardRefundsResourceWithStreamingResponse: + return AsyncCardRefundsResourceWithStreamingResponse(self._simulations.card_refunds) + + @cached_property + def card_authentications(self) -> AsyncCardAuthenticationsResourceWithStreamingResponse: + return AsyncCardAuthenticationsResourceWithStreamingResponse(self._simulations.card_authentications) + + @cached_property + def card_disputes(self) -> AsyncCardDisputesResourceWithStreamingResponse: + return AsyncCardDisputesResourceWithStreamingResponse(self._simulations.card_disputes) + + @cached_property + def physical_cards(self) -> AsyncPhysicalCardsResourceWithStreamingResponse: + return AsyncPhysicalCardsResourceWithStreamingResponse(self._simulations.physical_cards) + + @cached_property + def digital_wallet_token_requests(self) -> AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse: + return AsyncDigitalWalletTokenRequestsResourceWithStreamingResponse( + self._simulations.digital_wallet_token_requests ) @cached_property - def account_transfers(self) -> AsyncAccountTransfersWithStreamingResponse: - return AsyncAccountTransfersWithStreamingResponse(self._simulations.account_transfers) + def pending_transactions(self) -> AsyncPendingTransactionsResourceWithStreamingResponse: + return AsyncPendingTransactionsResourceWithStreamingResponse(self._simulations.pending_transactions) + + @cached_property + def ach_transfers(self) -> AsyncACHTransfersResourceWithStreamingResponse: + return AsyncACHTransfersResourceWithStreamingResponse(self._simulations.ach_transfers) @cached_property - def account_statements(self) -> AsyncAccountStatementsWithStreamingResponse: - return AsyncAccountStatementsWithStreamingResponse(self._simulations.account_statements) + def inbound_ach_transfers(self) -> AsyncInboundACHTransfersResourceWithStreamingResponse: + return AsyncInboundACHTransfersResourceWithStreamingResponse(self._simulations.inbound_ach_transfers) @cached_property - def ach_transfers(self) -> AsyncACHTransfersWithStreamingResponse: - return AsyncACHTransfersWithStreamingResponse(self._simulations.ach_transfers) + def wire_transfers(self) -> AsyncWireTransfersResourceWithStreamingResponse: + return AsyncWireTransfersResourceWithStreamingResponse(self._simulations.wire_transfers) @cached_property - def card_disputes(self) -> AsyncCardDisputesWithStreamingResponse: - return AsyncCardDisputesWithStreamingResponse(self._simulations.card_disputes) + def inbound_wire_transfers(self) -> AsyncInboundWireTransfersResourceWithStreamingResponse: + return AsyncInboundWireTransfersResourceWithStreamingResponse(self._simulations.inbound_wire_transfers) @cached_property - def card_refunds(self) -> AsyncCardRefundsWithStreamingResponse: - return AsyncCardRefundsWithStreamingResponse(self._simulations.card_refunds) + def wire_drawdown_requests(self) -> AsyncWireDrawdownRequestsResourceWithStreamingResponse: + return AsyncWireDrawdownRequestsResourceWithStreamingResponse(self._simulations.wire_drawdown_requests) @cached_property - def check_transfers(self) -> AsyncCheckTransfersWithStreamingResponse: - return AsyncCheckTransfersWithStreamingResponse(self._simulations.check_transfers) + def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse: + return AsyncInboundWireDrawdownRequestsResourceWithStreamingResponse( + self._simulations.inbound_wire_drawdown_requests + ) + + @cached_property + def check_transfers(self) -> AsyncCheckTransfersResourceWithStreamingResponse: + return AsyncCheckTransfersResourceWithStreamingResponse(self._simulations.check_transfers) @cached_property - def documents(self) -> AsyncDocumentsWithStreamingResponse: - return AsyncDocumentsWithStreamingResponse(self._simulations.documents) + def inbound_check_deposits(self) -> AsyncInboundCheckDepositsResourceWithStreamingResponse: + return AsyncInboundCheckDepositsResourceWithStreamingResponse(self._simulations.inbound_check_deposits) @cached_property - def digital_wallet_token_requests(self) -> AsyncDigitalWalletTokenRequestsWithStreamingResponse: - return AsyncDigitalWalletTokenRequestsWithStreamingResponse(self._simulations.digital_wallet_token_requests) + def real_time_payments_transfers(self) -> AsyncRealTimePaymentsTransfersResourceWithStreamingResponse: + return AsyncRealTimePaymentsTransfersResourceWithStreamingResponse( + self._simulations.real_time_payments_transfers + ) @cached_property - def check_deposits(self) -> AsyncCheckDepositsWithStreamingResponse: - return AsyncCheckDepositsWithStreamingResponse(self._simulations.check_deposits) + def inbound_real_time_payments_transfers( + self, + ) -> AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse: + return AsyncInboundRealTimePaymentsTransfersResourceWithStreamingResponse( + self._simulations.inbound_real_time_payments_transfers + ) @cached_property - def programs(self) -> AsyncProgramsWithStreamingResponse: - return AsyncProgramsWithStreamingResponse(self._simulations.programs) + def inbound_fednow_transfers(self) -> AsyncInboundFednowTransfersResourceWithStreamingResponse: + return AsyncInboundFednowTransfersResourceWithStreamingResponse(self._simulations.inbound_fednow_transfers) @cached_property - def inbound_wire_drawdown_requests(self) -> AsyncInboundWireDrawdownRequestsWithStreamingResponse: - return AsyncInboundWireDrawdownRequestsWithStreamingResponse(self._simulations.inbound_wire_drawdown_requests) + def check_deposits(self) -> AsyncCheckDepositsResourceWithStreamingResponse: + return AsyncCheckDepositsResourceWithStreamingResponse(self._simulations.check_deposits) @cached_property - def inbound_funds_holds(self) -> AsyncInboundFundsHoldsWithStreamingResponse: - return AsyncInboundFundsHoldsWithStreamingResponse(self._simulations.inbound_funds_holds) + def inbound_mail_items(self) -> AsyncInboundMailItemsResourceWithStreamingResponse: + return AsyncInboundMailItemsResourceWithStreamingResponse(self._simulations.inbound_mail_items) @cached_property - def interest_payments(self) -> AsyncInterestPaymentsWithStreamingResponse: - return AsyncInterestPaymentsWithStreamingResponse(self._simulations.interest_payments) + def entity_onboarding_sessions(self) -> AsyncEntityOnboardingSessionsResourceWithStreamingResponse: + return AsyncEntityOnboardingSessionsResourceWithStreamingResponse(self._simulations.entity_onboarding_sessions) @cached_property - def wire_transfers(self) -> AsyncWireTransfersWithStreamingResponse: - return AsyncWireTransfersWithStreamingResponse(self._simulations.wire_transfers) + def programs(self) -> AsyncProgramsResourceWithStreamingResponse: + return AsyncProgramsResourceWithStreamingResponse(self._simulations.programs) @cached_property - def cards(self) -> AsyncCardsWithStreamingResponse: - return AsyncCardsWithStreamingResponse(self._simulations.cards) + def account_statements(self) -> AsyncAccountStatementsResourceWithStreamingResponse: + return AsyncAccountStatementsResourceWithStreamingResponse(self._simulations.account_statements) @cached_property - def real_time_payments_transfers(self) -> AsyncRealTimePaymentsTransfersWithStreamingResponse: - return AsyncRealTimePaymentsTransfersWithStreamingResponse(self._simulations.real_time_payments_transfers) + def exports(self) -> AsyncExportsResourceWithStreamingResponse: + return AsyncExportsResourceWithStreamingResponse(self._simulations.exports) @cached_property - def physical_cards(self) -> AsyncPhysicalCardsWithStreamingResponse: - return AsyncPhysicalCardsWithStreamingResponse(self._simulations.physical_cards) + def card_tokens(self) -> AsyncCardTokensResourceWithStreamingResponse: + return AsyncCardTokensResourceWithStreamingResponse(self._simulations.card_tokens) diff --git a/src/increase/resources/simulations/wire_drawdown_requests.py b/src/increase/resources/simulations/wire_drawdown_requests.py new file mode 100644 index 000000000..a3c8cc56b --- /dev/null +++ b/src/increase/resources/simulations/wire_drawdown_requests.py @@ -0,0 +1,298 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import httpx + +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.wire_drawdown_request import WireDrawdownRequest + +__all__ = ["WireDrawdownRequestsResource", "AsyncWireDrawdownRequestsResource"] + + +class WireDrawdownRequestsResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> WireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return WireDrawdownRequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> WireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return WireDrawdownRequestsResourceWithStreamingResponse(self) + + def refuse( + self, + wire_drawdown_request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> WireDrawdownRequest: + """ + Simulates a Wire Drawdown Request being refused by the debtor. + + Args: + wire_drawdown_request_id: The identifier of the Wire Drawdown Request you wish to refuse. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_drawdown_request_id: + raise ValueError( + f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" + ) + return self._post( + path_template( + "/simulations/wire_drawdown_requests/{wire_drawdown_request_id}/refuse", + wire_drawdown_request_id=wire_drawdown_request_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireDrawdownRequest, + ) + + def submit( + self, + wire_drawdown_request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> WireDrawdownRequest: + """ + Simulates a Wire Drawdown Request being submitted to Fedwire. + + Args: + wire_drawdown_request_id: The identifier of the Wire Drawdown Request you wish to submit. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_drawdown_request_id: + raise ValueError( + f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" + ) + return self._post( + path_template( + "/simulations/wire_drawdown_requests/{wire_drawdown_request_id}/submit", + wire_drawdown_request_id=wire_drawdown_request_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireDrawdownRequest, + ) + + +class AsyncWireDrawdownRequestsResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncWireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncWireDrawdownRequestsResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncWireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncWireDrawdownRequestsResourceWithStreamingResponse(self) + + async def refuse( + self, + wire_drawdown_request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> WireDrawdownRequest: + """ + Simulates a Wire Drawdown Request being refused by the debtor. + + Args: + wire_drawdown_request_id: The identifier of the Wire Drawdown Request you wish to refuse. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_drawdown_request_id: + raise ValueError( + f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" + ) + return await self._post( + path_template( + "/simulations/wire_drawdown_requests/{wire_drawdown_request_id}/refuse", + wire_drawdown_request_id=wire_drawdown_request_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireDrawdownRequest, + ) + + async def submit( + self, + wire_drawdown_request_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> WireDrawdownRequest: + """ + Simulates a Wire Drawdown Request being submitted to Fedwire. + + Args: + wire_drawdown_request_id: The identifier of the Wire Drawdown Request you wish to submit. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_drawdown_request_id: + raise ValueError( + f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" + ) + return await self._post( + path_template( + "/simulations/wire_drawdown_requests/{wire_drawdown_request_id}/submit", + wire_drawdown_request_id=wire_drawdown_request_id, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireDrawdownRequest, + ) + + +class WireDrawdownRequestsResourceWithRawResponse: + def __init__(self, wire_drawdown_requests: WireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = to_raw_response_wrapper( + wire_drawdown_requests.refuse, + ) + self.submit = to_raw_response_wrapper( + wire_drawdown_requests.submit, + ) + + +class AsyncWireDrawdownRequestsResourceWithRawResponse: + def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = async_to_raw_response_wrapper( + wire_drawdown_requests.refuse, + ) + self.submit = async_to_raw_response_wrapper( + wire_drawdown_requests.submit, + ) + + +class WireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, wire_drawdown_requests: WireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = to_streamed_response_wrapper( + wire_drawdown_requests.refuse, + ) + self.submit = to_streamed_response_wrapper( + wire_drawdown_requests.submit, + ) + + +class AsyncWireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequestsResource) -> None: + self._wire_drawdown_requests = wire_drawdown_requests + + self.refuse = async_to_streamed_response_wrapper( + wire_drawdown_requests.refuse, + ) + self.submit = async_to_streamed_response_wrapper( + wire_drawdown_requests.submit, + ) diff --git a/src/increase/resources/simulations/wire_transfers.py b/src/increase/resources/simulations/wire_transfers.py index fda534dfc..f46dd3675 100644 --- a/src/increase/resources/simulations/wire_transfers.py +++ b/src/increase/resources/simulations/wire_transfers.py @@ -4,109 +4,106 @@ import httpx -from ... import _legacy_response -from ...types import InboundWireTransfer -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..._types import Body, Query, Headers, NotGiven, not_given +from ..._utils import path_template from ..._compat import cached_property from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..._base_client import ( - make_request_options, +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) -from ...types.simulations import wire_transfer_create_inbound_params +from ..._base_client import make_request_options +from ...types.wire_transfer import WireTransfer -__all__ = ["WireTransfers", "AsyncWireTransfers"] +__all__ = ["WireTransfersResource", "AsyncWireTransfersResource"] -class WireTransfers(SyncAPIResource): +class WireTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WireTransfersWithRawResponse: - return WireTransfersWithRawResponse(self) + def with_raw_response(self) -> WireTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return WireTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WireTransfersWithStreamingResponse: - return WireTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> WireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - def create_inbound( + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return WireTransfersResourceWithStreamingResponse(self) + + def reverse( self, + wire_transfer_id: str, *, - account_number_id: str, - amount: int, - beneficiary_address_line1: str | NotGiven = NOT_GIVEN, - beneficiary_address_line2: str | NotGiven = NOT_GIVEN, - beneficiary_address_line3: str | NotGiven = NOT_GIVEN, - beneficiary_name: str | NotGiven = NOT_GIVEN, - beneficiary_reference: str | NotGiven = NOT_GIVEN, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - originator_routing_number: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line1: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line2: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line3: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line4: 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, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> InboundWireTransfer: + ) -> WireTransfer: """ - Simulates an inbound Wire Transfer to your account. + Simulates the reversal of a [Wire Transfer](#wire-transfers) by the Federal + Reserve due to error conditions. This will also create a + [Transaction](#transaction) to account for the returned funds. This Wire + Transfer must first have a `status` of `complete`. Args: - account_number_id: The identifier of the Account Number the inbound Wire Transfer is for. - - amount: The transfer amount in cents. Must be positive. - - beneficiary_address_line1: The sending bank will set beneficiary_address_line1 in production. You can - simulate any value here. - - beneficiary_address_line2: The sending bank will set beneficiary_address_line2 in production. You can - simulate any value here. - - beneficiary_address_line3: The sending bank will set beneficiary_address_line3 in production. You can - simulate any value here. + wire_transfer_id: The identifier of the Wire Transfer you wish to reverse. - beneficiary_name: The sending bank will set beneficiary_name in production. You can simulate any - value here. - - beneficiary_reference: The sending bank will set beneficiary_reference in production. You can simulate - any value here. - - originator_address_line1: The sending bank will set originator_address_line1 in production. You can - simulate any value here. - - originator_address_line2: The sending bank will set originator_address_line2 in production. You can - simulate any value here. - - originator_address_line3: The sending bank will set originator_address_line3 in production. You can - simulate any value here. + extra_headers: Send extra headers - originator_name: The sending bank will set originator_name in production. You can simulate any - value here. + extra_query: Add additional query parameters to the request - originator_routing_number: The sending bank will set originator_routing_number in production. You can - simulate any value here. + extra_body: Add additional JSON properties to the request - originator_to_beneficiary_information_line1: The sending bank will set originator_to_beneficiary_information_line1 in - production. You can simulate any value here. + timeout: Override the client-level default timeout for this request, in seconds - originator_to_beneficiary_information_line2: The sending bank will set originator_to_beneficiary_information_line2 in - production. You can simulate any value here. + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_transfer_id: + raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") + return self._post( + path_template("/simulations/wire_transfers/{wire_transfer_id}/reverse", wire_transfer_id=wire_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireTransfer, + ) - originator_to_beneficiary_information_line3: The sending bank will set originator_to_beneficiary_information_line3 in - production. You can simulate any value here. + def submit( + self, + wire_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> WireTransfer: + """ + Simulates the submission of a [Wire Transfer](#wire-transfers) to the Federal + Reserve. This transfer must first have a `status` of `pending_approval` or + `pending_creating`. - originator_to_beneficiary_information_line4: The sending bank will set originator_to_beneficiary_information_line4 in - production. You can simulate any value here. + Args: + wire_transfer_id: The identifier of the Wire Transfer you wish to submit. extra_headers: Send extra headers @@ -118,29 +115,10 @@ def create_inbound( idempotency_key: Specify a custom idempotency key for this request """ + if not wire_transfer_id: + raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return self._post( - "/simulations/inbound_wire_transfers", - body=maybe_transform( - { - "account_number_id": account_number_id, - "amount": amount, - "beneficiary_address_line1": beneficiary_address_line1, - "beneficiary_address_line2": beneficiary_address_line2, - "beneficiary_address_line3": beneficiary_address_line3, - "beneficiary_name": beneficiary_name, - "beneficiary_reference": beneficiary_reference, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, - "originator_routing_number": originator_routing_number, - "originator_to_beneficiary_information_line1": originator_to_beneficiary_information_line1, - "originator_to_beneficiary_information_line2": originator_to_beneficiary_information_line2, - "originator_to_beneficiary_information_line3": originator_to_beneficiary_information_line3, - "originator_to_beneficiary_information_line4": originator_to_beneficiary_information_line4, - }, - wire_transfer_create_inbound_params.WireTransferCreateInboundParams, - ), + path_template("/simulations/wire_transfers/{wire_transfer_id}/submit", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -148,95 +126,94 @@ def create_inbound( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=InboundWireTransfer, + cast_to=WireTransfer, ) -class AsyncWireTransfers(AsyncAPIResource): +class AsyncWireTransfersResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWireTransfersWithRawResponse: - return AsyncWireTransfersWithRawResponse(self) + def with_raw_response(self) -> AsyncWireTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncWireTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWireTransfersWithStreamingResponse: - return AsyncWireTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncWireTransfersResourceWithStreamingResponse(self) - async def create_inbound( + async def reverse( self, + wire_transfer_id: str, *, - account_number_id: str, - amount: int, - beneficiary_address_line1: str | NotGiven = NOT_GIVEN, - beneficiary_address_line2: str | NotGiven = NOT_GIVEN, - beneficiary_address_line3: str | NotGiven = NOT_GIVEN, - beneficiary_name: str | NotGiven = NOT_GIVEN, - beneficiary_reference: str | NotGiven = NOT_GIVEN, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - originator_routing_number: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line1: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line2: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line3: str | NotGiven = NOT_GIVEN, - originator_to_beneficiary_information_line4: 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, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> InboundWireTransfer: + ) -> WireTransfer: """ - Simulates an inbound Wire Transfer to your account. + Simulates the reversal of a [Wire Transfer](#wire-transfers) by the Federal + Reserve due to error conditions. This will also create a + [Transaction](#transaction) to account for the returned funds. This Wire + Transfer must first have a `status` of `complete`. Args: - account_number_id: The identifier of the Account Number the inbound Wire Transfer is for. - - amount: The transfer amount in cents. Must be positive. - - beneficiary_address_line1: The sending bank will set beneficiary_address_line1 in production. You can - simulate any value here. - - beneficiary_address_line2: The sending bank will set beneficiary_address_line2 in production. You can - simulate any value here. - - beneficiary_address_line3: The sending bank will set beneficiary_address_line3 in production. You can - simulate any value here. - - beneficiary_name: The sending bank will set beneficiary_name in production. You can simulate any - value here. - - beneficiary_reference: The sending bank will set beneficiary_reference in production. You can simulate - any value here. - - originator_address_line1: The sending bank will set originator_address_line1 in production. You can - simulate any value here. + wire_transfer_id: The identifier of the Wire Transfer you wish to reverse. - originator_address_line2: The sending bank will set originator_address_line2 in production. You can - simulate any value here. - - originator_address_line3: The sending bank will set originator_address_line3 in production. You can - simulate any value here. + extra_headers: Send extra headers - originator_name: The sending bank will set originator_name in production. You can simulate any - value here. + extra_query: Add additional query parameters to the request - originator_routing_number: The sending bank will set originator_routing_number in production. You can - simulate any value here. + extra_body: Add additional JSON properties to the request - originator_to_beneficiary_information_line1: The sending bank will set originator_to_beneficiary_information_line1 in - production. You can simulate any value here. + timeout: Override the client-level default timeout for this request, in seconds - originator_to_beneficiary_information_line2: The sending bank will set originator_to_beneficiary_information_line2 in - production. You can simulate any value here. + idempotency_key: Specify a custom idempotency key for this request + """ + if not wire_transfer_id: + raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") + return await self._post( + path_template("/simulations/wire_transfers/{wire_transfer_id}/reverse", wire_transfer_id=wire_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=WireTransfer, + ) - originator_to_beneficiary_information_line3: The sending bank will set originator_to_beneficiary_information_line3 in - production. You can simulate any value here. + async def submit( + self, + wire_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> WireTransfer: + """ + Simulates the submission of a [Wire Transfer](#wire-transfers) to the Federal + Reserve. This transfer must first have a `status` of `pending_approval` or + `pending_creating`. - originator_to_beneficiary_information_line4: The sending bank will set originator_to_beneficiary_information_line4 in - production. You can simulate any value here. + Args: + wire_transfer_id: The identifier of the Wire Transfer you wish to submit. extra_headers: Send extra headers @@ -248,29 +225,10 @@ async def create_inbound( idempotency_key: Specify a custom idempotency key for this request """ + if not wire_transfer_id: + raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return await self._post( - "/simulations/inbound_wire_transfers", - body=await async_maybe_transform( - { - "account_number_id": account_number_id, - "amount": amount, - "beneficiary_address_line1": beneficiary_address_line1, - "beneficiary_address_line2": beneficiary_address_line2, - "beneficiary_address_line3": beneficiary_address_line3, - "beneficiary_name": beneficiary_name, - "beneficiary_reference": beneficiary_reference, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, - "originator_routing_number": originator_routing_number, - "originator_to_beneficiary_information_line1": originator_to_beneficiary_information_line1, - "originator_to_beneficiary_information_line2": originator_to_beneficiary_information_line2, - "originator_to_beneficiary_information_line3": originator_to_beneficiary_information_line3, - "originator_to_beneficiary_information_line4": originator_to_beneficiary_information_line4, - }, - wire_transfer_create_inbound_params.WireTransferCreateInboundParams, - ), + path_template("/simulations/wire_transfers/{wire_transfer_id}/submit", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -278,41 +236,53 @@ async def create_inbound( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=InboundWireTransfer, + cast_to=WireTransfer, ) -class WireTransfersWithRawResponse: - def __init__(self, wire_transfers: WireTransfers) -> None: +class WireTransfersResourceWithRawResponse: + def __init__(self, wire_transfers: WireTransfersResource) -> None: self._wire_transfers = wire_transfers - self.create_inbound = _legacy_response.to_raw_response_wrapper( - wire_transfers.create_inbound, + self.reverse = to_raw_response_wrapper( + wire_transfers.reverse, + ) + self.submit = to_raw_response_wrapper( + wire_transfers.submit, ) -class AsyncWireTransfersWithRawResponse: - def __init__(self, wire_transfers: AsyncWireTransfers) -> None: +class AsyncWireTransfersResourceWithRawResponse: + def __init__(self, wire_transfers: AsyncWireTransfersResource) -> None: self._wire_transfers = wire_transfers - self.create_inbound = _legacy_response.async_to_raw_response_wrapper( - wire_transfers.create_inbound, + self.reverse = async_to_raw_response_wrapper( + wire_transfers.reverse, + ) + self.submit = async_to_raw_response_wrapper( + wire_transfers.submit, ) -class WireTransfersWithStreamingResponse: - def __init__(self, wire_transfers: WireTransfers) -> None: +class WireTransfersResourceWithStreamingResponse: + def __init__(self, wire_transfers: WireTransfersResource) -> None: self._wire_transfers = wire_transfers - self.create_inbound = to_streamed_response_wrapper( - wire_transfers.create_inbound, + self.reverse = to_streamed_response_wrapper( + wire_transfers.reverse, + ) + self.submit = to_streamed_response_wrapper( + wire_transfers.submit, ) -class AsyncWireTransfersWithStreamingResponse: - def __init__(self, wire_transfers: AsyncWireTransfers) -> None: +class AsyncWireTransfersResourceWithStreamingResponse: + def __init__(self, wire_transfers: AsyncWireTransfersResource) -> None: self._wire_transfers = wire_transfers - self.create_inbound = async_to_streamed_response_wrapper( - wire_transfers.create_inbound, + self.reverse = async_to_streamed_response_wrapper( + wire_transfers.reverse, + ) + self.submit = async_to_streamed_response_wrapper( + wire_transfers.submit, ) diff --git a/src/increase/resources/entities/supplemental_documents.py b/src/increase/resources/supplemental_documents.py similarity index 65% rename from src/increase/resources/entities/supplemental_documents.py rename to src/increase/resources/supplemental_documents.py index fb78b6ab1..adb9d9645 100644 --- a/src/increase/resources/entities/supplemental_documents.py +++ b/src/increase/resources/supplemental_documents.py @@ -4,52 +4,57 @@ import httpx -from ... import _legacy_response -from ...types import Entity -from ..._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from ..._utils import ( - maybe_transform, - async_maybe_transform, -) -from ..._compat import cached_property -from ..._resource import SyncAPIResource, AsyncAPIResource -from ..._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ...pagination import SyncPage, AsyncPage -from ..._base_client import ( - AsyncPaginator, - make_request_options, -) -from ...types.entities import ( - SupplementalDocument, - supplemental_document_list_params, - supplemental_document_create_params, +from ..types import supplemental_document_list_params, supplemental_document_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.entity_supplemental_document import EntitySupplementalDocument -__all__ = ["SupplementalDocuments", "AsyncSupplementalDocuments"] +__all__ = ["SupplementalDocumentsResource", "AsyncSupplementalDocumentsResource"] -class SupplementalDocuments(SyncAPIResource): +class SupplementalDocumentsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> SupplementalDocumentsWithRawResponse: - return SupplementalDocumentsWithRawResponse(self) + def with_raw_response(self) -> SupplementalDocumentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return SupplementalDocumentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> SupplementalDocumentsWithStreamingResponse: - return SupplementalDocumentsWithStreamingResponse(self) + def with_streaming_response(self) -> SupplementalDocumentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return SupplementalDocumentsResourceWithStreamingResponse(self) def create( self, - entity_id: str, *, + entity_id: str, file_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Entity: + ) -> EntitySupplementalDocument: """ Create a supplemental document for an Entity @@ -68,12 +73,14 @@ def create( idempotency_key: Specify a custom idempotency key for this request """ - if not entity_id: - raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") return self._post( - f"/entities/{entity_id}/supplemental_documents", + "/entity_supplemental_documents", body=maybe_transform( - {"file_id": file_id}, supplemental_document_create_params.SupplementalDocumentCreateParams + { + "entity_id": entity_id, + "file_id": file_id, + }, + supplemental_document_create_params.SupplementalDocumentCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -82,23 +89,23 @@ def create( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Entity, + cast_to=EntitySupplementalDocument, ) def list( self, *, entity_id: str, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> SyncPage[SupplementalDocument]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[EntitySupplementalDocument]: """ List Entity Supplemental Document Submissions @@ -125,7 +132,7 @@ def list( """ return self._get_api_list( "/entity_supplemental_documents", - page=SyncPage[SupplementalDocument], + page=SyncPage[EntitySupplementalDocument], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -141,32 +148,43 @@ def list( supplemental_document_list_params.SupplementalDocumentListParams, ), ), - model=SupplementalDocument, + model=EntitySupplementalDocument, ) -class AsyncSupplementalDocuments(AsyncAPIResource): +class AsyncSupplementalDocumentsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncSupplementalDocumentsWithRawResponse: - return AsyncSupplementalDocumentsWithRawResponse(self) + def with_raw_response(self) -> AsyncSupplementalDocumentsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncSupplementalDocumentsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncSupplementalDocumentsWithStreamingResponse: - return AsyncSupplementalDocumentsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncSupplementalDocumentsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncSupplementalDocumentsResourceWithStreamingResponse(self) async def create( self, - entity_id: str, *, + entity_id: str, file_id: str, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, - ) -> Entity: + ) -> EntitySupplementalDocument: """ Create a supplemental document for an Entity @@ -185,12 +203,14 @@ async def create( idempotency_key: Specify a custom idempotency key for this request """ - if not entity_id: - raise ValueError(f"Expected a non-empty value for `entity_id` but received {entity_id!r}") return await self._post( - f"/entities/{entity_id}/supplemental_documents", + "/entity_supplemental_documents", body=await async_maybe_transform( - {"file_id": file_id}, supplemental_document_create_params.SupplementalDocumentCreateParams + { + "entity_id": entity_id, + "file_id": file_id, + }, + supplemental_document_create_params.SupplementalDocumentCreateParams, ), options=make_request_options( extra_headers=extra_headers, @@ -199,23 +219,23 @@ async def create( timeout=timeout, idempotency_key=idempotency_key, ), - cast_to=Entity, + cast_to=EntitySupplementalDocument, ) def list( self, *, entity_id: str, - cursor: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - ) -> AsyncPaginator[SupplementalDocument, AsyncPage[SupplementalDocument]]: + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[EntitySupplementalDocument, AsyncPage[EntitySupplementalDocument]]: """ List Entity Supplemental Document Submissions @@ -242,7 +262,7 @@ def list( """ return self._get_api_list( "/entity_supplemental_documents", - page=AsyncPage[SupplementalDocument], + page=AsyncPage[EntitySupplementalDocument], options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -258,36 +278,36 @@ def list( supplemental_document_list_params.SupplementalDocumentListParams, ), ), - model=SupplementalDocument, + model=EntitySupplementalDocument, ) -class SupplementalDocumentsWithRawResponse: - def __init__(self, supplemental_documents: SupplementalDocuments) -> None: +class SupplementalDocumentsResourceWithRawResponse: + def __init__(self, supplemental_documents: SupplementalDocumentsResource) -> None: self._supplemental_documents = supplemental_documents - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( supplemental_documents.create, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( supplemental_documents.list, ) -class AsyncSupplementalDocumentsWithRawResponse: - def __init__(self, supplemental_documents: AsyncSupplementalDocuments) -> None: +class AsyncSupplementalDocumentsResourceWithRawResponse: + def __init__(self, supplemental_documents: AsyncSupplementalDocumentsResource) -> None: self._supplemental_documents = supplemental_documents - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( supplemental_documents.create, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( supplemental_documents.list, ) -class SupplementalDocumentsWithStreamingResponse: - def __init__(self, supplemental_documents: SupplementalDocuments) -> None: +class SupplementalDocumentsResourceWithStreamingResponse: + def __init__(self, supplemental_documents: SupplementalDocumentsResource) -> None: self._supplemental_documents = supplemental_documents self.create = to_streamed_response_wrapper( @@ -298,8 +318,8 @@ def __init__(self, supplemental_documents: SupplementalDocuments) -> None: ) -class AsyncSupplementalDocumentsWithStreamingResponse: - def __init__(self, supplemental_documents: AsyncSupplementalDocuments) -> None: +class AsyncSupplementalDocumentsResourceWithStreamingResponse: + def __init__(self, supplemental_documents: AsyncSupplementalDocumentsResource) -> None: self._supplemental_documents = supplemental_documents self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/swift_transfers.py b/src/increase/resources/swift_transfers.py new file mode 100644 index 000000000..df75020e3 --- /dev/null +++ b/src/increase/resources/swift_transfers.py @@ -0,0 +1,714 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..types import swift_transfer_list_params, swift_transfer_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.swift_transfer import SwiftTransfer + +__all__ = ["SwiftTransfersResource", "AsyncSwiftTransfersResource"] + + +class SwiftTransfersResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> SwiftTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return SwiftTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> SwiftTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return SwiftTransfersResourceWithStreamingResponse(self) + + def create( + self, + *, + account_id: str, + account_number: str, + bank_identification_code: str, + creditor_address: swift_transfer_create_params.CreditorAddress, + creditor_name: str, + debtor_address: swift_transfer_create_params.DebtorAddress, + debtor_name: str, + instructed_amount: int, + instructed_currency: Literal["USD"], + source_account_number_id: str, + unstructured_remittance_information: str, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> SwiftTransfer: + """ + Create a Swift Transfer + + Args: + account_id: The identifier for the account that will send the transfer. + + account_number: The creditor's account number. + + bank_identification_code: The bank identification code (BIC) of the creditor. If it ends with the + three-character branch code, this must be 11 characters long. Otherwise this + must be 8 characters and the branch code will be assumed to be `XXX`. + + creditor_address: The creditor's address. + + creditor_name: The creditor's name. + + debtor_address: The debtor's address. + + debtor_name: The debtor's name. + + instructed_amount: The amount, in minor units of `instructed_currency`, to send to the creditor. + + instructed_currency: The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the + instructed amount. + + - `USD` - United States Dollar + + source_account_number_id: The Account Number to include in the transfer as the debtor's account number. + + unstructured_remittance_information: Unstructured remittance information to include in the transfer. + + require_approval: Whether the transfer requires explicit approval via the dashboard or API. + + routing_number: The creditor's bank account routing or transit number. Required in certain + countries. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/swift_transfers", + body=maybe_transform( + { + "account_id": account_id, + "account_number": account_number, + "bank_identification_code": bank_identification_code, + "creditor_address": creditor_address, + "creditor_name": creditor_name, + "debtor_address": debtor_address, + "debtor_name": debtor_name, + "instructed_amount": instructed_amount, + "instructed_currency": instructed_currency, + "source_account_number_id": source_account_number_id, + "unstructured_remittance_information": unstructured_remittance_information, + "require_approval": require_approval, + "routing_number": routing_number, + }, + swift_transfer_create_params.SwiftTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=SwiftTransfer, + ) + + def retrieve( + self, + swift_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SwiftTransfer: + """ + Retrieve a Swift Transfer + + Args: + swift_transfer_id: The identifier of the Swift Transfer. + + 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 swift_transfer_id: + raise ValueError(f"Expected a non-empty value for `swift_transfer_id` but received {swift_transfer_id!r}") + return self._get( + path_template("/swift_transfers/{swift_transfer_id}", swift_transfer_id=swift_transfer_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SwiftTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: swift_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: swift_transfer_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[SwiftTransfer]: + """ + List Swift Transfers + + Args: + account_id: Filter Swift Transfers to those that originated from the specified Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/swift_transfers", + page=SyncPage[SwiftTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + swift_transfer_list_params.SwiftTransferListParams, + ), + ), + model=SwiftTransfer, + ) + + def approve( + self, + swift_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> SwiftTransfer: + """ + Approve a Swift Transfer + + Args: + swift_transfer_id: The identifier of the Swift Transfer to approve. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not swift_transfer_id: + raise ValueError(f"Expected a non-empty value for `swift_transfer_id` but received {swift_transfer_id!r}") + return self._post( + path_template("/swift_transfers/{swift_transfer_id}/approve", swift_transfer_id=swift_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=SwiftTransfer, + ) + + def cancel( + self, + swift_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> SwiftTransfer: + """ + Cancel a pending Swift Transfer + + Args: + swift_transfer_id: The identifier of the pending Swift Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not swift_transfer_id: + raise ValueError(f"Expected a non-empty value for `swift_transfer_id` but received {swift_transfer_id!r}") + return self._post( + path_template("/swift_transfers/{swift_transfer_id}/cancel", swift_transfer_id=swift_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=SwiftTransfer, + ) + + +class AsyncSwiftTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncSwiftTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncSwiftTransfersResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncSwiftTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncSwiftTransfersResourceWithStreamingResponse(self) + + async def create( + self, + *, + account_id: str, + account_number: str, + bank_identification_code: str, + creditor_address: swift_transfer_create_params.CreditorAddress, + creditor_name: str, + debtor_address: swift_transfer_create_params.DebtorAddress, + debtor_name: str, + instructed_amount: int, + instructed_currency: Literal["USD"], + source_account_number_id: str, + unstructured_remittance_information: str, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> SwiftTransfer: + """ + Create a Swift Transfer + + Args: + account_id: The identifier for the account that will send the transfer. + + account_number: The creditor's account number. + + bank_identification_code: The bank identification code (BIC) of the creditor. If it ends with the + three-character branch code, this must be 11 characters long. Otherwise this + must be 8 characters and the branch code will be assumed to be `XXX`. + + creditor_address: The creditor's address. + + creditor_name: The creditor's name. + + debtor_address: The debtor's address. + + debtor_name: The debtor's name. + + instructed_amount: The amount, in minor units of `instructed_currency`, to send to the creditor. + + instructed_currency: The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the + instructed amount. + + - `USD` - United States Dollar + + source_account_number_id: The Account Number to include in the transfer as the debtor's account number. + + unstructured_remittance_information: Unstructured remittance information to include in the transfer. + + require_approval: Whether the transfer requires explicit approval via the dashboard or API. + + routing_number: The creditor's bank account routing or transit number. Required in certain + countries. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/swift_transfers", + body=await async_maybe_transform( + { + "account_id": account_id, + "account_number": account_number, + "bank_identification_code": bank_identification_code, + "creditor_address": creditor_address, + "creditor_name": creditor_name, + "debtor_address": debtor_address, + "debtor_name": debtor_name, + "instructed_amount": instructed_amount, + "instructed_currency": instructed_currency, + "source_account_number_id": source_account_number_id, + "unstructured_remittance_information": unstructured_remittance_information, + "require_approval": require_approval, + "routing_number": routing_number, + }, + swift_transfer_create_params.SwiftTransferCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=SwiftTransfer, + ) + + async def retrieve( + self, + swift_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SwiftTransfer: + """ + Retrieve a Swift Transfer + + Args: + swift_transfer_id: The identifier of the Swift Transfer. + + 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 swift_transfer_id: + raise ValueError(f"Expected a non-empty value for `swift_transfer_id` but received {swift_transfer_id!r}") + return await self._get( + path_template("/swift_transfers/{swift_transfer_id}", swift_transfer_id=swift_transfer_id), + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=SwiftTransfer, + ) + + def list( + self, + *, + account_id: str | Omit = omit, + created_at: swift_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: swift_transfer_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[SwiftTransfer, AsyncPage[SwiftTransfer]]: + """ + List Swift Transfers + + Args: + account_id: Filter Swift Transfers to those that originated from the specified Account. + + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + 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 + """ + return self._get_api_list( + "/swift_transfers", + page=AsyncPage[SwiftTransfer], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "account_id": account_id, + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + swift_transfer_list_params.SwiftTransferListParams, + ), + ), + model=SwiftTransfer, + ) + + async def approve( + self, + swift_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> SwiftTransfer: + """ + Approve a Swift Transfer + + Args: + swift_transfer_id: The identifier of the Swift Transfer to approve. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not swift_transfer_id: + raise ValueError(f"Expected a non-empty value for `swift_transfer_id` but received {swift_transfer_id!r}") + return await self._post( + path_template("/swift_transfers/{swift_transfer_id}/approve", swift_transfer_id=swift_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=SwiftTransfer, + ) + + async def cancel( + self, + swift_transfer_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> SwiftTransfer: + """ + Cancel a pending Swift Transfer + + Args: + swift_transfer_id: The identifier of the pending Swift Transfer to cancel. + + 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 + + idempotency_key: Specify a custom idempotency key for this request + """ + if not swift_transfer_id: + raise ValueError(f"Expected a non-empty value for `swift_transfer_id` but received {swift_transfer_id!r}") + return await self._post( + path_template("/swift_transfers/{swift_transfer_id}/cancel", swift_transfer_id=swift_transfer_id), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=SwiftTransfer, + ) + + +class SwiftTransfersResourceWithRawResponse: + def __init__(self, swift_transfers: SwiftTransfersResource) -> None: + self._swift_transfers = swift_transfers + + self.create = to_raw_response_wrapper( + swift_transfers.create, + ) + self.retrieve = to_raw_response_wrapper( + swift_transfers.retrieve, + ) + self.list = to_raw_response_wrapper( + swift_transfers.list, + ) + self.approve = to_raw_response_wrapper( + swift_transfers.approve, + ) + self.cancel = to_raw_response_wrapper( + swift_transfers.cancel, + ) + + +class AsyncSwiftTransfersResourceWithRawResponse: + def __init__(self, swift_transfers: AsyncSwiftTransfersResource) -> None: + self._swift_transfers = swift_transfers + + self.create = async_to_raw_response_wrapper( + swift_transfers.create, + ) + self.retrieve = async_to_raw_response_wrapper( + swift_transfers.retrieve, + ) + self.list = async_to_raw_response_wrapper( + swift_transfers.list, + ) + self.approve = async_to_raw_response_wrapper( + swift_transfers.approve, + ) + self.cancel = async_to_raw_response_wrapper( + swift_transfers.cancel, + ) + + +class SwiftTransfersResourceWithStreamingResponse: + def __init__(self, swift_transfers: SwiftTransfersResource) -> None: + self._swift_transfers = swift_transfers + + self.create = to_streamed_response_wrapper( + swift_transfers.create, + ) + self.retrieve = to_streamed_response_wrapper( + swift_transfers.retrieve, + ) + self.list = to_streamed_response_wrapper( + swift_transfers.list, + ) + self.approve = to_streamed_response_wrapper( + swift_transfers.approve, + ) + self.cancel = to_streamed_response_wrapper( + swift_transfers.cancel, + ) + + +class AsyncSwiftTransfersResourceWithStreamingResponse: + def __init__(self, swift_transfers: AsyncSwiftTransfersResource) -> None: + self._swift_transfers = swift_transfers + + self.create = async_to_streamed_response_wrapper( + swift_transfers.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + swift_transfers.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + swift_transfers.list, + ) + self.approve = async_to_streamed_response_wrapper( + swift_transfers.approve, + ) + self.cancel = async_to_streamed_response_wrapper( + swift_transfers.cancel, + ) diff --git a/src/increase/resources/transactions.py b/src/increase/resources/transactions.py index c761f7b58..7bbadaf7e 100644 --- a/src/increase/resources/transactions.py +++ b/src/increase/resources/transactions.py @@ -4,30 +4,43 @@ import httpx -from .. import _legacy_response -from ..types import Transaction, transaction_list_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import maybe_transform +from ..types import transaction_list_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.transaction import Transaction -__all__ = ["Transactions", "AsyncTransactions"] +__all__ = ["TransactionsResource", "AsyncTransactionsResource"] -class Transactions(SyncAPIResource): +class TransactionsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> TransactionsWithRawResponse: - return TransactionsWithRawResponse(self) + def with_raw_response(self) -> TransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return TransactionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> TransactionsWithStreamingResponse: - return TransactionsWithStreamingResponse(self) + def with_streaming_response(self) -> TransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return TransactionsResourceWithStreamingResponse(self) def retrieve( self, @@ -38,7 +51,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Transaction: """ Retrieve a Transaction @@ -57,7 +70,7 @@ def retrieve( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return self._get( - f"/transactions/{transaction_id}", + path_template("/transactions/{transaction_id}", transaction_id=transaction_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -67,18 +80,18 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - category: transaction_list_params.Category | NotGiven = NOT_GIVEN, - created_at: transaction_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - route_id: str | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + category: transaction_list_params.Category | Omit = omit, + created_at: transaction_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + route_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[Transaction]: """ List Transactions @@ -126,14 +139,25 @@ def list( ) -class AsyncTransactions(AsyncAPIResource): +class AsyncTransactionsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncTransactionsWithRawResponse: - return AsyncTransactionsWithRawResponse(self) + def with_raw_response(self) -> AsyncTransactionsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncTransactionsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncTransactionsWithStreamingResponse: - return AsyncTransactionsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncTransactionsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncTransactionsResourceWithStreamingResponse(self) async def retrieve( self, @@ -144,7 +168,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> Transaction: """ Retrieve a Transaction @@ -163,7 +187,7 @@ async def retrieve( if not transaction_id: raise ValueError(f"Expected a non-empty value for `transaction_id` but received {transaction_id!r}") return await self._get( - f"/transactions/{transaction_id}", + path_template("/transactions/{transaction_id}", transaction_id=transaction_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -173,18 +197,18 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - category: transaction_list_params.Category | NotGiven = NOT_GIVEN, - created_at: transaction_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, - route_id: str | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + category: transaction_list_params.Category | Omit = omit, + created_at: transaction_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + limit: int | Omit = omit, + route_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[Transaction, AsyncPage[Transaction]]: """ List Transactions @@ -232,32 +256,32 @@ def list( ) -class TransactionsWithRawResponse: - def __init__(self, transactions: Transactions) -> None: +class TransactionsResourceWithRawResponse: + def __init__(self, transactions: TransactionsResource) -> None: self._transactions = transactions - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( transactions.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( transactions.list, ) -class AsyncTransactionsWithRawResponse: - def __init__(self, transactions: AsyncTransactions) -> None: +class AsyncTransactionsResourceWithRawResponse: + def __init__(self, transactions: AsyncTransactionsResource) -> None: self._transactions = transactions - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( transactions.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( transactions.list, ) -class TransactionsWithStreamingResponse: - def __init__(self, transactions: Transactions) -> None: +class TransactionsResourceWithStreamingResponse: + def __init__(self, transactions: TransactionsResource) -> None: self._transactions = transactions self.retrieve = to_streamed_response_wrapper( @@ -268,8 +292,8 @@ def __init__(self, transactions: Transactions) -> None: ) -class AsyncTransactionsWithStreamingResponse: - def __init__(self, transactions: AsyncTransactions) -> None: +class AsyncTransactionsResourceWithStreamingResponse: + def __init__(self, transactions: AsyncTransactionsResource) -> None: self._transactions = transactions self.retrieve = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/webhooks.py b/src/increase/resources/webhooks.py deleted file mode 100644 index dde3cbd70..000000000 --- a/src/increase/resources/webhooks.py +++ /dev/null @@ -1,138 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import hmac -import json -import hashlib -from typing import Dict - -from .._types import ( - HeadersLike, -) -from .._utils import ( - get_required_header, -) -from .._resource import SyncAPIResource, AsyncAPIResource - -__all__ = ["Webhooks", "AsyncWebhooks"] - - -class Webhooks(SyncAPIResource): - def unwrap( - self, - payload: str | bytes, - headers: HeadersLike, - *, - secret: str | None = None, - ) -> object: - """Validates that the given payload was sent by Increase and parses the payload.""" - if secret is not None: - self.verify_signature(payload=payload, headers=headers, secret=secret) - return json.loads(payload) - - def verify_signature( - self, - payload: str | bytes, - headers: HeadersLike, - *, - secret: str | None = None, - ) -> None: - """Validates whether or not the webhook payload was sent by Increase. - - An error will be raised if the webhook payload was not sent by Increase. - """ - if secret is None: - secret = self._client.webhook_secret - - if secret is None: - raise ValueError( - "The webhook secret must either be set using the env var, INCREASE_WEBHOOK_SECRET, on the client class, Increase(webhook_secret='123'), or passed to this function" - ) - - def parse_kv_pairs(text: str, item_sep: str = ",", value_sep: str = "=") -> Dict[str, str]: - return dict(t.split(value_sep) for t in text.split(item_sep)) - - raw_signature = get_required_header(headers, "Increase-Webhook-Signature") - try: - parsed_signature = parse_kv_pairs(raw_signature) - except ValueError as err: - raise ValueError("Unable to parse Increase-Webhook-Signature header.") from err - - timestamp, signature = parsed_signature["t"], parsed_signature["v1"] - - # create the signature - body = payload.decode("utf-8") if isinstance(payload, bytes) else payload - if not isinstance(body, str): # pyright: ignore[reportUnnecessaryIsInstance] - raise ValueError( - "Webhook body should be a string of JSON (or bytes which can be decoded to a utf-8 string), not a parsed dictionary." - ) - - to_sign = f"{timestamp}.{body}".encode() - expected_signature = hmac.new(secret.encode(), to_sign, hashlib.sha256).hexdigest() - - if hmac.compare_digest(expected_signature, signature): - # valid! - return None - - raise ValueError("None of the given webhook signatures match the expected signature.") - - -class AsyncWebhooks(AsyncAPIResource): - def unwrap( - self, - payload: str | bytes, - headers: HeadersLike, - *, - secret: str | None = None, - ) -> object: - """Validates that the given payload was sent by Increase and parses the payload.""" - if secret is not None: - self.verify_signature(payload=payload, headers=headers, secret=secret) - return json.loads(payload) - - def verify_signature( - self, - payload: str | bytes, - headers: HeadersLike, - *, - secret: str | None = None, - ) -> None: - """Validates whether or not the webhook payload was sent by Increase. - - An error will be raised if the webhook payload was not sent by Increase. - """ - if secret is None: - secret = self._client.webhook_secret - - if secret is None: - raise ValueError( - "The webhook secret must either be set using the env var, INCREASE_WEBHOOK_SECRET, on the client class, Increase(webhook_secret='123'), or passed to this function" - ) - - def parse_kv_pairs(text: str, item_sep: str = ",", value_sep: str = "=") -> Dict[str, str]: - return dict(t.split(value_sep) for t in text.split(item_sep)) - - raw_signature = get_required_header(headers, "Increase-Webhook-Signature") - try: - parsed_signature = parse_kv_pairs(raw_signature) - except ValueError as err: - raise ValueError("Unable to parse Increase-Webhook-Signature header.") from err - - timestamp, signature = parsed_signature["t"], parsed_signature["v1"] - - # create the signature - body = payload.decode("utf-8") if isinstance(payload, bytes) else payload - if not isinstance(body, str): # pyright: ignore[reportUnnecessaryIsInstance] - raise ValueError( - "Webhook body should be a string of JSON (or bytes which can be decoded to a utf-8 string), not a parsed dictionary." - ) - - to_sign = f"{timestamp}.{body}".encode() - expected_signature = hmac.new(secret.encode(), to_sign, hashlib.sha256).hexdigest() - - if hmac.compare_digest(expected_signature, signature): - # valid! - return None - - raise ValueError("None of the given webhook signatures match the expected signature.") diff --git a/src/increase/resources/wire_drawdown_requests.py b/src/increase/resources/wire_drawdown_requests.py index 3b683ae24..6a3defdc7 100644 --- a/src/increase/resources/wire_drawdown_requests.py +++ b/src/increase/resources/wire_drawdown_requests.py @@ -2,101 +2,106 @@ from __future__ import annotations +from typing_extensions import Literal + import httpx -from .. import _legacy_response -from ..types import ( - WireDrawdownRequest, - wire_drawdown_request_list_params, - wire_drawdown_request_create_params, -) -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import wire_drawdown_request_list_params, wire_drawdown_request_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.wire_drawdown_request import WireDrawdownRequest -__all__ = ["WireDrawdownRequests", "AsyncWireDrawdownRequests"] +__all__ = ["WireDrawdownRequestsResource", "AsyncWireDrawdownRequestsResource"] -class WireDrawdownRequests(SyncAPIResource): +class WireDrawdownRequestsResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WireDrawdownRequestsWithRawResponse: - return WireDrawdownRequestsWithRawResponse(self) + def with_raw_response(self) -> WireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return WireDrawdownRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WireDrawdownRequestsWithStreamingResponse: - return WireDrawdownRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> WireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return WireDrawdownRequestsResourceWithStreamingResponse(self) def create( self, *, account_number_id: str, amount: int, - message_to_recipient: str, - recipient_account_number: str, - recipient_name: str, - recipient_routing_number: str, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - recipient_address_line1: str | NotGiven = NOT_GIVEN, - recipient_address_line2: str | NotGiven = NOT_GIVEN, - recipient_address_line3: str | NotGiven = NOT_GIVEN, + creditor_address: wire_drawdown_request_create_params.CreditorAddress, + creditor_name: str, + debtor_address: wire_drawdown_request_create_params.DebtorAddress, + debtor_name: str, + unstructured_remittance_information: str, + charge_bearer: Literal["shared", "debtor", "creditor", "service_level"] | Omit = omit, + debtor_account_number: str | Omit = omit, + debtor_external_account_id: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + end_to_end_identification: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireDrawdownRequest: """ Create a Wire Drawdown Request Args: - account_number_id: The Account Number to which the recipient should send funds. + account_number_id: The Account Number to which the debtor should send funds. - amount: The amount requested from the recipient, in cents. + amount: The amount requested from the debtor, in USD cents. - message_to_recipient: A message the recipient will see as part of the request. + creditor_address: The creditor's address. - recipient_account_number: The drawdown request's recipient's account number. + creditor_name: The creditor's name. - recipient_name: The drawdown request's recipient's name. + debtor_address: The debtor's address. - recipient_routing_number: The drawdown request's recipient's routing number. + debtor_name: The debtor's name. - originator_address_line1: The drawdown request originator's address line 1. This is only necessary if - you're requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + unstructured_remittance_information: Remittance information the debtor will see as part of the request. - originator_address_line2: The drawdown request originator's address line 2. This is only necessary if - you're requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + charge_bearer: Determines who bears the cost of the drawdown request. Defaults to `shared` if + not specified. - originator_address_line3: The drawdown request originator's address line 3. This is only necessary if - you're requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + - `shared` - Charges are shared between the debtor and creditor. + - `debtor` - Charges are borne by the debtor. + - `creditor` - Charges are borne by the creditor. + - `service_level` - Charges are determined by the service level. - originator_name: The drawdown request originator's name. This is only necessary if you're - requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + debtor_account_number: The debtor's account number. - recipient_address_line1: Line 1 of the drawdown request's recipient's address. + debtor_external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is + provided, `debtor_account_number` and `debtor_routing_number` must be absent. - recipient_address_line2: Line 2 of the drawdown request's recipient's address. + debtor_routing_number: The debtor's routing number. - recipient_address_line3: Line 3 of the drawdown request's recipient's address. + end_to_end_identification: A free-form reference string set by the sender mirrored back in the subsequent + wire transfer. extra_headers: Send extra headers @@ -114,17 +119,16 @@ def create( { "account_number_id": account_number_id, "amount": amount, - "message_to_recipient": message_to_recipient, - "recipient_account_number": recipient_account_number, - "recipient_name": recipient_name, - "recipient_routing_number": recipient_routing_number, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, - "recipient_address_line1": recipient_address_line1, - "recipient_address_line2": recipient_address_line2, - "recipient_address_line3": recipient_address_line3, + "creditor_address": creditor_address, + "creditor_name": creditor_name, + "debtor_address": debtor_address, + "debtor_name": debtor_name, + "unstructured_remittance_information": unstructured_remittance_information, + "charge_bearer": charge_bearer, + "debtor_account_number": debtor_account_number, + "debtor_external_account_id": debtor_external_account_id, + "debtor_routing_number": debtor_routing_number, + "end_to_end_identification": end_to_end_identification, }, wire_drawdown_request_create_params.WireDrawdownRequestCreateParams, ), @@ -147,7 +151,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WireDrawdownRequest: """ Retrieve a Wire Drawdown Request @@ -168,7 +172,9 @@ def retrieve( f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" ) return self._get( - f"/wire_drawdown_requests/{wire_drawdown_request_id}", + path_template( + "/wire_drawdown_requests/{wire_drawdown_request_id}", wire_drawdown_request_id=wire_drawdown_request_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,14 +184,16 @@ def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: wire_drawdown_request_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[WireDrawdownRequest]: """ List Wire Drawdown Requests @@ -193,6 +201,11 @@ def list( Args: cursor: Return the page of entries after this one. + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. @@ -215,7 +228,9 @@ def list( query=maybe_transform( { "cursor": cursor, + "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, wire_drawdown_request_list_params.WireDrawdownRequestListParams, ), @@ -224,76 +239,84 @@ def list( ) -class AsyncWireDrawdownRequests(AsyncAPIResource): +class AsyncWireDrawdownRequestsResource(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWireDrawdownRequestsWithRawResponse: - return AsyncWireDrawdownRequestsWithRawResponse(self) + def with_raw_response(self) -> AsyncWireDrawdownRequestsResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncWireDrawdownRequestsResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> AsyncWireDrawdownRequestsWithStreamingResponse: - return AsyncWireDrawdownRequestsWithStreamingResponse(self) + def with_streaming_response(self) -> AsyncWireDrawdownRequestsResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncWireDrawdownRequestsResourceWithStreamingResponse(self) async def create( self, *, account_number_id: str, amount: int, - message_to_recipient: str, - recipient_account_number: str, - recipient_name: str, - recipient_routing_number: str, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - recipient_address_line1: str | NotGiven = NOT_GIVEN, - recipient_address_line2: str | NotGiven = NOT_GIVEN, - recipient_address_line3: str | NotGiven = NOT_GIVEN, + creditor_address: wire_drawdown_request_create_params.CreditorAddress, + creditor_name: str, + debtor_address: wire_drawdown_request_create_params.DebtorAddress, + debtor_name: str, + unstructured_remittance_information: str, + charge_bearer: Literal["shared", "debtor", "creditor", "service_level"] | Omit = omit, + debtor_account_number: str | Omit = omit, + debtor_external_account_id: str | Omit = omit, + debtor_routing_number: str | Omit = omit, + end_to_end_identification: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireDrawdownRequest: """ Create a Wire Drawdown Request Args: - account_number_id: The Account Number to which the recipient should send funds. + account_number_id: The Account Number to which the debtor should send funds. - amount: The amount requested from the recipient, in cents. + amount: The amount requested from the debtor, in USD cents. - message_to_recipient: A message the recipient will see as part of the request. + creditor_address: The creditor's address. - recipient_account_number: The drawdown request's recipient's account number. + creditor_name: The creditor's name. - recipient_name: The drawdown request's recipient's name. + debtor_address: The debtor's address. - recipient_routing_number: The drawdown request's recipient's routing number. + debtor_name: The debtor's name. - originator_address_line1: The drawdown request originator's address line 1. This is only necessary if - you're requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + unstructured_remittance_information: Remittance information the debtor will see as part of the request. - originator_address_line2: The drawdown request originator's address line 2. This is only necessary if - you're requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + charge_bearer: Determines who bears the cost of the drawdown request. Defaults to `shared` if + not specified. - originator_address_line3: The drawdown request originator's address line 3. This is only necessary if - you're requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + - `shared` - Charges are shared between the debtor and creditor. + - `debtor` - Charges are borne by the debtor. + - `creditor` - Charges are borne by the creditor. + - `service_level` - Charges are determined by the service level. - originator_name: The drawdown request originator's name. This is only necessary if you're - requesting a payment to a commingled account. Otherwise, we'll use the - associated entity's details. + debtor_account_number: The debtor's account number. - recipient_address_line1: Line 1 of the drawdown request's recipient's address. + debtor_external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is + provided, `debtor_account_number` and `debtor_routing_number` must be absent. - recipient_address_line2: Line 2 of the drawdown request's recipient's address. + debtor_routing_number: The debtor's routing number. - recipient_address_line3: Line 3 of the drawdown request's recipient's address. + end_to_end_identification: A free-form reference string set by the sender mirrored back in the subsequent + wire transfer. extra_headers: Send extra headers @@ -311,17 +334,16 @@ async def create( { "account_number_id": account_number_id, "amount": amount, - "message_to_recipient": message_to_recipient, - "recipient_account_number": recipient_account_number, - "recipient_name": recipient_name, - "recipient_routing_number": recipient_routing_number, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, - "recipient_address_line1": recipient_address_line1, - "recipient_address_line2": recipient_address_line2, - "recipient_address_line3": recipient_address_line3, + "creditor_address": creditor_address, + "creditor_name": creditor_name, + "debtor_address": debtor_address, + "debtor_name": debtor_name, + "unstructured_remittance_information": unstructured_remittance_information, + "charge_bearer": charge_bearer, + "debtor_account_number": debtor_account_number, + "debtor_external_account_id": debtor_external_account_id, + "debtor_routing_number": debtor_routing_number, + "end_to_end_identification": end_to_end_identification, }, wire_drawdown_request_create_params.WireDrawdownRequestCreateParams, ), @@ -344,7 +366,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WireDrawdownRequest: """ Retrieve a Wire Drawdown Request @@ -365,7 +387,9 @@ async def retrieve( f"Expected a non-empty value for `wire_drawdown_request_id` but received {wire_drawdown_request_id!r}" ) return await self._get( - f"/wire_drawdown_requests/{wire_drawdown_request_id}", + path_template( + "/wire_drawdown_requests/{wire_drawdown_request_id}", wire_drawdown_request_id=wire_drawdown_request_id + ), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -375,14 +399,16 @@ async def retrieve( def list( self, *, - cursor: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: wire_drawdown_request_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WireDrawdownRequest, AsyncPage[WireDrawdownRequest]]: """ List Wire Drawdown Requests @@ -390,6 +416,11 @@ def list( Args: cursor: Return the page of entries after this one. + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + limit: Limit the size of the list that is returned. The default (and maximum) is 100 objects. @@ -412,7 +443,9 @@ def list( query=maybe_transform( { "cursor": cursor, + "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, wire_drawdown_request_list_params.WireDrawdownRequestListParams, ), @@ -421,38 +454,38 @@ def list( ) -class WireDrawdownRequestsWithRawResponse: - def __init__(self, wire_drawdown_requests: WireDrawdownRequests) -> None: +class WireDrawdownRequestsResourceWithRawResponse: + def __init__(self, wire_drawdown_requests: WireDrawdownRequestsResource) -> None: self._wire_drawdown_requests = wire_drawdown_requests - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( wire_drawdown_requests.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( wire_drawdown_requests.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( wire_drawdown_requests.list, ) -class AsyncWireDrawdownRequestsWithRawResponse: - def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequests) -> None: +class AsyncWireDrawdownRequestsResourceWithRawResponse: + def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequestsResource) -> None: self._wire_drawdown_requests = wire_drawdown_requests - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( wire_drawdown_requests.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( wire_drawdown_requests.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( wire_drawdown_requests.list, ) -class WireDrawdownRequestsWithStreamingResponse: - def __init__(self, wire_drawdown_requests: WireDrawdownRequests) -> None: +class WireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, wire_drawdown_requests: WireDrawdownRequestsResource) -> None: self._wire_drawdown_requests = wire_drawdown_requests self.create = to_streamed_response_wrapper( @@ -466,8 +499,8 @@ def __init__(self, wire_drawdown_requests: WireDrawdownRequests) -> None: ) -class AsyncWireDrawdownRequestsWithStreamingResponse: - def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequests) -> None: +class AsyncWireDrawdownRequestsResourceWithStreamingResponse: + def __init__(self, wire_drawdown_requests: AsyncWireDrawdownRequestsResource) -> None: self._wire_drawdown_requests = wire_drawdown_requests self.create = async_to_streamed_response_wrapper( diff --git a/src/increase/resources/wire_transfers.py b/src/increase/resources/wire_transfers.py index 97610f00f..86a714336 100644 --- a/src/increase/resources/wire_transfers.py +++ b/src/increase/resources/wire_transfers.py @@ -4,58 +4,64 @@ import httpx -from .. import _legacy_response -from ..types import WireTransfer, wire_transfer_list_params, wire_transfer_create_params -from .._types import NOT_GIVEN, Body, Query, Headers, NotGiven -from .._utils import ( - maybe_transform, - async_maybe_transform, -) +from ..types import wire_transfer_list_params, wire_transfer_create_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import path_template, maybe_transform, async_maybe_transform from .._compat import cached_property from .._resource import SyncAPIResource, AsyncAPIResource -from .._response import to_streamed_response_wrapper, async_to_streamed_response_wrapper -from ..pagination import SyncPage, AsyncPage -from .._base_client import ( - AsyncPaginator, - make_request_options, +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, ) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.wire_transfer import WireTransfer -__all__ = ["WireTransfers", "AsyncWireTransfers"] +__all__ = ["WireTransfersResource", "AsyncWireTransfersResource"] -class WireTransfers(SyncAPIResource): +class WireTransfersResource(SyncAPIResource): @cached_property - def with_raw_response(self) -> WireTransfersWithRawResponse: - return WireTransfersWithRawResponse(self) + def with_raw_response(self) -> WireTransfersResourceWithRawResponse: + """ + 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/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return WireTransfersResourceWithRawResponse(self) @cached_property - def with_streaming_response(self) -> WireTransfersWithStreamingResponse: - return WireTransfersWithStreamingResponse(self) + def with_streaming_response(self) -> WireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return WireTransfersResourceWithStreamingResponse(self) def create( self, *, account_id: str, amount: int, - beneficiary_name: str, - message_to_recipient: str, - account_number: str | NotGiven = NOT_GIVEN, - beneficiary_address_line1: str | NotGiven = NOT_GIVEN, - beneficiary_address_line2: str | NotGiven = NOT_GIVEN, - beneficiary_address_line3: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, - routing_number: str | NotGiven = NOT_GIVEN, + creditor: wire_transfer_create_params.Creditor, + remittance: wire_transfer_create_params.Remittance, + account_number: str | Omit = omit, + debtor: wire_transfer_create_params.Debtor | Omit = omit, + external_account_id: str | Omit = omit, + inbound_wire_drawdown_request_id: str | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + source_account_number_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireTransfer: """ @@ -64,40 +70,31 @@ def create( Args: account_id: The identifier for the account that will send the transfer. - amount: The transfer amount in cents. + amount: The transfer amount in USD cents. - beneficiary_name: The beneficiary's name. + creditor: The person or business that is receiving the funds from the transfer. - message_to_recipient: The message that will show on the recipient's bank statement. + remittance: Additional remittance information related to the wire transfer. account_number: The account number for the destination account. - beneficiary_address_line1: The beneficiary's address line 1. - - beneficiary_address_line2: The beneficiary's address line 2. - - beneficiary_address_line3: The beneficiary's address line 3. + debtor: The person or business whose funds are being transferred. This is only necessary + if you're transferring from a commingled account. Otherwise, we'll use the + associated entity's details. external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is provided, `account_number` and `routing_number` must be absent. - originator_address_line1: The originator's address line 1. This is only necessary if you're transferring - from a commingled account. Otherwise, we'll use the associated entity's details. - - originator_address_line2: The originator's address line 2. This is only necessary if you're transferring - from a commingled account. Otherwise, we'll use the associated entity's details. - - originator_address_line3: The originator's address line 3. This is only necessary if you're transferring - from a commingled account. Otherwise, we'll use the associated entity's details. - - originator_name: The originator's name. This is only necessary if you're transferring from a - commingled account. Otherwise, we'll use the associated entity's details. + inbound_wire_drawdown_request_id: The ID of an Inbound Wire Drawdown Request in response to which this transfer is + being sent. require_approval: Whether the transfer requires explicit approval via the dashboard or API. routing_number: The American Bankers' Association (ABA) Routing Transit Number (RTN) for the destination account. + source_account_number_id: The ID of an Account Number that will be passed to the wire's recipient + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -114,19 +111,15 @@ def create( { "account_id": account_id, "amount": amount, - "beneficiary_name": beneficiary_name, - "message_to_recipient": message_to_recipient, + "creditor": creditor, + "remittance": remittance, "account_number": account_number, - "beneficiary_address_line1": beneficiary_address_line1, - "beneficiary_address_line2": beneficiary_address_line2, - "beneficiary_address_line3": beneficiary_address_line3, + "debtor": debtor, "external_account_id": external_account_id, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, + "inbound_wire_drawdown_request_id": inbound_wire_drawdown_request_id, "require_approval": require_approval, "routing_number": routing_number, + "source_account_number_id": source_account_number_id, }, wire_transfer_create_params.WireTransferCreateParams, ), @@ -149,7 +142,7 @@ def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WireTransfer: """ Retrieve a Wire Transfer @@ -168,7 +161,7 @@ def retrieve( if not wire_transfer_id: raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return self._get( - f"/wire_transfers/{wire_transfer_id}", + path_template("/wire_transfers/{wire_transfer_id}", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -178,18 +171,19 @@ def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: wire_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: wire_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: wire_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> SyncPage[WireTransfer]: """ List Wire Transfers @@ -233,6 +227,7 @@ def list( "external_account_id": external_account_id, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, wire_transfer_list_params.WireTransferListParams, ), @@ -249,7 +244,7 @@ def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireTransfer: """ @@ -271,7 +266,7 @@ def approve( if not wire_transfer_id: raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return self._post( - f"/wire_transfers/{wire_transfer_id}/approve", + path_template("/wire_transfers/{wire_transfer_id}/approve", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -291,7 +286,7 @@ def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireTransfer: """ @@ -313,7 +308,7 @@ def cancel( if not wire_transfer_id: raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return self._post( - f"/wire_transfers/{wire_transfer_id}/cancel", + path_template("/wire_transfers/{wire_transfer_id}/cancel", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -324,129 +319,47 @@ def cancel( cast_to=WireTransfer, ) - def reverse( - self, - wire_transfer_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> WireTransfer: - """ - Simulates the reversal of a [Wire Transfer](#wire-transfers) by the Federal - Reserve due to error conditions. This will also create a - [Transaction](#transaction) to account for the returned funds. This Wire - Transfer must first have a `status` of `complete`. - - Args: - wire_transfer_id: The identifier of the Wire Transfer you wish to reverse. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - if not wire_transfer_id: - raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") - return self._post( - f"/simulations/wire_transfers/{wire_transfer_id}/reverse", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=WireTransfer, - ) - - def submit( - self, - wire_transfer_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> WireTransfer: +class AsyncWireTransfersResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncWireTransfersResourceWithRawResponse: """ - Simulates the submission of a [Wire Transfer](#wire-transfers) to the Federal - Reserve. This transfer must first have a `status` of `pending_approval` or - `pending_creating`. - - Args: - wire_transfer_id: The identifier of the Wire Transfer you wish to submit. - - extra_headers: Send extra headers - - extra_query: Add additional query parameters to the request - - extra_body: Add additional JSON properties to the request + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. - timeout: Override the client-level default timeout for this request, in seconds - - idempotency_key: Specify a custom idempotency key for this request + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers """ - if not wire_transfer_id: - raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") - return self._post( - f"/simulations/wire_transfers/{wire_transfer_id}/submit", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=WireTransfer, - ) - + return AsyncWireTransfersResourceWithRawResponse(self) -class AsyncWireTransfers(AsyncAPIResource): @cached_property - def with_raw_response(self) -> AsyncWireTransfersWithRawResponse: - return AsyncWireTransfersWithRawResponse(self) + def with_streaming_response(self) -> AsyncWireTransfersResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. - @cached_property - def with_streaming_response(self) -> AsyncWireTransfersWithStreamingResponse: - return AsyncWireTransfersWithStreamingResponse(self) + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncWireTransfersResourceWithStreamingResponse(self) async def create( self, *, account_id: str, amount: int, - beneficiary_name: str, - message_to_recipient: str, - account_number: str | NotGiven = NOT_GIVEN, - beneficiary_address_line1: str | NotGiven = NOT_GIVEN, - beneficiary_address_line2: str | NotGiven = NOT_GIVEN, - beneficiary_address_line3: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - originator_address_line1: str | NotGiven = NOT_GIVEN, - originator_address_line2: str | NotGiven = NOT_GIVEN, - originator_address_line3: str | NotGiven = NOT_GIVEN, - originator_name: str | NotGiven = NOT_GIVEN, - require_approval: bool | NotGiven = NOT_GIVEN, - routing_number: str | NotGiven = NOT_GIVEN, + creditor: wire_transfer_create_params.Creditor, + remittance: wire_transfer_create_params.Remittance, + account_number: str | Omit = omit, + debtor: wire_transfer_create_params.Debtor | Omit = omit, + external_account_id: str | Omit = omit, + inbound_wire_drawdown_request_id: str | Omit = omit, + require_approval: bool | Omit = omit, + routing_number: str | Omit = omit, + source_account_number_id: str | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireTransfer: """ @@ -455,40 +368,31 @@ async def create( Args: account_id: The identifier for the account that will send the transfer. - amount: The transfer amount in cents. + amount: The transfer amount in USD cents. - beneficiary_name: The beneficiary's name. + creditor: The person or business that is receiving the funds from the transfer. - message_to_recipient: The message that will show on the recipient's bank statement. + remittance: Additional remittance information related to the wire transfer. account_number: The account number for the destination account. - beneficiary_address_line1: The beneficiary's address line 1. - - beneficiary_address_line2: The beneficiary's address line 2. - - beneficiary_address_line3: The beneficiary's address line 3. + debtor: The person or business whose funds are being transferred. This is only necessary + if you're transferring from a commingled account. Otherwise, we'll use the + associated entity's details. external_account_id: The ID of an External Account to initiate a transfer to. If this parameter is provided, `account_number` and `routing_number` must be absent. - originator_address_line1: The originator's address line 1. This is only necessary if you're transferring - from a commingled account. Otherwise, we'll use the associated entity's details. - - originator_address_line2: The originator's address line 2. This is only necessary if you're transferring - from a commingled account. Otherwise, we'll use the associated entity's details. - - originator_address_line3: The originator's address line 3. This is only necessary if you're transferring - from a commingled account. Otherwise, we'll use the associated entity's details. - - originator_name: The originator's name. This is only necessary if you're transferring from a - commingled account. Otherwise, we'll use the associated entity's details. + inbound_wire_drawdown_request_id: The ID of an Inbound Wire Drawdown Request in response to which this transfer is + being sent. require_approval: Whether the transfer requires explicit approval via the dashboard or API. routing_number: The American Bankers' Association (ABA) Routing Transit Number (RTN) for the destination account. + source_account_number_id: The ID of an Account Number that will be passed to the wire's recipient + extra_headers: Send extra headers extra_query: Add additional query parameters to the request @@ -505,19 +409,15 @@ async def create( { "account_id": account_id, "amount": amount, - "beneficiary_name": beneficiary_name, - "message_to_recipient": message_to_recipient, + "creditor": creditor, + "remittance": remittance, "account_number": account_number, - "beneficiary_address_line1": beneficiary_address_line1, - "beneficiary_address_line2": beneficiary_address_line2, - "beneficiary_address_line3": beneficiary_address_line3, + "debtor": debtor, "external_account_id": external_account_id, - "originator_address_line1": originator_address_line1, - "originator_address_line2": originator_address_line2, - "originator_address_line3": originator_address_line3, - "originator_name": originator_name, + "inbound_wire_drawdown_request_id": inbound_wire_drawdown_request_id, "require_approval": require_approval, "routing_number": routing_number, + "source_account_number_id": source_account_number_id, }, wire_transfer_create_params.WireTransferCreateParams, ), @@ -540,7 +440,7 @@ async def retrieve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> WireTransfer: """ Retrieve a Wire Transfer @@ -559,7 +459,7 @@ async def retrieve( if not wire_transfer_id: raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return await self._get( - f"/wire_transfers/{wire_transfer_id}", + path_template("/wire_transfers/{wire_transfer_id}", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout ), @@ -569,18 +469,19 @@ async def retrieve( def list( self, *, - account_id: str | NotGiven = NOT_GIVEN, - created_at: wire_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, - cursor: str | NotGiven = NOT_GIVEN, - external_account_id: str | NotGiven = NOT_GIVEN, - idempotency_key: str | NotGiven = NOT_GIVEN, - limit: int | NotGiven = NOT_GIVEN, + account_id: str | Omit = omit, + created_at: wire_transfer_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + external_account_id: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: wire_transfer_list_params.Status | Omit = omit, # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. # The extra values given here take precedence over values defined on the client or passed to this method. extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, ) -> AsyncPaginator[WireTransfer, AsyncPage[WireTransfer]]: """ List Wire Transfers @@ -624,6 +525,7 @@ def list( "external_account_id": external_account_id, "idempotency_key": idempotency_key, "limit": limit, + "status": status, }, wire_transfer_list_params.WireTransferListParams, ), @@ -640,7 +542,7 @@ async def approve( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireTransfer: """ @@ -662,7 +564,7 @@ async def approve( if not wire_transfer_id: raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return await self._post( - f"/wire_transfers/{wire_transfer_id}/approve", + path_template("/wire_transfers/{wire_transfer_id}/approve", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -682,7 +584,7 @@ async def cancel( extra_headers: Headers | None = None, extra_query: Query | None = None, extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, + timeout: float | httpx.Timeout | None | NotGiven = not_given, idempotency_key: str | None = None, ) -> WireTransfer: """ @@ -704,96 +606,7 @@ async def cancel( if not wire_transfer_id: raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") return await self._post( - f"/wire_transfers/{wire_transfer_id}/cancel", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=WireTransfer, - ) - - async def reverse( - self, - wire_transfer_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> WireTransfer: - """ - Simulates the reversal of a [Wire Transfer](#wire-transfers) by the Federal - Reserve due to error conditions. This will also create a - [Transaction](#transaction) to account for the returned funds. This Wire - Transfer must first have a `status` of `complete`. - - Args: - wire_transfer_id: The identifier of the Wire Transfer you wish to reverse. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - if not wire_transfer_id: - raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") - return await self._post( - f"/simulations/wire_transfers/{wire_transfer_id}/reverse", - options=make_request_options( - extra_headers=extra_headers, - extra_query=extra_query, - extra_body=extra_body, - timeout=timeout, - idempotency_key=idempotency_key, - ), - cast_to=WireTransfer, - ) - - async def submit( - self, - wire_transfer_id: str, - *, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this method. - extra_headers: Headers | None = None, - extra_query: Query | None = None, - extra_body: Body | None = None, - timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN, - idempotency_key: str | None = None, - ) -> WireTransfer: - """ - Simulates the submission of a [Wire Transfer](#wire-transfers) to the Federal - Reserve. This transfer must first have a `status` of `pending_approval` or - `pending_creating`. - - Args: - wire_transfer_id: The identifier of the Wire Transfer you wish to submit. - - 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 - - idempotency_key: Specify a custom idempotency key for this request - """ - if not wire_transfer_id: - raise ValueError(f"Expected a non-empty value for `wire_transfer_id` but received {wire_transfer_id!r}") - return await self._post( - f"/simulations/wire_transfers/{wire_transfer_id}/submit", + path_template("/wire_transfers/{wire_transfer_id}/cancel", wire_transfer_id=wire_transfer_id), options=make_request_options( extra_headers=extra_headers, extra_query=extra_query, @@ -805,62 +618,50 @@ async def submit( ) -class WireTransfersWithRawResponse: - def __init__(self, wire_transfers: WireTransfers) -> None: +class WireTransfersResourceWithRawResponse: + def __init__(self, wire_transfers: WireTransfersResource) -> None: self._wire_transfers = wire_transfers - self.create = _legacy_response.to_raw_response_wrapper( + self.create = to_raw_response_wrapper( wire_transfers.create, ) - self.retrieve = _legacy_response.to_raw_response_wrapper( + self.retrieve = to_raw_response_wrapper( wire_transfers.retrieve, ) - self.list = _legacy_response.to_raw_response_wrapper( + self.list = to_raw_response_wrapper( wire_transfers.list, ) - self.approve = _legacy_response.to_raw_response_wrapper( + self.approve = to_raw_response_wrapper( wire_transfers.approve, ) - self.cancel = _legacy_response.to_raw_response_wrapper( + self.cancel = to_raw_response_wrapper( wire_transfers.cancel, ) - self.reverse = _legacy_response.to_raw_response_wrapper( - wire_transfers.reverse, - ) - self.submit = _legacy_response.to_raw_response_wrapper( - wire_transfers.submit, - ) -class AsyncWireTransfersWithRawResponse: - def __init__(self, wire_transfers: AsyncWireTransfers) -> None: +class AsyncWireTransfersResourceWithRawResponse: + def __init__(self, wire_transfers: AsyncWireTransfersResource) -> None: self._wire_transfers = wire_transfers - self.create = _legacy_response.async_to_raw_response_wrapper( + self.create = async_to_raw_response_wrapper( wire_transfers.create, ) - self.retrieve = _legacy_response.async_to_raw_response_wrapper( + self.retrieve = async_to_raw_response_wrapper( wire_transfers.retrieve, ) - self.list = _legacy_response.async_to_raw_response_wrapper( + self.list = async_to_raw_response_wrapper( wire_transfers.list, ) - self.approve = _legacy_response.async_to_raw_response_wrapper( + self.approve = async_to_raw_response_wrapper( wire_transfers.approve, ) - self.cancel = _legacy_response.async_to_raw_response_wrapper( + self.cancel = async_to_raw_response_wrapper( wire_transfers.cancel, ) - self.reverse = _legacy_response.async_to_raw_response_wrapper( - wire_transfers.reverse, - ) - self.submit = _legacy_response.async_to_raw_response_wrapper( - wire_transfers.submit, - ) -class WireTransfersWithStreamingResponse: - def __init__(self, wire_transfers: WireTransfers) -> None: +class WireTransfersResourceWithStreamingResponse: + def __init__(self, wire_transfers: WireTransfersResource) -> None: self._wire_transfers = wire_transfers self.create = to_streamed_response_wrapper( @@ -878,16 +679,10 @@ def __init__(self, wire_transfers: WireTransfers) -> None: self.cancel = to_streamed_response_wrapper( wire_transfers.cancel, ) - self.reverse = to_streamed_response_wrapper( - wire_transfers.reverse, - ) - self.submit = to_streamed_response_wrapper( - wire_transfers.submit, - ) -class AsyncWireTransfersWithStreamingResponse: - def __init__(self, wire_transfers: AsyncWireTransfers) -> None: +class AsyncWireTransfersResourceWithStreamingResponse: + def __init__(self, wire_transfers: AsyncWireTransfersResource) -> None: self._wire_transfers = wire_transfers self.create = async_to_streamed_response_wrapper( @@ -905,9 +700,3 @@ def __init__(self, wire_transfers: AsyncWireTransfers) -> None: self.cancel = async_to_streamed_response_wrapper( wire_transfers.cancel, ) - self.reverse = async_to_streamed_response_wrapper( - wire_transfers.reverse, - ) - self.submit = async_to_streamed_response_wrapper( - wire_transfers.submit, - ) diff --git a/src/increase/types/__init__.py b/src/increase/types/__init__.py index c495ff163..9ff68547c 100644 --- a/src/increase/types/__init__.py +++ b/src/increase/types/__init__.py @@ -9,8 +9,10 @@ from .entity import Entity as Entity from .export import Export as Export from .account import Account as Account +from .lockbox import Lockbox as Lockbox from .program import Program as Program -from .document import Document as Document +from .file_link import FileLink as FileLink +from .card_token import CardToken as CardToken from .oauth_token import OAuthToken as OAuthToken from .transaction import Transaction as Transaction from .ach_transfer import ACHTransfer as ACHTransfer @@ -23,7 +25,11 @@ from .account_number import AccountNumber as AccountNumber from .balance_lookup import BalanceLookup as BalanceLookup from .check_transfer import CheckTransfer as CheckTransfer -from .routing_number import RoutingNumber as RoutingNumber +from .swift_transfer import SwiftTransfer as SwiftTransfer +from .card_iframe_url import CardIframeURL as CardIframeURL +from .card_validation import CardValidation as CardValidation +from .fednow_transfer import FednowTransfer as FednowTransfer +from .intrafi_balance import IntrafiBalance as IntrafiBalance from .account_transfer import AccountTransfer as AccountTransfer from .card_list_params import CardListParams as CardListParams from .external_account import ExternalAccount as ExternalAccount @@ -32,7 +38,11 @@ from .account_statement import AccountStatement as AccountStatement from .bookkeeping_entry import BookkeepingEntry as BookkeepingEntry from .event_list_params import EventListParams as EventListParams +from .inbound_mail_item import InboundMailItem as InboundMailItem +from .intrafi_exclusion import IntrafiExclusion as IntrafiExclusion +from .oauth_application import OAuthApplication as OAuthApplication from .card_create_params import CardCreateParams as CardCreateParams +from .card_push_transfer import CardPushTransfer as CardPushTransfer from .card_update_params import CardUpdateParams as CardUpdateParams from .entity_list_params import EntityListParams as EntityListParams from .event_subscription import EventSubscription as EventSubscription @@ -42,29 +52,40 @@ from .account_list_params import AccountListParams as AccountListParams from .ach_prenotification import ACHPrenotification as ACHPrenotification from .bookkeeping_account import BookkeepingAccount as BookkeepingAccount +from .lockbox_list_params import LockboxListParams as LockboxListParams from .pending_transaction import PendingTransaction as PendingTransaction from .program_list_params import ProgramListParams as ProgramListParams from .declined_transaction import DeclinedTransaction as DeclinedTransaction from .digital_card_profile import DigitalCardProfile as DigitalCardProfile from .digital_wallet_token import DigitalWalletToken as DigitalWalletToken -from .document_list_params import DocumentListParams as DocumentListParams from .entity_create_params import EntityCreateParams as EntityCreateParams +from .entity_update_params import EntityUpdateParams as EntityUpdateParams from .export_create_params import ExportCreateParams as ExportCreateParams from .inbound_ach_transfer import InboundACHTransfer as InboundACHTransfer +from .unwrap_webhook_event import UnwrapWebhookEvent as UnwrapWebhookEvent from .account_create_params import AccountCreateParams as AccountCreateParams from .account_update_params import AccountUpdateParams as AccountUpdateParams from .bookkeeping_entry_set import BookkeepingEntrySet as BookkeepingEntrySet -from .entity_confirm_params import EntityConfirmParams as EntityConfirmParams +from .inbound_check_deposit import InboundCheckDeposit as InboundCheckDeposit from .inbound_wire_transfer import InboundWireTransfer as InboundWireTransfer +from .lockbox_create_params import LockboxCreateParams as LockboxCreateParams +from .lockbox_update_params import LockboxUpdateParams as LockboxUpdateParams from .physical_card_profile import PhysicalCardProfile as PhysicalCardProfile from .wire_drawdown_request import WireDrawdownRequest as WireDrawdownRequest from .account_balance_params import AccountBalanceParams as AccountBalanceParams +from .card_token_list_params import CardTokenListParams as CardTokenListParams +from .card_update_pin_params import CardUpdatePinParams as CardUpdatePinParams +from .card_token_capabilities import CardTokenCapabilities as CardTokenCapabilities +from .entity_beneficial_owner import EntityBeneficialOwner as EntityBeneficialOwner +from .file_link_create_params import FileLinkCreateParams as FileLinkCreateParams +from .inbound_fednow_transfer import InboundFednowTransfer as InboundFednowTransfer from .transaction_list_params import TransactionListParams as TransactionListParams from .ach_transfer_list_params import ACHTransferListParams as ACHTransferListParams from .card_dispute_list_params import CardDisputeListParams as CardDisputeListParams from .card_payment_list_params import CardPaymentListParams as CardPaymentListParams from .card_purchase_supplement import CardPurchaseSupplement as CardPurchaseSupplement from .check_deposit_list_params import CheckDepositListParams as CheckDepositListParams +from .entity_onboarding_session import EntityOnboardingSession as EntityOnboardingSession from .oauth_token_create_params import OAuthTokenCreateParams as OAuthTokenCreateParams from .physical_card_list_params import PhysicalCardListParams as PhysicalCardListParams from .wire_transfer_list_params import WireTransferListParams as WireTransferListParams @@ -73,8 +94,12 @@ from .bookkeeping_balance_lookup import BookkeepingBalanceLookup as BookkeepingBalanceLookup from .card_dispute_create_params import CardDisputeCreateParams as CardDisputeCreateParams from .check_transfer_list_params import CheckTransferListParams as CheckTransferListParams +from .intrafi_account_enrollment import IntrafiAccountEnrollment as IntrafiAccountEnrollment from .routing_number_list_params import RoutingNumberListParams as RoutingNumberListParams +from .swift_transfer_list_params import SwiftTransferListParams as SwiftTransferListParams +from .card_validation_list_params import CardValidationListParams as CardValidationListParams from .check_deposit_create_params import CheckDepositCreateParams as CheckDepositCreateParams +from .fednow_transfer_list_params import FednowTransferListParams as FednowTransferListParams from .physical_card_create_params import PhysicalCardCreateParams as PhysicalCardCreateParams from .physical_card_update_params import PhysicalCardUpdateParams as PhysicalCardUpdateParams from .real_time_payments_transfer import RealTimePaymentsTransfer as RealTimePaymentsTransfer @@ -82,21 +107,35 @@ from .account_number_create_params import AccountNumberCreateParams as AccountNumberCreateParams from .account_number_update_params import AccountNumberUpdateParams as AccountNumberUpdateParams from .account_transfer_list_params import AccountTransferListParams as AccountTransferListParams +from .beneficial_owner_list_params import BeneficialOwnerListParams as BeneficialOwnerListParams +from .card_dispute_withdraw_params import CardDisputeWithdrawParams as CardDisputeWithdrawParams from .check_transfer_create_params import CheckTransferCreateParams as CheckTransferCreateParams -from .entity_update_address_params import EntityUpdateAddressParams as EntityUpdateAddressParams +from .entity_supplemental_document import EntitySupplementalDocument as EntitySupplementalDocument from .external_account_list_params import ExternalAccountListParams as ExternalAccountListParams from .oauth_connection_list_params import OAuthConnectionListParams as OAuthConnectionListParams +from .routing_number_list_response import RoutingNumberListResponse as RoutingNumberListResponse +from .swift_transfer_create_params import SwiftTransferCreateParams as SwiftTransferCreateParams from .account_statement_list_params import AccountStatementListParams as AccountStatementListParams from .bookkeeping_entry_list_params import BookkeepingEntryListParams as BookkeepingEntryListParams +from .card_validation_create_params import CardValidationCreateParams as CardValidationCreateParams +from .fednow_transfer_create_params import FednowTransferCreateParams as FednowTransferCreateParams +from .inbound_mail_item_list_params import InboundMailItemListParams as InboundMailItemListParams from .inbound_wire_drawdown_request import InboundWireDrawdownRequest as InboundWireDrawdownRequest +from .intrafi_exclusion_list_params import IntrafiExclusionListParams as IntrafiExclusionListParams +from .oauth_application_list_params import OAuthApplicationListParams as OAuthApplicationListParams from .account_transfer_create_params import AccountTransferCreateParams as AccountTransferCreateParams +from .beneficial_owner_create_params import BeneficialOwnerCreateParams as BeneficialOwnerCreateParams +from .beneficial_owner_update_params import BeneficialOwnerUpdateParams as BeneficialOwnerUpdateParams +from .card_push_transfer_list_params import CardPushTransferListParams as CardPushTransferListParams from .event_subscription_list_params import EventSubscriptionListParams as EventSubscriptionListParams from .external_account_create_params import ExternalAccountCreateParams as ExternalAccountCreateParams from .external_account_update_params import ExternalAccountUpdateParams as ExternalAccountUpdateParams -from .proof_of_authorization_request import ProofOfAuthorizationRequest as ProofOfAuthorizationRequest from .ach_prenotification_list_params import ACHPrenotificationListParams as ACHPrenotificationListParams from .bookkeeping_account_list_params import BookkeepingAccountListParams as BookkeepingAccountListParams +from .inbound_mail_item_action_params import InboundMailItemActionParams as InboundMailItemActionParams +from .intrafi_exclusion_create_params import IntrafiExclusionCreateParams as IntrafiExclusionCreateParams from .pending_transaction_list_params import PendingTransactionListParams as PendingTransactionListParams +from .card_push_transfer_create_params import CardPushTransferCreateParams as CardPushTransferCreateParams from .declined_transaction_list_params import DeclinedTransactionListParams as DeclinedTransactionListParams from .digital_card_profile_list_params import DigitalCardProfileListParams as DigitalCardProfileListParams from .digital_wallet_token_list_params import DigitalWalletTokenListParams as DigitalWalletTokenListParams @@ -104,63 +143,62 @@ from .event_subscription_update_params import EventSubscriptionUpdateParams as EventSubscriptionUpdateParams from .inbound_ach_transfer_list_params import InboundACHTransferListParams as InboundACHTransferListParams from .real_time_decision_action_params import RealTimeDecisionActionParams as RealTimeDecisionActionParams -from .simulation_card_reversals_params import SimulationCardReversalsParams as SimulationCardReversalsParams from .ach_prenotification_create_params import ACHPrenotificationCreateParams as ACHPrenotificationCreateParams from .bookkeeping_account_create_params import BookkeepingAccountCreateParams as BookkeepingAccountCreateParams from .bookkeeping_account_update_params import BookkeepingAccountUpdateParams as BookkeepingAccountUpdateParams from .bookkeeping_entry_set_list_params import BookkeepingEntrySetListParams as BookkeepingEntrySetListParams +from .card_create_details_iframe_params import CardCreateDetailsIframeParams as CardCreateDetailsIframeParams from .digital_card_profile_clone_params import DigitalCardProfileCloneParams as DigitalCardProfileCloneParams +from .inbound_check_deposit_list_params import InboundCheckDepositListParams as InboundCheckDepositListParams from .inbound_wire_transfer_list_params import InboundWireTransferListParams as InboundWireTransferListParams +from .pending_transaction_create_params import PendingTransactionCreateParams as PendingTransactionCreateParams from .physical_card_profile_list_params import PhysicalCardProfileListParams as PhysicalCardProfileListParams -from .simulation_card_increments_params import SimulationCardIncrementsParams as SimulationCardIncrementsParams +from .supplemental_document_list_params import SupplementalDocumentListParams as SupplementalDocumentListParams from .wire_drawdown_request_list_params import WireDrawdownRequestListParams as WireDrawdownRequestListParams from .bookkeeping_account_balance_params import BookkeepingAccountBalanceParams as BookkeepingAccountBalanceParams from .check_transfer_stop_payment_params import CheckTransferStopPaymentParams as CheckTransferStopPaymentParams from .digital_card_profile_create_params import DigitalCardProfileCreateParams as DigitalCardProfileCreateParams from .physical_card_profile_clone_params import PhysicalCardProfileCloneParams as PhysicalCardProfileCloneParams from .bookkeeping_entry_set_create_params import BookkeepingEntrySetCreateParams as BookkeepingEntrySetCreateParams +from .inbound_ach_transfer_decline_params import InboundACHTransferDeclineParams as InboundACHTransferDeclineParams +from .inbound_check_deposit_return_params import InboundCheckDepositReturnParams as InboundCheckDepositReturnParams +from .inbound_fednow_transfer_list_params import InboundFednowTransferListParams as InboundFednowTransferListParams +from .inbound_real_time_payments_transfer import InboundRealTimePaymentsTransfer as InboundRealTimePaymentsTransfer from .physical_card_profile_create_params import PhysicalCardProfileCreateParams as PhysicalCardProfileCreateParams +from .supplemental_document_create_params import SupplementalDocumentCreateParams as SupplementalDocumentCreateParams from .wire_drawdown_request_create_params import WireDrawdownRequestCreateParams as WireDrawdownRequestCreateParams from .card_purchase_supplement_list_params import CardPurchaseSupplementListParams as CardPurchaseSupplementListParams -from .real_time_payments_request_for_payment import ( - RealTimePaymentsRequestForPayment as RealTimePaymentsRequestForPayment, +from .inbound_wire_transfer_reverse_params import InboundWireTransferReverseParams as InboundWireTransferReverseParams +from .entity_onboarding_session_list_params import ( + EntityOnboardingSessionListParams as EntityOnboardingSessionListParams, +) +from .intrafi_account_enrollment_list_params import ( + IntrafiAccountEnrollmentListParams as IntrafiAccountEnrollmentListParams, +) +from .entity_onboarding_session_create_params import ( + EntityOnboardingSessionCreateParams as EntityOnboardingSessionCreateParams, ) from .real_time_payments_transfer_list_params import ( RealTimePaymentsTransferListParams as RealTimePaymentsTransferListParams, ) +from .intrafi_account_enrollment_create_params import ( + IntrafiAccountEnrollmentCreateParams as IntrafiAccountEnrollmentCreateParams, +) from .inbound_wire_drawdown_request_list_params import ( InboundWireDrawdownRequestListParams as InboundWireDrawdownRequestListParams, ) -from .proof_of_authorization_request_submission import ( - ProofOfAuthorizationRequestSubmission as ProofOfAuthorizationRequestSubmission, -) from .real_time_payments_transfer_create_params import ( RealTimePaymentsTransferCreateParams as RealTimePaymentsTransferCreateParams, ) -from .simulation_card_fuel_confirmations_params import ( - SimulationCardFuelConfirmationsParams as SimulationCardFuelConfirmationsParams, -) -from .proof_of_authorization_request_list_params import ( - ProofOfAuthorizationRequestListParams as ProofOfAuthorizationRequestListParams, +from .card_dispute_submit_user_submission_params import ( + CardDisputeSubmitUserSubmissionParams as CardDisputeSubmitUserSubmissionParams, ) from .inbound_ach_transfer_transfer_return_params import ( InboundACHTransferTransferReturnParams as InboundACHTransferTransferReturnParams, ) -from .simulation_card_authorization_expirations_params import ( - SimulationCardAuthorizationExpirationsParams as SimulationCardAuthorizationExpirationsParams, -) -from .inbound_ach_transfer_notification_of_change_params import ( - InboundACHTransferNotificationOfChangeParams as InboundACHTransferNotificationOfChangeParams, -) -from .real_time_payments_request_for_payment_list_params import ( - RealTimePaymentsRequestForPaymentListParams as RealTimePaymentsRequestForPaymentListParams, -) -from .real_time_payments_request_for_payment_create_params import ( - RealTimePaymentsRequestForPaymentCreateParams as RealTimePaymentsRequestForPaymentCreateParams, -) -from .proof_of_authorization_request_submission_list_params import ( - ProofOfAuthorizationRequestSubmissionListParams as ProofOfAuthorizationRequestSubmissionListParams, +from .inbound_real_time_payments_transfer_list_params import ( + InboundRealTimePaymentsTransferListParams as InboundRealTimePaymentsTransferListParams, ) -from .proof_of_authorization_request_submission_create_params import ( - ProofOfAuthorizationRequestSubmissionCreateParams as ProofOfAuthorizationRequestSubmissionCreateParams, +from .inbound_ach_transfer_create_notification_of_change_params import ( + InboundACHTransferCreateNotificationOfChangeParams as InboundACHTransferCreateNotificationOfChangeParams, ) diff --git a/src/increase/types/account.py b/src/increase/types/account.py index 3c65e31cf..f5ac3fd2e 100644 --- a/src/increase/types/account.py +++ b/src/increase/types/account.py @@ -1,23 +1,73 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import date, datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["Account"] +__all__ = ["Account", "Loan"] + + +class Loan(BaseModel): + """The Account's loan-related information, if the Account is a loan account.""" + + credit_limit: int + """The maximum amount of money that can be borrowed on the Account.""" + + grace_period_days: int + """ + The number of days after the statement date that the Account can be past due + before being considered delinquent. + """ + + maturity_date: Optional[date] = None + """The date on which the loan matures.""" + + statement_day_of_month: int + """The day of the month on which the loan statement is generated.""" + + statement_payment_type: Literal["balance", "interest_until_maturity"] + """The type of payment for the loan. + + - `balance` - The borrower must pay the full balance of the loan at the end of + the statement period. + - `interest_until_maturity` - The borrower must pay the accrued interest at the + end of the statement period. + """ class Account(BaseModel): + """Accounts are your bank accounts with Increase. + + They store money, receive transfers, and send payments. They earn interest and have depository insurance. + """ + id: str """The Account identifier.""" - bank: Literal["blue_ridge_bank", "first_internet_bank"] + account_revenue_rate: Optional[str] = None + """ + The account revenue rate currently being earned on the account, as a string + containing a decimal number. For example, a 1% account revenue rate would be + represented as "0.01". Account revenue is a type of non-interest income accrued + on the account. + """ + + bank: Literal["core_bank", "first_internet_bank", "grasshopper_bank"] """The bank the Account is with. - - `blue_ridge_bank` - Blue Ridge Bank, N.A. + - `core_bank` - Core Bank - `first_internet_bank` - First Internet Bank of Indiana + - `grasshopper_bank` - Grasshopper Bank + """ + + closed_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Account + was closed. """ created_at: datetime @@ -26,22 +76,25 @@ class Account(BaseModel): was created. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Account currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - entity_id: Optional[str] = None + entity_id: str """The identifier for the Entity the Account belongs to.""" + funding: Literal["loan", "deposits"] + """Whether the Account is funded by a loan or by deposits. + + - `loan` - An account funded by a loan. Before opening a loan account, contact + support@increase.com to set up a loan program. + - `deposits` - An account funded by deposits. + """ + idempotency_key: Optional[str] = None """The idempotency key you chose for this object. @@ -56,33 +109,30 @@ class Account(BaseModel): with its activity. """ - interest_accrued: str - """ - The interest accrued but not yet paid, expressed as a string containing a - floating-point value. - """ - - interest_accrued_at: Optional[date] = None - """ - The latest [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which - interest was accrued. - """ - interest_rate: str """ - The Interest Rate currently being earned on the account, as a string containing + The interest rate currently being earned on the account, as a string containing a decimal number. For example, a 1% interest rate would be represented as "0.01". """ + loan: Optional[Loan] = None + """The Account's loan-related information, if the Account is a loan account.""" + name: str """The name you choose for the Account.""" - status: Literal["open", "closed"] + program_id: str + """ + The identifier of the Program determining the compliance and commercial terms of + this Account. + """ + + status: Literal["closed", "open"] """The status of the Account. - - `open` - Open Accounts that are ready to use. - `closed` - Closed Accounts on which no new activity can occur. + - `open` - Open Accounts that are ready to use. """ type: Literal["account"] @@ -90,3 +140,15 @@ class Account(BaseModel): For this resource it will always be `account`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/account_create_params.py b/src/increase/types/account_create_params.py index 3ce6ad3ba..705b76ebd 100644 --- a/src/increase/types/account_create_params.py +++ b/src/increase/types/account_create_params.py @@ -2,9 +2,13 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Union +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict -__all__ = ["AccountCreateParams"] +from .._utils import PropertyInfo + +__all__ = ["AccountCreateParams", "Loan"] class AccountCreateParams(TypedDict, total=False): @@ -14,14 +18,53 @@ class AccountCreateParams(TypedDict, total=False): entity_id: str """The identifier for the Entity that will own the Account.""" + funding: Literal["loan", "deposits"] + """Whether the Account is funded by a loan or by deposits. + + - `loan` - An account funded by a loan. Before opening a loan account, contact + support@increase.com to set up a loan program. + - `deposits` - An account funded by deposits. + """ + informational_entity_id: str """ The identifier of an Entity that, while not owning the Account, is associated - with its activity. Its relationship to your group must be `informational`. + with its activity. This is generally the beneficiary of the funds. """ + loan: Loan + """The loan details for the account.""" + program_id: str """The identifier for the Program that this Account falls under. Required if you operate more than one Program. """ + + +class Loan(TypedDict, total=False): + """The loan details for the account.""" + + credit_limit: Required[int] + """The maximum amount of money that can be drawn from the Account.""" + + grace_period_days: Required[int] + """ + The number of days after the statement date that the Account can be past due + before being considered delinquent. + """ + + statement_day_of_month: Required[int] + """The day of the month on which the loan statement is generated.""" + + statement_payment_type: Required[Literal["balance", "interest_until_maturity"]] + """The type of statement payment for the account. + + - `balance` - The borrower must pay the full balance of the loan at the end of + the statement period. + - `interest_until_maturity` - The borrower must pay the accrued interest at the + end of the statement period. + """ + + maturity_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """The date on which the loan matures.""" diff --git a/src/increase/types/account_list_params.py b/src/increase/types/account_list_params.py index b439c1103..1888d6908 100644 --- a/src/increase/types/account_list_params.py +++ b/src/increase/types/account_list_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["AccountListParams", "CreatedAt"] +__all__ = ["AccountListParams", "CreatedAt", "Status"] class AccountListParams(TypedDict, total=False): @@ -37,12 +37,10 @@ class AccountListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ - status: Literal["open", "closed"] - """Filter Accounts for those with the specified status. + program_id: str + """Filter Accounts for those in a specific Program.""" - - `open` - Open Accounts that are ready to use. - - `closed` - Closed Accounts on which no new activity can occur. - """ + status: Status class CreatedAt(TypedDict, total=False): @@ -69,3 +67,16 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["closed", "open"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/account_number.py b/src/increase/types/account_number.py index 5c5921561..6977332d7 100644 --- a/src/increase/types/account_number.py +++ b/src/increase/types/account_number.py @@ -1,15 +1,19 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["AccountNumber", "InboundACH", "InboundChecks"] class InboundACH(BaseModel): + """Properties related to how this Account Number handles inbound ACH transfers.""" + debit_status: Literal["allowed", "blocked"] """Whether ACH debits are allowed against this Account Number. @@ -22,6 +26,10 @@ class InboundACH(BaseModel): class InboundChecks(BaseModel): + """ + Properties related to how this Account Number should handle inbound check withdrawals. + """ + status: Literal["allowed", "check_transfers_only"] """How Increase should process checks with this account number printed on them. @@ -33,6 +41,11 @@ class InboundChecks(BaseModel): class AccountNumber(BaseModel): + """Each account can have multiple account and routing numbers. + + We recommend that you use a set per vendor. This is similar to how you use different passwords for different websites. Account numbers can also be used to seamlessly reconcile inbound payments. Generating a unique account number per vendor ensures you always know the originator of an incoming payment. + """ + id: str """The Account Number identifier.""" @@ -84,3 +97,15 @@ class AccountNumber(BaseModel): For this resource it will always be `account_number`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/account_number_create_params.py b/src/increase/types/account_number_create_params.py index 7c394f8da..32d7e1a39 100644 --- a/src/increase/types/account_number_create_params.py +++ b/src/increase/types/account_number_create_params.py @@ -25,11 +25,14 @@ class AccountNumberCreateParams(TypedDict, total=False): class InboundACH(TypedDict, total=False): + """Options related to how this Account Number should handle inbound ACH transfers.""" + debit_status: Required[Literal["allowed", "blocked"]] """Whether ACH debits are allowed against this Account Number. Note that ACH debits will be declined if this is `allowed` but the Account - Number is not active. + Number is not active. If you do not specify this field, the default is + `allowed`. - `allowed` - ACH Debits are allowed. - `blocked` - ACH Debits are blocked. @@ -37,9 +40,15 @@ class InboundACH(TypedDict, total=False): class InboundChecks(TypedDict, total=False): + """ + Options related to how this Account Number should handle inbound check withdrawals. + """ + status: Required[Literal["allowed", "check_transfers_only"]] """How Increase should process checks with this account number printed on them. + If you do not specify this field, the default is `check_transfers_only`. + - `allowed` - Checks with this Account Number will be processed even if they are not associated with a Check Transfer. - `check_transfers_only` - Checks with this Account Number will be processed diff --git a/src/increase/types/account_number_list_params.py b/src/increase/types/account_number_list_params.py index ed027f9b4..57ef69909 100644 --- a/src/increase/types/account_number_list_params.py +++ b/src/increase/types/account_number_list_params.py @@ -2,25 +2,20 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["AccountNumberListParams", "CreatedAt"] +__all__ = ["AccountNumberListParams", "ACHDebitStatus", "CreatedAt", "Status"] class AccountNumberListParams(TypedDict, total=False): account_id: str """Filter Account Numbers to those belonging to the specified Account.""" - ach_debit_status: Literal["allowed", "blocked"] - """The ACH Debit status to retrieve Account Numbers for. - - - `allowed` - ACH Debits are allowed. - - `blocked` - ACH Debits are blocked. - """ + ach_debit_status: ACHDebitStatus created_at: CreatedAt @@ -41,13 +36,20 @@ class AccountNumberListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ - status: Literal["active", "disabled", "canceled"] - """The status to retrieve Account Numbers for. + status: Status + + +_ACHDebitStatusReservedKeywords = TypedDict( + "_ACHDebitStatusReservedKeywords", + { + "in": List[Literal["allowed", "blocked"]], + }, + total=False, +) - - `active` - The account number is active. - - `disabled` - The account number is temporarily disabled. - - `canceled` - The account number is permanently disabled. - """ + +class ACHDebitStatus(_ACHDebitStatusReservedKeywords, total=False): + pass class CreatedAt(TypedDict, total=False): @@ -74,3 +76,16 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["active", "disabled", "canceled"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/account_number_update_params.py b/src/increase/types/account_number_update_params.py index 1ee620fe4..47ad6ae70 100644 --- a/src/increase/types/account_number_update_params.py +++ b/src/increase/types/account_number_update_params.py @@ -30,6 +30,8 @@ class AccountNumberUpdateParams(TypedDict, total=False): class InboundACH(TypedDict, total=False): + """Options related to how this Account Number handles inbound ACH transfers.""" + debit_status: Literal["allowed", "blocked"] """Whether ACH debits are allowed against this Account Number. @@ -42,6 +44,10 @@ class InboundACH(TypedDict, total=False): class InboundChecks(TypedDict, total=False): + """ + Options related to how this Account Number should handle inbound check withdrawals. + """ + status: Required[Literal["allowed", "check_transfers_only"]] """How Increase should process checks with this account number printed on them. diff --git a/src/increase/types/account_statement.py b/src/increase/types/account_statement.py index d2e124f86..f1369ef82 100644 --- a/src/increase/types/account_statement.py +++ b/src/increase/types/account_statement.py @@ -1,14 +1,36 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -__all__ = ["AccountStatement"] +__all__ = ["AccountStatement", "Loan"] + + +class Loan(BaseModel): + """The loan balances.""" + + due_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the loan + payment is due. + """ + + due_balance: int + """The total amount due on the loan.""" + + past_due_balance: int + """The amount past due on the loan.""" class AccountStatement(BaseModel): + """Account Statements are generated monthly for every active Account. + + You can access the statement's data via the API or retrieve a PDF with its details via its associated File. + """ + id: str """The Account Statement identifier.""" @@ -22,11 +44,14 @@ class AccountStatement(BaseModel): """ ending_balance: int - """The Account's balance at the start of its statement period.""" + """The Account's balance at the end of its statement period.""" file_id: str """The identifier of the File containing a PDF of the statement.""" + loan: Optional[Loan] = None + """The loan balances.""" + starting_balance: int """The Account's balance at the start of its statement period.""" diff --git a/src/increase/types/account_transfer.py b/src/increase/types/account_transfer.py index 952efdc36..13b58f2e5 100644 --- a/src/increase/types/account_transfer.py +++ b/src/increase/types/account_transfer.py @@ -1,15 +1,29 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["AccountTransfer", "Approval", "Cancellation"] +__all__ = [ + "AccountTransfer", + "Approval", + "Cancellation", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", +] class Approval(BaseModel): + """ + If your account requires approvals for transfers and the transfer was approved, this will contain details of the approval. + """ + approved_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -24,6 +38,10 @@ class Approval(BaseModel): class Cancellation(BaseModel): + """ + If your account requires approvals for transfers and the transfer was not approved, this will contain details of the cancellation. + """ + canceled_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -37,17 +55,66 @@ class Cancellation(BaseModel): """ +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + class AccountTransfer(BaseModel): + """ + Account transfers move funds between your own accounts at Increase (accounting systems often refer to these as Book Transfers). Account Transfers are free and synchronous. Upon creation they create two Transactions, one negative on the originating account and one positive on the destination account (unless the transfer requires approval, in which case the Transactions will be created when the transfer is approved). + """ + id: str - """The account transfer's identifier.""" + """The Account Transfer's identifier.""" account_id: str - """The Account to which the transfer belongs.""" + """The Account from which the transfer originated.""" amount: int - """The transfer amount in the minor unit of the destination account currency. + """The transfer amount in cents. - For dollars, for example, this is cents. + This will always be positive and indicates the amount of money leaving the + originating account. """ approval: Optional[Approval] = None @@ -68,27 +135,31 @@ class AccountTransfer(BaseModel): the transfer was created. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + created_by: Optional[CreatedBy] = None + """What object created the transfer, either via the API or the dashboard.""" + + currency: Literal["USD"] """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - account currency. + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transfer's + currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ description: str - """The description that will show on the transactions.""" + """ + An internal-facing description for the transfer for display in the API and + dashboard. This will also show in the description of the created Transactions. + """ destination_account_id: str - """The destination account's identifier.""" + """The destination Account's identifier.""" destination_transaction_id: Optional[str] = None - """The ID for the transaction receiving the transfer.""" + """ + The identifier of the Transaction on the destination Account representing the + received funds. + """ idempotency_key: Optional[str] = None """The idempotency key you chose for this object. @@ -98,9 +169,6 @@ class AccountTransfer(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ - network: Literal["account"] - """The transfer's network.""" - pending_transaction_id: Optional[str] = None """The ID for the pending transaction representing the transfer. @@ -112,16 +180,32 @@ class AccountTransfer(BaseModel): status: Literal["pending_approval", "canceled", "complete"] """The lifecycle status of the transfer. - - `pending_approval` - The transfer is pending approval. - - `canceled` - The transfer has been canceled. + - `pending_approval` - The transfer is pending approval from your team. + - `canceled` - The transfer was pending approval from your team and has been + canceled. - `complete` - The transfer has been completed. """ transaction_id: Optional[str] = None - """The ID for the transaction funding the transfer.""" + """ + The identifier of the Transaction on the originating account representing the + transferred funds. + """ type: Literal["account_transfer"] """A constant representing the object's type. For this resource it will always be `account_transfer`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/account_transfer_create_params.py b/src/increase/types/account_transfer_create_params.py index 0ec1db929..6a3db1a09 100644 --- a/src/increase/types/account_transfer_create_params.py +++ b/src/increase/types/account_transfer_create_params.py @@ -9,7 +9,7 @@ class AccountTransferCreateParams(TypedDict, total=False): account_id: Required[str] - """The identifier for the account that will send the transfer.""" + """The identifier for the originating Account that will send the transfer.""" amount: Required[int] """The transfer amount in the minor unit of the account currency. @@ -18,10 +18,17 @@ class AccountTransferCreateParams(TypedDict, total=False): """ description: Required[str] - """The description you choose to give the transfer.""" + """ + An internal-facing description for the transfer for display in the API and + dashboard. This will also show in the description of the created Transactions. + """ destination_account_id: Required[str] - """The identifier for the account that will receive the transfer.""" + """The identifier for the destination Account that will receive the transfer.""" require_approval: bool - """Whether the transfer requires explicit approval via the dashboard or API.""" + """Whether the transfer should require explicit approval via the dashboard or API. + + For more information, see + [Transfer Approvals](/documentation/transfer-approvals). + """ diff --git a/src/increase/types/account_update_params.py b/src/increase/types/account_update_params.py index 86ec914d0..6ce69dac3 100644 --- a/src/increase/types/account_update_params.py +++ b/src/increase/types/account_update_params.py @@ -2,11 +2,21 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["AccountUpdateParams"] +__all__ = ["AccountUpdateParams", "Loan"] class AccountUpdateParams(TypedDict, total=False): + loan: Loan + """The loan details for the account.""" + name: str """The new name of the Account.""" + + +class Loan(TypedDict, total=False): + """The loan details for the account.""" + + credit_limit: Required[int] + """The maximum amount of money that can be drawn from the Account.""" diff --git a/src/increase/types/ach_prenotification.py b/src/increase/types/ach_prenotification.py index 43ef00cf8..96ae0d96b 100644 --- a/src/increase/types/ach_prenotification.py +++ b/src/increase/types/ach_prenotification.py @@ -88,6 +88,8 @@ class NotificationsOfChange(BaseModel): class PrenotificationReturn(BaseModel): + """If your prenotification is returned, this will contain details of the return.""" + created_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -169,24 +171,28 @@ class PrenotificationReturn(BaseModel): """Why the Prenotification was returned. - `insufficient_fund` - Code R01. Insufficient funds in the receiving account. - Sometimes abbreviated to NSF. + Sometimes abbreviated to "NSF." - `no_account` - Code R03. The account does not exist or the receiving bank was unable to locate it. - `account_closed` - Code R02. The account is closed at the receiving bank. - `invalid_account_number_structure` - Code R04. The account number is invalid at the receiving bank. - - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. The account - at the receiving bank was frozen per the Office of Foreign Assets Control. - - `credit_entry_refused_by_receiver` - Code R23. The receiving bank account - refused a credit transfer. + - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. This return + code has two separate meanings. (1) The receiving bank froze the account or + (2) the Office of Foreign Assets Control (OFAC) instructed the receiving bank + to return the entry. + - `credit_entry_refused_by_receiver` - Code R23. The receiving bank refused the + credit transfer. - `unauthorized_debit_to_consumer_account_using_corporate_sec_code` - Code R05. The receiving bank rejected because of an incorrect Standard Entry Class code. + Consumer accounts cannot be debited as `corporate_credit_or_debit` or + `corporate_trade_exchange`. - `corporate_customer_advised_not_authorized` - Code R29. The corporate customer at the receiving bank reversed the transfer. - `payment_stopped` - Code R08. The receiving bank stopped payment on this transfer. - - `non_transaction_account` - Code R20. The receiving bank account does not - perform transfers. + - `non_transaction_account` - Code R20. The account is not eligible for ACH, + such as a savings account with transaction limits. - `uncollected_funds` - Code R09. The receiving bank account does not have enough available balance for the transfer. - `routing_number_check_digit_error` - Code R28. The routing number is @@ -194,14 +200,13 @@ class PrenotificationReturn(BaseModel): - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - Code R10. The customer at the receiving bank reversed the transfer. - `amount_field_error` - Code R19. The amount field is incorrect or too large. - - `authorization_revoked_by_customer` - Code R07. The customer at the receiving - institution informed their bank that they have revoked authorization for a - previously authorized transfer. + - `authorization_revoked_by_customer` - Code R07. The customer revoked their + authorization for a previously authorized transfer. - `invalid_ach_routing_number` - Code R13. The routing number is invalid. - `file_record_edit_criteria` - Code R17. The receiving bank is unable to process a field in the transfer. - - `enr_invalid_individual_name` - Code R45. The individual name field was - invalid. + - `enr_invalid_individual_name` - Code R45. A rare return reason. The individual + name field was invalid. - `returned_per_odfi_request` - Code R06. The originating financial institution asked for this transfer to be returned. The receiving bank is complying with the request. @@ -296,8 +301,8 @@ class PrenotificationReturn(BaseModel): a malformed credit entry. - `return_of_improper_debit_entry` - Code R35. A rare return reason. Return of a malformed debit entry. - - `return_of_xck_entry` - Code R33. A rare return reason. Return of a Destroyed - Check ("XKC") entry. + - `return_of_xck_entry` - Code R33. A rare return reason. Return of a destroyed + check ("XCK") entry. - `source_document_presented_for_payment` - Code R37. A rare return reason. The source document related to this ACH, usually an ACH check conversion, was presented to the bank. @@ -319,9 +324,16 @@ class PrenotificationReturn(BaseModel): class ACHPrenotification(BaseModel): + """ + ACH Prenotifications are one way you can verify account and routing numbers by Automated Clearing House (ACH). + """ + id: str """The ACH Prenotification's identifier.""" + account_id: Optional[str] = None + """The account that sent the ACH Prenotification.""" + account_number: str """The destination account number.""" @@ -366,6 +378,15 @@ class ACHPrenotification(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ + individual_id: Optional[str] = None + """Your identifier for the recipient.""" + + individual_name: Optional[str] = None + """The name of the recipient. + + This value is informational and not verified by the recipient's bank. + """ + notifications_of_change: List[NotificationsOfChange] """ If the receiving bank notifies that future transfers should use different @@ -378,6 +399,32 @@ class ACHPrenotification(BaseModel): routing_number: str """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" + standard_entry_class_code: Optional[ + Literal[ + "corporate_credit_or_debit", + "corporate_trade_exchange", + "prearranged_payments_and_deposit", + "internet_initiated", + ] + ] = None + """ + The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the ACH Prenotification. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. + """ + status: Literal["pending_submitting", "requires_attention", "returned", "submitted"] """The lifecycle status of the ACH Prenotification. diff --git a/src/increase/types/ach_prenotification_create_params.py b/src/increase/types/ach_prenotification_create_params.py index 9a01bc5a3..9a2e83e89 100644 --- a/src/increase/types/ach_prenotification_create_params.py +++ b/src/increase/types/ach_prenotification_create_params.py @@ -12,6 +12,9 @@ class ACHPrenotificationCreateParams(TypedDict, total=False): + account_id: Required[str] + """The Increase identifier for the account that will send the ACH Prenotification.""" + account_number: Required[str] """The account number for the destination account.""" @@ -25,13 +28,13 @@ class ACHPrenotificationCreateParams(TypedDict, total=False): """Additional information that will be sent to the recipient.""" company_descriptive_date: str - """The description of the date of the transfer.""" + """The description of the date of the ACH Prenotification.""" company_discretionary_data: str - """The data you choose to associate with the transfer.""" + """The data you choose to associate with the ACH Prenotification.""" company_entry_description: str - """The description of the transfer you wish to be shown to the recipient.""" + """The description you wish to be shown to the recipient.""" company_name: str """The name by which the recipient knows you.""" @@ -45,17 +48,17 @@ class ACHPrenotificationCreateParams(TypedDict, total=False): effective_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] """ - The transfer effective date in + The ACH Prenotification effective date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. """ individual_id: str - """Your identifier for the transfer recipient.""" + """Your identifier for the recipient.""" individual_name: str - """The name of the transfer recipient. + """The name of therecipient. - This value is information and not verified by the recipient's bank. + This value is informational and not verified by the recipient's bank. """ standard_entry_class_code: Literal[ @@ -64,10 +67,20 @@ class ACHPrenotificationCreateParams(TypedDict, total=False): "prearranged_payments_and_deposit", "internet_initiated", ] - """The Standard Entry Class (SEC) code to use for the ACH Prenotification. - - - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). - - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). - - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). - - `internet_initiated` - Internet Initiated (WEB). + """ + The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the ACH Prenotification. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. """ diff --git a/src/increase/types/ach_transfer.py b/src/increase/types/ach_transfer.py index e474e2ae2..5616ebb2f 100644 --- a/src/increase/types/ach_transfer.py +++ b/src/increase/types/ach_transfer.py @@ -1,7 +1,7 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import date, datetime +import datetime +from typing import TYPE_CHECKING, Dict, List, Optional from typing_extensions import Literal from pydantic import Field as FieldInfo @@ -18,13 +18,24 @@ "AddendaPaymentOrderRemittanceAdviceInvoice", "Approval", "Cancellation", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "InboundFundsHold", "NotificationsOfChange", + "PreferredEffectiveDate", "Return", + "Settlement", "Submission", ] class Acknowledgement(BaseModel): + """ + After the transfer is acknowledged by FedACH, this will contain supplemental details. The Federal Reserve sends an acknowledgement message for each file that Increase submits. + """ + acknowledged_at: str """ When the Federal Reserve acknowledged the submitted file containing this @@ -38,6 +49,8 @@ class AddendaFreeformEntry(BaseModel): class AddendaFreeform(BaseModel): + """Unstructured `payment_related_information` passed through with the transfer.""" + entries: List[AddendaFreeformEntry] """Each entry represents an addendum sent with the transfer.""" @@ -54,11 +67,18 @@ class AddendaPaymentOrderRemittanceAdviceInvoice(BaseModel): class AddendaPaymentOrderRemittanceAdvice(BaseModel): + """Structured ASC X12 820 remittance advice records. + + Please reach out to [support@increase.com](mailto:support@increase.com) for more information. + """ + invoices: List[AddendaPaymentOrderRemittanceAdviceInvoice] """ASC X12 RMR records for this specific transfer.""" class Addenda(BaseModel): + """Additional information that will be sent to the recipient.""" + category: Literal["freeform", "payment_order_remittance_advice", "other"] """The type of the resource. @@ -85,7 +105,11 @@ class Addenda(BaseModel): class Approval(BaseModel): - approved_at: datetime + """ + If your account requires approvals for transfers and the transfer was approved, this will contain details of the approval. + """ + + approved_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the transfer was approved. @@ -99,7 +123,11 @@ class Approval(BaseModel): class Cancellation(BaseModel): - canceled_at: datetime + """ + If your account requires approvals for transfers and the transfer was not approved, this will contain details of the cancellation. + """ + + canceled_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Transfer was canceled. @@ -112,6 +140,117 @@ class Cancellation(BaseModel): """ +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + +class InboundFundsHold(BaseModel): + """Increase will sometimes hold the funds for ACH debit transfers. + + If funds are held, this sub-object will contain details of the hold. + """ + + amount: int + """The held amount in the minor unit of the account's currency. + + For dollars, for example, this is cents. + """ + + automatically_releases_at: datetime.datetime + """When the hold will be released automatically. + + Certain conditions may cause it to be released before this time. + """ + + created_at: datetime.datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the hold + was created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's + currency. + + - `USD` - US Dollar (USD) + """ + + held_transaction_id: Optional[str] = None + """The ID of the Transaction for which funds were held.""" + + pending_transaction_id: Optional[str] = None + """The ID of the Pending Transaction representing the held funds.""" + + released_at: Optional[datetime.datetime] = None + """When the hold was released (if it has been released).""" + + status: Literal["held", "complete"] + """The status of the hold. + + - `held` - Funds are still being held. + - `complete` - Funds have been released. + """ + + type: Literal["inbound_funds_hold"] + """A constant representing the object's type. + + For this resource it will always be `inbound_funds_hold`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + class NotificationsOfChange(BaseModel): change_code: Literal[ "incorrect_account_number", @@ -183,15 +322,42 @@ class NotificationsOfChange(BaseModel): checking; numbers starting with a 3 encourage changing to savings. """ - created_at: datetime + created_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the notification occurred. """ +class PreferredEffectiveDate(BaseModel): + """Configuration for how the effective date of the transfer will be set. + + This determines same-day vs future-dated settlement timing. If not set, defaults to a `settlement_schedule` of `same_day`. If set, exactly one of the child attributes must be set. + """ + + date: Optional[datetime.date] = None + """ + A specific date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format to + use as the effective date when submitting this transfer. + """ + + settlement_schedule: Optional[Literal["same_day", "future_dated"]] = None + """A schedule by which Increase will choose an effective date for the transfer. + + - `same_day` - The chosen effective date will be the same as the ACH processing + date on which the transfer is submitted. This is necessary, but not sufficient + for the transfer to be settled same-day: it must also be submitted before the + last same-day cutoff and be less than or equal to $1,000.000.00. + - `future_dated` - The chosen effective date will be the business day following + the ACH processing date on which the transfer is submitted. The transfer will + be settled on that future day. + """ + + class Return(BaseModel): - created_at: datetime + """If your transfer is returned, this will contain details of the return.""" + + created_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the transfer was created. @@ -277,24 +443,28 @@ class Return(BaseModel): This reason code is sent by the receiving bank back to Increase. - `insufficient_fund` - Code R01. Insufficient funds in the receiving account. - Sometimes abbreviated to NSF. + Sometimes abbreviated to "NSF." - `no_account` - Code R03. The account does not exist or the receiving bank was unable to locate it. - `account_closed` - Code R02. The account is closed at the receiving bank. - `invalid_account_number_structure` - Code R04. The account number is invalid at the receiving bank. - - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. The account - at the receiving bank was frozen per the Office of Foreign Assets Control. - - `credit_entry_refused_by_receiver` - Code R23. The receiving bank account - refused a credit transfer. + - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. This return + code has two separate meanings. (1) The receiving bank froze the account or + (2) the Office of Foreign Assets Control (OFAC) instructed the receiving bank + to return the entry. + - `credit_entry_refused_by_receiver` - Code R23. The receiving bank refused the + credit transfer. - `unauthorized_debit_to_consumer_account_using_corporate_sec_code` - Code R05. The receiving bank rejected because of an incorrect Standard Entry Class code. + Consumer accounts cannot be debited as `corporate_credit_or_debit` or + `corporate_trade_exchange`. - `corporate_customer_advised_not_authorized` - Code R29. The corporate customer at the receiving bank reversed the transfer. - `payment_stopped` - Code R08. The receiving bank stopped payment on this transfer. - - `non_transaction_account` - Code R20. The receiving bank account does not - perform transfers. + - `non_transaction_account` - Code R20. The account is not eligible for ACH, + such as a savings account with transaction limits. - `uncollected_funds` - Code R09. The receiving bank account does not have enough available balance for the transfer. - `routing_number_check_digit_error` - Code R28. The routing number is @@ -302,14 +472,13 @@ class Return(BaseModel): - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - Code R10. The customer at the receiving bank reversed the transfer. - `amount_field_error` - Code R19. The amount field is incorrect or too large. - - `authorization_revoked_by_customer` - Code R07. The customer at the receiving - institution informed their bank that they have revoked authorization for a - previously authorized transfer. + - `authorization_revoked_by_customer` - Code R07. The customer revoked their + authorization for a previously authorized transfer. - `invalid_ach_routing_number` - Code R13. The routing number is invalid. - `file_record_edit_criteria` - Code R17. The receiving bank is unable to process a field in the transfer. - - `enr_invalid_individual_name` - Code R45. The individual name field was - invalid. + - `enr_invalid_individual_name` - Code R45. A rare return reason. The individual + name field was invalid. - `returned_per_odfi_request` - Code R06. The originating financial institution asked for this transfer to be returned. The receiving bank is complying with the request. @@ -404,8 +573,8 @@ class Return(BaseModel): a malformed credit entry. - `return_of_improper_debit_entry` - Code R35. A rare return reason. Return of a malformed debit entry. - - `return_of_xck_entry` - Code R33. A rare return reason. Return of a Destroyed - Check ("XKC") entry. + - `return_of_xck_entry` - Code R33. A rare return reason. Return of a destroyed + check ("XCK") entry. - `source_document_presented_for_payment` - Code R37. A rare return reason. The source document related to this ACH, usually an ACH check conversion, was presented to the bank. @@ -425,31 +594,88 @@ class Return(BaseModel): late. """ + trace_number: str + """A 15 digit number that was generated by the bank that initiated the return. + + The trace number of the return is different than that of the original transfer. + ACH trace numbers are not unique, but along with the amount and date this number + can be used to identify the ACH return at the bank that initiated it. + """ + transaction_id: str """The identifier of the Transaction associated with this return.""" transfer_id: str """The identifier of the ACH Transfer associated with this return.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Settlement(BaseModel): + """ + A subhash containing information about when and how the transfer settled at the Federal Reserve. + """ + + settled_at: datetime.datetime + """ + When the funds for this transfer have settled at the destination bank at the + Federal Reserve. + """ + class Submission(BaseModel): - effective_date: date - """The ACH's effective date sent to the receiving bank. + """ + After the transfer is submitted to FedACH, this will contain supplemental details. Increase batches transfers and submits a file to the Federal Reserve roughly every 30 minutes. The Federal Reserve processes ACH transfers during weekdays according to their [posted schedule](https://www.frbservices.org/resources/resource-centers/same-day-ach/fedach-processing-schedule.html). + """ + + administrative_returns_expected_by: datetime.datetime + """The timestamp by which any administrative returns are expected to be received + by. + + This follows the NACHA guidelines for return windows, which are: "In general, + return entries must be received by the RDFI’s ACH Operator by its deposit + deadline for the return entry to be made available to the ODFI no later than the + opening of business on the second banking day following the Settlement Date of + the original entry.". + """ - If `effective_date` is configured in the ACH transfer, this will match the value - there. Otherwise, it will the date that the ACH transfer was processed, which is - usually the current or subsequent business day. + effective_date: datetime.date + """The ACH transfer's effective date as sent to the Federal Reserve. + + If a specific date was configured using `preferred_effective_date`, this will + match that value. Otherwise, it will be the date selected (following the + specified settlement schedule) at the time the transfer was submitted. """ - expected_funds_settlement_at: datetime - """When the funds transfer is expected to settle in the recipient's account. + expected_funds_settlement_at: datetime.datetime + """When the transfer is expected to settle in the recipient's account. - Credits may be available sooner, at the receiving banks discretion. The FedACH + Credits may be available sooner, at the receiving bank's discretion. The FedACH schedule is published [here](https://www.frbservices.org/resources/resource-centers/same-day-ach/fedach-processing-schedule.html). """ - submitted_at: datetime + expected_settlement_schedule: Literal["same_day", "future_dated"] + """The settlement schedule the transfer is expected to follow. + + This expectation takes into account the `effective_date`, `submitted_at`, and + the amount of the transfer. + + - `same_day` - The transfer is expected to settle same-day. + - `future_dated` - The transfer is expected to settle on a future date. + """ + + submitted_at: datetime.datetime """When the ACH transfer was sent to FedACH.""" trace_number: str @@ -458,11 +684,15 @@ class Submission(BaseModel): bank. Along with the amount, date, and originating routing number, this can be used to identify the ACH transfer at the receiving bank. ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). + [used to correlate returns](https://increase.com/documentation/ach-returns#ach-returns). """ class ACHTransfer(BaseModel): + """ + ACH transfers move funds between your Increase account and any other account accessible by the Automated Clearing House (ACH). + """ + id: str """The ACH transfer's identifier.""" @@ -511,25 +741,26 @@ class ACHTransfer(BaseModel): company_entry_description: Optional[str] = None """The description of the transfer you set to be shown to the recipient.""" + company_id: str + """The company ID associated with the transfer.""" + company_name: Optional[str] = None """The name by which the recipient knows you.""" - created_at: datetime + created_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the transfer was created. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + created_by: Optional[CreatedBy] = None + """What object created the transfer, either via the API or the dashboard.""" + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transfer's currency. For ACH transfers this is always equal to `usd`. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -543,20 +774,15 @@ class ACHTransfer(BaseModel): - `unknown` - It's unknown what kind of entity owns the External Account. """ - effective_date: Optional[date] = None - """ - The transfer effective date in - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - external_account_id: Optional[str] = None """The identifier of the External Account the transfer was made to, if any.""" - funding: Literal["checking", "savings"] + funding: Literal["checking", "savings", "general_ledger"] """The type of the account to which the transfer will be sent. - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A bank's general ledger. Uncommon. """ idempotency_key: Optional[str] = None @@ -567,13 +793,19 @@ class ACHTransfer(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ + inbound_funds_hold: Optional[InboundFundsHold] = None + """Increase will sometimes hold the funds for ACH debit transfers. + + If funds are held, this sub-object will contain details of the hold. + """ + individual_id: Optional[str] = None """Your identifier for the transfer recipient.""" individual_name: Optional[str] = None """The name of the transfer recipient. - This value is information and not verified by the recipient's bank. + This value is informational and not verified by the recipient's bank. """ network: Literal["ach"] @@ -593,24 +825,48 @@ class ACHTransfer(BaseModel): by someone else in your organization. """ + preferred_effective_date: PreferredEffectiveDate + """Configuration for how the effective date of the transfer will be set. + + This determines same-day vs future-dated settlement timing. If not set, defaults + to a `settlement_schedule` of `same_day`. If set, exactly one of the child + attributes must be set. + """ + return_: Optional[Return] = FieldInfo(alias="return", default=None) """If your transfer is returned, this will contain details of the return.""" routing_number: str """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" + settlement: Optional[Settlement] = None + """ + A subhash containing information about when and how the transfer settled at the + Federal Reserve. + """ + standard_entry_class_code: Literal[ "corporate_credit_or_debit", "corporate_trade_exchange", "prearranged_payments_and_deposit", "internet_initiated", ] - """The Standard Entry Class (SEC) code to use for the transfer. + """ + The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the transfer. - - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). - - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). - - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). - - `internet_initiated` - Internet Initiated (WEB). + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. """ statement_descriptor: str @@ -618,26 +874,29 @@ class ACHTransfer(BaseModel): status: Literal[ "pending_approval", + "pending_transfer_session_confirmation", "canceled", - "pending_reviewing", "pending_submission", - "submitted", - "returned", + "pending_reviewing", "requires_attention", "rejected", + "submitted", + "returned", ] """The lifecycle status of the transfer. - `pending_approval` - The transfer is pending approval. + - `pending_transfer_session_confirmation` - The transfer belongs to a Transfer + Session that is pending confirmation. - `canceled` - The transfer has been canceled. - - `pending_reviewing` - The transfer is pending review by Increase. - `pending_submission` - The transfer is pending submission to the Federal Reserve. - - `submitted` - The transfer is complete. - - `returned` - The transfer has been returned. + - `pending_reviewing` - The transfer is pending review by Increase. - `requires_attention` - The transfer requires attention from an Increase operator. - `rejected` - The transfer has been rejected. + - `submitted` - The transfer is complete. + - `returned` - The transfer has been returned. """ submission: Optional[Submission] = None @@ -657,3 +916,15 @@ class ACHTransfer(BaseModel): For this resource it will always be `ach_transfer`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/ach_transfer_create_params.py b/src/increase/types/ach_transfer_create_params.py index 8863bd89d..2b795a738 100644 --- a/src/increase/types/ach_transfer_create_params.py +++ b/src/increase/types/ach_transfer_create_params.py @@ -2,8 +2,8 @@ from __future__ import annotations +import datetime from typing import Union, Iterable -from datetime import date from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo @@ -15,6 +15,7 @@ "AddendaFreeformEntry", "AddendaPaymentOrderRemittanceAdvice", "AddendaPaymentOrderRemittanceAdviceInvoice", + "PreferredEffectiveDate", ] @@ -23,7 +24,7 @@ class ACHTransferCreateParams(TypedDict, total=False): """The Increase identifier for the account that will send the transfer.""" amount: Required[int] - """The transfer amount in cents. + """The transfer amount in USD cents. A positive amount originates a credit transfer pushing funds to the receiving account. A negative amount originates a debit transfer pulling funds from the @@ -63,9 +64,10 @@ class ACHTransferCreateParams(TypedDict, total=False): """ company_entry_description: str - """A description of the transfer. - - This is included in the transfer data sent to the receiving bank. + """ + A description of the transfer, included in the transfer data sent to the + receiving bank. Standardized formatting may be required, for example `PAYROLL` + for payroll-related Prearranged Payments and Deposits (PPD) credit transfers. """ company_name: str @@ -84,12 +86,6 @@ class ACHTransferCreateParams(TypedDict, total=False): - `unknown` - It's unknown what kind of entity owns the External Account. """ - effective_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] - """ - The transfer effective date in - [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - """ - external_account_id: str """The ID of an External Account to initiate a transfer to. @@ -97,11 +93,12 @@ class ACHTransferCreateParams(TypedDict, total=False): must be absent. """ - funding: Literal["checking", "savings"] + funding: Literal["checking", "savings", "general_ledger"] """The type of the account to which the transfer will be sent. - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A bank's general ledger. Uncommon. """ individual_id: str @@ -113,6 +110,14 @@ class ACHTransferCreateParams(TypedDict, total=False): This value is informational and not verified by the recipient's bank. """ + preferred_effective_date: PreferredEffectiveDate + """Configuration for how the effective date of the transfer will be set. + + This determines same-day vs future-dated settlement timing. If not set, defaults + to a `settlement_schedule` of `same_day`. If set, exactly one of the child + attributes must be set. + """ + require_approval: bool """Whether the transfer requires explicit approval via the dashboard or API.""" @@ -128,12 +133,30 @@ class ACHTransferCreateParams(TypedDict, total=False): "prearranged_payments_and_deposit", "internet_initiated", ] - """The Standard Entry Class (SEC) code to use for the transfer. + """ + The + [Standard Entry Class (SEC) code](/documentation/ach-standard-entry-class-codes) + to use for the transfer. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD) is used for + business-to-business payments. + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX) allows for + including extensive remittance information with business-to-business payments. + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD) + is used for credits or debits originated by an organization to a consumer, + such as payroll direct deposits. + - `internet_initiated` - Internet Initiated (WEB) is used for consumer payments + initiated or authorized via the Internet. Debits can only be initiated by + non-consumers to debit a consumer’s account. Credits can only be used for + consumer to consumer transactions. + """ + + transaction_timing: Literal["synchronous", "asynchronous"] + """The timing of the transaction. - - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). - - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). - - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). - - `internet_initiated` - Internet Initiated (WEB). + - `synchronous` - A Transaction will be created immediately. + - `asynchronous` - A Transaction will be created when the funds settle at the + Federal Reserve. """ @@ -143,11 +166,18 @@ class AddendaFreeformEntry(TypedDict, total=False): class AddendaFreeform(TypedDict, total=False): + """Unstructured `payment_related_information` passed through with the transfer. + + Required if and only if `category` is `freeform`. + """ + entries: Required[Iterable[AddendaFreeformEntry]] """Each entry represents an addendum sent with the transfer. - Please reach out to [support@increase.com](mailto:support@increase.com) to send - more than one addendum. + In general, you should send at most one addendum–most ACH recipients cannot + access beyond the first 80 characters sent. Please reach out to + [support@increase.com](mailto:support@increase.com) to send 2 or more addenda to + a recipient expecting a specific addendum format. """ @@ -163,11 +193,21 @@ class AddendaPaymentOrderRemittanceAdviceInvoice(TypedDict, total=False): class AddendaPaymentOrderRemittanceAdvice(TypedDict, total=False): + """Structured ASC X12 820 remittance advice records. + + Please reach out to [support@increase.com](mailto:support@increase.com) for more information. Required if and only if `category` is `payment_order_remittance_advice`. + """ + invoices: Required[Iterable[AddendaPaymentOrderRemittanceAdviceInvoice]] """ASC X12 RMR records for this specific transfer.""" class Addenda(TypedDict, total=False): + """Additional information that will be sent to the recipient. + + This is included in the transfer data sent to the receiving bank. + """ + category: Required[Literal["freeform", "payment_order_remittance_advice"]] """The type of addenda to pass with the transfer. @@ -179,11 +219,40 @@ class Addenda(TypedDict, total=False): """ freeform: AddendaFreeform - """Unstructured `payment_related_information` passed through with the transfer.""" + """Unstructured `payment_related_information` passed through with the transfer. + + Required if and only if `category` is `freeform`. + """ payment_order_remittance_advice: AddendaPaymentOrderRemittanceAdvice """Structured ASC X12 820 remittance advice records. Please reach out to [support@increase.com](mailto:support@increase.com) for more - information. + information. Required if and only if `category` is + `payment_order_remittance_advice`. + """ + + +class PreferredEffectiveDate(TypedDict, total=False): + """Configuration for how the effective date of the transfer will be set. + + This determines same-day vs future-dated settlement timing. If not set, defaults to a `settlement_schedule` of `same_day`. If set, exactly one of the child attributes must be set. + """ + + date: Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")] + """ + A specific date in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format to + use as the effective date when submitting this transfer. + """ + + settlement_schedule: Literal["same_day", "future_dated"] + """A schedule by which Increase will choose an effective date for the transfer. + + - `same_day` - The chosen effective date will be the same as the ACH processing + date on which the transfer is submitted. This is necessary, but not sufficient + for the transfer to be settled same-day: it must also be submitted before the + last same-day cutoff and be less than or equal to $1,000.000.00. + - `future_dated` - The chosen effective date will be the business day following + the ACH processing date on which the transfer is submitted. The transfer will + be settled on that future day. """ diff --git a/src/increase/types/ach_transfer_list_params.py b/src/increase/types/ach_transfer_list_params.py index f9d5b4c7f..49d621b90 100644 --- a/src/increase/types/ach_transfer_list_params.py +++ b/src/increase/types/ach_transfer_list_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["ACHTransferListParams", "CreatedAt"] +__all__ = ["ACHTransferListParams", "CreatedAt", "Status"] class ACHTransferListParams(TypedDict, total=False): @@ -37,6 +37,8 @@ class ACHTransferListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ + status: Status + class CreatedAt(TypedDict, total=False): after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] @@ -62,3 +64,28 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[ + Literal[ + "pending_approval", + "pending_transfer_session_confirmation", + "canceled", + "pending_submission", + "pending_reviewing", + "requires_attention", + "rejected", + "submitted", + "returned", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/balance_lookup.py b/src/increase/types/balance_lookup.py index 94b09f413..53ca19549 100644 --- a/src/increase/types/balance_lookup.py +++ b/src/increase/types/balance_lookup.py @@ -1,13 +1,35 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional +from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -__all__ = ["BalanceLookup"] +__all__ = ["BalanceLookup", "Loan"] + + +class Loan(BaseModel): + """The loan balances for the Account.""" + + due_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the loan + payment is due. + """ + + due_balance: int + """The total amount due on the loan.""" + + past_due_balance: int + """The amount past due on the loan.""" class BalanceLookup(BaseModel): + """ + Represents a request to lookup the balance of an Account at a given point in time. + """ + account_id: str """The identifier for the account for which the balance was queried.""" @@ -23,6 +45,9 @@ class BalanceLookup(BaseModel): on the Account. """ + loan: Optional[Loan] = None + """The loan balances for the Account.""" + type: Literal["balance_lookup"] """A constant representing the object's type. diff --git a/src/increase/types/entities/beneficial_owner_create_params.py b/src/increase/types/beneficial_owner_create_params.py similarity index 68% rename from src/increase/types/entities/beneficial_owner_create_params.py rename to src/increase/types/beneficial_owner_create_params.py index 1aee87eff..36ed82d9f 100644 --- a/src/increase/types/entities/beneficial_owner_create_params.py +++ b/src/increase/types/beneficial_owner_create_params.py @@ -6,52 +6,71 @@ from datetime import date from typing_extensions import Literal, Required, Annotated, TypedDict -from ..._utils import PropertyInfo +from .._utils import PropertyInfo __all__ = [ "BeneficialOwnerCreateParams", - "BeneficialOwner", - "BeneficialOwnerIndividual", - "BeneficialOwnerIndividualAddress", - "BeneficialOwnerIndividualIdentification", - "BeneficialOwnerIndividualIdentificationDriversLicense", - "BeneficialOwnerIndividualIdentificationOther", - "BeneficialOwnerIndividualIdentificationPassport", + "Individual", + "IndividualAddress", + "IndividualIdentification", + "IndividualIdentificationDriversLicense", + "IndividualIdentificationOther", + "IndividualIdentificationPassport", ] class BeneficialOwnerCreateParams(TypedDict, total=False): - beneficial_owner: Required[BeneficialOwner] - """ - The identifying details of anyone controlling or owning 25% or more of the - corporation. - """ - entity_id: Required[str] """The identifier of the Entity to associate with the new Beneficial Owner.""" + individual: Required[Individual] + """Personal details for the beneficial owner.""" + + prongs: Required[List[Literal["ownership", "control"]]] + """Why this person is considered a beneficial owner of the entity. + + At least one option is required, if a person is both a control person and owner, + submit an array containing both. + """ + + company_title: str + """This person's role or title within the entity.""" + + +class IndividualAddress(TypedDict, total=False): + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ -class BeneficialOwnerIndividualAddress(TypedDict, total=False): city: Required[str] - """The city of the address.""" + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: Required[str] """The first line of the address. This is usually the street number and street.""" - state: Required[str] + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. """ - zip: Required[str] - """The ZIP code of the address.""" + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" - line2: str - """The second line of the address. This might be the floor or room number.""" +class IndividualIdentificationDriversLicense(TypedDict, total=False): + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ -class BeneficialOwnerIndividualIdentificationDriversLicense(TypedDict, total=False): expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The driver's license's expiration date in YYYY-MM-DD format.""" @@ -65,11 +84,16 @@ class BeneficialOwnerIndividualIdentificationDriversLicense(TypedDict, total=Fal """The identifier of the File containing the back of the driver's license.""" -class BeneficialOwnerIndividualIdentificationOther(TypedDict, total=False): +class IndividualIdentificationOther(TypedDict, total=False): + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + country: Required[str] """ The two-character ISO 3166-1 code representing the country that issued the - document. + document (e.g., `US`). """ description: Required[str] @@ -88,9 +112,17 @@ class BeneficialOwnerIndividualIdentificationOther(TypedDict, total=False): """The document's expiration date in YYYY-MM-DD format.""" -class BeneficialOwnerIndividualIdentificationPassport(TypedDict, total=False): +class IndividualIdentificationPassport(TypedDict, total=False): + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ + country: Required[str] - """The country that issued the passport.""" + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The passport's expiration date in YYYY-MM-DD format.""" @@ -99,7 +131,9 @@ class BeneficialOwnerIndividualIdentificationPassport(TypedDict, total=False): """The identifier of the File containing the passport.""" -class BeneficialOwnerIndividualIdentification(TypedDict, total=False): +class IndividualIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """A means of verifying the person's identity.""" + method: Required[ Literal[ "social_security_number", @@ -125,27 +159,29 @@ class BeneficialOwnerIndividualIdentification(TypedDict, total=False): such as a social security number. """ - drivers_license: BeneficialOwnerIndividualIdentificationDriversLicense + drivers_license: IndividualIdentificationDriversLicense """Information about the United States driver's license used for identification. Required if `method` is equal to `drivers_license`. """ - other: BeneficialOwnerIndividualIdentificationOther + other: IndividualIdentificationOther """Information about the identification document provided. Required if `method` is equal to `other`. """ - passport: BeneficialOwnerIndividualIdentificationPassport + passport: IndividualIdentificationPassport """Information about the passport used for identification. Required if `method` is equal to `passport`. """ -class BeneficialOwnerIndividual(TypedDict, total=False): - address: Required[BeneficialOwnerIndividualAddress] +class Individual(TypedDict, total=False): + """Personal details for the beneficial owner.""" + + address: Required[IndividualAddress] """The individual's physical address. Mail receiving locations like PO Boxes and PMB's are disallowed. @@ -154,7 +190,7 @@ class BeneficialOwnerIndividual(TypedDict, total=False): date_of_birth: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The person's date of birth in YYYY-MM-DD format.""" - identification: Required[BeneficialOwnerIndividualIdentification] + identification: Required[IndividualIdentification] """A means of verifying the person's identity.""" name: Required[str] @@ -167,18 +203,3 @@ class BeneficialOwnerIndividual(TypedDict, total=False): tax id (either a Social Security Number or Individual Taxpayer Identification Number). """ - - -class BeneficialOwner(TypedDict, total=False): - individual: Required[BeneficialOwnerIndividual] - """Personal details for the beneficial owner.""" - - prongs: Required[List[Literal["ownership", "control"]]] - """Why this person is considered a beneficial owner of the entity. - - At least one option is required, if a person is both a control person and owner, - submit an array containing both. - """ - - company_title: str - """This person's role or title within the entity.""" diff --git a/src/increase/types/proof_of_authorization_request_submission_list_params.py b/src/increase/types/beneficial_owner_list_params.py similarity index 67% rename from src/increase/types/proof_of_authorization_request_submission_list_params.py rename to src/increase/types/beneficial_owner_list_params.py index a79a2fb1d..362677638 100644 --- a/src/increase/types/proof_of_authorization_request_submission_list_params.py +++ b/src/increase/types/beneficial_owner_list_params.py @@ -2,12 +2,18 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing_extensions import Required, TypedDict -__all__ = ["ProofOfAuthorizationRequestSubmissionListParams"] +__all__ = ["BeneficialOwnerListParams"] -class ProofOfAuthorizationRequestSubmissionListParams(TypedDict, total=False): +class BeneficialOwnerListParams(TypedDict, total=False): + entity_id: Required[str] + """The identifier of the Entity to list beneficial owners for. + + Only `corporation` entities have beneficial owners. + """ + cursor: str """Return the page of entries after this one.""" @@ -24,6 +30,3 @@ class ProofOfAuthorizationRequestSubmissionListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ - - proof_of_authorization_request_id: str - """ID of the proof of authorization request.""" diff --git a/src/increase/types/beneficial_owner_update_params.py b/src/increase/types/beneficial_owner_update_params.py new file mode 100644 index 000000000..5312d8745 --- /dev/null +++ b/src/increase/types/beneficial_owner_update_params.py @@ -0,0 +1,181 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = [ + "BeneficialOwnerUpdateParams", + "Address", + "Identification", + "IdentificationDriversLicense", + "IdentificationOther", + "IdentificationPassport", +] + + +class BeneficialOwnerUpdateParams(TypedDict, total=False): + address: Address + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + confirmed_no_us_tax_id: bool + """ + The identification method for an individual can only be a passport, driver's + license, or other document if you've confirmed the individual does not have a US + tax id (either a Social Security Number or Individual Taxpayer Identification + Number). + """ + + identification: Identification + """A means of verifying the person's identity.""" + + name: str + """The individual's legal name.""" + + +class Address(TypedDict, total=False): + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + city: Required[str] + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str + """ + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. + """ + + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" + + +class IdentificationDriversLicense(TypedDict, total=False): + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ + + expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """The driver's license's expiration date in YYYY-MM-DD format.""" + + file_id: Required[str] + """The identifier of the File containing the front of the driver's license.""" + + state: Required[str] + """The state that issued the provided driver's license.""" + + back_file_id: str + """The identifier of the File containing the back of the driver's license.""" + + +class IdentificationOther(TypedDict, total=False): + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + + country: Required[str] + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ + + description: Required[str] + """A description of the document submitted.""" + + file_id: Required[str] + """The identifier of the File containing the front of the document.""" + + back_file_id: str + """The identifier of the File containing the back of the document. + + Not every document has a reverse side. + """ + + expiration_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """The document's expiration date in YYYY-MM-DD format.""" + + +class IdentificationPassport(TypedDict, total=False): + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ + + country: Required[str] + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ + + expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """The passport's expiration date in YYYY-MM-DD format.""" + + file_id: Required[str] + """The identifier of the File containing the passport.""" + + +class Identification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """A means of verifying the person's identity.""" + + method: Required[ + Literal[ + "social_security_number", + "individual_taxpayer_identification_number", + "passport", + "drivers_license", + "other", + ] + ] + """A method that can be used to verify the individual's identity. + + - `social_security_number` - A social security number. + - `individual_taxpayer_identification_number` - An individual taxpayer + identification number (ITIN). + - `passport` - A passport number. + - `drivers_license` - A driver's license number. + - `other` - Another identifying document. + """ + + number: Required[str] + """ + An identification number that can be used to verify the individual's identity, + such as a social security number. + """ + + drivers_license: IdentificationDriversLicense + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ + + other: IdentificationOther + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + + passport: IdentificationPassport + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ diff --git a/src/increase/types/bookkeeping_account.py b/src/increase/types/bookkeeping_account.py index fbe1f0239..b33b8f61b 100644 --- a/src/increase/types/bookkeeping_account.py +++ b/src/increase/types/bookkeeping_account.py @@ -9,6 +9,11 @@ class BookkeepingAccount(BaseModel): + """Accounts are T-accounts. + + They can store accounting entries. Your compliance setup might require annotating money movements using this API. Learn more in our [guide to Bookkeeping](https://increase.com/documentation/bookkeeping#bookkeeping). + """ + id: str """The account identifier.""" diff --git a/src/increase/types/bookkeeping_account_create_params.py b/src/increase/types/bookkeeping_account_create_params.py index d7b472c0a..5c974fcbb 100644 --- a/src/increase/types/bookkeeping_account_create_params.py +++ b/src/increase/types/bookkeeping_account_create_params.py @@ -12,7 +12,7 @@ class BookkeepingAccountCreateParams(TypedDict, total=False): """The name you choose for the account.""" account_id: str - """The entity, if `compliance_category` is `commingled_cash`.""" + """The account, if `compliance_category` is `commingled_cash`.""" compliance_category: Literal["commingled_cash", "customer_balance"] """The account compliance category. diff --git a/src/increase/types/bookkeeping_balance_lookup.py b/src/increase/types/bookkeeping_balance_lookup.py index 71ff0385b..e41891c38 100644 --- a/src/increase/types/bookkeeping_balance_lookup.py +++ b/src/increase/types/bookkeeping_balance_lookup.py @@ -8,6 +8,10 @@ class BookkeepingBalanceLookup(BaseModel): + """ + Represents a request to lookup the balance of a Bookkeeping Account at a given point in time. + """ + balance: int """ The Bookkeeping Account's current balance, representing the sum of all diff --git a/src/increase/types/bookkeeping_entry.py b/src/increase/types/bookkeeping_entry.py index ffcd2ab5a..5ccd70acb 100644 --- a/src/increase/types/bookkeeping_entry.py +++ b/src/increase/types/bookkeeping_entry.py @@ -9,6 +9,11 @@ class BookkeepingEntry(BaseModel): + """Entries are T-account entries recording debits and credits. + + Your compliance setup might require annotating money movements using this API. Learn more in our [guide to Bookkeeping](https://increase.com/documentation/bookkeeping#bookkeeping). + """ + id: str """The entry identifier.""" @@ -25,7 +30,7 @@ class BookkeepingEntry(BaseModel): """When the entry set was created.""" entry_set_id: str - """The identifier for the Account the Entry belongs to.""" + """The identifier for the Entry Set the Entry belongs to.""" type: Literal["bookkeeping_entry"] """A constant representing the object's type. diff --git a/src/increase/types/bookkeeping_entry_list_params.py b/src/increase/types/bookkeeping_entry_list_params.py index c0550e5aa..243b9bf9e 100644 --- a/src/increase/types/bookkeeping_entry_list_params.py +++ b/src/increase/types/bookkeeping_entry_list_params.py @@ -8,6 +8,9 @@ class BookkeepingEntryListParams(TypedDict, total=False): + account_id: str + """The identifier for the Bookkeeping Account to filter by.""" + cursor: str """Return the page of entries after this one.""" diff --git a/src/increase/types/bookkeeping_entry_set.py b/src/increase/types/bookkeeping_entry_set.py index d83ecd71f..4b6760f05 100644 --- a/src/increase/types/bookkeeping_entry_set.py +++ b/src/increase/types/bookkeeping_entry_set.py @@ -21,6 +21,11 @@ class Entry(BaseModel): class BookkeepingEntrySet(BaseModel): + """Entry Sets are accounting entries that are transactionally applied. + + Your compliance setup might require annotating money movements using this API. Learn more in our [guide to Bookkeeping](https://increase.com/documentation/bookkeeping#bookkeeping). + """ + id: str """The entry set identifier.""" diff --git a/src/increase/types/card.py b/src/increase/types/card.py index 6e96d690b..4c412672a 100644 --- a/src/increase/types/card.py +++ b/src/increase/types/card.py @@ -1,15 +1,220 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["Card", "BillingAddress", "DigitalWallet"] +__all__ = [ + "Card", + "AuthorizationControls", + "AuthorizationControlsMerchantAcceptorIdentifier", + "AuthorizationControlsMerchantAcceptorIdentifierAllowed", + "AuthorizationControlsMerchantAcceptorIdentifierBlocked", + "AuthorizationControlsMerchantCategoryCode", + "AuthorizationControlsMerchantCategoryCodeAllowed", + "AuthorizationControlsMerchantCategoryCodeBlocked", + "AuthorizationControlsMerchantCountry", + "AuthorizationControlsMerchantCountryAllowed", + "AuthorizationControlsMerchantCountryBlocked", + "AuthorizationControlsUsage", + "AuthorizationControlsUsageMultiUse", + "AuthorizationControlsUsageMultiUseSpendingLimit", + "AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode", + "AuthorizationControlsUsageSingleUse", + "AuthorizationControlsUsageSingleUseSettlementAmount", + "BillingAddress", + "DigitalWallet", +] + + +class AuthorizationControlsMerchantAcceptorIdentifierAllowed(BaseModel): + identifier: str + """The Merchant Acceptor ID.""" + + +class AuthorizationControlsMerchantAcceptorIdentifierBlocked(BaseModel): + identifier: str + """The Merchant Acceptor ID.""" + + +class AuthorizationControlsMerchantAcceptorIdentifier(BaseModel): + """ + Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this card. + """ + + allowed: Optional[List[AuthorizationControlsMerchantAcceptorIdentifierAllowed]] = None + """The Merchant Acceptor IDs that are allowed for authorizations on this card.""" + + blocked: Optional[List[AuthorizationControlsMerchantAcceptorIdentifierBlocked]] = None + """The Merchant Acceptor IDs that are blocked for authorizations on this card.""" + + +class AuthorizationControlsMerchantCategoryCodeAllowed(BaseModel): + code: str + """The Merchant Category Code (MCC).""" + + +class AuthorizationControlsMerchantCategoryCodeBlocked(BaseModel): + code: str + """The Merchant Category Code (MCC).""" + + +class AuthorizationControlsMerchantCategoryCode(BaseModel): + """ + Restricts which Merchant Category Codes are allowed or blocked for authorizations on this card. + """ + + allowed: Optional[List[AuthorizationControlsMerchantCategoryCodeAllowed]] = None + """The Merchant Category Codes that are allowed for authorizations on this card.""" + + blocked: Optional[List[AuthorizationControlsMerchantCategoryCodeBlocked]] = None + """The Merchant Category Codes that are blocked for authorizations on this card.""" + + +class AuthorizationControlsMerchantCountryAllowed(BaseModel): + country: str + """The ISO 3166-1 alpha-2 country code.""" + + +class AuthorizationControlsMerchantCountryBlocked(BaseModel): + country: str + """The ISO 3166-1 alpha-2 country code.""" + + +class AuthorizationControlsMerchantCountry(BaseModel): + """ + Restricts which merchant countries are allowed or blocked for authorizations on this card. + """ + + allowed: Optional[List[AuthorizationControlsMerchantCountryAllowed]] = None + """The merchant countries that are allowed for authorizations on this card.""" + + blocked: Optional[List[AuthorizationControlsMerchantCountryBlocked]] = None + """The merchant countries that are blocked for authorizations on this card.""" + + +class AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode(BaseModel): + code: str + """The Merchant Category Code (MCC).""" + + +class AuthorizationControlsUsageMultiUseSpendingLimit(BaseModel): + interval: Literal["all_time", "per_transaction", "per_day", "per_week", "per_month"] + """The interval at which the spending limit is enforced. + + - `all_time` - The spending limit applies over the lifetime of the card. + - `per_transaction` - The spending limit applies per transaction. + - `per_day` - The spending limit applies per day. Resets nightly at midnight + UTC. + - `per_week` - The spending limit applies per week. Resets weekly on Mondays at + midnight UTC. + - `per_month` - The spending limit applies per month. Resets on the first of the + month, midnight UTC. + """ + + merchant_category_codes: Optional[List[AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode]] = None + """The Merchant Category Codes (MCCs) this spending limit applies to. + + If not set, the limit applies to all transactions. + """ + + settlement_amount: int + """The maximum settlement amount permitted in the given interval.""" + + +class AuthorizationControlsUsageMultiUse(BaseModel): + """Controls for multi-use cards. + + Required if and only if `category` is `multi_use`. + """ + + spending_limits: Optional[List[AuthorizationControlsUsageMultiUseSpendingLimit]] = None + """Spending limits for this card. + + The most restrictive limit applies if multiple limits match. + """ + + +class AuthorizationControlsUsageSingleUseSettlementAmount(BaseModel): + """The settlement amount constraint for this single-use card.""" + + comparison: Literal["equals", "less_than_or_equals"] + """The operator used to compare the settlement amount. + + - `equals` - The settlement amount must be exactly the specified value. + - `less_than_or_equals` - The settlement amount must be less than or equal to + the specified value. + """ + + value: int + """The settlement amount value.""" + + +class AuthorizationControlsUsageSingleUse(BaseModel): + """Controls for single-use cards. + + Required if and only if `category` is `single_use`. + """ + + settlement_amount: AuthorizationControlsUsageSingleUseSettlementAmount + """The settlement amount constraint for this single-use card.""" + + +class AuthorizationControlsUsage(BaseModel): + """Controls how many times this card can be used.""" + + category: Literal["single_use", "multi_use"] + """Whether the card is for a single use or multiple uses. + + - `single_use` - The card can only be used for a single authorization. + - `multi_use` - The card can be used for multiple authorizations. + """ + + multi_use: Optional[AuthorizationControlsUsageMultiUse] = None + """Controls for multi-use cards. + + Required if and only if `category` is `multi_use`. + """ + + single_use: Optional[AuthorizationControlsUsageSingleUse] = None + """Controls for single-use cards. + + Required if and only if `category` is `single_use`. + """ + + +class AuthorizationControls(BaseModel): + """Controls that restrict how this card can be used.""" + + merchant_acceptor_identifier: Optional[AuthorizationControlsMerchantAcceptorIdentifier] = None + """ + Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations + on this card. + """ + + merchant_category_code: Optional[AuthorizationControlsMerchantCategoryCode] = None + """ + Restricts which Merchant Category Codes are allowed or blocked for + authorizations on this card. + """ + + merchant_country: Optional[AuthorizationControlsMerchantCountry] = None + """ + Restricts which merchant countries are allowed or blocked for authorizations on + this card. + """ + + usage: Optional[AuthorizationControlsUsage] = None + """Controls how many times this card can be used.""" class BillingAddress(BaseModel): + """The Card's billing address.""" + city: Optional[str] = None """The city of the billing address.""" @@ -27,6 +232,10 @@ class BillingAddress(BaseModel): class DigitalWallet(BaseModel): + """ + The contact information used in the two-factor steps for digital wallet card creation. At least one field must be present to complete the digital wallet steps. + """ + digital_card_profile_id: Optional[str] = None """The digital card profile assigned to this digital card. @@ -47,12 +256,20 @@ class DigitalWallet(BaseModel): class Card(BaseModel): + """Cards may operate on credit, debit or prepaid BINs. + + They’ll immediately work for online purchases after you create them. All cards work on a good funds model, and maintain a maximum limit of 100% of the Account’s available balance at the time of transaction. Funds are deducted from the Account upon transaction settlement. + """ + id: str """The card identifier.""" account_id: str """The identifier for the account this card belongs to.""" + authorization_controls: Optional[AuthorizationControls] = None + """Controls that restrict how this card can be used.""" + billing_address: BillingAddress """The Card's billing address.""" @@ -105,3 +322,15 @@ class Card(BaseModel): For this resource it will always be `card`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/card_create_details_iframe_params.py b/src/increase/types/card_create_details_iframe_params.py new file mode 100644 index 000000000..1aeb3786f --- /dev/null +++ b/src/increase/types/card_create_details_iframe_params.py @@ -0,0 +1,15 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CardCreateDetailsIframeParams"] + + +class CardCreateDetailsIframeParams(TypedDict, total=False): + physical_card_id: str + """The identifier of the Physical Card to create an iframe for. + + This will inform the appearance of the card rendered in the iframe. + """ diff --git a/src/increase/types/card_create_params.py b/src/increase/types/card_create_params.py index c86269dcb..be5832eb0 100644 --- a/src/increase/types/card_create_params.py +++ b/src/increase/types/card_create_params.py @@ -2,15 +2,39 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict -__all__ = ["CardCreateParams", "BillingAddress", "DigitalWallet"] +__all__ = [ + "CardCreateParams", + "AuthorizationControls", + "AuthorizationControlsMerchantAcceptorIdentifier", + "AuthorizationControlsMerchantAcceptorIdentifierAllowed", + "AuthorizationControlsMerchantAcceptorIdentifierBlocked", + "AuthorizationControlsMerchantCategoryCode", + "AuthorizationControlsMerchantCategoryCodeAllowed", + "AuthorizationControlsMerchantCategoryCodeBlocked", + "AuthorizationControlsMerchantCountry", + "AuthorizationControlsMerchantCountryAllowed", + "AuthorizationControlsMerchantCountryBlocked", + "AuthorizationControlsUsage", + "AuthorizationControlsUsageMultiUse", + "AuthorizationControlsUsageMultiUseSpendingLimit", + "AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode", + "AuthorizationControlsUsageSingleUse", + "AuthorizationControlsUsageSingleUseSettlementAmount", + "BillingAddress", + "DigitalWallet", +] class CardCreateParams(TypedDict, total=False): account_id: Required[str] """The Account the card should belong to.""" + authorization_controls: AuthorizationControls + """Controls that restrict how this card can be used.""" + billing_address: BillingAddress """The card's billing address.""" @@ -34,7 +58,208 @@ class CardCreateParams(TypedDict, total=False): """ +class AuthorizationControlsMerchantAcceptorIdentifierAllowed(TypedDict, total=False): + identifier: Required[str] + """The Merchant Acceptor ID.""" + + +class AuthorizationControlsMerchantAcceptorIdentifierBlocked(TypedDict, total=False): + identifier: Required[str] + """The Merchant Acceptor ID.""" + + +class AuthorizationControlsMerchantAcceptorIdentifier(TypedDict, total=False): + """ + Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this card. + """ + + allowed: Iterable[AuthorizationControlsMerchantAcceptorIdentifierAllowed] + """The Merchant Acceptor IDs that are allowed for authorizations on this card. + + Authorizations with Merchant Acceptor IDs not in this list will be declined. + """ + + blocked: Iterable[AuthorizationControlsMerchantAcceptorIdentifierBlocked] + """The Merchant Acceptor IDs that are blocked for authorizations on this card. + + Authorizations with Merchant Acceptor IDs in this list will be declined. + """ + + +class AuthorizationControlsMerchantCategoryCodeAllowed(TypedDict, total=False): + code: Required[str] + """The Merchant Category Code.""" + + +class AuthorizationControlsMerchantCategoryCodeBlocked(TypedDict, total=False): + code: Required[str] + """The Merchant Category Code.""" + + +class AuthorizationControlsMerchantCategoryCode(TypedDict, total=False): + """ + Restricts which Merchant Category Codes are allowed or blocked for authorizations on this card. + """ + + allowed: Iterable[AuthorizationControlsMerchantCategoryCodeAllowed] + """The Merchant Category Codes that are allowed for authorizations on this card. + + Authorizations with Merchant Category Codes not in this list will be declined. + """ + + blocked: Iterable[AuthorizationControlsMerchantCategoryCodeBlocked] + """The Merchant Category Codes that are blocked for authorizations on this card. + + Authorizations with Merchant Category Codes in this list will be declined. + """ + + +class AuthorizationControlsMerchantCountryAllowed(TypedDict, total=False): + country: Required[str] + """The ISO 3166-1 alpha-2 country code.""" + + +class AuthorizationControlsMerchantCountryBlocked(TypedDict, total=False): + country: Required[str] + """The ISO 3166-1 alpha-2 country code.""" + + +class AuthorizationControlsMerchantCountry(TypedDict, total=False): + """ + Restricts which merchant countries are allowed or blocked for authorizations on this card. + """ + + allowed: Iterable[AuthorizationControlsMerchantCountryAllowed] + """The merchant countries that are allowed for authorizations on this card. + + Authorizations with merchant countries not in this list will be declined. + """ + + blocked: Iterable[AuthorizationControlsMerchantCountryBlocked] + """The merchant countries that are blocked for authorizations on this card. + + Authorizations with merchant countries in this list will be declined. + """ + + +class AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode(TypedDict, total=False): + code: Required[str] + """The Merchant Category Code.""" + + +class AuthorizationControlsUsageMultiUseSpendingLimit(TypedDict, total=False): + interval: Required[Literal["all_time", "per_transaction", "per_day", "per_week", "per_month"]] + """The interval at which the spending limit is enforced. + + - `all_time` - The spending limit applies over the lifetime of the card. + - `per_transaction` - The spending limit applies per transaction. + - `per_day` - The spending limit applies per day. Resets nightly at midnight + UTC. + - `per_week` - The spending limit applies per week. Resets weekly on Mondays at + midnight UTC. + - `per_month` - The spending limit applies per month. Resets on the first of the + month, midnight UTC. + """ + + settlement_amount: Required[int] + """The maximum settlement amount permitted in the given interval.""" + + merchant_category_codes: Iterable[AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode] + """The Merchant Category Codes this spending limit applies to. + + If not set, the limit applies to all transactions. + """ + + +class AuthorizationControlsUsageMultiUse(TypedDict, total=False): + """Controls for multi-use cards. + + Required if and only if `category` is `multi_use`. + """ + + spending_limits: Iterable[AuthorizationControlsUsageMultiUseSpendingLimit] + """Spending limits for this card. + + The most restrictive limit applies if multiple limits match. + """ + + +class AuthorizationControlsUsageSingleUseSettlementAmount(TypedDict, total=False): + """The settlement amount constraint for this single-use card.""" + + comparison: Required[Literal["equals", "less_than_or_equals"]] + """The operator used to compare the settlement amount. + + - `equals` - The settlement amount must be exactly the specified value. + - `less_than_or_equals` - The settlement amount must be less than or equal to + the specified value. + """ + + value: Required[int] + """The settlement amount value.""" + + +class AuthorizationControlsUsageSingleUse(TypedDict, total=False): + """Controls for single-use cards. + + Required if and only if `category` is `single_use`. + """ + + settlement_amount: Required[AuthorizationControlsUsageSingleUseSettlementAmount] + """The settlement amount constraint for this single-use card.""" + + +class AuthorizationControlsUsage(TypedDict, total=False): + """Controls how many times this card can be used.""" + + category: Required[Literal["single_use", "multi_use"]] + """Whether the card is for a single use or multiple uses. + + - `single_use` - The card can only be used for a single authorization. + - `multi_use` - The card can be used for multiple authorizations. + """ + + multi_use: AuthorizationControlsUsageMultiUse + """Controls for multi-use cards. + + Required if and only if `category` is `multi_use`. + """ + + single_use: AuthorizationControlsUsageSingleUse + """Controls for single-use cards. + + Required if and only if `category` is `single_use`. + """ + + +class AuthorizationControls(TypedDict, total=False): + """Controls that restrict how this card can be used.""" + + merchant_acceptor_identifier: AuthorizationControlsMerchantAcceptorIdentifier + """ + Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations + on this card. + """ + + merchant_category_code: AuthorizationControlsMerchantCategoryCode + """ + Restricts which Merchant Category Codes are allowed or blocked for + authorizations on this card. + """ + + merchant_country: AuthorizationControlsMerchantCountry + """ + Restricts which merchant countries are allowed or blocked for authorizations on + this card. + """ + + usage: AuthorizationControlsUsage + """Controls how many times this card can be used.""" + + class BillingAddress(TypedDict, total=False): + """The card's billing address.""" + city: Required[str] """The city of the billing address.""" @@ -52,6 +277,10 @@ class BillingAddress(TypedDict, total=False): class DigitalWallet(TypedDict, total=False): + """ + The contact information used in the two-factor steps for digital wallet card creation. To add the card to a digital wallet, you may supply an email or phone number with this request. Otherwise, subscribe and then action a Real Time Decision with the category `digital_wallet_token_requested` or `digital_wallet_authentication_requested`. + """ + digital_card_profile_id: str """The digital card profile assigned to this digital card.""" diff --git a/src/increase/types/card_details.py b/src/increase/types/card_details.py index 54bb5d619..6fc7caeae 100644 --- a/src/increase/types/card_details.py +++ b/src/increase/types/card_details.py @@ -8,6 +8,10 @@ class CardDetails(BaseModel): + """ + An object containing the sensitive details (card number, CVC, PIN, etc) for a Card. These details are not included in the Card object. If you'd prefer to never access these details directly, you can use the [embedded iframe](/documentation/embedded-card-component) to display the information to your users. + """ + card_id: str """The identifier for the Card for which sensitive details have been returned.""" @@ -17,6 +21,9 @@ class CardDetails(BaseModel): expiration_year: int """The year the card expires in YYYY format (e.g., 2025).""" + pin: str + """The 4-digit PIN for the card, for use with ATMs.""" + primary_account_number: str """The card number.""" diff --git a/src/increase/types/card_dispute.py b/src/increase/types/card_dispute.py index 996d62f38..146616e14 100644 --- a/src/increase/types/card_dispute.py +++ b/src/increase/types/card_dispute.py @@ -1,54 +1,2655 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from datetime import datetime +from typing import List, Optional +from datetime import date, datetime from typing_extensions import Literal from .._models import BaseModel -__all__ = ["CardDispute", "Acceptance", "Rejection"] +__all__ = [ + "CardDispute", + "Loss", + "Visa", + "VisaNetworkEvent", + "VisaNetworkEventAttachmentFile", + "VisaNetworkEventChargebackAccepted", + "VisaNetworkEventChargebackSubmitted", + "VisaNetworkEventChargebackTimedOut", + "VisaNetworkEventMerchantPrearbitrationDeclineSubmitted", + "VisaNetworkEventMerchantPrearbitrationReceived", + "VisaNetworkEventMerchantPrearbitrationReceivedCardholderNoLongerDisputes", + "VisaNetworkEventMerchantPrearbitrationReceivedCompellingEvidence", + "VisaNetworkEventMerchantPrearbitrationReceivedCreditOrReversalProcessed", + "VisaNetworkEventMerchantPrearbitrationReceivedDelayedChargeTransaction", + "VisaNetworkEventMerchantPrearbitrationReceivedEvidenceOfImprint", + "VisaNetworkEventMerchantPrearbitrationReceivedInvalidDispute", + "VisaNetworkEventMerchantPrearbitrationReceivedNonFiatCurrencyOrNonFungibleTokenReceived", + "VisaNetworkEventMerchantPrearbitrationReceivedPriorUndisputedNonFraudTransactions", + "VisaNetworkEventMerchantPrearbitrationTimedOut", + "VisaNetworkEventRepresented", + "VisaNetworkEventRepresentedCardholderNoLongerDisputes", + "VisaNetworkEventRepresentedCreditOrReversalProcessed", + "VisaNetworkEventRepresentedInvalidDispute", + "VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenAsDescribed", + "VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenReceived", + "VisaNetworkEventRepresentedProofOfCashDisbursement", + "VisaNetworkEventRepresentedReversalIssued", + "VisaNetworkEventRepresentmentTimedOut", + "VisaNetworkEventUserPrearbitrationAccepted", + "VisaNetworkEventUserPrearbitrationDeclined", + "VisaNetworkEventUserPrearbitrationSubmitted", + "VisaNetworkEventUserPrearbitrationTimedOut", + "VisaNetworkEventUserWithdrawalSubmitted", + "VisaUserSubmission", + "VisaUserSubmissionAttachmentFile", + "VisaUserSubmissionChargeback", + "VisaUserSubmissionChargebackAuthorization", + "VisaUserSubmissionChargebackConsumerCanceledMerchandise", + "VisaUserSubmissionChargebackConsumerCanceledMerchandiseCardholderCancellation", + "VisaUserSubmissionChargebackConsumerCanceledMerchandiseNotReturned", + "VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturnAttempted", + "VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturned", + "VisaUserSubmissionChargebackConsumerCanceledRecurringTransaction", + "VisaUserSubmissionChargebackConsumerCanceledRecurringTransactionMerchantContactMethods", + "VisaUserSubmissionChargebackConsumerCanceledServices", + "VisaUserSubmissionChargebackConsumerCanceledServicesCardholderCancellation", + "VisaUserSubmissionChargebackConsumerCanceledServicesGuaranteedReservation", + "VisaUserSubmissionChargebackConsumerCanceledServicesOther", + "VisaUserSubmissionChargebackConsumerCanceledServicesTimeshare", + "VisaUserSubmissionChargebackConsumerCounterfeitMerchandise", + "VisaUserSubmissionChargebackConsumerCreditNotProcessed", + "VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandise", + "VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseNotReturned", + "VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted", + "VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentation", + "VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationNotReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturnAttempted", + "VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribed", + "VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturnAttempted", + "VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceived", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayed", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedNotReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedMerchantCancellation", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedNoCancellation", + "VisaUserSubmissionChargebackConsumerNonReceiptOfCash", + "VisaUserSubmissionChargebackConsumerOriginalCreditTransactionNotAccepted", + "VisaUserSubmissionChargebackConsumerQualityMerchandise", + "VisaUserSubmissionChargebackConsumerQualityMerchandiseNotReturned", + "VisaUserSubmissionChargebackConsumerQualityMerchandiseOngoingNegotiations", + "VisaUserSubmissionChargebackConsumerQualityMerchandiseReturnAttempted", + "VisaUserSubmissionChargebackConsumerQualityMerchandiseReturned", + "VisaUserSubmissionChargebackConsumerQualityServices", + "VisaUserSubmissionChargebackConsumerQualityServicesCardholderCancellation", + "VisaUserSubmissionChargebackConsumerQualityServicesOngoingNegotiations", + "VisaUserSubmissionChargebackConsumerServicesMisrepresentation", + "VisaUserSubmissionChargebackConsumerServicesMisrepresentationCardholderCancellation", + "VisaUserSubmissionChargebackConsumerServicesNotAsDescribed", + "VisaUserSubmissionChargebackConsumerServicesNotAsDescribedCardholderCancellation", + "VisaUserSubmissionChargebackConsumerServicesNotReceived", + "VisaUserSubmissionChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaUserSubmissionChargebackConsumerServicesNotReceivedMerchantCancellation", + "VisaUserSubmissionChargebackConsumerServicesNotReceivedNoCancellation", + "VisaUserSubmissionChargebackFraud", + "VisaUserSubmissionChargebackProcessingError", + "VisaUserSubmissionChargebackProcessingErrorDuplicateTransaction", + "VisaUserSubmissionChargebackProcessingErrorIncorrectAmount", + "VisaUserSubmissionChargebackProcessingErrorPaidByOtherMeans", + "VisaUserSubmissionMerchantPrearbitrationDecline", + "VisaUserSubmissionUserPrearbitration", + "VisaUserSubmissionUserPrearbitrationCategoryChange", + "Win", + "Withdrawal", +] -class Acceptance(BaseModel): - accepted_at: datetime +class Loss(BaseModel): + """ + If the Card Dispute's status is `lost`, this will contain details of the lost dispute. + """ + + lost_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Card Dispute was lost. + """ + + reason: Literal["user_withdrawn", "loss"] + """The reason the Card Dispute was lost. + + - `user_withdrawn` - The user withdrew the Card Dispute. + - `loss` - The Card Dispute was lost according to network rules. + """ + + +class VisaNetworkEventAttachmentFile(BaseModel): + file_id: str + """The ID of the file attached to the Card Dispute.""" + + +class VisaNetworkEventChargebackAccepted(BaseModel): + """A Card Dispute Chargeback Accepted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `chargeback_accepted`. Contains the details specific to a chargeback accepted Visa Card Dispute Network Event, which represents that a chargeback has been accepted by the merchant. + """ + + pass + + +class VisaNetworkEventChargebackSubmitted(BaseModel): + """A Card Dispute Chargeback Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `chargeback_submitted`. Contains the details specific to a chargeback submitted Visa Card Dispute Network Event, which represents that a chargeback has been submitted to the network. + """ + + pass + + +class VisaNetworkEventChargebackTimedOut(BaseModel): + """A Card Dispute Chargeback Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `chargeback_timed_out`. Contains the details specific to a chargeback timed out Visa Card Dispute Network Event, which represents that the chargeback has timed out in the user's favor. + """ + + pass + + +class VisaNetworkEventMerchantPrearbitrationDeclineSubmitted(BaseModel): + """ + A Card Dispute Merchant Pre-Arbitration Decline Submitted Visa Network Event object. This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline_submitted`. Contains the details specific to a merchant prearbitration decline submitted Visa Card Dispute Network Event, which represents that the user has declined the merchant's request for a prearbitration request decision in their favor. + """ + + pass + + +class VisaNetworkEventMerchantPrearbitrationReceivedCardholderNoLongerDisputes(BaseModel): + """Cardholder no longer disputes details. + + Present if and only if `reason` is `cardholder_no_longer_disputes`. + """ + + explanation: Optional[str] = None + """ + Explanation for why the merchant believes the cardholder no longer disputes the + transaction. + """ + + +class VisaNetworkEventMerchantPrearbitrationReceivedCompellingEvidence(BaseModel): + """Compelling evidence details. + + Present if and only if `reason` is `compelling_evidence`. + """ + + category: Literal[ + "authorized_signer", + "delivery", + "delivery_at_place_of_employment", + "digital_goods_download", + "dynamic_currency_conversion_actively_chosen", + "flight_manifest_and_purchase_itinerary", + "household_member_signer", + "legitimate_spend_across_payment_types_for_same_merchandise", + "merchandise_use", + "passenger_transport_ticket_use", + "recurring_transaction_with_binding_contract_or_previous_undisputed_transaction", + "signed_delivery_or_pickup_form", + "signed_mail_order_phone_order_form", + "travel_and_expense_loyalty_transaction", + "travel_and_expense_subsequent_purchase", + ] + """The category of compelling evidence provided by the merchant. + + - `authorized_signer` - Authorized signer known by the cardholder. + - `delivery` - Proof of delivery. + - `delivery_at_place_of_employment` - Proof of delivery to cardholder at place + of employment. + - `digital_goods_download` - Proof of digital goods download. + - `dynamic_currency_conversion_actively_chosen` - Dynamic Currency Conversion + actively chosen by cardholder. + - `flight_manifest_and_purchase_itinerary` - Flight manifest with corresponding + purchase itinerary record. + - `household_member_signer` - Signer is member of cardholder's household. + - `legitimate_spend_across_payment_types_for_same_merchandise` - Legitimate + spend across multiple payment types for same merchandise. + - `merchandise_use` - Documentation to prove the cardholder is in possession of + and/or using the merchandise. + - `passenger_transport_ticket_use` - Passenger transport: proof ticket was + received, scanned at gate or other transaction related to original (for + example, frequent flyer miles.) + - `recurring_transaction_with_binding_contract_or_previous_undisputed_transaction` - + Recurring transaction with binding contract or previous undisputed recurring + transactions and proof the cardholder is using the merchandise or service. + - `signed_delivery_or_pickup_form` - Signed delivery form, or copy of/details of + identification from cardholder as proof goods were picked up at merchant + location. + - `signed_mail_order_phone_order_form` - Signed Mail Order/Phone Order form. + - `travel_and_expense_loyalty_transaction` - Travel & Expense: loyalty + transactions related to purchase. + - `travel_and_expense_subsequent_purchase` - Travel & Expense: subsequent + purchases made throughout service period. + """ + + explanation: Optional[str] = None + """Explanation of the compelling evidence provided by the merchant.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedCreditOrReversalProcessed(BaseModel): + """Credit or reversal processed details. + + Present if and only if `reason` is `credit_or_reversal_processed`. + """ + + amount: int + """The amount of the credit or reversal in the minor unit of its currency. + + For dollars, for example, this is cents. + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the credit or + reversal's currency. + """ + + explanation: Optional[str] = None + """Explanation for why the merchant believes the credit or reversal was processed.""" + + processed_at: date + """The date the credit or reversal was processed.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedDelayedChargeTransaction(BaseModel): + """Delayed charge transaction details. + + Present if and only if `reason` is `delayed_charge_transaction`. + """ + + explanation: Optional[str] = None + """Additional details about the delayed charge transaction.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedEvidenceOfImprint(BaseModel): + """Evidence of imprint details. + + Present if and only if `reason` is `evidence_of_imprint`. + """ + + explanation: Optional[str] = None + """Explanation of the evidence of imprint.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedInvalidDispute(BaseModel): + """Invalid dispute details. Present if and only if `reason` is `invalid_dispute`.""" + + explanation: Optional[str] = None + """Explanation for why the dispute is considered invalid by the merchant.""" + + reason: Literal["other", "special_authorization_procedures_followed"] + """The reason a merchant considers the dispute invalid. + + - `other` - Other. + - `special_authorization_procedures_followed` - Special authorization procedures + followed. + """ + + +class VisaNetworkEventMerchantPrearbitrationReceivedNonFiatCurrencyOrNonFungibleTokenReceived(BaseModel): + """Non-fiat currency or non-fungible token received details. + + Present if and only if `reason` is `non_fiat_currency_or_non_fungible_token_received`. + """ + + blockchain_transaction_hash: str + """Blockchain transaction hash.""" + + destination_wallet_address: str + """Destination wallet address.""" + + prior_approved_transactions: Optional[str] = None + """Prior approved transactions.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedPriorUndisputedNonFraudTransactions(BaseModel): + """Prior undisputed non-fraud transactions details. + + Present if and only if `reason` is `prior_undisputed_non_fraud_transactions`. + """ + + explanation: Optional[str] = None + """ + Explanation of the prior undisputed non-fraud transactions provided by the + merchant. + """ + + +class VisaNetworkEventMerchantPrearbitrationReceived(BaseModel): + """A Card Dispute Merchant Pre-Arbitration Received Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_received`. Contains the details specific to a merchant prearbitration received Visa Card Dispute Network Event, which represents that the merchant has issued a prearbitration request in the user's favor. + """ + + cardholder_no_longer_disputes: Optional[ + VisaNetworkEventMerchantPrearbitrationReceivedCardholderNoLongerDisputes + ] = None + """Cardholder no longer disputes details. + + Present if and only if `reason` is `cardholder_no_longer_disputes`. + """ + + compelling_evidence: Optional[VisaNetworkEventMerchantPrearbitrationReceivedCompellingEvidence] = None + """Compelling evidence details. + + Present if and only if `reason` is `compelling_evidence`. + """ + + credit_or_reversal_processed: Optional[VisaNetworkEventMerchantPrearbitrationReceivedCreditOrReversalProcessed] = ( + None + ) + """Credit or reversal processed details. + + Present if and only if `reason` is `credit_or_reversal_processed`. + """ + + delayed_charge_transaction: Optional[VisaNetworkEventMerchantPrearbitrationReceivedDelayedChargeTransaction] = None + """Delayed charge transaction details. + + Present if and only if `reason` is `delayed_charge_transaction`. + """ + + evidence_of_imprint: Optional[VisaNetworkEventMerchantPrearbitrationReceivedEvidenceOfImprint] = None + """Evidence of imprint details. + + Present if and only if `reason` is `evidence_of_imprint`. + """ + + invalid_dispute: Optional[VisaNetworkEventMerchantPrearbitrationReceivedInvalidDispute] = None + """Invalid dispute details. Present if and only if `reason` is `invalid_dispute`.""" + + non_fiat_currency_or_non_fungible_token_received: Optional[ + VisaNetworkEventMerchantPrearbitrationReceivedNonFiatCurrencyOrNonFungibleTokenReceived + ] = None + """Non-fiat currency or non-fungible token received details. + + Present if and only if `reason` is + `non_fiat_currency_or_non_fungible_token_received`. + """ + + prior_undisputed_non_fraud_transactions: Optional[ + VisaNetworkEventMerchantPrearbitrationReceivedPriorUndisputedNonFraudTransactions + ] = None + """Prior undisputed non-fraud transactions details. + + Present if and only if `reason` is `prior_undisputed_non_fraud_transactions`. + """ + + reason: Literal[ + "cardholder_no_longer_disputes", + "compelling_evidence", + "credit_or_reversal_processed", + "delayed_charge_transaction", + "evidence_of_imprint", + "invalid_dispute", + "non_fiat_currency_or_non_fungible_token_received", + "prior_undisputed_non_fraud_transactions", + ] + """The reason the merchant re-presented the dispute. + + - `cardholder_no_longer_disputes` - Cardholder no longer disputes the + transaction. + - `compelling_evidence` - Compelling evidence. + - `credit_or_reversal_processed` - Credit or reversal was processed. + - `delayed_charge_transaction` - Delayed charge transaction. + - `evidence_of_imprint` - Evidence of imprint. + - `invalid_dispute` - Invalid dispute. + - `non_fiat_currency_or_non_fungible_token_received` - Non-fiat currency or + non-fungible token was received by the cardholder. + - `prior_undisputed_non_fraud_transactions` - Prior undisputed non-fraud + transactions. + """ + + +class VisaNetworkEventMerchantPrearbitrationTimedOut(BaseModel): + """A Card Dispute Merchant Pre-Arbitration Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_timed_out`. Contains the details specific to a merchant prearbitration timed out Visa Card Dispute Network Event, which represents that the user has timed out responding to the merchant's prearbitration request. + """ + + pass + + +class VisaNetworkEventRepresentedCardholderNoLongerDisputes(BaseModel): + """Cardholder no longer disputes details. + + Present if and only if `reason` is `cardholder_no_longer_disputes`. + """ + + explanation: Optional[str] = None + """ + Explanation for why the merchant believes the cardholder no longer disputes the + transaction. + """ + + +class VisaNetworkEventRepresentedCreditOrReversalProcessed(BaseModel): + """Credit or reversal processed details. + + Present if and only if `reason` is `credit_or_reversal_processed`. + """ + + amount: int + """The amount of the credit or reversal in the minor unit of its currency. + + For dollars, for example, this is cents. + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the credit or + reversal's currency. + """ + + explanation: Optional[str] = None + """Explanation for why the merchant believes the credit or reversal was processed.""" + + processed_at: date + """The date the credit or reversal was processed.""" + + +class VisaNetworkEventRepresentedInvalidDispute(BaseModel): + """Invalid dispute details. Present if and only if `reason` is `invalid_dispute`.""" + + explanation: Optional[str] = None + """Explanation for why the dispute is considered invalid by the merchant.""" + + reason: Literal[ + "automatic_teller_machine_transaction_proof_provided", + "balance_of_partial_prepayment_not_paid", + "cardholder_canceled_before_expected_merchandise_receipt_date", + "cardholder_canceled_before_expected_services_receipt_date", + "cardholder_canceled_different_date", + "cardholder_did_not_cancel_according_to_policy", + "cardholder_received_merchandise", + "country_code_correct", + "credit_processed_correctly", + "currency_correct", + "dispute_is_for_quality", + "dispute_is_for_visa_cash_back_transaction_portion", + "disputed_amount_is_value_added_tax", + "disputed_amount_is_value_added_tax_no_credit_receipt_provided", + "limited_return_or_cancellation_policy_properly_disclosed", + "merchandise_held_at_cardholder_customs_agency", + "merchandise_matches_description", + "merchandise_not_counterfeit", + "merchandise_not_damaged", + "merchandise_not_defective", + "merchandise_provided_prior_to_cancellation_date", + "merchandise_quality_matches_description", + "merchandise_return_not_attempted", + "merchant_not_notified_of_closed_account", + "name_on_flight_manifest_matches_purchase", + "no_credit_receipt_provided", + "other", + "processing_error_incorrect", + "returned_mechandise_held_at_customs_agency_outside_merchant_country", + "services_match_description", + "services_provided_prior_to_cancellation_date", + "services_used_after_cancellation_date", + "terms_of_service_not_misrepresented", + "transaction_code_correct", + ] + """The reason a merchant considers the dispute invalid. + + - `automatic_teller_machine_transaction_proof_provided` - Automatic Teller + Machine (ATM) transaction proof provided. + - `balance_of_partial_prepayment_not_paid` - Balance of partial prepayment not + paid. + - `cardholder_canceled_before_expected_merchandise_receipt_date` - Cardholder + canceled before expected receipt date of the merchandise. + - `cardholder_canceled_before_expected_services_receipt_date` - Cardholder + canceled before expected receipt date of the services. + - `cardholder_canceled_different_date` - Cardholder canceled on a different date + than claimed. + - `cardholder_did_not_cancel_according_to_policy` - Cardholder received did not + cancel according to policy. + - `cardholder_received_merchandise` - Cardholder received the merchandise. + - `country_code_correct` - Country code is correct. + - `credit_processed_correctly` - Credit was processed correctly. + - `currency_correct` - Currency is correct. + - `dispute_is_for_quality` - Dispute is for quality. + - `dispute_is_for_visa_cash_back_transaction_portion` - Dispute is for Visa Cash + Back transaction portion. + - `disputed_amount_is_value_added_tax` - Disputed amount is Value Added Tax + (VAT). + - `disputed_amount_is_value_added_tax_no_credit_receipt_provided` - Disputed + amount is Value Added Tax (VAT) but no credit receipt was provided by the + cardholder. + - `limited_return_or_cancellation_policy_properly_disclosed` - Limited return or + cancellation policy was properly disclosed. + - `merchandise_held_at_cardholder_customs_agency` - Merchandise held at + cardholder customs agency. + - `merchandise_matches_description` - Merchandise matches the merchant's + description. + - `merchandise_not_counterfeit` - Merchandise is not counterfeit. + - `merchandise_not_damaged` - Merchandise is not damaged. + - `merchandise_not_defective` - Merchandise is not defective. + - `merchandise_provided_prior_to_cancellation_date` - Merchandise was provided + prior to the cancellation date. + - `merchandise_quality_matches_description` - Merchandise quality matches the + merchant's description. + - `merchandise_return_not_attempted` - Merchandise was not attempted returned to + the merchant. + - `merchant_not_notified_of_closed_account` - Merchant was not notified of the + closed account. + - `name_on_flight_manifest_matches_purchase` - Name on manifest of departed + flight matches name on purchased itinerary. + - `no_credit_receipt_provided` - No credit receipt was provided by the + cardholder. + - `other` - Other. + - `processing_error_incorrect` - The claimed processing error did not occur. + - `returned_mechandise_held_at_customs_agency_outside_merchant_country` - + Returned merchandise held at customs agency outside the merchant's country. + - `services_match_description` - Services match the merchant's description. + - `services_provided_prior_to_cancellation_date` - Services were provided prior + to the cancellation date. + - `services_used_after_cancellation_date` - Services were used after the + cancellation date and prior to the dispute submission date. + - `terms_of_service_not_misrepresented` - Terms of service were not + misrepresented. + - `transaction_code_correct` - Transaction code is correct. + """ + + +class VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenAsDescribed(BaseModel): + """Non-fiat currency or non-fungible token as described details. + + Present if and only if `reason` is `non_fiat_currency_or_non_fungible_token_as_described`. + """ + + pass + + +class VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenReceived(BaseModel): + """Non-fiat currency or non-fungible token received details. + + Present if and only if `reason` is `non_fiat_currency_or_non_fungible_token_received`. + """ + + blockchain_transaction_hash: str + """Blockchain transaction hash.""" + + destination_wallet_address: str + """Destination wallet address.""" + + prior_approved_transactions: Optional[str] = None + """Prior approved transactions.""" + + +class VisaNetworkEventRepresentedProofOfCashDisbursement(BaseModel): + """Proof of cash disbursement details. + + Present if and only if `reason` is `proof_of_cash_disbursement`. + """ + + explanation: Optional[str] = None + """ + Explanation for why the merchant believes the evidence provides proof of cash + disbursement. + """ + + +class VisaNetworkEventRepresentedReversalIssued(BaseModel): + """Reversal issued by merchant details. + + Present if and only if `reason` is `reversal_issued`. + """ + + explanation: Optional[str] = None + """Explanation of the reversal issued by the merchant.""" + + +class VisaNetworkEventRepresented(BaseModel): + """A Card Dispute Re-presented Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `represented`. Contains the details specific to a re-presented Visa Card Dispute Network Event, which represents that the merchant has declined the user's chargeback and has re-presented the payment. + """ + + cardholder_no_longer_disputes: Optional[VisaNetworkEventRepresentedCardholderNoLongerDisputes] = None + """Cardholder no longer disputes details. + + Present if and only if `reason` is `cardholder_no_longer_disputes`. + """ + + credit_or_reversal_processed: Optional[VisaNetworkEventRepresentedCreditOrReversalProcessed] = None + """Credit or reversal processed details. + + Present if and only if `reason` is `credit_or_reversal_processed`. + """ + + invalid_dispute: Optional[VisaNetworkEventRepresentedInvalidDispute] = None + """Invalid dispute details. Present if and only if `reason` is `invalid_dispute`.""" + + non_fiat_currency_or_non_fungible_token_as_described: Optional[ + VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenAsDescribed + ] = None + """Non-fiat currency or non-fungible token as described details. + + Present if and only if `reason` is + `non_fiat_currency_or_non_fungible_token_as_described`. + """ + + non_fiat_currency_or_non_fungible_token_received: Optional[ + VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenReceived + ] = None + """Non-fiat currency or non-fungible token received details. + + Present if and only if `reason` is + `non_fiat_currency_or_non_fungible_token_received`. + """ + + proof_of_cash_disbursement: Optional[VisaNetworkEventRepresentedProofOfCashDisbursement] = None + """Proof of cash disbursement details. + + Present if and only if `reason` is `proof_of_cash_disbursement`. + """ + + reason: Literal[ + "cardholder_no_longer_disputes", + "credit_or_reversal_processed", + "invalid_dispute", + "non_fiat_currency_or_non_fungible_token_as_described", + "non_fiat_currency_or_non_fungible_token_received", + "proof_of_cash_disbursement", + "reversal_issued", + ] + """The reason the merchant re-presented the dispute. + + - `cardholder_no_longer_disputes` - Cardholder no longer disputes the + transaction. + - `credit_or_reversal_processed` - Credit or reversal was processed. + - `invalid_dispute` - Invalid dispute. + - `non_fiat_currency_or_non_fungible_token_as_described` - Non-fiat currency or + non-fungible token is as described by the merchant. + - `non_fiat_currency_or_non_fungible_token_received` - Non-fiat currency or + non-fungible token was received by the cardholder. + - `proof_of_cash_disbursement` - Proof of cash disbursement provided. + - `reversal_issued` - Reversal issued by merchant. + """ + + reversal_issued: Optional[VisaNetworkEventRepresentedReversalIssued] = None + """Reversal issued by merchant details. + + Present if and only if `reason` is `reversal_issued`. + """ + + +class VisaNetworkEventRepresentmentTimedOut(BaseModel): + """A Card Dispute Re-presentment Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `representment_timed_out`. Contains the details specific to a re-presentment time-out Visa Card Dispute Network Event, which represents that the user did not respond to the re-presentment by the merchant within the time limit. + """ + + pass + + +class VisaNetworkEventUserPrearbitrationAccepted(BaseModel): + """A Card Dispute User Pre-Arbitration Accepted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_accepted`. Contains the details specific to a user prearbitration accepted Visa Card Dispute Network Event, which represents that the merchant has accepted the user's prearbitration request in the user's favor. + """ + + pass + + +class VisaNetworkEventUserPrearbitrationDeclined(BaseModel): + """A Card Dispute User Pre-Arbitration Declined Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_declined`. Contains the details specific to a user prearbitration declined Visa Card Dispute Network Event, which represents that the merchant has declined the user's prearbitration request. + """ + + pass + + +class VisaNetworkEventUserPrearbitrationSubmitted(BaseModel): + """A Card Dispute User Pre-Arbitration Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_submitted`. Contains the details specific to a user prearbitration submitted Visa Card Dispute Network Event, which represents that the user's request for prearbitration has been submitted to the network. + """ + + pass + + +class VisaNetworkEventUserPrearbitrationTimedOut(BaseModel): + """A Card Dispute User Pre-Arbitration Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration_timed_out`. Contains the details specific to a user prearbitration timed out Visa Card Dispute Network Event, which represents that the merchant has timed out responding to the user's prearbitration request. + """ + + pass + + +class VisaNetworkEventUserWithdrawalSubmitted(BaseModel): + """A Card Dispute User Withdrawal Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is equal to `user_withdrawal_submitted`. Contains the details specific to a user withdrawal submitted Visa Card Dispute Network Event, which represents that the user's request to withdraw the dispute has been submitted to the network. + """ + + pass + + +class VisaNetworkEvent(BaseModel): + attachment_files: List[VisaNetworkEventAttachmentFile] + """The files attached to the Visa Card Dispute User Submission.""" + + category: Literal[ + "chargeback_accepted", + "chargeback_submitted", + "chargeback_timed_out", + "merchant_prearbitration_decline_submitted", + "merchant_prearbitration_received", + "merchant_prearbitration_timed_out", + "represented", + "representment_timed_out", + "user_prearbitration_accepted", + "user_prearbitration_declined", + "user_prearbitration_submitted", + "user_prearbitration_timed_out", + "user_withdrawal_submitted", + ] + """The category of the user submission. + + We may add additional possible values for this enum over time; your application + should be able to handle such additions gracefully. + + - `chargeback_accepted` - Card Dispute Chargeback Accepted Visa Network Event: + details will be under the `chargeback_accepted` object. + - `chargeback_submitted` - Card Dispute Chargeback Submitted Visa Network Event: + details will be under the `chargeback_submitted` object. + - `chargeback_timed_out` - Card Dispute Chargeback Timed Out Visa Network Event: + details will be under the `chargeback_timed_out` object. + - `merchant_prearbitration_decline_submitted` - Card Dispute Merchant + Pre-Arbitration Decline Submitted Visa Network Event: details will be under + the `merchant_prearbitration_decline_submitted` object. + - `merchant_prearbitration_received` - Card Dispute Merchant Pre-Arbitration + Received Visa Network Event: details will be under the + `merchant_prearbitration_received` object. + - `merchant_prearbitration_timed_out` - Card Dispute Merchant Pre-Arbitration + Timed Out Visa Network Event: details will be under the + `merchant_prearbitration_timed_out` object. + - `represented` - Card Dispute Re-presented Visa Network Event: details will be + under the `represented` object. + - `representment_timed_out` - Card Dispute Re-presentment Timed Out Visa Network + Event: details will be under the `representment_timed_out` object. + - `user_prearbitration_accepted` - Card Dispute User Pre-Arbitration Accepted + Visa Network Event: details will be under the `user_prearbitration_accepted` + object. + - `user_prearbitration_declined` - Card Dispute User Pre-Arbitration Declined + Visa Network Event: details will be under the `user_prearbitration_declined` + object. + - `user_prearbitration_submitted` - Card Dispute User Pre-Arbitration Submitted + Visa Network Event: details will be under the `user_prearbitration_submitted` + object. + - `user_prearbitration_timed_out` - Card Dispute User Pre-Arbitration Timed Out + Visa Network Event: details will be under the `user_prearbitration_timed_out` + object. + - `user_withdrawal_submitted` - Card Dispute User Withdrawal Submitted Visa + Network Event: details will be under the `user_withdrawal_submitted` object. + """ + + created_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the Card Dispute was accepted. + the Visa Card Dispute Network Event was created. + """ + + dispute_financial_transaction_id: Optional[str] = None + """The dispute financial transaction that resulted from the network event, if any.""" + + chargeback_accepted: Optional[VisaNetworkEventChargebackAccepted] = None + """A Card Dispute Chargeback Accepted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback_accepted`. Contains the details specific to a chargeback + accepted Visa Card Dispute Network Event, which represents that a chargeback has + been accepted by the merchant. + """ + + chargeback_submitted: Optional[VisaNetworkEventChargebackSubmitted] = None + """A Card Dispute Chargeback Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback_submitted`. Contains the details specific to a chargeback + submitted Visa Card Dispute Network Event, which represents that a chargeback + has been submitted to the network. + """ + + chargeback_timed_out: Optional[VisaNetworkEventChargebackTimedOut] = None + """A Card Dispute Chargeback Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback_timed_out`. Contains the details specific to a chargeback + timed out Visa Card Dispute Network Event, which represents that the chargeback + has timed out in the user's favor. + """ + + merchant_prearbitration_decline_submitted: Optional[VisaNetworkEventMerchantPrearbitrationDeclineSubmitted] = None + """ + A Card Dispute Merchant Pre-Arbitration Decline Submitted Visa Network Event + object. This field will be present in the JSON response if and only if + `category` is equal to `merchant_prearbitration_decline_submitted`. Contains the + details specific to a merchant prearbitration decline submitted Visa Card + Dispute Network Event, which represents that the user has declined the + merchant's request for a prearbitration request decision in their favor. + """ + + merchant_prearbitration_received: Optional[VisaNetworkEventMerchantPrearbitrationReceived] = None + """A Card Dispute Merchant Pre-Arbitration Received Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `merchant_prearbitration_received`. Contains the details specific to a + merchant prearbitration received Visa Card Dispute Network Event, which + represents that the merchant has issued a prearbitration request in the user's + favor. + """ + + merchant_prearbitration_timed_out: Optional[VisaNetworkEventMerchantPrearbitrationTimedOut] = None + """A Card Dispute Merchant Pre-Arbitration Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `merchant_prearbitration_timed_out`. Contains the details specific to a + merchant prearbitration timed out Visa Card Dispute Network Event, which + represents that the user has timed out responding to the merchant's + prearbitration request. + """ + + represented: Optional[VisaNetworkEventRepresented] = None + """A Card Dispute Re-presented Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `represented`. Contains the details specific to a re-presented Visa + Card Dispute Network Event, which represents that the merchant has declined the + user's chargeback and has re-presented the payment. + """ + + representment_timed_out: Optional[VisaNetworkEventRepresentmentTimedOut] = None + """A Card Dispute Re-presentment Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `representment_timed_out`. Contains the details specific to a + re-presentment time-out Visa Card Dispute Network Event, which represents that + the user did not respond to the re-presentment by the merchant within the time + limit. + """ + + user_prearbitration_accepted: Optional[VisaNetworkEventUserPrearbitrationAccepted] = None + """A Card Dispute User Pre-Arbitration Accepted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_accepted`. Contains the details specific to a user + prearbitration accepted Visa Card Dispute Network Event, which represents that + the merchant has accepted the user's prearbitration request in the user's favor. + """ + + user_prearbitration_declined: Optional[VisaNetworkEventUserPrearbitrationDeclined] = None + """A Card Dispute User Pre-Arbitration Declined Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_declined`. Contains the details specific to a user + prearbitration declined Visa Card Dispute Network Event, which represents that + the merchant has declined the user's prearbitration request. + """ + + user_prearbitration_submitted: Optional[VisaNetworkEventUserPrearbitrationSubmitted] = None + """A Card Dispute User Pre-Arbitration Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_submitted`. Contains the details specific to a + user prearbitration submitted Visa Card Dispute Network Event, which represents + that the user's request for prearbitration has been submitted to the network. + """ + + user_prearbitration_timed_out: Optional[VisaNetworkEventUserPrearbitrationTimedOut] = None + """A Card Dispute User Pre-Arbitration Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_timed_out`. Contains the details specific to a + user prearbitration timed out Visa Card Dispute Network Event, which represents + that the merchant has timed out responding to the user's prearbitration request. + """ + + user_withdrawal_submitted: Optional[VisaNetworkEventUserWithdrawalSubmitted] = None + """A Card Dispute User Withdrawal Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_withdrawal_submitted`. Contains the details specific to a user + withdrawal submitted Visa Card Dispute Network Event, which represents that the + user's request to withdraw the dispute has been submitted to the network. + """ + + +class VisaUserSubmissionAttachmentFile(BaseModel): + file_id: str + """The ID of the file attached to the Card Dispute.""" + + +class VisaUserSubmissionChargebackAuthorization(BaseModel): + """Authorization. Present if and only if `category` is `authorization`.""" + + account_status: Literal["account_closed", "credit_problem", "fraud"] + """Account status. + + - `account_closed` - Account closed. + - `credit_problem` - Credit problem. + - `fraud` - Fraud. + """ + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandiseCardholderCancellation(BaseModel): + """Cardholder cancellation.""" + + canceled_at: date + """Canceled at.""" + + canceled_prior_to_ship_date: Literal["canceled_prior_to_ship_date", "not_canceled_prior_to_ship_date"] + """Canceled prior to ship date. + + - `canceled_prior_to_ship_date` - Canceled prior to ship date. + - `not_canceled_prior_to_ship_date` - Not canceled prior to ship date. + """ + + cancellation_policy_provided: Literal["not_provided", "provided"] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandiseNotReturned(BaseModel): + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturnAttempted(BaseModel): + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturned(BaseModel): + """Returned. Present if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandise(BaseModel): + """Canceled merchandise. + + Present if and only if `category` is `consumer_canceled_merchandise`. + """ + + cardholder_cancellation: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandiseCardholderCancellation] = ( + None + ) + """Cardholder cancellation.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + not_returned: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandiseNotReturned] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + purchase_explanation: str + """Purchase explanation.""" + + received_or_expected_at: date + """Received or expected at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerCanceledRecurringTransactionMerchantContactMethods(BaseModel): + """Merchant contact methods.""" + + application_name: Optional[str] = None + """Application name.""" + + call_center_phone_number: Optional[str] = None + """Call center phone number.""" + + email_address: Optional[str] = None + """Email address.""" + + in_person_address: Optional[str] = None + """In person address.""" + + mailing_address: Optional[str] = None + """Mailing address.""" + + text_phone_number: Optional[str] = None + """Text phone number.""" + + +class VisaUserSubmissionChargebackConsumerCanceledRecurringTransaction(BaseModel): + """Canceled recurring transaction. + + Present if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + cancellation_target: Literal["account", "transaction"] + """Cancellation target. + + - `account` - Account. + - `transaction` - Transaction. + """ + + merchant_contact_methods: VisaUserSubmissionChargebackConsumerCanceledRecurringTransactionMerchantContactMethods + """Merchant contact methods.""" + + other_form_of_payment_explanation: Optional[str] = None + """Other form of payment explanation.""" + + transaction_or_account_canceled_at: date + """Transaction or account canceled at.""" + + +class VisaUserSubmissionChargebackConsumerCanceledServicesCardholderCancellation(BaseModel): + """Cardholder cancellation.""" + + canceled_at: date + """Canceled at.""" + + cancellation_policy_provided: Literal["not_provided", "provided"] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerCanceledServicesGuaranteedReservation(BaseModel): + """Guaranteed reservation explanation. + + Present if and only if `service_type` is `guaranteed_reservation`. + """ + + explanation: Literal[ + "cardholder_canceled_prior_to_service", + "cardholder_cancellation_attempt_within_24_hours_of_confirmation", + "merchant_billed_no_show", + ] + """Explanation. + + - `cardholder_canceled_prior_to_service` - Cardholder canceled prior to service. + - `cardholder_cancellation_attempt_within_24_hours_of_confirmation` - Cardholder + cancellation attempt within 24 hours of confirmation. + - `merchant_billed_no_show` - Merchant billed for no-show. + """ + + +class VisaUserSubmissionChargebackConsumerCanceledServicesOther(BaseModel): + """Other service type explanation. + + Present if and only if `service_type` is `other`. + """ + + pass + + +class VisaUserSubmissionChargebackConsumerCanceledServicesTimeshare(BaseModel): + """Timeshare explanation. Present if and only if `service_type` is `timeshare`.""" + + pass + + +class VisaUserSubmissionChargebackConsumerCanceledServices(BaseModel): + """Canceled services. + + Present if and only if `category` is `consumer_canceled_services`. + """ + + cardholder_cancellation: VisaUserSubmissionChargebackConsumerCanceledServicesCardholderCancellation + """Cardholder cancellation.""" + + contracted_at: date + """Contracted at.""" + + guaranteed_reservation: Optional[VisaUserSubmissionChargebackConsumerCanceledServicesGuaranteedReservation] = None + """Guaranteed reservation explanation. + + Present if and only if `service_type` is `guaranteed_reservation`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + other: Optional[VisaUserSubmissionChargebackConsumerCanceledServicesOther] = None + """Other service type explanation. + + Present if and only if `service_type` is `other`. + """ + + purchase_explanation: str + """Purchase explanation.""" + + service_type: Literal["guaranteed_reservation", "other", "timeshare"] + """Service type. + + - `guaranteed_reservation` - Guaranteed reservation. + - `other` - Other. + - `timeshare` - Timeshare. + """ + + timeshare: Optional[VisaUserSubmissionChargebackConsumerCanceledServicesTimeshare] = None + """Timeshare explanation. Present if and only if `service_type` is `timeshare`.""" + + +class VisaUserSubmissionChargebackConsumerCounterfeitMerchandise(BaseModel): + """Counterfeit merchandise. + + Present if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + counterfeit_explanation: str + """Counterfeit explanation.""" + + disposition_explanation: str + """Disposition explanation.""" + + order_explanation: str + """Order explanation.""" + + received_at: date + """Received at.""" + + +class VisaUserSubmissionChargebackConsumerCreditNotProcessed(BaseModel): + """Credit not processed. + + Present if and only if `category` is `consumer_credit_not_processed`. + """ + + canceled_or_returned_at: Optional[date] = None + """Canceled or returned at.""" + + credit_expected_at: Optional[date] = None + """Credit expected at.""" + + +class VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseNotReturned(BaseModel): + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted(BaseModel): + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturned(BaseModel): + """Returned. Present if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandise(BaseModel): + """Damaged or defective merchandise. + + Present if and only if `category` is `consumer_damaged_or_defective_merchandise`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + not_returned: Optional[VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseNotReturned] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + order_and_issue_explanation: str + """Order and issue explanation.""" + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationNotReturned(BaseModel): + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturnAttempted(BaseModel): + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturned(BaseModel): + """Returned. Present if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentation(BaseModel): + """Merchandise misrepresentation. + + Present if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: str + """Misrepresentation explanation.""" + + not_returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationNotReturned] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + purchase_explanation: str + """Purchase explanation.""" + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturnAttempted(BaseModel): + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturned(BaseModel): + """Returned. Present if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribed(BaseModel): + """Merchandise not as described. + + Present if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["returned", "return_attempted"] + """Return outcome. + + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt(BaseModel): + """Cardholder cancellation prior to expected receipt. + + Present if and only if `cancellation_outcome` is `cardholder_cancellation_prior_to_expected_receipt`. + """ + + canceled_at: date + """Canceled at.""" + + reason: Optional[str] = None + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedNotReturned(BaseModel): + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted(BaseModel): + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + attempted_at: date + """Attempted at.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturned(BaseModel): + """Returned. Present if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: date + """Merchant received return at.""" + + returned_at: date + """Returned at.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayed(BaseModel): + """Delayed. Present if and only if `delivery_issue` is `delayed`.""" + + explanation: str + """Explanation.""" + + not_returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedNotReturned] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation(BaseModel): + """Delivered to wrong location. + + Present if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + agreed_location: str + """Agreed location.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedMerchantCancellation(BaseModel): + """Merchant cancellation. + + Present if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + canceled_at: date + """Canceled at.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedNoCancellation(BaseModel): + """No cancellation. + + Present if and only if `cancellation_outcome` is `no_cancellation`. + """ + + pass + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceived(BaseModel): + """Merchandise not received. + + Present if and only if `category` is `consumer_merchandise_not_received`. + """ + + cancellation_outcome: Literal[ + "cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation" + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + cardholder_cancellation_prior_to_expected_receipt: Optional[ + VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt + ] = None + """Cardholder cancellation prior to expected receipt. + + Present if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + delayed: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayed] = None + """Delayed. Present if and only if `delivery_issue` is `delayed`.""" + + delivered_to_wrong_location: Optional[ + VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation + ] = None + """Delivered to wrong location. + + Present if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + delivery_issue: Literal["delayed", "delivered_to_wrong_location"] + """Delivery issue. + + - `delayed` - Delayed. + - `delivered_to_wrong_location` - Delivered to wrong location. + """ + + last_expected_receipt_at: date + """Last expected receipt at.""" + + merchant_cancellation: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedMerchantCancellation] = ( + None + ) + """Merchant cancellation. + + Present if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + no_cancellation: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedNoCancellation] = None + """No cancellation. + + Present if and only if `cancellation_outcome` is `no_cancellation`. + """ + + purchase_info_and_explanation: str + """Purchase information and explanation.""" + + +class VisaUserSubmissionChargebackConsumerNonReceiptOfCash(BaseModel): + """Non-receipt of cash. + + Present if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + pass + + +class VisaUserSubmissionChargebackConsumerOriginalCreditTransactionNotAccepted(BaseModel): + """Original Credit Transaction (OCT) not accepted. + + Present if and only if `category` is `consumer_original_credit_transaction_not_accepted`. + """ + + explanation: str + """Explanation.""" + + reason: Literal["prohibited_by_local_laws_or_regulation", "recipient_refused"] + """Reason. + + - `prohibited_by_local_laws_or_regulation` - Prohibited by local laws or + regulation. + - `recipient_refused` - Recipient refused. + """ + + +class VisaUserSubmissionChargebackConsumerQualityMerchandiseNotReturned(BaseModel): + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaUserSubmissionChargebackConsumerQualityMerchandiseOngoingNegotiations(BaseModel): + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + explanation: str + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: date + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: date + """Started at.""" + + +class VisaUserSubmissionChargebackConsumerQualityMerchandiseReturnAttempted(BaseModel): + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerQualityMerchandiseReturned(BaseModel): + """Returned. Present if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerQualityMerchandise(BaseModel): + """Merchandise quality issue. + + Present if and only if `category` is `consumer_quality_merchandise`. + """ + + expected_at: date + """Expected at.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + not_returned: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandiseNotReturned] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + ongoing_negotiations: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandiseOngoingNegotiations] = None + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + purchase_info_and_quality_issue: str + """Purchase information and quality issue.""" + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandiseReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandiseReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerQualityServicesCardholderCancellation(BaseModel): + """Cardholder cancellation.""" + + accepted_by_merchant: Literal["accepted", "not_accepted"] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: date + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerQualityServicesOngoingNegotiations(BaseModel): + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + explanation: str + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: date + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: date + """Started at.""" + + +class VisaUserSubmissionChargebackConsumerQualityServices(BaseModel): + """Services quality issue. + + Present if and only if `category` is `consumer_quality_services`. + """ + + cardholder_cancellation: VisaUserSubmissionChargebackConsumerQualityServicesCardholderCancellation + """Cardholder cancellation.""" + + cardholder_paid_to_have_work_redone: Optional[ + Literal["did_not_pay_to_have_work_redone", "paid_to_have_work_redone"] + ] = None + """Cardholder paid to have work redone. + + - `did_not_pay_to_have_work_redone` - Cardholder did not pay to have work + redone. + - `paid_to_have_work_redone` - Cardholder paid to have work redone. + """ + + non_fiat_currency_or_non_fungible_token_related_and_not_matching_description: Literal["not_related", "related"] + """Non-fiat currency or non-fungible token related and not matching description. + + - `not_related` - Not related. + - `related` - Related. + """ + + ongoing_negotiations: Optional[VisaUserSubmissionChargebackConsumerQualityServicesOngoingNegotiations] = None + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + purchase_info_and_quality_issue: str + """Purchase information and quality issue.""" + + restaurant_food_related: Optional[Literal["not_related", "related"]] = None + """ + Whether the dispute is related to the quality of food from an eating place or + restaurant. Must be provided when Merchant Category Code (MCC) is 5812, 5813 + or 5814. + + - `not_related` - Not related. + - `related` - Related. + """ + + services_received_at: date + """Services received at.""" + + +class VisaUserSubmissionChargebackConsumerServicesMisrepresentationCardholderCancellation(BaseModel): + """Cardholder cancellation.""" + + accepted_by_merchant: Literal["accepted", "not_accepted"] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: date + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerServicesMisrepresentation(BaseModel): + """Services misrepresentation. + + Present if and only if `category` is `consumer_services_misrepresentation`. """ - card_dispute_id: str - """The identifier of the Card Dispute that was accepted.""" + cardholder_cancellation: VisaUserSubmissionChargebackConsumerServicesMisrepresentationCardholderCancellation + """Cardholder cancellation.""" - transaction_id: str + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. """ - The identifier of the Transaction that was created to return the disputed funds - to your account. + + misrepresentation_explanation: str + """Misrepresentation explanation.""" + + purchase_explanation: str + """Purchase explanation.""" + + received_at: date + """Received at.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotAsDescribedCardholderCancellation(BaseModel): + """Cardholder cancellation.""" + + accepted_by_merchant: Literal["accepted", "not_accepted"] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. """ + canceled_at: date + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotAsDescribed(BaseModel): + """Services not as described. + + Present if and only if `category` is `consumer_services_not_as_described`. + """ -class Rejection(BaseModel): - card_dispute_id: str - """The identifier of the Card Dispute that was rejected.""" + cardholder_cancellation: VisaUserSubmissionChargebackConsumerServicesNotAsDescribedCardholderCancellation + """Cardholder cancellation.""" explanation: str - """Why the Card Dispute was rejected.""" + """Explanation of what was ordered and was not as described.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: date + """Received at.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt(BaseModel): + """Cardholder cancellation prior to expected receipt. + + Present if and only if `cancellation_outcome` is `cardholder_cancellation_prior_to_expected_receipt`. + """ + + canceled_at: date + """Canceled at.""" + + reason: Optional[str] = None + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotReceivedMerchantCancellation(BaseModel): + """Merchant cancellation. + + Present if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + canceled_at: date + """Canceled at.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotReceivedNoCancellation(BaseModel): + """No cancellation. + + Present if and only if `cancellation_outcome` is `no_cancellation`. + """ + + pass + + +class VisaUserSubmissionChargebackConsumerServicesNotReceived(BaseModel): + """Services not received. + + Present if and only if `category` is `consumer_services_not_received`. + """ + + cancellation_outcome: Literal[ + "cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation" + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + cardholder_cancellation_prior_to_expected_receipt: Optional[ + VisaUserSubmissionChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt + ] = None + """Cardholder cancellation prior to expected receipt. + + Present if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + last_expected_receipt_at: date + """Last expected receipt at.""" + + merchant_cancellation: Optional[VisaUserSubmissionChargebackConsumerServicesNotReceivedMerchantCancellation] = None + """Merchant cancellation. + + Present if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + no_cancellation: Optional[VisaUserSubmissionChargebackConsumerServicesNotReceivedNoCancellation] = None + """No cancellation. + + Present if and only if `cancellation_outcome` is `no_cancellation`. + """ + + purchase_info_and_explanation: str + """Purchase information and explanation.""" + + +class VisaUserSubmissionChargebackFraud(BaseModel): + """Fraud. Present if and only if `category` is `fraud`.""" + + fraud_type: Literal[ + "account_or_credentials_takeover", + "card_not_received_as_issued", + "fraudulent_application", + "fraudulent_use_of_account_number", + "incorrect_processing", + "issuer_reported_counterfeit", + "lost", + "manipulation_of_account_holder", + "merchant_misrepresentation", + "miscellaneous", + "stolen", + ] + """Fraud type. + + - `account_or_credentials_takeover` - Account or credentials takeover. + - `card_not_received_as_issued` - Card not received as issued. + - `fraudulent_application` - Fraudulent application. + - `fraudulent_use_of_account_number` - Fraudulent use of account number. + - `incorrect_processing` - Incorrect processing. + - `issuer_reported_counterfeit` - Issuer reported counterfeit. + - `lost` - Lost. + - `manipulation_of_account_holder` - Manipulation of account holder. + - `merchant_misrepresentation` - Merchant misrepresentation. + - `miscellaneous` - Miscellaneous. + - `stolen` - Stolen. + """ + + +class VisaUserSubmissionChargebackProcessingErrorDuplicateTransaction(BaseModel): + """Duplicate transaction. + + Present if and only if `error_reason` is `duplicate_transaction`. + """ + + other_transaction_id: str + """Other transaction ID.""" + + +class VisaUserSubmissionChargebackProcessingErrorIncorrectAmount(BaseModel): + """Incorrect amount. Present if and only if `error_reason` is `incorrect_amount`.""" + + expected_amount: int + """Expected amount.""" + + +class VisaUserSubmissionChargebackProcessingErrorPaidByOtherMeans(BaseModel): + """Paid by other means. + + Present if and only if `error_reason` is `paid_by_other_means`. + """ + + other_form_of_payment_evidence: Literal[ + "canceled_check", "card_transaction", "cash_receipt", "other", "statement", "voucher" + ] + """Other form of payment evidence. + + - `canceled_check` - Canceled check. + - `card_transaction` - Card transaction. + - `cash_receipt` - Cash receipt. + - `other` - Other. + - `statement` - Statement. + - `voucher` - Voucher. + """ + + other_transaction_id: Optional[str] = None + """Other transaction ID.""" + + +class VisaUserSubmissionChargebackProcessingError(BaseModel): + """Processing error. Present if and only if `category` is `processing_error`.""" + + duplicate_transaction: Optional[VisaUserSubmissionChargebackProcessingErrorDuplicateTransaction] = None + """Duplicate transaction. + + Present if and only if `error_reason` is `duplicate_transaction`. + """ + + error_reason: Literal["duplicate_transaction", "incorrect_amount", "paid_by_other_means"] + """Error reason. + + - `duplicate_transaction` - Duplicate transaction. + - `incorrect_amount` - Incorrect amount. + - `paid_by_other_means` - Paid by other means. + """ + + incorrect_amount: Optional[VisaUserSubmissionChargebackProcessingErrorIncorrectAmount] = None + """Incorrect amount. Present if and only if `error_reason` is `incorrect_amount`.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + paid_by_other_means: Optional[VisaUserSubmissionChargebackProcessingErrorPaidByOtherMeans] = None + """Paid by other means. + + Present if and only if `error_reason` is `paid_by_other_means`. + """ + + +class VisaUserSubmissionChargeback(BaseModel): + """A Visa Card Dispute Chargeback User Submission Chargeback Details object. + + This field will be present in the JSON response if and only if `category` is equal to `chargeback`. Contains the details specific to a Visa chargeback User Submission for a Card Dispute. + """ + + authorization: Optional[VisaUserSubmissionChargebackAuthorization] = None + """Authorization. Present if and only if `category` is `authorization`.""" + + category: Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + """Category. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + consumer_canceled_merchandise: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandise] = None + """Canceled merchandise. + + Present if and only if `category` is `consumer_canceled_merchandise`. + """ + + consumer_canceled_recurring_transaction: Optional[ + VisaUserSubmissionChargebackConsumerCanceledRecurringTransaction + ] = None + """Canceled recurring transaction. + + Present if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + consumer_canceled_services: Optional[VisaUserSubmissionChargebackConsumerCanceledServices] = None + """Canceled services. + + Present if and only if `category` is `consumer_canceled_services`. + """ + + consumer_counterfeit_merchandise: Optional[VisaUserSubmissionChargebackConsumerCounterfeitMerchandise] = None + """Counterfeit merchandise. + + Present if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + consumer_credit_not_processed: Optional[VisaUserSubmissionChargebackConsumerCreditNotProcessed] = None + """Credit not processed. + + Present if and only if `category` is `consumer_credit_not_processed`. + """ + + consumer_damaged_or_defective_merchandise: Optional[ + VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandise + ] = None + """Damaged or defective merchandise. + + Present if and only if `category` is + `consumer_damaged_or_defective_merchandise`. + """ + + consumer_merchandise_misrepresentation: Optional[ + VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentation + ] = None + """Merchandise misrepresentation. + + Present if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + consumer_merchandise_not_as_described: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribed] = ( + None + ) + """Merchandise not as described. + + Present if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + consumer_merchandise_not_received: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceived] = None + """Merchandise not received. + + Present if and only if `category` is `consumer_merchandise_not_received`. + """ + + consumer_non_receipt_of_cash: Optional[VisaUserSubmissionChargebackConsumerNonReceiptOfCash] = None + """Non-receipt of cash. + + Present if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + consumer_original_credit_transaction_not_accepted: Optional[ + VisaUserSubmissionChargebackConsumerOriginalCreditTransactionNotAccepted + ] = None + """Original Credit Transaction (OCT) not accepted. + + Present if and only if `category` is + `consumer_original_credit_transaction_not_accepted`. + """ + + consumer_quality_merchandise: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandise] = None + """Merchandise quality issue. + + Present if and only if `category` is `consumer_quality_merchandise`. + """ + + consumer_quality_services: Optional[VisaUserSubmissionChargebackConsumerQualityServices] = None + """Services quality issue. + + Present if and only if `category` is `consumer_quality_services`. + """ + + consumer_services_misrepresentation: Optional[VisaUserSubmissionChargebackConsumerServicesMisrepresentation] = None + """Services misrepresentation. + + Present if and only if `category` is `consumer_services_misrepresentation`. + """ + + consumer_services_not_as_described: Optional[VisaUserSubmissionChargebackConsumerServicesNotAsDescribed] = None + """Services not as described. + + Present if and only if `category` is `consumer_services_not_as_described`. + """ + + consumer_services_not_received: Optional[VisaUserSubmissionChargebackConsumerServicesNotReceived] = None + """Services not received. + + Present if and only if `category` is `consumer_services_not_received`. + """ + + fraud: Optional[VisaUserSubmissionChargebackFraud] = None + """Fraud. Present if and only if `category` is `fraud`.""" + + processing_error: Optional[VisaUserSubmissionChargebackProcessingError] = None + """Processing error. Present if and only if `category` is `processing_error`.""" + + +class VisaUserSubmissionMerchantPrearbitrationDecline(BaseModel): + """A Visa Card Dispute Merchant Pre-Arbitration Decline User Submission object. + + This field will be present in the JSON response if and only if `category` is equal to `merchant_prearbitration_decline`. Contains the details specific to a merchant prearbitration decline Visa Card Dispute User Submission. + """ + + reason: str + """ + The reason the user declined the merchant's request for pre-arbitration in their + favor. + """ + + +class VisaUserSubmissionUserPrearbitrationCategoryChange(BaseModel): + """Category change details for the pre-arbitration request, if requested.""" + + category: Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + """The category the dispute is being changed to. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + reason: str + """The reason for the pre-arbitration request.""" + + +class VisaUserSubmissionUserPrearbitration(BaseModel): + """A Visa Card Dispute User-Initiated Pre-Arbitration User Submission object. + + This field will be present in the JSON response if and only if `category` is equal to `user_prearbitration`. Contains the details specific to a user-initiated pre-arbitration Visa Card Dispute User Submission. + """ + + category_change: Optional[VisaUserSubmissionUserPrearbitrationCategoryChange] = None + """Category change details for the pre-arbitration request, if requested.""" + + reason: str + """The reason for the pre-arbitration request.""" + + +class VisaUserSubmission(BaseModel): + accepted_at: Optional[datetime] = None + """ + The date and time at which the Visa Card Dispute User Submission was reviewed + and accepted. + """ + + amount: Optional[int] = None + """ + The amount of the dispute if it is different from the amount of a prior user + submission or the disputed transaction. + """ + + attachment_files: List[VisaUserSubmissionAttachmentFile] + """The files attached to the Visa Card Dispute User Submission.""" + + category: Literal["chargeback", "merchant_prearbitration_decline", "user_prearbitration"] + """The category of the user submission. + + We may add additional possible values for this enum over time; your application + should be able to handle such additions gracefully. + + - `chargeback` - Visa Card Dispute Chargeback User Submission Chargeback + Details: details will be under the `chargeback` object. + - `merchant_prearbitration_decline` - Visa Card Dispute Merchant Pre-Arbitration + Decline User Submission: details will be under the + `merchant_prearbitration_decline` object. + - `user_prearbitration` - Visa Card Dispute User-Initiated Pre-Arbitration User + Submission: details will be under the `user_prearbitration` object. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Visa Card Dispute User Submission was created. + """ + + explanation: Optional[str] = None + """ + The free-form explanation provided to Increase to provide more context for the + user submission. This field is not sent directly to the card networks. + """ + + further_information_requested_at: Optional[datetime] = None + """ + The date and time at which Increase requested further information from the user + for the Visa Card Dispute. + """ + + further_information_requested_reason: Optional[str] = None + """ + The reason for Increase requesting further information from the user for the + Visa Card Dispute. + """ + + status: Literal["abandoned", "accepted", "further_information_requested", "pending_reviewing"] + """The status of the Visa Card Dispute User Submission. + + - `abandoned` - The User Submission was abandoned. + - `accepted` - The User Submission was accepted. + - `further_information_requested` - Further information is requested, please + resubmit with the requested information. + - `pending_reviewing` - The User Submission is pending review. + """ + + updated_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Visa Card Dispute User Submission was updated. + """ + + chargeback: Optional[VisaUserSubmissionChargeback] = None + """A Visa Card Dispute Chargeback User Submission Chargeback Details object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback`. Contains the details specific to a Visa chargeback User + Submission for a Card Dispute. + """ + + merchant_prearbitration_decline: Optional[VisaUserSubmissionMerchantPrearbitrationDecline] = None + """A Visa Card Dispute Merchant Pre-Arbitration Decline User Submission object. + + This field will be present in the JSON response if and only if `category` is + equal to `merchant_prearbitration_decline`. Contains the details specific to a + merchant prearbitration decline Visa Card Dispute User Submission. + """ + + user_prearbitration: Optional[VisaUserSubmissionUserPrearbitration] = None + """A Visa Card Dispute User-Initiated Pre-Arbitration User Submission object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration`. Contains the details specific to a + user-initiated pre-arbitration Visa Card Dispute User Submission. + """ + + +class Visa(BaseModel): + """Card Dispute information for card payments processed over Visa's network. + + This field will be present in the JSON response if and only if `network` is equal to `visa`. + """ + + network_events: List[VisaNetworkEvent] + """The network events for the Card Dispute.""" + + required_user_submission_category: Optional[ + Literal["chargeback", "merchant_prearbitration_decline", "user_prearbitration"] + ] = None + """ + The category of the currently required user submission if the user wishes to + proceed with the dispute. Present if and only if status is + `user_submission_required`. Otherwise, this will be `nil`. + + - `chargeback` - A Chargeback User Submission is required. + - `merchant_prearbitration_decline` - A Merchant Pre Arbitration Decline User + Submission is required. + - `user_prearbitration` - A User Initiated Pre Arbitration User Submission is + required. + """ + + user_submissions: List[VisaUserSubmission] + """The user submissions for the Card Dispute.""" + - rejected_at: datetime +class Win(BaseModel): + """ + If the Card Dispute's status is `won`, this will contain details of the won dispute. + """ + + won_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the Card Dispute was rejected. + the Card Dispute was won. + """ + + +class Withdrawal(BaseModel): """ + If the Card Dispute has been withdrawn, this will contain details of the withdrawal. + """ + + explanation: Optional[str] = None + """The explanation for the withdrawal of the Card Dispute.""" class CardDispute(BaseModel): + """ + If unauthorized activity occurs on a card, you can create a Card Dispute and we'll work with the card networks to return the funds if appropriate. + """ + id: str """The Card Dispute identifier.""" - acceptance: Optional[Acceptance] = None - """ - If the Card Dispute's status is `accepted`, this will contain details of the - successful dispute. - """ + amount: int + """The amount of the dispute.""" + + card_id: str + """The Card that the Card Dispute is associated with.""" created_at: datetime """ @@ -59,9 +2660,6 @@ class CardDispute(BaseModel): disputed_transaction_id: str """The identifier of the Transaction that was disputed.""" - explanation: str - """Why you disputed the Transaction in question.""" - idempotency_key: Optional[str] = None """The idempotency key you chose for this object. @@ -70,19 +2668,42 @@ class CardDispute(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ - rejection: Optional[Rejection] = None + loss: Optional[Loss] = None """ - If the Card Dispute's status is `rejected`, this will contain details of the - unsuccessful dispute. + If the Card Dispute's status is `lost`, this will contain details of the lost + dispute. """ - status: Literal["pending_reviewing", "accepted", "rejected"] - """The results of the Dispute investigation. + network: Literal["visa", "pulse"] + """The network that the Card Dispute is associated with. - - `pending_reviewing` - The Card Dispute is pending review. - - `accepted` - The Card Dispute has been accepted and your funds have been - returned. - - `rejected` - The Card Dispute has been rejected. + - `visa` - Visa: details will be under the `visa` object. + - `pulse` - Pulse: details will be under the `pulse` object. + """ + + status: Literal[ + "user_submission_required", + "pending_user_submission_reviewing", + "pending_user_submission_submitting", + "pending_user_withdrawal_submitting", + "pending_response", + "lost", + "won", + ] + """The status of the Card Dispute. + + - `user_submission_required` - A User Submission is required to continue with + the Card Dispute. + - `pending_user_submission_reviewing` - The most recent User Submission is being + reviewed. + - `pending_user_submission_submitting` - The most recent User Submission is + being submitted to the network. + - `pending_user_withdrawal_submitting` - The user's withdrawal of the Card + Dispute is being submitted to the network. + - `pending_response` - The Card Dispute is pending a response from the network. + - `lost` - The Card Dispute has been lost and funds previously credited from the + acceptance have been debited. + - `won` - The Card Dispute has been won and no further action can be taken. """ type: Literal["card_dispute"] @@ -90,3 +2711,30 @@ class CardDispute(BaseModel): For this resource it will always be `card_dispute`. """ + + user_submission_required_by: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the user submission is required by. Present only if status is + `user_submission_required` and a user submission is required by a certain time. + Otherwise, this will be `nil`. + """ + + visa: Optional[Visa] = None + """Card Dispute information for card payments processed over Visa's network. + + This field will be present in the JSON response if and only if `network` is + equal to `visa`. + """ + + win: Optional[Win] = None + """ + If the Card Dispute's status is `won`, this will contain details of the won + dispute. + """ + + withdrawal: Optional[Withdrawal] = None + """ + If the Card Dispute has been withdrawn, this will contain details of the + withdrawal. + """ diff --git a/src/increase/types/card_dispute_create_params.py b/src/increase/types/card_dispute_create_params.py index e7f882932..eca8fc702 100644 --- a/src/increase/types/card_dispute_create_params.py +++ b/src/increase/types/card_dispute_create_params.py @@ -2,9 +2,75 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict -__all__ = ["CardDisputeCreateParams"] +from .._utils import PropertyInfo + +__all__ = [ + "CardDisputeCreateParams", + "AttachmentFile", + "Visa", + "VisaAuthorization", + "VisaConsumerCanceledMerchandise", + "VisaConsumerCanceledMerchandiseCardholderCancellation", + "VisaConsumerCanceledMerchandiseNotReturned", + "VisaConsumerCanceledMerchandiseReturnAttempted", + "VisaConsumerCanceledMerchandiseReturned", + "VisaConsumerCanceledRecurringTransaction", + "VisaConsumerCanceledRecurringTransactionMerchantContactMethods", + "VisaConsumerCanceledServices", + "VisaConsumerCanceledServicesCardholderCancellation", + "VisaConsumerCanceledServicesGuaranteedReservation", + "VisaConsumerCanceledServicesOther", + "VisaConsumerCanceledServicesTimeshare", + "VisaConsumerCounterfeitMerchandise", + "VisaConsumerCreditNotProcessed", + "VisaConsumerDamagedOrDefectiveMerchandise", + "VisaConsumerDamagedOrDefectiveMerchandiseNotReturned", + "VisaConsumerDamagedOrDefectiveMerchandiseReturnAttempted", + "VisaConsumerDamagedOrDefectiveMerchandiseReturned", + "VisaConsumerMerchandiseMisrepresentation", + "VisaConsumerMerchandiseMisrepresentationNotReturned", + "VisaConsumerMerchandiseMisrepresentationReturnAttempted", + "VisaConsumerMerchandiseMisrepresentationReturned", + "VisaConsumerMerchandiseNotAsDescribed", + "VisaConsumerMerchandiseNotAsDescribedReturnAttempted", + "VisaConsumerMerchandiseNotAsDescribedReturned", + "VisaConsumerMerchandiseNotReceived", + "VisaConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaConsumerMerchandiseNotReceivedDelayed", + "VisaConsumerMerchandiseNotReceivedDelayedNotReturned", + "VisaConsumerMerchandiseNotReceivedDelayedReturnAttempted", + "VisaConsumerMerchandiseNotReceivedDelayedReturned", + "VisaConsumerMerchandiseNotReceivedDeliveredToWrongLocation", + "VisaConsumerMerchandiseNotReceivedMerchantCancellation", + "VisaConsumerMerchandiseNotReceivedNoCancellation", + "VisaConsumerNonReceiptOfCash", + "VisaConsumerOriginalCreditTransactionNotAccepted", + "VisaConsumerQualityMerchandise", + "VisaConsumerQualityMerchandiseNotReturned", + "VisaConsumerQualityMerchandiseOngoingNegotiations", + "VisaConsumerQualityMerchandiseReturnAttempted", + "VisaConsumerQualityMerchandiseReturned", + "VisaConsumerQualityServices", + "VisaConsumerQualityServicesCardholderCancellation", + "VisaConsumerQualityServicesOngoingNegotiations", + "VisaConsumerServicesMisrepresentation", + "VisaConsumerServicesMisrepresentationCardholderCancellation", + "VisaConsumerServicesNotAsDescribed", + "VisaConsumerServicesNotAsDescribedCardholderCancellation", + "VisaConsumerServicesNotReceived", + "VisaConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaConsumerServicesNotReceivedMerchantCancellation", + "VisaConsumerServicesNotReceivedNoCancellation", + "VisaFraud", + "VisaProcessingError", + "VisaProcessingErrorDuplicateTransaction", + "VisaProcessingErrorIncorrectAmount", + "VisaProcessingErrorPaidByOtherMeans", +] class CardDisputeCreateParams(TypedDict, total=False): @@ -14,5 +80,1514 @@ class CardDisputeCreateParams(TypedDict, total=False): This Transaction must have a `source_type` of `card_settlement`. """ - explanation: Required[str] - """Why you are disputing this Transaction.""" + network: Required[Literal["visa"]] + """The network of the disputed transaction. + + Details specific to the network are required under the sub-object with the same + identifier as the network. + + - `visa` - Visa + """ + + amount: int + """The monetary amount of the part of the transaction that is being disputed. + + This is optional and will default to the full amount of the transaction if not + provided. If provided, the amount must be less than or equal to the amount of + the transaction. + """ + + attachment_files: Iterable[AttachmentFile] + """The files to be attached to the initial dispute submission.""" + + explanation: str + """ + The free-form explanation provided to Increase to provide more context for the + user submission. This field is not sent directly to the card networks. + """ + + visa: Visa + """The Visa-specific parameters for the dispute. + + Required if and only if `network` is `visa`. + """ + + +class AttachmentFile(TypedDict, total=False): + file_id: Required[str] + """The ID of the file to be attached. + + The file must have a `purpose` of `card_dispute_attachment`. + """ + + +class VisaAuthorization(TypedDict, total=False): + """Authorization. Required if and only if `category` is `authorization`.""" + + account_status: Required[Literal["account_closed", "credit_problem", "fraud"]] + """Account status. + + - `account_closed` - Account closed. + - `credit_problem` - Credit problem. + - `fraud` - Fraud. + """ + + +class VisaConsumerCanceledMerchandiseCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + canceled_prior_to_ship_date: Required[Literal["canceled_prior_to_ship_date", "not_canceled_prior_to_ship_date"]] + """Canceled prior to ship date. + + - `canceled_prior_to_ship_date` - Canceled prior to ship date. + - `not_canceled_prior_to_ship_date` - Not canceled prior to ship date. + """ + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaConsumerCanceledMerchandiseNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaConsumerCanceledMerchandiseReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerCanceledMerchandiseReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerCanceledMerchandise(TypedDict, total=False): + """Canceled merchandise. + + Required if and only if `category` is `consumer_canceled_merchandise`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_or_expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received or expected at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + cardholder_cancellation: VisaConsumerCanceledMerchandiseCardholderCancellation + """Cardholder cancellation.""" + + not_returned: VisaConsumerCanceledMerchandiseNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerCanceledMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerCanceledMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerCanceledRecurringTransactionMerchantContactMethods(TypedDict, total=False): + """Merchant contact methods.""" + + application_name: str + """Application name.""" + + call_center_phone_number: str + """Call center phone number.""" + + email_address: str + """Email address.""" + + in_person_address: str + """In person address.""" + + mailing_address: str + """Mailing address.""" + + text_phone_number: str + """Text phone number.""" + + +class VisaConsumerCanceledRecurringTransaction(TypedDict, total=False): + """Canceled recurring transaction. + + Required if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + cancellation_target: Required[Literal["account", "transaction"]] + """Cancellation target. + + - `account` - Account. + - `transaction` - Transaction. + """ + + merchant_contact_methods: Required[VisaConsumerCanceledRecurringTransactionMerchantContactMethods] + """Merchant contact methods.""" + + transaction_or_account_canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Transaction or account canceled at.""" + + other_form_of_payment_explanation: str + """Other form of payment explanation.""" + + +class VisaConsumerCanceledServicesCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaConsumerCanceledServicesGuaranteedReservation(TypedDict, total=False): + """Guaranteed reservation explanation. + + Required if and only if `service_type` is `guaranteed_reservation`. + """ + + explanation: Required[ + Literal[ + "cardholder_canceled_prior_to_service", + "cardholder_cancellation_attempt_within_24_hours_of_confirmation", + "merchant_billed_no_show", + ] + ] + """Explanation. + + - `cardholder_canceled_prior_to_service` - Cardholder canceled prior to service. + - `cardholder_cancellation_attempt_within_24_hours_of_confirmation` - Cardholder + cancellation attempt within 24 hours of confirmation. + - `merchant_billed_no_show` - Merchant billed for no-show. + """ + + +class VisaConsumerCanceledServicesOther(TypedDict, total=False): + """Other service type explanation. + + Required if and only if `service_type` is `other`. + """ + + pass + + +class VisaConsumerCanceledServicesTimeshare(TypedDict, total=False): + """Timeshare explanation. Required if and only if `service_type` is `timeshare`.""" + + pass + + +class VisaConsumerCanceledServices(TypedDict, total=False): + """Canceled services. + + Required if and only if `category` is `consumer_canceled_services`. + """ + + cardholder_cancellation: Required[VisaConsumerCanceledServicesCardholderCancellation] + """Cardholder cancellation.""" + + contracted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Contracted at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + service_type: Required[Literal["guaranteed_reservation", "other", "timeshare"]] + """Service type. + + - `guaranteed_reservation` - Guaranteed reservation. + - `other` - Other. + - `timeshare` - Timeshare. + """ + + guaranteed_reservation: VisaConsumerCanceledServicesGuaranteedReservation + """Guaranteed reservation explanation. + + Required if and only if `service_type` is `guaranteed_reservation`. + """ + + other: VisaConsumerCanceledServicesOther + """Other service type explanation. + + Required if and only if `service_type` is `other`. + """ + + timeshare: VisaConsumerCanceledServicesTimeshare + """Timeshare explanation. Required if and only if `service_type` is `timeshare`.""" + + +class VisaConsumerCounterfeitMerchandise(TypedDict, total=False): + """Counterfeit merchandise. + + Required if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + counterfeit_explanation: Required[str] + """Counterfeit explanation.""" + + disposition_explanation: Required[str] + """Disposition explanation.""" + + order_explanation: Required[str] + """Order explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaConsumerCreditNotProcessed(TypedDict, total=False): + """Credit not processed. + + Required if and only if `category` is `consumer_credit_not_processed`. + """ + + canceled_or_returned_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Canceled or returned at.""" + + credit_expected_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Credit expected at.""" + + +class VisaConsumerDamagedOrDefectiveMerchandiseNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaConsumerDamagedOrDefectiveMerchandiseReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerDamagedOrDefectiveMerchandiseReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerDamagedOrDefectiveMerchandise(TypedDict, total=False): + """Damaged or defective merchandise. + + Required if and only if `category` is `consumer_damaged_or_defective_merchandise`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + order_and_issue_explanation: Required[str] + """Order and issue explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaConsumerDamagedOrDefectiveMerchandiseNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerDamagedOrDefectiveMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerDamagedOrDefectiveMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseMisrepresentationNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaConsumerMerchandiseMisrepresentationReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerMerchandiseMisrepresentationReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerMerchandiseMisrepresentation(TypedDict, total=False): + """Merchandise misrepresentation. + + Required if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaConsumerMerchandiseMisrepresentationNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerMerchandiseMisrepresentationReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerMerchandiseMisrepresentationReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseNotAsDescribedReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerMerchandiseNotAsDescribedReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerMerchandiseNotAsDescribed(TypedDict, total=False): + """Merchandise not as described. + + Required if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["returned", "return_attempted"]] + """Return outcome. + + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + return_attempted: VisaConsumerMerchandiseNotAsDescribedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerMerchandiseNotAsDescribedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is `cardholder_cancellation_prior_to_expected_receipt`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaConsumerMerchandiseNotReceivedDelayedNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaConsumerMerchandiseNotReceivedDelayedReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + +class VisaConsumerMerchandiseNotReceivedDelayedReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Merchant received return at.""" + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + +class VisaConsumerMerchandiseNotReceivedDelayed(TypedDict, total=False): + """Delayed. Required if and only if `delivery_issue` is `delayed`.""" + + explanation: Required[str] + """Explanation.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaConsumerMerchandiseNotReceivedDelayedNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerMerchandiseNotReceivedDelayedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerMerchandiseNotReceivedDelayedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseNotReceivedDeliveredToWrongLocation(TypedDict, total=False): + """Delivered to wrong location. + + Required if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + agreed_location: Required[str] + """Agreed location.""" + + +class VisaConsumerMerchandiseNotReceivedMerchantCancellation(TypedDict, total=False): + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaConsumerMerchandiseNotReceivedNoCancellation(TypedDict, total=False): + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + pass + + +class VisaConsumerMerchandiseNotReceived(TypedDict, total=False): + """Merchandise not received. + + Required if and only if `category` is `consumer_merchandise_not_received`. + """ + + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + delivery_issue: Required[Literal["delayed", "delivered_to_wrong_location"]] + """Delivery issue. + + - `delayed` - Delayed. + - `delivered_to_wrong_location` - Delivered to wrong location. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + delayed: VisaConsumerMerchandiseNotReceivedDelayed + """Delayed. Required if and only if `delivery_issue` is `delayed`.""" + + delivered_to_wrong_location: VisaConsumerMerchandiseNotReceivedDeliveredToWrongLocation + """Delivered to wrong location. + + Required if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + merchant_cancellation: VisaConsumerMerchandiseNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: VisaConsumerMerchandiseNotReceivedNoCancellation + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaConsumerNonReceiptOfCash(TypedDict, total=False): + """Non-receipt of cash. + + Required if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + pass + + +class VisaConsumerOriginalCreditTransactionNotAccepted(TypedDict, total=False): + """Original Credit Transaction (OCT) not accepted. + + Required if and only if `category` is `consumer_original_credit_transaction_not_accepted`. + """ + + explanation: Required[str] + """Explanation.""" + + reason: Required[Literal["prohibited_by_local_laws_or_regulation", "recipient_refused"]] + """Reason. + + - `prohibited_by_local_laws_or_regulation` - Prohibited by local laws or + regulation. + - `recipient_refused` - Recipient refused. + """ + + +class VisaConsumerQualityMerchandiseNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaConsumerQualityMerchandiseOngoingNegotiations(TypedDict, total=False): + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaConsumerQualityMerchandiseReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerQualityMerchandiseReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerQualityMerchandise(TypedDict, total=False): + """Merchandise quality issue. + + Required if and only if `category` is `consumer_quality_merchandise`. + """ + + expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Expected at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaConsumerQualityMerchandiseNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + ongoing_negotiations: VisaConsumerQualityMerchandiseOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + return_attempted: VisaConsumerQualityMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerQualityMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerQualityServicesCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaConsumerQualityServicesOngoingNegotiations(TypedDict, total=False): + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaConsumerQualityServices(TypedDict, total=False): + """Services quality issue. + + Required if and only if `category` is `consumer_quality_services`. + """ + + cardholder_cancellation: Required[VisaConsumerQualityServicesCardholderCancellation] + """Cardholder cancellation.""" + + non_fiat_currency_or_non_fungible_token_related_and_not_matching_description: Required[ + Literal["not_related", "related"] + ] + """Non-fiat currency or non-fungible token related and not matching description. + + - `not_related` - Not related. + - `related` - Related. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + services_received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Services received at.""" + + cardholder_paid_to_have_work_redone: Literal["did_not_pay_to_have_work_redone", "paid_to_have_work_redone"] + """Cardholder paid to have work redone. + + - `did_not_pay_to_have_work_redone` - Cardholder did not pay to have work + redone. + - `paid_to_have_work_redone` - Cardholder paid to have work redone. + """ + + ongoing_negotiations: VisaConsumerQualityServicesOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + restaurant_food_related: Literal["not_related", "related"] + """ + Whether the dispute is related to the quality of food from an eating place or + restaurant. Must be provided when Merchant Category Code (MCC) is 5812, 5813 + or 5814. + + - `not_related` - Not related. + - `related` - Related. + """ + + +class VisaConsumerServicesMisrepresentationCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaConsumerServicesMisrepresentation(TypedDict, total=False): + """Services misrepresentation. + + Required if and only if `category` is `consumer_services_misrepresentation`. + """ + + cardholder_cancellation: Required[VisaConsumerServicesMisrepresentationCardholderCancellation] + """Cardholder cancellation.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaConsumerServicesNotAsDescribedCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaConsumerServicesNotAsDescribed(TypedDict, total=False): + """Services not as described. + + Required if and only if `category` is `consumer_services_not_as_described`. + """ + + cardholder_cancellation: Required[VisaConsumerServicesNotAsDescribedCardholderCancellation] + """Cardholder cancellation.""" + + explanation: Required[str] + """Explanation of what was ordered and was not as described.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is `cardholder_cancellation_prior_to_expected_receipt`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaConsumerServicesNotReceivedMerchantCancellation(TypedDict, total=False): + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaConsumerServicesNotReceivedNoCancellation(TypedDict, total=False): + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + pass + + +class VisaConsumerServicesNotReceived(TypedDict, total=False): + """Services not received. + + Required if and only if `category` is `consumer_services_not_received`. + """ + + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + merchant_cancellation: VisaConsumerServicesNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: VisaConsumerServicesNotReceivedNoCancellation + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaFraud(TypedDict, total=False): + """Fraud. Required if and only if `category` is `fraud`.""" + + fraud_type: Required[ + Literal[ + "account_or_credentials_takeover", + "card_not_received_as_issued", + "fraudulent_application", + "fraudulent_use_of_account_number", + "incorrect_processing", + "issuer_reported_counterfeit", + "lost", + "manipulation_of_account_holder", + "merchant_misrepresentation", + "miscellaneous", + "stolen", + ] + ] + """Fraud type. + + - `account_or_credentials_takeover` - Account or credentials takeover. + - `card_not_received_as_issued` - Card not received as issued. + - `fraudulent_application` - Fraudulent application. + - `fraudulent_use_of_account_number` - Fraudulent use of account number. + - `incorrect_processing` - Incorrect processing. + - `issuer_reported_counterfeit` - Issuer reported counterfeit. + - `lost` - Lost. + - `manipulation_of_account_holder` - Manipulation of account holder. + - `merchant_misrepresentation` - Merchant misrepresentation. + - `miscellaneous` - Miscellaneous. + - `stolen` - Stolen. + """ + + +class VisaProcessingErrorDuplicateTransaction(TypedDict, total=False): + """Duplicate transaction. + + Required if and only if `error_reason` is `duplicate_transaction`. + """ + + other_transaction_id: Required[str] + """Other transaction ID.""" + + +class VisaProcessingErrorIncorrectAmount(TypedDict, total=False): + """Incorrect amount. Required if and only if `error_reason` is `incorrect_amount`.""" + + expected_amount: Required[int] + """Expected amount.""" + + +class VisaProcessingErrorPaidByOtherMeans(TypedDict, total=False): + """Paid by other means. + + Required if and only if `error_reason` is `paid_by_other_means`. + """ + + other_form_of_payment_evidence: Required[ + Literal["canceled_check", "card_transaction", "cash_receipt", "other", "statement", "voucher"] + ] + """Other form of payment evidence. + + - `canceled_check` - Canceled check. + - `card_transaction` - Card transaction. + - `cash_receipt` - Cash receipt. + - `other` - Other. + - `statement` - Statement. + - `voucher` - Voucher. + """ + + other_transaction_id: str + """Other transaction ID.""" + + +class VisaProcessingError(TypedDict, total=False): + """Processing error. Required if and only if `category` is `processing_error`.""" + + error_reason: Required[Literal["duplicate_transaction", "incorrect_amount", "paid_by_other_means"]] + """Error reason. + + - `duplicate_transaction` - Duplicate transaction. + - `incorrect_amount` - Incorrect amount. + - `paid_by_other_means` - Paid by other means. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + duplicate_transaction: VisaProcessingErrorDuplicateTransaction + """Duplicate transaction. + + Required if and only if `error_reason` is `duplicate_transaction`. + """ + + incorrect_amount: VisaProcessingErrorIncorrectAmount + """Incorrect amount. Required if and only if `error_reason` is `incorrect_amount`.""" + + paid_by_other_means: VisaProcessingErrorPaidByOtherMeans + """Paid by other means. + + Required if and only if `error_reason` is `paid_by_other_means`. + """ + + +class Visa(TypedDict, total=False): + """The Visa-specific parameters for the dispute. + + Required if and only if `network` is `visa`. + """ + + category: Required[ + Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + ] + """Category. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + authorization: VisaAuthorization + """Authorization. Required if and only if `category` is `authorization`.""" + + consumer_canceled_merchandise: VisaConsumerCanceledMerchandise + """Canceled merchandise. + + Required if and only if `category` is `consumer_canceled_merchandise`. + """ + + consumer_canceled_recurring_transaction: VisaConsumerCanceledRecurringTransaction + """Canceled recurring transaction. + + Required if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + consumer_canceled_services: VisaConsumerCanceledServices + """Canceled services. + + Required if and only if `category` is `consumer_canceled_services`. + """ + + consumer_counterfeit_merchandise: VisaConsumerCounterfeitMerchandise + """Counterfeit merchandise. + + Required if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + consumer_credit_not_processed: VisaConsumerCreditNotProcessed + """Credit not processed. + + Required if and only if `category` is `consumer_credit_not_processed`. + """ + + consumer_damaged_or_defective_merchandise: VisaConsumerDamagedOrDefectiveMerchandise + """Damaged or defective merchandise. + + Required if and only if `category` is + `consumer_damaged_or_defective_merchandise`. + """ + + consumer_merchandise_misrepresentation: VisaConsumerMerchandiseMisrepresentation + """Merchandise misrepresentation. + + Required if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + consumer_merchandise_not_as_described: VisaConsumerMerchandiseNotAsDescribed + """Merchandise not as described. + + Required if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + consumer_merchandise_not_received: VisaConsumerMerchandiseNotReceived + """Merchandise not received. + + Required if and only if `category` is `consumer_merchandise_not_received`. + """ + + consumer_non_receipt_of_cash: VisaConsumerNonReceiptOfCash + """Non-receipt of cash. + + Required if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + consumer_original_credit_transaction_not_accepted: VisaConsumerOriginalCreditTransactionNotAccepted + """Original Credit Transaction (OCT) not accepted. + + Required if and only if `category` is + `consumer_original_credit_transaction_not_accepted`. + """ + + consumer_quality_merchandise: VisaConsumerQualityMerchandise + """Merchandise quality issue. + + Required if and only if `category` is `consumer_quality_merchandise`. + """ + + consumer_quality_services: VisaConsumerQualityServices + """Services quality issue. + + Required if and only if `category` is `consumer_quality_services`. + """ + + consumer_services_misrepresentation: VisaConsumerServicesMisrepresentation + """Services misrepresentation. + + Required if and only if `category` is `consumer_services_misrepresentation`. + """ + + consumer_services_not_as_described: VisaConsumerServicesNotAsDescribed + """Services not as described. + + Required if and only if `category` is `consumer_services_not_as_described`. + """ + + consumer_services_not_received: VisaConsumerServicesNotReceived + """Services not received. + + Required if and only if `category` is `consumer_services_not_received`. + """ + + fraud: VisaFraud + """Fraud. Required if and only if `category` is `fraud`.""" + + processing_error: VisaProcessingError + """Processing error. Required if and only if `category` is `processing_error`.""" diff --git a/src/increase/types/card_dispute_list_params.py b/src/increase/types/card_dispute_list_params.py index dbd7d93d9..18cf4ff8d 100644 --- a/src/increase/types/card_dispute_list_params.py +++ b/src/increase/types/card_dispute_list_params.py @@ -63,7 +63,17 @@ class CreatedAt(TypedDict, total=False): _StatusReservedKeywords = TypedDict( "_StatusReservedKeywords", { - "in": List[Literal["pending_reviewing", "accepted", "rejected"]], + "in": List[ + Literal[ + "user_submission_required", + "pending_user_submission_reviewing", + "pending_user_submission_submitting", + "pending_user_withdrawal_submitting", + "pending_response", + "lost", + "won", + ] + ], }, total=False, ) diff --git a/src/increase/types/card_dispute_submit_user_submission_params.py b/src/increase/types/card_dispute_submit_user_submission_params.py new file mode 100644 index 000000000..ccb3fed22 --- /dev/null +++ b/src/increase/types/card_dispute_submit_user_submission_params.py @@ -0,0 +1,1714 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = [ + "CardDisputeSubmitUserSubmissionParams", + "AttachmentFile", + "Visa", + "VisaChargeback", + "VisaChargebackAuthorization", + "VisaChargebackConsumerCanceledMerchandise", + "VisaChargebackConsumerCanceledMerchandiseCardholderCancellation", + "VisaChargebackConsumerCanceledMerchandiseNotReturned", + "VisaChargebackConsumerCanceledMerchandiseReturnAttempted", + "VisaChargebackConsumerCanceledMerchandiseReturned", + "VisaChargebackConsumerCanceledRecurringTransaction", + "VisaChargebackConsumerCanceledRecurringTransactionMerchantContactMethods", + "VisaChargebackConsumerCanceledServices", + "VisaChargebackConsumerCanceledServicesCardholderCancellation", + "VisaChargebackConsumerCanceledServicesGuaranteedReservation", + "VisaChargebackConsumerCanceledServicesOther", + "VisaChargebackConsumerCanceledServicesTimeshare", + "VisaChargebackConsumerCounterfeitMerchandise", + "VisaChargebackConsumerCreditNotProcessed", + "VisaChargebackConsumerDamagedOrDefectiveMerchandise", + "VisaChargebackConsumerDamagedOrDefectiveMerchandiseNotReturned", + "VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted", + "VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturned", + "VisaChargebackConsumerMerchandiseMisrepresentation", + "VisaChargebackConsumerMerchandiseMisrepresentationNotReturned", + "VisaChargebackConsumerMerchandiseMisrepresentationReturnAttempted", + "VisaChargebackConsumerMerchandiseMisrepresentationReturned", + "VisaChargebackConsumerMerchandiseNotAsDescribed", + "VisaChargebackConsumerMerchandiseNotAsDescribedReturnAttempted", + "VisaChargebackConsumerMerchandiseNotAsDescribedReturned", + "VisaChargebackConsumerMerchandiseNotReceived", + "VisaChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaChargebackConsumerMerchandiseNotReceivedDelayed", + "VisaChargebackConsumerMerchandiseNotReceivedDelayedNotReturned", + "VisaChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted", + "VisaChargebackConsumerMerchandiseNotReceivedDelayedReturned", + "VisaChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation", + "VisaChargebackConsumerMerchandiseNotReceivedMerchantCancellation", + "VisaChargebackConsumerMerchandiseNotReceivedNoCancellation", + "VisaChargebackConsumerNonReceiptOfCash", + "VisaChargebackConsumerOriginalCreditTransactionNotAccepted", + "VisaChargebackConsumerQualityMerchandise", + "VisaChargebackConsumerQualityMerchandiseNotReturned", + "VisaChargebackConsumerQualityMerchandiseOngoingNegotiations", + "VisaChargebackConsumerQualityMerchandiseReturnAttempted", + "VisaChargebackConsumerQualityMerchandiseReturned", + "VisaChargebackConsumerQualityServices", + "VisaChargebackConsumerQualityServicesCardholderCancellation", + "VisaChargebackConsumerQualityServicesOngoingNegotiations", + "VisaChargebackConsumerServicesMisrepresentation", + "VisaChargebackConsumerServicesMisrepresentationCardholderCancellation", + "VisaChargebackConsumerServicesNotAsDescribed", + "VisaChargebackConsumerServicesNotAsDescribedCardholderCancellation", + "VisaChargebackConsumerServicesNotReceived", + "VisaChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaChargebackConsumerServicesNotReceivedMerchantCancellation", + "VisaChargebackConsumerServicesNotReceivedNoCancellation", + "VisaChargebackFraud", + "VisaChargebackProcessingError", + "VisaChargebackProcessingErrorDuplicateTransaction", + "VisaChargebackProcessingErrorIncorrectAmount", + "VisaChargebackProcessingErrorPaidByOtherMeans", + "VisaMerchantPrearbitrationDecline", + "VisaUserPrearbitration", + "VisaUserPrearbitrationCategoryChange", +] + + +class CardDisputeSubmitUserSubmissionParams(TypedDict, total=False): + network: Required[Literal["visa"]] + """The network of the Card Dispute. + + Details specific to the network are required under the sub-object with the same + identifier as the network. + + - `visa` - Visa + """ + + amount: int + """ + The adjusted monetary amount of the part of the transaction that is being + disputed. This is optional and will default to the most recent amount provided. + If provided, the amount must be less than or equal to the amount of the + transaction. + """ + + attachment_files: Iterable[AttachmentFile] + """The files to be attached to the user submission.""" + + explanation: str + """ + The free-form explanation provided to Increase to provide more context for the + user submission. This field is not sent directly to the card networks. + """ + + visa: Visa + """The Visa-specific parameters for the dispute. + + Required if and only if `network` is `visa`. + """ + + +class AttachmentFile(TypedDict, total=False): + file_id: Required[str] + """The ID of the file to be attached. + + The file must have a `purpose` of `card_dispute_attachment`. + """ + + +class VisaChargebackAuthorization(TypedDict, total=False): + """Authorization. Required if and only if `category` is `authorization`.""" + + account_status: Required[Literal["account_closed", "credit_problem", "fraud"]] + """Account status. + + - `account_closed` - Account closed. + - `credit_problem` - Credit problem. + - `fraud` - Fraud. + """ + + +class VisaChargebackConsumerCanceledMerchandiseCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + canceled_prior_to_ship_date: Required[Literal["canceled_prior_to_ship_date", "not_canceled_prior_to_ship_date"]] + """Canceled prior to ship date. + + - `canceled_prior_to_ship_date` - Canceled prior to ship date. + - `not_canceled_prior_to_ship_date` - Not canceled prior to ship date. + """ + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerCanceledMerchandiseNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaChargebackConsumerCanceledMerchandiseReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerCanceledMerchandiseReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerCanceledMerchandise(TypedDict, total=False): + """Canceled merchandise. + + Required if and only if `category` is `consumer_canceled_merchandise`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_or_expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received or expected at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + cardholder_cancellation: VisaChargebackConsumerCanceledMerchandiseCardholderCancellation + """Cardholder cancellation.""" + + not_returned: VisaChargebackConsumerCanceledMerchandiseNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerCanceledMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerCanceledMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerCanceledRecurringTransactionMerchantContactMethods(TypedDict, total=False): + """Merchant contact methods.""" + + application_name: str + """Application name.""" + + call_center_phone_number: str + """Call center phone number.""" + + email_address: str + """Email address.""" + + in_person_address: str + """In person address.""" + + mailing_address: str + """Mailing address.""" + + text_phone_number: str + """Text phone number.""" + + +class VisaChargebackConsumerCanceledRecurringTransaction(TypedDict, total=False): + """Canceled recurring transaction. + + Required if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + cancellation_target: Required[Literal["account", "transaction"]] + """Cancellation target. + + - `account` - Account. + - `transaction` - Transaction. + """ + + merchant_contact_methods: Required[VisaChargebackConsumerCanceledRecurringTransactionMerchantContactMethods] + """Merchant contact methods.""" + + transaction_or_account_canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Transaction or account canceled at.""" + + other_form_of_payment_explanation: str + """Other form of payment explanation.""" + + +class VisaChargebackConsumerCanceledServicesCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerCanceledServicesGuaranteedReservation(TypedDict, total=False): + """Guaranteed reservation explanation. + + Required if and only if `service_type` is `guaranteed_reservation`. + """ + + explanation: Required[ + Literal[ + "cardholder_canceled_prior_to_service", + "cardholder_cancellation_attempt_within_24_hours_of_confirmation", + "merchant_billed_no_show", + ] + ] + """Explanation. + + - `cardholder_canceled_prior_to_service` - Cardholder canceled prior to service. + - `cardholder_cancellation_attempt_within_24_hours_of_confirmation` - Cardholder + cancellation attempt within 24 hours of confirmation. + - `merchant_billed_no_show` - Merchant billed for no-show. + """ + + +class VisaChargebackConsumerCanceledServicesOther(TypedDict, total=False): + """Other service type explanation. + + Required if and only if `service_type` is `other`. + """ + + pass + + +class VisaChargebackConsumerCanceledServicesTimeshare(TypedDict, total=False): + """Timeshare explanation. Required if and only if `service_type` is `timeshare`.""" + + pass + + +class VisaChargebackConsumerCanceledServices(TypedDict, total=False): + """Canceled services. + + Required if and only if `category` is `consumer_canceled_services`. + """ + + cardholder_cancellation: Required[VisaChargebackConsumerCanceledServicesCardholderCancellation] + """Cardholder cancellation.""" + + contracted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Contracted at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + service_type: Required[Literal["guaranteed_reservation", "other", "timeshare"]] + """Service type. + + - `guaranteed_reservation` - Guaranteed reservation. + - `other` - Other. + - `timeshare` - Timeshare. + """ + + guaranteed_reservation: VisaChargebackConsumerCanceledServicesGuaranteedReservation + """Guaranteed reservation explanation. + + Required if and only if `service_type` is `guaranteed_reservation`. + """ + + other: VisaChargebackConsumerCanceledServicesOther + """Other service type explanation. + + Required if and only if `service_type` is `other`. + """ + + timeshare: VisaChargebackConsumerCanceledServicesTimeshare + """Timeshare explanation. Required if and only if `service_type` is `timeshare`.""" + + +class VisaChargebackConsumerCounterfeitMerchandise(TypedDict, total=False): + """Counterfeit merchandise. + + Required if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + counterfeit_explanation: Required[str] + """Counterfeit explanation.""" + + disposition_explanation: Required[str] + """Disposition explanation.""" + + order_explanation: Required[str] + """Order explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaChargebackConsumerCreditNotProcessed(TypedDict, total=False): + """Credit not processed. + + Required if and only if `category` is `consumer_credit_not_processed`. + """ + + canceled_or_returned_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Canceled or returned at.""" + + credit_expected_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Credit expected at.""" + + +class VisaChargebackConsumerDamagedOrDefectiveMerchandiseNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerDamagedOrDefectiveMerchandise(TypedDict, total=False): + """Damaged or defective merchandise. + + Required if and only if `category` is `consumer_damaged_or_defective_merchandise`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + order_and_issue_explanation: Required[str] + """Order and issue explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaChargebackConsumerDamagedOrDefectiveMerchandiseNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseMisrepresentationNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaChargebackConsumerMerchandiseMisrepresentationReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerMerchandiseMisrepresentationReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerMerchandiseMisrepresentation(TypedDict, total=False): + """Merchandise misrepresentation. + + Required if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaChargebackConsumerMerchandiseMisrepresentationNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerMerchandiseMisrepresentationReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerMerchandiseMisrepresentationReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseNotAsDescribedReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerMerchandiseNotAsDescribedReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerMerchandiseNotAsDescribed(TypedDict, total=False): + """Merchandise not as described. + + Required if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["returned", "return_attempted"]] + """Return outcome. + + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + return_attempted: VisaChargebackConsumerMerchandiseNotAsDescribedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerMerchandiseNotAsDescribedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is `cardholder_cancellation_prior_to_expected_receipt`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDelayedNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDelayedReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + merchant_received_return_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Merchant received return at.""" + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDelayed(TypedDict, total=False): + """Delayed. Required if and only if `delivery_issue` is `delayed`.""" + + explanation: Required[str] + """Explanation.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaChargebackConsumerMerchandiseNotReceivedDelayedNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerMerchandiseNotReceivedDelayedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation(TypedDict, total=False): + """Delivered to wrong location. + + Required if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + agreed_location: Required[str] + """Agreed location.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedMerchantCancellation(TypedDict, total=False): + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedNoCancellation(TypedDict, total=False): + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + pass + + +class VisaChargebackConsumerMerchandiseNotReceived(TypedDict, total=False): + """Merchandise not received. + + Required if and only if `category` is `consumer_merchandise_not_received`. + """ + + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + delivery_issue: Required[Literal["delayed", "delivered_to_wrong_location"]] + """Delivery issue. + + - `delayed` - Delayed. + - `delivered_to_wrong_location` - Delivered to wrong location. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + delayed: VisaChargebackConsumerMerchandiseNotReceivedDelayed + """Delayed. Required if and only if `delivery_issue` is `delayed`.""" + + delivered_to_wrong_location: VisaChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation + """Delivered to wrong location. + + Required if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + merchant_cancellation: VisaChargebackConsumerMerchandiseNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: VisaChargebackConsumerMerchandiseNotReceivedNoCancellation + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaChargebackConsumerNonReceiptOfCash(TypedDict, total=False): + """Non-receipt of cash. + + Required if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + pass + + +class VisaChargebackConsumerOriginalCreditTransactionNotAccepted(TypedDict, total=False): + """Original Credit Transaction (OCT) not accepted. + + Required if and only if `category` is `consumer_original_credit_transaction_not_accepted`. + """ + + explanation: Required[str] + """Explanation.""" + + reason: Required[Literal["prohibited_by_local_laws_or_regulation", "recipient_refused"]] + """Reason. + + - `prohibited_by_local_laws_or_regulation` - Prohibited by local laws or + regulation. + - `recipient_refused` - Recipient refused. + """ + + +class VisaChargebackConsumerQualityMerchandiseNotReturned(TypedDict, total=False): + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + pass + + +class VisaChargebackConsumerQualityMerchandiseOngoingNegotiations(TypedDict, total=False): + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaChargebackConsumerQualityMerchandiseReturnAttempted(TypedDict, total=False): + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerQualityMerchandiseReturned(TypedDict, total=False): + """Returned. Required if and only if `return_outcome` is `returned`.""" + + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerQualityMerchandise(TypedDict, total=False): + """Merchandise quality issue. + + Required if and only if `category` is `consumer_quality_merchandise`. + """ + + expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Expected at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: VisaChargebackConsumerQualityMerchandiseNotReturned + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + ongoing_negotiations: VisaChargebackConsumerQualityMerchandiseOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + return_attempted: VisaChargebackConsumerQualityMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerQualityMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerQualityServicesCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerQualityServicesOngoingNegotiations(TypedDict, total=False): + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaChargebackConsumerQualityServices(TypedDict, total=False): + """Services quality issue. + + Required if and only if `category` is `consumer_quality_services`. + """ + + cardholder_cancellation: Required[VisaChargebackConsumerQualityServicesCardholderCancellation] + """Cardholder cancellation.""" + + non_fiat_currency_or_non_fungible_token_related_and_not_matching_description: Required[ + Literal["not_related", "related"] + ] + """Non-fiat currency or non-fungible token related and not matching description. + + - `not_related` - Not related. + - `related` - Related. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + services_received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Services received at.""" + + cardholder_paid_to_have_work_redone: Literal["did_not_pay_to_have_work_redone", "paid_to_have_work_redone"] + """Cardholder paid to have work redone. + + - `did_not_pay_to_have_work_redone` - Cardholder did not pay to have work + redone. + - `paid_to_have_work_redone` - Cardholder paid to have work redone. + """ + + ongoing_negotiations: VisaChargebackConsumerQualityServicesOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + restaurant_food_related: Literal["not_related", "related"] + """ + Whether the dispute is related to the quality of food from an eating place or + restaurant. Must be provided when Merchant Category Code (MCC) is 5812, 5813 + or 5814. + + - `not_related` - Not related. + - `related` - Related. + """ + + +class VisaChargebackConsumerServicesMisrepresentationCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerServicesMisrepresentation(TypedDict, total=False): + """Services misrepresentation. + + Required if and only if `category` is `consumer_services_misrepresentation`. + """ + + cardholder_cancellation: Required[VisaChargebackConsumerServicesMisrepresentationCardholderCancellation] + """Cardholder cancellation.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaChargebackConsumerServicesNotAsDescribedCardholderCancellation(TypedDict, total=False): + """Cardholder cancellation.""" + + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerServicesNotAsDescribed(TypedDict, total=False): + """Services not as described. + + Required if and only if `category` is `consumer_services_not_as_described`. + """ + + cardholder_cancellation: Required[VisaChargebackConsumerServicesNotAsDescribedCardholderCancellation] + """Cardholder cancellation.""" + + explanation: Required[str] + """Explanation of what was ordered and was not as described.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is `cardholder_cancellation_prior_to_expected_receipt`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaChargebackConsumerServicesNotReceivedMerchantCancellation(TypedDict, total=False): + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaChargebackConsumerServicesNotReceivedNoCancellation(TypedDict, total=False): + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + pass + + +class VisaChargebackConsumerServicesNotReceived(TypedDict, total=False): + """Services not received. + + Required if and only if `category` is `consumer_services_not_received`. + """ + + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + merchant_cancellation: VisaChargebackConsumerServicesNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: VisaChargebackConsumerServicesNotReceivedNoCancellation + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaChargebackFraud(TypedDict, total=False): + """Fraud. Required if and only if `category` is `fraud`.""" + + fraud_type: Required[ + Literal[ + "account_or_credentials_takeover", + "card_not_received_as_issued", + "fraudulent_application", + "fraudulent_use_of_account_number", + "incorrect_processing", + "issuer_reported_counterfeit", + "lost", + "manipulation_of_account_holder", + "merchant_misrepresentation", + "miscellaneous", + "stolen", + ] + ] + """Fraud type. + + - `account_or_credentials_takeover` - Account or credentials takeover. + - `card_not_received_as_issued` - Card not received as issued. + - `fraudulent_application` - Fraudulent application. + - `fraudulent_use_of_account_number` - Fraudulent use of account number. + - `incorrect_processing` - Incorrect processing. + - `issuer_reported_counterfeit` - Issuer reported counterfeit. + - `lost` - Lost. + - `manipulation_of_account_holder` - Manipulation of account holder. + - `merchant_misrepresentation` - Merchant misrepresentation. + - `miscellaneous` - Miscellaneous. + - `stolen` - Stolen. + """ + + +class VisaChargebackProcessingErrorDuplicateTransaction(TypedDict, total=False): + """Duplicate transaction. + + Required if and only if `error_reason` is `duplicate_transaction`. + """ + + other_transaction_id: Required[str] + """Other transaction ID.""" + + +class VisaChargebackProcessingErrorIncorrectAmount(TypedDict, total=False): + """Incorrect amount. Required if and only if `error_reason` is `incorrect_amount`.""" + + expected_amount: Required[int] + """Expected amount.""" + + +class VisaChargebackProcessingErrorPaidByOtherMeans(TypedDict, total=False): + """Paid by other means. + + Required if and only if `error_reason` is `paid_by_other_means`. + """ + + other_form_of_payment_evidence: Required[ + Literal["canceled_check", "card_transaction", "cash_receipt", "other", "statement", "voucher"] + ] + """Other form of payment evidence. + + - `canceled_check` - Canceled check. + - `card_transaction` - Card transaction. + - `cash_receipt` - Cash receipt. + - `other` - Other. + - `statement` - Statement. + - `voucher` - Voucher. + """ + + other_transaction_id: str + """Other transaction ID.""" + + +class VisaChargebackProcessingError(TypedDict, total=False): + """Processing error. Required if and only if `category` is `processing_error`.""" + + error_reason: Required[Literal["duplicate_transaction", "incorrect_amount", "paid_by_other_means"]] + """Error reason. + + - `duplicate_transaction` - Duplicate transaction. + - `incorrect_amount` - Incorrect amount. + - `paid_by_other_means` - Paid by other means. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + duplicate_transaction: VisaChargebackProcessingErrorDuplicateTransaction + """Duplicate transaction. + + Required if and only if `error_reason` is `duplicate_transaction`. + """ + + incorrect_amount: VisaChargebackProcessingErrorIncorrectAmount + """Incorrect amount. Required if and only if `error_reason` is `incorrect_amount`.""" + + paid_by_other_means: VisaChargebackProcessingErrorPaidByOtherMeans + """Paid by other means. + + Required if and only if `error_reason` is `paid_by_other_means`. + """ + + +class VisaChargeback(TypedDict, total=False): + """The chargeback details for the user submission. + + Required if and only if `category` is `chargeback`. + """ + + category: Required[ + Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + ] + """Category. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + authorization: VisaChargebackAuthorization + """Authorization. Required if and only if `category` is `authorization`.""" + + consumer_canceled_merchandise: VisaChargebackConsumerCanceledMerchandise + """Canceled merchandise. + + Required if and only if `category` is `consumer_canceled_merchandise`. + """ + + consumer_canceled_recurring_transaction: VisaChargebackConsumerCanceledRecurringTransaction + """Canceled recurring transaction. + + Required if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + consumer_canceled_services: VisaChargebackConsumerCanceledServices + """Canceled services. + + Required if and only if `category` is `consumer_canceled_services`. + """ + + consumer_counterfeit_merchandise: VisaChargebackConsumerCounterfeitMerchandise + """Counterfeit merchandise. + + Required if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + consumer_credit_not_processed: VisaChargebackConsumerCreditNotProcessed + """Credit not processed. + + Required if and only if `category` is `consumer_credit_not_processed`. + """ + + consumer_damaged_or_defective_merchandise: VisaChargebackConsumerDamagedOrDefectiveMerchandise + """Damaged or defective merchandise. + + Required if and only if `category` is + `consumer_damaged_or_defective_merchandise`. + """ + + consumer_merchandise_misrepresentation: VisaChargebackConsumerMerchandiseMisrepresentation + """Merchandise misrepresentation. + + Required if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + consumer_merchandise_not_as_described: VisaChargebackConsumerMerchandiseNotAsDescribed + """Merchandise not as described. + + Required if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + consumer_merchandise_not_received: VisaChargebackConsumerMerchandiseNotReceived + """Merchandise not received. + + Required if and only if `category` is `consumer_merchandise_not_received`. + """ + + consumer_non_receipt_of_cash: VisaChargebackConsumerNonReceiptOfCash + """Non-receipt of cash. + + Required if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + consumer_original_credit_transaction_not_accepted: VisaChargebackConsumerOriginalCreditTransactionNotAccepted + """Original Credit Transaction (OCT) not accepted. + + Required if and only if `category` is + `consumer_original_credit_transaction_not_accepted`. + """ + + consumer_quality_merchandise: VisaChargebackConsumerQualityMerchandise + """Merchandise quality issue. + + Required if and only if `category` is `consumer_quality_merchandise`. + """ + + consumer_quality_services: VisaChargebackConsumerQualityServices + """Services quality issue. + + Required if and only if `category` is `consumer_quality_services`. + """ + + consumer_services_misrepresentation: VisaChargebackConsumerServicesMisrepresentation + """Services misrepresentation. + + Required if and only if `category` is `consumer_services_misrepresentation`. + """ + + consumer_services_not_as_described: VisaChargebackConsumerServicesNotAsDescribed + """Services not as described. + + Required if and only if `category` is `consumer_services_not_as_described`. + """ + + consumer_services_not_received: VisaChargebackConsumerServicesNotReceived + """Services not received. + + Required if and only if `category` is `consumer_services_not_received`. + """ + + fraud: VisaChargebackFraud + """Fraud. Required if and only if `category` is `fraud`.""" + + processing_error: VisaChargebackProcessingError + """Processing error. Required if and only if `category` is `processing_error`.""" + + +class VisaMerchantPrearbitrationDecline(TypedDict, total=False): + """The merchant pre-arbitration decline details for the user submission. + + Required if and only if `category` is `merchant_prearbitration_decline`. + """ + + reason: Required[str] + """The reason for declining the merchant's pre-arbitration request.""" + + +class VisaUserPrearbitrationCategoryChange(TypedDict, total=False): + """Category change details for the pre-arbitration request. + + Should only be populated if the category of the dispute is being changed as part of the pre-arbitration request. + """ + + category: Required[ + Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + ] + """ + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + reason: Required[str] + """The reason for the category change.""" + + +class VisaUserPrearbitration(TypedDict, total=False): + """The user pre-arbitration details for the user submission. + + Required if and only if `category` is `user_prearbitration`. + """ + + reason: Required[str] + """The reason for the pre-arbitration request.""" + + category_change: VisaUserPrearbitrationCategoryChange + """Category change details for the pre-arbitration request. + + Should only be populated if the category of the dispute is being changed as part + of the pre-arbitration request. + """ + + +class Visa(TypedDict, total=False): + """The Visa-specific parameters for the dispute. + + Required if and only if `network` is `visa`. + """ + + category: Required[Literal["chargeback", "merchant_prearbitration_decline", "user_prearbitration"]] + """The category of the user submission. + + Details specific to the category are required under the sub-object with the same + identifier as the category. + + - `chargeback` - Chargeback. + - `merchant_prearbitration_decline` - Merchant pre-arbitration decline. + - `user_prearbitration` - User pre-arbitration. + """ + + chargeback: VisaChargeback + """The chargeback details for the user submission. + + Required if and only if `category` is `chargeback`. + """ + + merchant_prearbitration_decline: VisaMerchantPrearbitrationDecline + """The merchant pre-arbitration decline details for the user submission. + + Required if and only if `category` is `merchant_prearbitration_decline`. + """ + + user_prearbitration: VisaUserPrearbitration + """The user pre-arbitration details for the user submission. + + Required if and only if `category` is `user_prearbitration`. + """ diff --git a/src/increase/types/card_dispute_withdraw_params.py b/src/increase/types/card_dispute_withdraw_params.py new file mode 100644 index 000000000..ac79a2e8e --- /dev/null +++ b/src/increase/types/card_dispute_withdraw_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import TypedDict + +__all__ = ["CardDisputeWithdrawParams"] + + +class CardDisputeWithdrawParams(TypedDict, total=False): + explanation: str + """The explanation for withdrawing the Card Dispute.""" diff --git a/src/increase/types/card_iframe_url.py b/src/increase/types/card_iframe_url.py new file mode 100644 index 000000000..5449f0823 --- /dev/null +++ b/src/increase/types/card_iframe_url.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["CardIframeURL"] + + +class CardIframeURL(BaseModel): + """An object containing the iframe URL for a Card.""" + + expires_at: datetime + """The time the iframe URL will expire.""" + + iframe_url: str + """The iframe URL for the Card. Treat this as an opaque URL.""" + + type: Literal["card_iframe_url"] + """A constant representing the object's type. + + For this resource it will always be `card_iframe_url`. + """ diff --git a/src/increase/types/card_list_params.py b/src/increase/types/card_list_params.py index 8042a2912..c1eef0f8c 100644 --- a/src/increase/types/card_list_params.py +++ b/src/increase/types/card_list_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["CardListParams", "CreatedAt"] +__all__ = ["CardListParams", "CreatedAt", "Status"] class CardListParams(TypedDict, total=False): @@ -34,6 +34,8 @@ class CardListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ + status: Status + class CreatedAt(TypedDict, total=False): after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] @@ -59,3 +61,16 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["active", "disabled", "canceled"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/card_payment.py b/src/increase/types/card_payment.py index 316bd7bb8..828b95643 100644 --- a/src/increase/types/card_payment.py +++ b/src/increase/types/card_payment.py @@ -1,65 +1,2584 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import date, datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = [ - "CardPayment", - "Element", - "ElementCardAuthorization", - "ElementCardAuthorizationNetworkDetails", - "ElementCardAuthorizationNetworkDetailsVisa", - "ElementCardAuthorizationNetworkIdentifiers", - "ElementCardAuthorizationVerification", - "ElementCardAuthorizationVerificationCardVerificationCode", - "ElementCardAuthorizationVerificationCardholderAddress", - "ElementCardAuthorizationExpiration", - "ElementCardDecline", - "ElementCardDeclineNetworkDetails", - "ElementCardDeclineNetworkDetailsVisa", - "ElementCardDeclineNetworkIdentifiers", - "ElementCardDeclineVerification", - "ElementCardDeclineVerificationCardVerificationCode", - "ElementCardDeclineVerificationCardholderAddress", - "ElementCardFuelConfirmation", - "ElementCardFuelConfirmationNetworkIdentifiers", - "ElementCardIncrement", - "ElementCardIncrementNetworkIdentifiers", - "ElementCardRefund", - "ElementCardRefundNetworkIdentifiers", - "ElementCardRefundPurchaseDetails", - "ElementCardRefundPurchaseDetailsCarRental", - "ElementCardRefundPurchaseDetailsLodging", - "ElementCardRefundPurchaseDetailsTravel", - "ElementCardRefundPurchaseDetailsTravelAncillary", - "ElementCardRefundPurchaseDetailsTravelAncillaryService", - "ElementCardRefundPurchaseDetailsTravelTripLeg", - "ElementCardReversal", - "ElementCardReversalNetworkIdentifiers", - "ElementCardSettlement", - "ElementCardSettlementNetworkIdentifiers", - "ElementCardSettlementPurchaseDetails", - "ElementCardSettlementPurchaseDetailsCarRental", - "ElementCardSettlementPurchaseDetailsLodging", - "ElementCardSettlementPurchaseDetailsTravel", - "ElementCardSettlementPurchaseDetailsTravelAncillary", - "ElementCardSettlementPurchaseDetailsTravelAncillaryService", - "ElementCardSettlementPurchaseDetailsTravelTripLeg", - "ElementCardValidation", - "ElementCardValidationNetworkDetails", - "ElementCardValidationNetworkDetailsVisa", - "ElementCardValidationNetworkIdentifiers", - "ElementCardValidationVerification", - "ElementCardValidationVerificationCardVerificationCode", - "ElementCardValidationVerificationCardholderAddress", - "State", -] +__all__ = [ + "CardPayment", + "Element", + "ElementCardAuthentication", + "ElementCardAuthenticationChallenge", + "ElementCardAuthenticationChallengeAttempt", + "ElementCardAuthenticationDeviceChannel", + "ElementCardAuthenticationDeviceChannelBrowser", + "ElementCardAuthenticationDeviceChannelMerchantInitiated", + "ElementCardAuthenticationMessageCategory", + "ElementCardAuthenticationMessageCategoryNonPayment", + "ElementCardAuthenticationMessageCategoryPayment", + "ElementCardAuthorization", + "ElementCardAuthorizationAdditionalAmounts", + "ElementCardAuthorizationAdditionalAmountsClinic", + "ElementCardAuthorizationAdditionalAmountsDental", + "ElementCardAuthorizationAdditionalAmountsOriginal", + "ElementCardAuthorizationAdditionalAmountsPrescription", + "ElementCardAuthorizationAdditionalAmountsSurcharge", + "ElementCardAuthorizationAdditionalAmountsTotalCumulative", + "ElementCardAuthorizationAdditionalAmountsTotalHealthcare", + "ElementCardAuthorizationAdditionalAmountsTransit", + "ElementCardAuthorizationAdditionalAmountsUnknown", + "ElementCardAuthorizationAdditionalAmountsVision", + "ElementCardAuthorizationNetworkDetails", + "ElementCardAuthorizationNetworkDetailsPulse", + "ElementCardAuthorizationNetworkDetailsVisa", + "ElementCardAuthorizationNetworkIdentifiers", + "ElementCardAuthorizationSchemeFee", + "ElementCardAuthorizationVerification", + "ElementCardAuthorizationVerificationCardVerificationCode", + "ElementCardAuthorizationVerificationCardholderAddress", + "ElementCardAuthorizationVerificationCardholderName", + "ElementCardAuthorizationExpiration", + "ElementCardBalanceInquiry", + "ElementCardBalanceInquiryAdditionalAmounts", + "ElementCardBalanceInquiryAdditionalAmountsClinic", + "ElementCardBalanceInquiryAdditionalAmountsDental", + "ElementCardBalanceInquiryAdditionalAmountsOriginal", + "ElementCardBalanceInquiryAdditionalAmountsPrescription", + "ElementCardBalanceInquiryAdditionalAmountsSurcharge", + "ElementCardBalanceInquiryAdditionalAmountsTotalCumulative", + "ElementCardBalanceInquiryAdditionalAmountsTotalHealthcare", + "ElementCardBalanceInquiryAdditionalAmountsTransit", + "ElementCardBalanceInquiryAdditionalAmountsUnknown", + "ElementCardBalanceInquiryAdditionalAmountsVision", + "ElementCardBalanceInquiryNetworkDetails", + "ElementCardBalanceInquiryNetworkDetailsPulse", + "ElementCardBalanceInquiryNetworkDetailsVisa", + "ElementCardBalanceInquiryNetworkIdentifiers", + "ElementCardBalanceInquirySchemeFee", + "ElementCardBalanceInquiryVerification", + "ElementCardBalanceInquiryVerificationCardVerificationCode", + "ElementCardBalanceInquiryVerificationCardholderAddress", + "ElementCardBalanceInquiryVerificationCardholderName", + "ElementCardDecline", + "ElementCardDeclineAdditionalAmounts", + "ElementCardDeclineAdditionalAmountsClinic", + "ElementCardDeclineAdditionalAmountsDental", + "ElementCardDeclineAdditionalAmountsOriginal", + "ElementCardDeclineAdditionalAmountsPrescription", + "ElementCardDeclineAdditionalAmountsSurcharge", + "ElementCardDeclineAdditionalAmountsTotalCumulative", + "ElementCardDeclineAdditionalAmountsTotalHealthcare", + "ElementCardDeclineAdditionalAmountsTransit", + "ElementCardDeclineAdditionalAmountsUnknown", + "ElementCardDeclineAdditionalAmountsVision", + "ElementCardDeclineNetworkDetails", + "ElementCardDeclineNetworkDetailsPulse", + "ElementCardDeclineNetworkDetailsVisa", + "ElementCardDeclineNetworkIdentifiers", + "ElementCardDeclineSchemeFee", + "ElementCardDeclineVerification", + "ElementCardDeclineVerificationCardVerificationCode", + "ElementCardDeclineVerificationCardholderAddress", + "ElementCardDeclineVerificationCardholderName", + "ElementCardFinancial", + "ElementCardFinancialAdditionalAmounts", + "ElementCardFinancialAdditionalAmountsClinic", + "ElementCardFinancialAdditionalAmountsDental", + "ElementCardFinancialAdditionalAmountsOriginal", + "ElementCardFinancialAdditionalAmountsPrescription", + "ElementCardFinancialAdditionalAmountsSurcharge", + "ElementCardFinancialAdditionalAmountsTotalCumulative", + "ElementCardFinancialAdditionalAmountsTotalHealthcare", + "ElementCardFinancialAdditionalAmountsTransit", + "ElementCardFinancialAdditionalAmountsUnknown", + "ElementCardFinancialAdditionalAmountsVision", + "ElementCardFinancialNetworkDetails", + "ElementCardFinancialNetworkDetailsPulse", + "ElementCardFinancialNetworkDetailsVisa", + "ElementCardFinancialNetworkIdentifiers", + "ElementCardFinancialSchemeFee", + "ElementCardFinancialVerification", + "ElementCardFinancialVerificationCardVerificationCode", + "ElementCardFinancialVerificationCardholderAddress", + "ElementCardFinancialVerificationCardholderName", + "ElementCardFuelConfirmation", + "ElementCardFuelConfirmationNetworkIdentifiers", + "ElementCardFuelConfirmationSchemeFee", + "ElementCardIncrement", + "ElementCardIncrementAdditionalAmounts", + "ElementCardIncrementAdditionalAmountsClinic", + "ElementCardIncrementAdditionalAmountsDental", + "ElementCardIncrementAdditionalAmountsOriginal", + "ElementCardIncrementAdditionalAmountsPrescription", + "ElementCardIncrementAdditionalAmountsSurcharge", + "ElementCardIncrementAdditionalAmountsTotalCumulative", + "ElementCardIncrementAdditionalAmountsTotalHealthcare", + "ElementCardIncrementAdditionalAmountsTransit", + "ElementCardIncrementAdditionalAmountsUnknown", + "ElementCardIncrementAdditionalAmountsVision", + "ElementCardIncrementNetworkIdentifiers", + "ElementCardIncrementSchemeFee", + "ElementCardRefund", + "ElementCardRefundCashback", + "ElementCardRefundInterchange", + "ElementCardRefundNetworkIdentifiers", + "ElementCardRefundPurchaseDetails", + "ElementCardRefundPurchaseDetailsCarRental", + "ElementCardRefundPurchaseDetailsLodging", + "ElementCardRefundPurchaseDetailsTravel", + "ElementCardRefundPurchaseDetailsTravelAncillary", + "ElementCardRefundPurchaseDetailsTravelAncillaryService", + "ElementCardRefundPurchaseDetailsTravelTripLeg", + "ElementCardRefundSchemeFee", + "ElementCardReversal", + "ElementCardReversalNetworkIdentifiers", + "ElementCardReversalSchemeFee", + "ElementCardSettlement", + "ElementCardSettlementCashback", + "ElementCardSettlementInterchange", + "ElementCardSettlementNetworkIdentifiers", + "ElementCardSettlementPurchaseDetails", + "ElementCardSettlementPurchaseDetailsCarRental", + "ElementCardSettlementPurchaseDetailsLodging", + "ElementCardSettlementPurchaseDetailsTravel", + "ElementCardSettlementPurchaseDetailsTravelAncillary", + "ElementCardSettlementPurchaseDetailsTravelAncillaryService", + "ElementCardSettlementPurchaseDetailsTravelTripLeg", + "ElementCardSettlementSchemeFee", + "ElementCardSettlementSurcharge", + "ElementCardValidation", + "ElementCardValidationAdditionalAmounts", + "ElementCardValidationAdditionalAmountsClinic", + "ElementCardValidationAdditionalAmountsDental", + "ElementCardValidationAdditionalAmountsOriginal", + "ElementCardValidationAdditionalAmountsPrescription", + "ElementCardValidationAdditionalAmountsSurcharge", + "ElementCardValidationAdditionalAmountsTotalCumulative", + "ElementCardValidationAdditionalAmountsTotalHealthcare", + "ElementCardValidationAdditionalAmountsTransit", + "ElementCardValidationAdditionalAmountsUnknown", + "ElementCardValidationAdditionalAmountsVision", + "ElementCardValidationNetworkDetails", + "ElementCardValidationNetworkDetailsPulse", + "ElementCardValidationNetworkDetailsVisa", + "ElementCardValidationNetworkIdentifiers", + "ElementCardValidationSchemeFee", + "ElementCardValidationVerification", + "ElementCardValidationVerificationCardVerificationCode", + "ElementCardValidationVerificationCardholderAddress", + "ElementCardValidationVerificationCardholderName", + "ElementOther", + "State", +] + + +class ElementCardAuthenticationChallengeAttempt(BaseModel): + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time of the Card + Authentication Challenge Attempt. + """ + + outcome: Literal["successful", "failed"] + """The outcome of the Card Authentication Challenge Attempt. + + - `successful` - The attempt was successful. + - `failed` - The attempt was unsuccessful. + """ + + +class ElementCardAuthenticationChallenge(BaseModel): + """Details about the challenge, if one was requested.""" + + attempts: List[ElementCardAuthenticationChallengeAttempt] + """Details about the challenge verification attempts, if any happened.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card + Authentication Challenge was started. + """ + + one_time_code: str + """The one-time code used for the Card Authentication Challenge.""" + + real_time_decision_id: Optional[str] = None + """The identifier of the Real-Time Decision used to deliver this challenge.""" + + verification_method: Literal["text_message", "email", "none_available"] + """The method used to verify the Card Authentication Challenge. + + - `text_message` - The one-time code was sent via text message. + - `email` - The one-time code was sent via email. + - `none_available` - The one-time code was not successfully delivered. + """ + + verification_value: Optional[str] = None + """ + E.g., the email address or phone number used for the Card Authentication + Challenge. + """ + + +class ElementCardAuthenticationDeviceChannelBrowser(BaseModel): + """Fields specific to the browser device channel.""" + + accept_header: Optional[str] = None + """The accept header from the cardholder's browser.""" + + ip_address: Optional[str] = None + """The IP address of the cardholder's browser.""" + + javascript_enabled: Optional[Literal["enabled", "disabled"]] = None + """Whether JavaScript is enabled in the cardholder's browser. + + - `enabled` - JavaScript is enabled in the cardholder's browser. + - `disabled` - JavaScript is not enabled in the cardholder's browser. + """ + + language: Optional[str] = None + """The language of the cardholder's browser.""" + + user_agent: Optional[str] = None + """The user agent of the cardholder's browser.""" + + +class ElementCardAuthenticationDeviceChannelMerchantInitiated(BaseModel): + """Fields specific to merchant initiated transactions.""" + + indicator: Literal[ + "recurring_transaction", + "installment_transaction", + "add_card", + "maintain_card_information", + "account_verification", + "split_delayed_shipment", + "top_up", + "mail_order", + "telephone_order", + "whitelist_status_check", + "other_payment", + "billing_agreement", + "device_binding_status_check", + "card_security_code_status_check", + "delayed_shipment", + "split_payment", + "fido_credential_deletion", + "fido_credential_registration", + "decoupled_authentication_fallback", + ] + """The merchant initiated indicator for the transaction. + + - `recurring_transaction` - Recurring transaction. + - `installment_transaction` - Installment transaction. + - `add_card` - Add card. + - `maintain_card_information` - Maintain card information. + - `account_verification` - Account verification. + - `split_delayed_shipment` - Split or delayed shipment. + - `top_up` - Top up. + - `mail_order` - Mail order. + - `telephone_order` - Telephone order. + - `whitelist_status_check` - Whitelist status check. + - `other_payment` - Other payment. + - `billing_agreement` - Billing agreement. + - `device_binding_status_check` - Device binding status check. + - `card_security_code_status_check` - Card security code status check. + - `delayed_shipment` - Delayed shipment. + - `split_payment` - Split payment. + - `fido_credential_deletion` - FIDO credential deletion. + - `fido_credential_registration` - FIDO credential registration. + - `decoupled_authentication_fallback` - Decoupled authentication fallback. + """ + + +class ElementCardAuthenticationDeviceChannel(BaseModel): + """The device channel of the card authentication attempt.""" + + browser: Optional[ElementCardAuthenticationDeviceChannelBrowser] = None + """Fields specific to the browser device channel.""" + + category: Literal["app", "browser", "three_ds_requestor_initiated"] + """The category of the device channel. + + - `app` - The authentication attempt was made from an app. + - `browser` - The authentication attempt was made from a browser. + - `three_ds_requestor_initiated` - The authentication attempt was initiated by + the 3DS Requestor. + """ + + merchant_initiated: Optional[ElementCardAuthenticationDeviceChannelMerchantInitiated] = None + """Fields specific to merchant initiated transactions.""" + + +class ElementCardAuthenticationMessageCategoryNonPayment(BaseModel): + """Fields specific to non-payment authentication attempts.""" + + pass + + +class ElementCardAuthenticationMessageCategoryPayment(BaseModel): + """Fields specific to payment authentication attempts.""" + + purchase_amount: int + """The purchase amount in minor units.""" + + purchase_amount_cardholder_estimated: Optional[int] = None + """ + The purchase amount in the cardholder's currency (i.e., USD) estimated using + daily conversion rates from the card network. + """ + + purchase_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + authentication attempt's purchase currency. + """ + + transaction_type: Optional[ + Literal[ + "goods_service_purchase", + "check_acceptance", + "account_funding", + "quasi_cash_transaction", + "prepaid_activation_and_load", + ] + ] = None + """The type of transaction being authenticated. + + - `goods_service_purchase` - Purchase of goods or services. + - `check_acceptance` - Check acceptance. + - `account_funding` - Account funding. + - `quasi_cash_transaction` - Quasi-cash transaction. + - `prepaid_activation_and_load` - Prepaid activation and load. + """ + + +class ElementCardAuthenticationMessageCategory(BaseModel): + """The message category of the card authentication attempt.""" + + category: Literal["payment_authentication", "non_payment_authentication"] + """The category of the card authentication attempt. + + - `payment_authentication` - The authentication attempt is for a payment. + - `non_payment_authentication` - The authentication attempt is not for a + payment. + """ + + non_payment: Optional[ElementCardAuthenticationMessageCategoryNonPayment] = None + """Fields specific to non-payment authentication attempts.""" + + payment: Optional[ElementCardAuthenticationMessageCategoryPayment] = None + """Fields specific to payment authentication attempts.""" + + +class ElementCardAuthentication(BaseModel): + """A Card Authentication object. + + This field will be present in the JSON response if and only if `category` is equal to `card_authentication`. Card Authentications are attempts to authenticate a transaction or a card with 3DS. + """ + + id: str + """The Card Authentication identifier.""" + + access_control_server_transaction_identifier: str + """ + A unique identifier assigned by the Access Control Server (us) for this + transaction. + """ + + billing_address_city: Optional[str] = None + """ + The city of the cardholder billing address associated with the card used for + this purchase. + """ + + billing_address_country: Optional[str] = None + """ + The country of the cardholder billing address associated with the card used for + this purchase. + """ + + billing_address_line1: Optional[str] = None + """ + The first line of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_line2: Optional[str] = None + """ + The second line of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_line3: Optional[str] = None + """ + The third line of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_postal_code: Optional[str] = None + """ + The postal code of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_state: Optional[str] = None + """ + The US state of the cardholder billing address associated with the card used for + this purchase. + """ + + card_id: str + """The identifier of the Card.""" + + card_payment_id: str + """The ID of the Card Payment this transaction belongs to.""" + + cardholder_email: Optional[str] = None + """The email address of the cardholder.""" + + cardholder_name: Optional[str] = None + """The name of the cardholder.""" + + challenge: Optional[ElementCardAuthenticationChallenge] = None + """Details about the challenge, if one was requested.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Card + Authentication was attempted. + """ + + deny_reason: Optional[ + Literal[ + "group_locked", + "card_not_active", + "entity_not_active", + "transaction_not_allowed", + "webhook_denied", + "webhook_timed_out", + ] + ] = None + """The reason why this authentication attempt was denied, if it was. + + - `group_locked` - The group was locked. + - `card_not_active` - The card was not active. + - `entity_not_active` - The entity was not active. + - `transaction_not_allowed` - The transaction was not allowed. + - `webhook_denied` - The webhook was denied. + - `webhook_timed_out` - The webhook timed out. + """ + + device_channel: ElementCardAuthenticationDeviceChannel + """The device channel of the card authentication attempt.""" + + directory_server_transaction_identifier: str + """ + A unique identifier assigned by the Directory Server (the card network) for this + transaction. + """ + + merchant_acceptor_id: Optional[str] = None + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: Optional[str] = None + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_country: Optional[str] = None + """The country the merchant resides in.""" + + merchant_name: Optional[str] = None + """The name of the merchant.""" + + message_category: ElementCardAuthenticationMessageCategory + """The message category of the card authentication attempt.""" + + prior_authenticated_card_payment_id: Optional[str] = None + """ + The ID of a prior Card Authentication that the requestor used to authenticate + this cardholder for a previous transaction. + """ + + real_time_decision_id: Optional[str] = None + """ + The identifier of the Real-Time Decision sent to approve or decline this + authentication attempt. + """ + + requestor_authentication_indicator: Optional[ + Literal[ + "payment_transaction", + "recurring_transaction", + "installment_transaction", + "add_card", + "maintain_card", + "emv_token_cardholder_verification", + "billing_agreement", + ] + ] = None + """ + The 3DS requestor authentication indicator describes why the authentication + attempt is performed, such as for a recurring transaction. + + - `payment_transaction` - The authentication is for a payment transaction. + - `recurring_transaction` - The authentication is for a recurring transaction. + - `installment_transaction` - The authentication is for an installment + transaction. + - `add_card` - The authentication is for adding a card. + - `maintain_card` - The authentication is for maintaining a card. + - `emv_token_cardholder_verification` - The authentication is for EMV token + cardholder verification. + - `billing_agreement` - The authentication is for a billing agreement. + """ + + requestor_challenge_indicator: Optional[ + Literal[ + "no_preference", + "no_challenge_requested", + "challenge_requested_3ds_requestor_preference", + "challenge_requested_mandate", + "no_challenge_requested_transactional_risk_analysis_already_performed", + "no_challenge_requested_data_share_only", + "no_challenge_requested_strong_consumer_authentication_already_performed", + "no_challenge_requested_utilize_whitelist_exemption_if_no_challenge_required", + "challenge_requested_whitelist_prompt_requested_if_challenge_required", + ] + ] = None + """Indicates whether a challenge is requested for this transaction. + + - `no_preference` - No preference. + - `no_challenge_requested` - No challenge requested. + - `challenge_requested_3ds_requestor_preference` - Challenge requested, 3DS + Requestor preference. + - `challenge_requested_mandate` - Challenge requested, mandate. + - `no_challenge_requested_transactional_risk_analysis_already_performed` - No + challenge requested, transactional risk analysis already performed. + - `no_challenge_requested_data_share_only` - No challenge requested, data share + only. + - `no_challenge_requested_strong_consumer_authentication_already_performed` - No + challenge requested, strong consumer authentication already performed. + - `no_challenge_requested_utilize_whitelist_exemption_if_no_challenge_required` - + No challenge requested, utilize whitelist exemption if no challenge required. + - `challenge_requested_whitelist_prompt_requested_if_challenge_required` - + Challenge requested, whitelist prompt requested if challenge required. + """ + + requestor_name: str + """The name of the 3DS requestor.""" + + requestor_url: str + """The URL of the 3DS requestor.""" + + shipping_address_city: Optional[str] = None + """The city of the shipping address associated with this purchase.""" + + shipping_address_country: Optional[str] = None + """The country of the shipping address associated with this purchase.""" + + shipping_address_line1: Optional[str] = None + """The first line of the shipping address associated with this purchase.""" + + shipping_address_line2: Optional[str] = None + """The second line of the shipping address associated with this purchase.""" + + shipping_address_line3: Optional[str] = None + """The third line of the shipping address associated with this purchase.""" + + shipping_address_postal_code: Optional[str] = None + """The postal code of the shipping address associated with this purchase.""" + + shipping_address_state: Optional[str] = None + """The US state of the shipping address associated with this purchase.""" + + status: Literal[ + "denied", + "authenticated_with_challenge", + "authenticated_without_challenge", + "awaiting_challenge", + "validating_challenge", + "canceled", + "timed_out_awaiting_challenge", + "errored", + "exceeded_attempt_threshold", + ] + """The status of the card authentication. + + - `denied` - The authentication attempt was denied. + - `authenticated_with_challenge` - The authentication attempt was authenticated + with a challenge. + - `authenticated_without_challenge` - The authentication attempt was + authenticated without a challenge. + - `awaiting_challenge` - The authentication attempt is awaiting a challenge. + - `validating_challenge` - The authentication attempt is validating a challenge. + - `canceled` - The authentication attempt was canceled. + - `timed_out_awaiting_challenge` - The authentication attempt timed out while + awaiting a challenge. + - `errored` - The authentication attempt errored. + - `exceeded_attempt_threshold` - The authentication attempt exceeded the attempt + threshold. + """ + + three_d_secure_server_transaction_identifier: str + """ + A unique identifier assigned by the 3DS Server initiating the authentication + attempt for this transaction. + """ + + type: Literal["card_authentication"] + """A constant representing the object's type. + + For this resource it will always be `card_authentication`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardAuthorizationAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardAuthorizationAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[ElementCardAuthorizationAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[ElementCardAuthorizationAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[ElementCardAuthorizationAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[ElementCardAuthorizationAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[ElementCardAuthorizationAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[ElementCardAuthorizationAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[ElementCardAuthorizationAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[ElementCardAuthorizationAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[ElementCardAuthorizationAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[ElementCardAuthorizationAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class ElementCardAuthorizationNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + + +class ElementCardAuthorizationNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + + electronic_commerce_indicator: Optional[ + Literal[ + "mail_phone_order", + "recurring", + "installment", + "unknown_mail_phone_order", + "secure_electronic_commerce", + "non_authenticated_security_transaction_at_3ds_capable_merchant", + "non_authenticated_security_transaction", + "non_secure_transaction", + ] + ] = None + """ + For electronic commerce transactions, this identifies the level of security used + in obtaining the customer's payment credential. For mail or telephone order + transactions, identifies the type of mail or telephone order. + + - `mail_phone_order` - Single transaction of a mail/phone order: Use to indicate + that the transaction is a mail/phone order purchase, not a recurring + transaction or installment payment. For domestic transactions in the US + region, this value may also indicate one bill payment transaction in the + card-present or card-absent environments. + - `recurring` - Recurring transaction: Payment indicator used to indicate a + recurring transaction that originates from an acquirer in the US region. + - `installment` - Installment payment: Payment indicator used to indicate one + purchase of goods or services that is billed to the account in multiple + charges over a period of time agreed upon by the cardholder and merchant from + transactions that originate from an acquirer in the US region. + - `unknown_mail_phone_order` - Unknown classification: other mail order: Use to + indicate that the type of mail/telephone order is unknown. + - `secure_electronic_commerce` - Secure electronic commerce transaction: Use to + indicate that the electronic commerce transaction has been authenticated using + e.g., 3-D Secure + - `non_authenticated_security_transaction_at_3ds_capable_merchant` - + Non-authenticated security transaction at a 3-D Secure-capable merchant, and + merchant attempted to authenticate the cardholder using 3-D Secure: Use to + identify an electronic commerce transaction where the merchant attempted to + authenticate the cardholder using 3-D Secure, but was unable to complete the + authentication because the issuer or cardholder does not participate in the + 3-D Secure program. + - `non_authenticated_security_transaction` - Non-authenticated security + transaction: Use to identify an electronic commerce transaction that uses data + encryption for security however, cardholder authentication is not performed + using 3-D Secure. + - `non_secure_transaction` - Non-secure transaction: Use to identify an + electronic commerce transaction that has no data protection. + """ + + point_of_service_entry_mode: Optional[ + Literal[ + "unknown", + "manual", + "magnetic_stripe_no_cvv", + "optical_code", + "integrated_circuit_card", + "contactless", + "credential_on_file", + "magnetic_stripe", + "contactless_magnetic_stripe", + "integrated_circuit_card_no_cvv", + ] + ] = None + """ + The method used to enter the cardholder's primary account number and card + expiration date. + + - `unknown` - Unknown + - `manual` - Manual key entry + - `magnetic_stripe_no_cvv` - Magnetic stripe read, without card verification + value + - `optical_code` - Optical code + - `integrated_circuit_card` - Contact chip card + - `contactless` - Contactless read of chip card + - `credential_on_file` - Transaction initiated using a credential that has + previously been stored on file + - `magnetic_stripe` - Magnetic stripe read + - `contactless_magnetic_stripe` - Contactless read of magnetic stripe data + - `integrated_circuit_card_no_cvv` - Contact chip card, without card + verification value + """ + + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + + +class ElementCardAuthorizationNetworkDetails(BaseModel): + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] + """The payment network used to process this card authorization. + + - `visa` - Visa + - `pulse` - Pulse + """ + + pulse: Optional[ElementCardAuthorizationNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + + visa: Optional[ElementCardAuthorizationNetworkDetailsVisa] = None + """Fields specific to the `visa` network.""" + + +class ElementCardAuthorizationNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + + retrieval_reference_number: Optional[str] = None + """A life-cycle identifier used across e.g., an authorization and a reversal. + + Expected to be unique per acquirer within a window of time. For some card + networks the retrieval reference number includes the trace counter. + """ + + trace_number: Optional[str] = None + """A counter used to verify an individual authorization. + + Expected to be unique per acquirer within a window of time. + """ + + transaction_id: Optional[str] = None + """ + A globally unique transaction identifier provided by the card network, used + across multiple life-cycle requests. + """ + + +class ElementCardAuthorizationSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + +class ElementCardAuthorizationVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + + result: Literal["not_checked", "match", "no_match"] + """The result of verifying the Card Verification Code. + + - `not_checked` - No card verification code was provided in the authorization + request. + - `match` - The card verification code matched the one on file. + - `no_match` - The card verification code did not match the one on file. + """ + + +class ElementCardAuthorizationVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + + actual_line1: Optional[str] = None + """Line 1 of the address on file for the cardholder.""" + + actual_postal_code: Optional[str] = None + """The postal code of the address on file for the cardholder.""" + + provided_line1: Optional[str] = None + """ + The cardholder address line 1 provided for verification in the authorization + request. + """ + + provided_postal_code: Optional[str] = None + """The postal code provided for verification in the authorization request.""" + + result: Literal[ + "not_checked", + "postal_code_match_address_no_match", + "postal_code_no_match_address_match", + "match", + "no_match", + "postal_code_match_address_not_checked", + ] + """The address verification result returned to the card network. + + - `not_checked` - No address information was provided in the authorization + request. + - `postal_code_match_address_no_match` - Postal code matches, but the street + address does not match or was not provided. + - `postal_code_no_match_address_match` - Postal code does not match, but the + street address matches or was not provided. + - `match` - Postal code and street address match. + - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) + """ + + +class ElementCardAuthorizationVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + +class ElementCardAuthorizationVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + + card_verification_code: ElementCardAuthorizationVerificationCardVerificationCode + """ + Fields related to verification of the Card Verification Code, a 3-digit code on + the back of the card. + """ + + cardholder_address: ElementCardAuthorizationVerificationCardholderAddress + """ + Cardholder address provided in the authorization request and the address on file + we verified it against. + """ + + cardholder_name: Optional[ElementCardAuthorizationVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + + +class ElementCardAuthorization(BaseModel): + """A Card Authorization object. + + This field will be present in the JSON response if and only if `category` is equal to `card_authorization`. Card Authorizations are temporary holds placed on a customer's funds with the intent to later clear a transaction. + """ + + id: str + """The Card Authorization identifier.""" + + actioner: Literal["user", "increase", "network"] + """ + Whether this authorization was approved by Increase, the card network through + stand-in processing, or the user through a real-time decision. + + - `user` - This object was actioned by the user through a real-time decision. + - `increase` - This object was actioned by Increase without user intervention. + - `network` - This object was actioned by the network, through stand-in + processing. + """ + + additional_amounts: ElementCardAuthorizationAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + + amount: int + """The pending amount in the minor unit of the transaction's currency. + + For dollars, for example, this is cents. + """ + + card_payment_id: str + """The ID of the Card Payment this transaction belongs to.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's currency. + + - `USD` - US Dollar (USD) + """ + + digital_wallet_token_id: Optional[str] = None + """ + If the authorization was made via a Digital Wallet Token (such as an Apple Pay + purchase), the identifier of the token that was used. + """ + + direction: Literal["settlement", "refund"] + """ + The direction describes the direction the funds will move, either from the + cardholder to the merchant or from the merchant to the cardholder. + + - `settlement` - A regular card authorization where funds are debited from the + cardholder. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + """ + + expires_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) when this authorization + will expire and the pending transaction will be released. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: Optional[str] = None + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network_details: ElementCardAuthorizationNetworkDetails + """Fields specific to the `network`.""" + + network_identifiers: ElementCardAuthorizationNetworkIdentifiers + """Network-specific identifiers for a specific request or transaction.""" + + network_risk_score: Optional[int] = None + """The risk score generated by the card network. + + For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. + """ + + pending_transaction_id: Optional[str] = None + """The identifier of the Pending Transaction associated with this Transaction.""" + + physical_card_id: Optional[str] = None + """ + If the authorization was made in-person with a physical card, the Physical Card + that was used. + """ + + presentment_amount: int + """The pending amount in the minor unit of the transaction's presentment currency.""" + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + + processing_category: Literal[ + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + "unknown", + ] + """ + The processing category describes the intent behind the authorization, such as + whether it was used for bill payments or an automatic fuel dispenser. + + - `account_funding` - Account funding transactions are transactions used to + e.g., fund an account or transfer funds between accounts. + - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur + when a card is used at a gas pump, prior to the actual transaction amount + being known. They are followed by an advice message that updates the amount of + the pending transaction. + - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. + - `purchase` - A regular purchase. + - `quasi_cash` - Quasi-cash transactions represent purchases of items which may + be convertible to cash. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + - `unknown` - The processing category is unknown. + """ + + real_time_decision_id: Optional[str] = None + """ + The identifier of the Real-Time Decision sent to approve or decline this + transaction. + """ + + scheme_fees: List[ElementCardAuthorizationSchemeFee] + """The scheme fees associated with this card authorization.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + type: Literal["card_authorization"] + """A constant representing the object's type. + + For this resource it will always be `card_authorization`. + """ + + verification: ElementCardAuthorizationVerification + """Fields related to verification of cardholder-provided values.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardAuthorizationExpiration(BaseModel): + """A Card Authorization Expiration object. + + This field will be present in the JSON response if and only if `category` is equal to `card_authorization_expiration`. Card Authorization Expirations are cancellations of authorizations that were never settled by the acquirer. + """ + + id: str + """The Card Authorization Expiration identifier.""" + + card_authorization_id: str + """The identifier for the Card Authorization this reverses.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's + currency. + + - `USD` - US Dollar (USD) + """ + + expired_amount: int + """ + The amount of this authorization expiration in the minor unit of the + transaction's currency. For dollars, for example, this is cents. + """ + + network: Literal["visa", "pulse"] + """The card network used to process this card authorization. + + - `visa` - Visa + - `pulse` - Pulse + """ + + type: Literal["card_authorization_expiration"] + """A constant representing the object's type. + + For this resource it will always be `card_authorization_expiration`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardBalanceInquiryAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardBalanceInquiryAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[ElementCardBalanceInquiryAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[ElementCardBalanceInquiryAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[ElementCardBalanceInquiryAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[ElementCardBalanceInquiryAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[ElementCardBalanceInquiryAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[ElementCardBalanceInquiryAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[ElementCardBalanceInquiryAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[ElementCardBalanceInquiryAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[ElementCardBalanceInquiryAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[ElementCardBalanceInquiryAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class ElementCardBalanceInquiryNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + + +class ElementCardBalanceInquiryNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + + electronic_commerce_indicator: Optional[ + Literal[ + "mail_phone_order", + "recurring", + "installment", + "unknown_mail_phone_order", + "secure_electronic_commerce", + "non_authenticated_security_transaction_at_3ds_capable_merchant", + "non_authenticated_security_transaction", + "non_secure_transaction", + ] + ] = None + """ + For electronic commerce transactions, this identifies the level of security used + in obtaining the customer's payment credential. For mail or telephone order + transactions, identifies the type of mail or telephone order. + + - `mail_phone_order` - Single transaction of a mail/phone order: Use to indicate + that the transaction is a mail/phone order purchase, not a recurring + transaction or installment payment. For domestic transactions in the US + region, this value may also indicate one bill payment transaction in the + card-present or card-absent environments. + - `recurring` - Recurring transaction: Payment indicator used to indicate a + recurring transaction that originates from an acquirer in the US region. + - `installment` - Installment payment: Payment indicator used to indicate one + purchase of goods or services that is billed to the account in multiple + charges over a period of time agreed upon by the cardholder and merchant from + transactions that originate from an acquirer in the US region. + - `unknown_mail_phone_order` - Unknown classification: other mail order: Use to + indicate that the type of mail/telephone order is unknown. + - `secure_electronic_commerce` - Secure electronic commerce transaction: Use to + indicate that the electronic commerce transaction has been authenticated using + e.g., 3-D Secure + - `non_authenticated_security_transaction_at_3ds_capable_merchant` - + Non-authenticated security transaction at a 3-D Secure-capable merchant, and + merchant attempted to authenticate the cardholder using 3-D Secure: Use to + identify an electronic commerce transaction where the merchant attempted to + authenticate the cardholder using 3-D Secure, but was unable to complete the + authentication because the issuer or cardholder does not participate in the + 3-D Secure program. + - `non_authenticated_security_transaction` - Non-authenticated security + transaction: Use to identify an electronic commerce transaction that uses data + encryption for security however, cardholder authentication is not performed + using 3-D Secure. + - `non_secure_transaction` - Non-secure transaction: Use to identify an + electronic commerce transaction that has no data protection. + """ + + point_of_service_entry_mode: Optional[ + Literal[ + "unknown", + "manual", + "magnetic_stripe_no_cvv", + "optical_code", + "integrated_circuit_card", + "contactless", + "credential_on_file", + "magnetic_stripe", + "contactless_magnetic_stripe", + "integrated_circuit_card_no_cvv", + ] + ] = None + """ + The method used to enter the cardholder's primary account number and card + expiration date. + + - `unknown` - Unknown + - `manual` - Manual key entry + - `magnetic_stripe_no_cvv` - Magnetic stripe read, without card verification + value + - `optical_code` - Optical code + - `integrated_circuit_card` - Contact chip card + - `contactless` - Contactless read of chip card + - `credential_on_file` - Transaction initiated using a credential that has + previously been stored on file + - `magnetic_stripe` - Magnetic stripe read + - `contactless_magnetic_stripe` - Contactless read of magnetic stripe data + - `integrated_circuit_card_no_cvv` - Contact chip card, without card + verification value + """ + + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + + +class ElementCardBalanceInquiryNetworkDetails(BaseModel): + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] + """The payment network used to process this card authorization. + + - `visa` - Visa + - `pulse` - Pulse + """ + + pulse: Optional[ElementCardBalanceInquiryNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + + visa: Optional[ElementCardBalanceInquiryNetworkDetailsVisa] = None + """Fields specific to the `visa` network.""" + + +class ElementCardBalanceInquiryNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + + retrieval_reference_number: Optional[str] = None + """A life-cycle identifier used across e.g., an authorization and a reversal. + + Expected to be unique per acquirer within a window of time. For some card + networks the retrieval reference number includes the trace counter. + """ + + trace_number: Optional[str] = None + """A counter used to verify an individual authorization. + + Expected to be unique per acquirer within a window of time. + """ + + transaction_id: Optional[str] = None + """ + A globally unique transaction identifier provided by the card network, used + across multiple life-cycle requests. + """ + + +class ElementCardBalanceInquirySchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + +class ElementCardBalanceInquiryVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + + result: Literal["not_checked", "match", "no_match"] + """The result of verifying the Card Verification Code. + + - `not_checked` - No card verification code was provided in the authorization + request. + - `match` - The card verification code matched the one on file. + - `no_match` - The card verification code did not match the one on file. + """ + + +class ElementCardBalanceInquiryVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + + actual_line1: Optional[str] = None + """Line 1 of the address on file for the cardholder.""" + + actual_postal_code: Optional[str] = None + """The postal code of the address on file for the cardholder.""" + + provided_line1: Optional[str] = None + """ + The cardholder address line 1 provided for verification in the authorization + request. + """ + + provided_postal_code: Optional[str] = None + """The postal code provided for verification in the authorization request.""" + + result: Literal[ + "not_checked", + "postal_code_match_address_no_match", + "postal_code_no_match_address_match", + "match", + "no_match", + "postal_code_match_address_not_checked", + ] + """The address verification result returned to the card network. + + - `not_checked` - No address information was provided in the authorization + request. + - `postal_code_match_address_no_match` - Postal code matches, but the street + address does not match or was not provided. + - `postal_code_no_match_address_match` - Postal code does not match, but the + street address matches or was not provided. + - `match` - Postal code and street address match. + - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) + """ + + +class ElementCardBalanceInquiryVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + +class ElementCardBalanceInquiryVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + + card_verification_code: ElementCardBalanceInquiryVerificationCardVerificationCode + """ + Fields related to verification of the Card Verification Code, a 3-digit code on + the back of the card. + """ + + cardholder_address: ElementCardBalanceInquiryVerificationCardholderAddress + """ + Cardholder address provided in the authorization request and the address on file + we verified it against. + """ + + cardholder_name: Optional[ElementCardBalanceInquiryVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + + +class ElementCardBalanceInquiry(BaseModel): + """A Card Balance Inquiry object. + + This field will be present in the JSON response if and only if `category` is equal to `card_balance_inquiry`. Card Balance Inquiries are transactions that allow merchants to check the available balance on a card without placing a hold on funds, commonly used when a customer requests their balance at an ATM. + """ + + id: str + """The Card Balance Inquiry identifier.""" + + additional_amounts: ElementCardBalanceInquiryAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + + balance: int + """The balance amount in the minor unit of the account's currency. + + For dollars, for example, this is cents. + """ + + card_payment_id: str + """The ID of the Card Payment this transaction belongs to.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account's + currency. + + - `USD` - US Dollar (USD) + """ + + digital_wallet_token_id: Optional[str] = None + """ + If the authorization was made via a Digital Wallet Token (such as an Apple Pay + purchase), the identifier of the token that was used. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: Optional[str] = None + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network_details: ElementCardBalanceInquiryNetworkDetails + """Fields specific to the `network`.""" + + network_identifiers: ElementCardBalanceInquiryNetworkIdentifiers + """Network-specific identifiers for a specific request or transaction.""" + + network_risk_score: Optional[int] = None + """The risk score generated by the card network. + + For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. + """ + + physical_card_id: Optional[str] = None + """ + If the authorization was made in-person with a physical card, the Physical Card + that was used. + """ + + real_time_decision_id: Optional[str] = None + """ + The identifier of the Real-Time Decision sent to approve or decline this + transaction. + """ + + scheme_fees: List[ElementCardBalanceInquirySchemeFee] + """The scheme fees associated with this card balance inquiry.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + type: Literal["card_balance_inquiry"] + """A constant representing the object's type. + + For this resource it will always be `card_balance_inquiry`. + """ + + verification: ElementCardBalanceInquiryVerification + """Fields related to verification of cardholder-provided values.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardDeclineAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardDeclineAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[ElementCardDeclineAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[ElementCardDeclineAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[ElementCardDeclineAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[ElementCardDeclineAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[ElementCardDeclineAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[ElementCardDeclineAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[ElementCardDeclineAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[ElementCardDeclineAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[ElementCardDeclineAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[ElementCardDeclineAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class ElementCardDeclineNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + + +class ElementCardDeclineNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" -class ElementCardAuthorizationNetworkDetailsVisa(BaseModel): electronic_commerce_indicator: Optional[ Literal[ "mail_phone_order", @@ -102,7 +2621,7 @@ class ElementCardAuthorizationNetworkDetailsVisa(BaseModel): 3-D Secure program. - `non_authenticated_security_transaction` - Non-authenticated security transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed + encryption for security however, cardholder authentication is not performed using 3-D Secure. - `non_secure_transaction` - Non-secure transaction: Use to identify an electronic commerce transaction that has no data protection. @@ -141,19 +2660,106 @@ class ElementCardAuthorizationNetworkDetailsVisa(BaseModel): verification value """ + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. -class ElementCardAuthorizationNetworkDetails(BaseModel): - category: Literal["visa"] + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + + +class ElementCardDeclineNetworkDetails(BaseModel): + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] """The payment network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ - visa: Optional[ElementCardAuthorizationNetworkDetailsVisa] = None + pulse: Optional[ElementCardDeclineNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + + visa: Optional[ElementCardDeclineNetworkDetailsVisa] = None """Fields specific to the `visa` network.""" -class ElementCardAuthorizationNetworkIdentifiers(BaseModel): +class ElementCardDeclineNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -164,17 +2770,173 @@ class ElementCardAuthorizationNetworkIdentifiers(BaseModel): trace_number: Optional[str] = None """A counter used to verify an individual authorization. - Expected to be unique per acquirer within a window of time. + Expected to be unique per acquirer within a window of time. + """ + + transaction_id: Optional[str] = None + """ + A globally unique transaction identifier provided by the card network, used + across multiple life-cycle requests. + """ + + +class ElementCardDeclineSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). """ - transaction_id: Optional[str] = None + +class ElementCardDeclineVerificationCardVerificationCode(BaseModel): """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. """ - -class ElementCardAuthorizationVerificationCardVerificationCode(BaseModel): result: Literal["not_checked", "match", "no_match"] """The result of verifying the Card Verification Code. @@ -185,7 +2947,11 @@ class ElementCardAuthorizationVerificationCardVerificationCode(BaseModel): """ -class ElementCardAuthorizationVerificationCardholderAddress(BaseModel): +class ElementCardDeclineVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + actual_line1: Optional[str] = None """Line 1 of the address on file for the cardholder.""" @@ -203,43 +2969,67 @@ class ElementCardAuthorizationVerificationCardholderAddress(BaseModel): result: Literal[ "not_checked", - "postal_code_match_address_not_checked", "postal_code_match_address_no_match", "postal_code_no_match_address_match", "match", "no_match", + "postal_code_match_address_not_checked", ] """The address verification result returned to the card network. - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. + - `not_checked` - No address information was provided in the authorization + request. - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. + address does not match or was not provided. - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. + street address matches or was not provided. - `match` - Postal code and street address match. - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) """ -class ElementCardAuthorizationVerification(BaseModel): - card_verification_code: ElementCardAuthorizationVerificationCardVerificationCode +class ElementCardDeclineVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + +class ElementCardDeclineVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + + card_verification_code: ElementCardDeclineVerificationCardVerificationCode """ Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. """ - cardholder_address: ElementCardAuthorizationVerificationCardholderAddress + cardholder_address: ElementCardDeclineVerificationCardholderAddress """ Cardholder address provided in the authorization request and the address on file we verified it against. """ + cardholder_name: Optional[ElementCardDeclineVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + + +class ElementCardDecline(BaseModel): + """A Card Decline object. + + This field will be present in the JSON response if and only if `category` is equal to `card_decline`. + """ -class ElementCardAuthorization(BaseModel): id: str - """The Card Authorization identifier.""" + """The Card Decline identifier.""" actioner: Literal["user", "increase", "network"] """ @@ -252,28 +3042,33 @@ class ElementCardAuthorization(BaseModel): processing. """ + additional_amounts: ElementCardDeclineAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + amount: int - """The pending amount in the minor unit of the transaction's currency. + """The declined amount in the minor unit of the destination account currency. For dollars, for example, this is cents. """ - card_payment_id: Optional[str] = None + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination + account currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ + declined_transaction_id: str + """The identifier of the declined transaction created for this Card Decline.""" + digital_wallet_token_id: Optional[str] = None """ If the authorization was made via a Digital Wallet Token (such as an Apple Pay @@ -282,7 +3077,7 @@ class ElementCardAuthorization(BaseModel): direction: Literal["settlement", "refund"] """ - The direction descibes the direction the funds will move, either from the + The direction describes the direction the funds will move, either from the cardholder to the merchant or from the merchant to the cardholder. - `settlement` - A regular card authorization where funds are debited from the @@ -291,10 +3086,10 @@ class ElementCardAuthorization(BaseModel): voucher authorization, where funds are credited to the cardholder. """ - expires_at: datetime + incremented_card_authorization_id: Optional[str] = None """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) when this authorization - will expire and the pending transaction will be released. + The identifier of the card authorization this request attempted to incrementally + authorize. """ merchant_acceptor_id: str @@ -303,7 +3098,7 @@ class ElementCardAuthorization(BaseModel): is transacting with. """ - merchant_category_code: Optional[str] = None + merchant_category_code: str """ The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is transacting with. @@ -312,36 +3107,64 @@ class ElementCardAuthorization(BaseModel): merchant_city: Optional[str] = None """The city the merchant resides in.""" - merchant_country: Optional[str] = None + merchant_country: str """The country the merchant resides in.""" merchant_descriptor: str """The merchant descriptor of the merchant the card is transacting with.""" - network_details: ElementCardAuthorizationNetworkDetails + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network_details: ElementCardDeclineNetworkDetails """Fields specific to the `network`.""" - network_identifiers: ElementCardAuthorizationNetworkIdentifiers + network_identifiers: ElementCardDeclineNetworkIdentifiers """Network-specific identifiers for a specific request or transaction.""" network_risk_score: Optional[int] = None """The risk score generated by the card network. For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. """ - pending_transaction_id: Optional[str] = None - """The identifier of the Pending Transaction associated with this Transaction.""" - physical_card_id: Optional[str] = None """ If the authorization was made in-person with a physical card, the Physical Card that was used. """ + presentment_amount: int + """ + The declined amount in the minor unit of the transaction's presentment currency. + """ + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + "unknown", ] """ The processing category describes the intent behind the authorization, such as @@ -354,11 +3177,18 @@ class ElementCardAuthorization(BaseModel): being known. They are followed by an advice message that updates the amount of the pending transaction. - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. - `purchase` - A regular purchase. - `quasi_cash` - Quasi-cash transactions represent purchases of items which may be convertible to cash. - `refund` - A refund card authorization, sometimes referred to as a credit voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + - `unknown` - The processing category is unknown. """ real_time_decision_id: Optional[str] = None @@ -367,56 +3197,336 @@ class ElementCardAuthorization(BaseModel): transaction. """ - type: Literal["card_authorization"] - """A constant representing the object's type. + real_time_decision_reason: Optional[ + Literal[ + "insufficient_funds", + "transaction_never_allowed", + "exceeds_approval_limit", + "card_temporarily_disabled", + "suspected_fraud", + "other", + ] + ] = None + """ + This is present if a specific decline reason was given in the real-time + decision. - For this resource it will always be `card_authorization`. + - `insufficient_funds` - The cardholder does not have sufficient funds to cover + the transaction. The merchant may attempt to process the transaction again. + - `transaction_never_allowed` - This type of transaction is not allowed for this + card. This transaction should not be retried. + - `exceeds_approval_limit` - The transaction amount exceeds the cardholder's + approval limit. The merchant may attempt to process the transaction again. + - `card_temporarily_disabled` - The card has been temporarily disabled or not + yet activated. The merchant may attempt to process the transaction again. + - `suspected_fraud` - The transaction is suspected to be fraudulent. The + merchant may attempt to process the transaction again. + - `other` - The transaction was declined for another reason. The merchant may + attempt to process the transaction again. This should be used sparingly. """ - verification: ElementCardAuthorizationVerification + reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + """Why the transaction was declined. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + """ + + scheme_fees: List[ElementCardDeclineSchemeFee] + """The scheme fees associated with this card decline.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + verification: ElementCardDeclineVerification """Fields related to verification of cardholder-provided values.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class ElementCardAuthorizationExpiration(BaseModel): - id: str - """The Card Authorization Expiration identifier.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - card_authorization_id: str - """The identifier for the Card Authorization this reverses.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] +class ElementCardFinancialAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's - currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - expired_amount: int + +class ElementCardFinancialAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The amount of this authorization expiration in the minor unit of the - transaction's currency. For dollars, for example, this is cents. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - network: Literal["visa"] - """The card network used to process this card authorization. - - `visa` - Visa +class ElementCardFinancialAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - type: Literal["card_authorization_expiration"] - """A constant representing the object's type. + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ - For this resource it will always be `card_authorization_expiration`. + +class ElementCardFinancialAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ -class ElementCardDeclineNetworkDetailsVisa(BaseModel): +class ElementCardFinancialAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardFinancialAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardFinancialAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardFinancialAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardFinancialAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardFinancialAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardFinancialAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[ElementCardFinancialAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[ElementCardFinancialAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[ElementCardFinancialAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[ElementCardFinancialAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[ElementCardFinancialAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[ElementCardFinancialAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[ElementCardFinancialAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[ElementCardFinancialAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[ElementCardFinancialAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[ElementCardFinancialAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class ElementCardFinancialNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + + +class ElementCardFinancialNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + electronic_commerce_indicator: Optional[ Literal[ "mail_phone_order", @@ -459,7 +3569,7 @@ class ElementCardDeclineNetworkDetailsVisa(BaseModel): 3-D Secure program. - `non_authenticated_security_transaction` - Non-authenticated security transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed + encryption for security however, cardholder authentication is not performed using 3-D Secure. - `non_secure_transaction` - Non-secure transaction: Use to identify an electronic commerce transaction that has no data protection. @@ -498,19 +3608,106 @@ class ElementCardDeclineNetworkDetailsVisa(BaseModel): verification value """ + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. -class ElementCardDeclineNetworkDetails(BaseModel): - category: Literal["visa"] + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + + +class ElementCardFinancialNetworkDetails(BaseModel): + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] """The payment network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ - visa: Optional[ElementCardDeclineNetworkDetailsVisa] = None + pulse: Optional[ElementCardFinancialNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + + visa: Optional[ElementCardFinancialNetworkDetailsVisa] = None """Fields specific to the `visa` network.""" -class ElementCardDeclineNetworkIdentifiers(BaseModel): +class ElementCardFinancialNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -531,7 +3728,163 @@ class ElementCardDeclineNetworkIdentifiers(BaseModel): """ -class ElementCardDeclineVerificationCardVerificationCode(BaseModel): +class ElementCardFinancialSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + +class ElementCardFinancialVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + result: Literal["not_checked", "match", "no_match"] """The result of verifying the Card Verification Code. @@ -542,7 +3895,11 @@ class ElementCardDeclineVerificationCardVerificationCode(BaseModel): """ -class ElementCardDeclineVerificationCardholderAddress(BaseModel): +class ElementCardFinancialVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + actual_line1: Optional[str] = None """Line 1 of the address on file for the cardholder.""" @@ -560,47 +3917,71 @@ class ElementCardDeclineVerificationCardholderAddress(BaseModel): result: Literal[ "not_checked", - "postal_code_match_address_not_checked", "postal_code_match_address_no_match", "postal_code_no_match_address_match", "match", "no_match", + "postal_code_match_address_not_checked", ] """The address verification result returned to the card network. - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. + - `not_checked` - No address information was provided in the authorization + request. - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. + address does not match or was not provided. - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. + street address matches or was not provided. - `match` - Postal code and street address match. - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) """ -class ElementCardDeclineVerification(BaseModel): - card_verification_code: ElementCardDeclineVerificationCardVerificationCode +class ElementCardFinancialVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + +class ElementCardFinancialVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + + card_verification_code: ElementCardFinancialVerificationCardVerificationCode """ Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. """ - cardholder_address: ElementCardDeclineVerificationCardholderAddress + cardholder_address: ElementCardFinancialVerificationCardholderAddress """ Cardholder address provided in the authorization request and the address on file we verified it against. """ + cardholder_name: Optional[ElementCardFinancialVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + + +class ElementCardFinancial(BaseModel): + """A Card Financial object. + + This field will be present in the JSON response if and only if `category` is equal to `card_financial`. Card Financials are temporary holds placed on a customer's funds with the intent to later clear a transaction. + """ -class ElementCardDecline(BaseModel): id: str - """The Card Decline identifier.""" + """The Card Financial identifier.""" actioner: Literal["user", "increase", "network"] """ - Whether this authorization was approved by Increase, the card network through + Whether this financial was approved by Increase, the card network through stand-in processing, or the user through a real-time decision. - `user` - This object was actioned by the user through a real-time decision. @@ -609,25 +3990,27 @@ class ElementCardDecline(BaseModel): processing. """ + additional_amounts: ElementCardFinancialAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + amount: int - """The declined amount in the minor unit of the destination account currency. + """The pending amount in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ - card_payment_id: Optional[str] = None + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - account currency. + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -637,13 +4020,24 @@ class ElementCardDecline(BaseModel): purchase), the identifier of the token that was used. """ + direction: Literal["settlement", "refund"] + """ + The direction describes the direction the funds will move, either from the + cardholder to the merchant or from the merchant to the cardholder. + + - `settlement` - A regular card authorization where funds are debited from the + cardholder. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + """ + merchant_acceptor_id: str """ The merchant identifier (commonly abbreviated as MID) of the merchant the card is transacting with. """ - merchant_category_code: Optional[str] = None + merchant_category_code: str """ The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is transacting with. @@ -652,26 +4046,34 @@ class ElementCardDecline(BaseModel): merchant_city: Optional[str] = None """The city the merchant resides in.""" - merchant_country: Optional[str] = None + merchant_country: str """The country the merchant resides in.""" merchant_descriptor: str """The merchant descriptor of the merchant the card is transacting with.""" + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + merchant_state: Optional[str] = None """The state the merchant resides in.""" - network_details: ElementCardDeclineNetworkDetails + network_details: ElementCardFinancialNetworkDetails """Fields specific to the `network`.""" - network_identifiers: ElementCardDeclineNetworkIdentifiers + network_identifiers: ElementCardFinancialNetworkIdentifiers """Network-specific identifiers for a specific request or transaction.""" network_risk_score: Optional[int] = None """The risk score generated by the card network. For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. """ physical_card_id: Optional[str] = None @@ -680,11 +4082,29 @@ class ElementCardDecline(BaseModel): that was used. """ + presentment_amount: int + """The pending amount in the minor unit of the transaction's presentment currency.""" + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + "unknown", ] """ - The processing category describes the intent behind the authorization, such as + The processing category describes the intent behind the financial, such as whether it was used for bill payments or an automatic fuel dispenser. - `account_funding` - Account funding transactions are transactions used to @@ -694,11 +4114,18 @@ class ElementCardDecline(BaseModel): being known. They are followed by an advice message that updates the amount of the pending transaction. - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. - `purchase` - A regular purchase. - `quasi_cash` - Quasi-cash transactions represent purchases of items which may be convertible to cash. - `refund` - A refund card authorization, sometimes referred to as a credit voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + - `unknown` - The processing category is unknown. """ real_time_decision_id: Optional[str] = None @@ -707,120 +4134,504 @@ class ElementCardDecline(BaseModel): transaction. """ - reason: Literal[ - "card_not_active", - "physical_card_not_active", - "entity_not_active", - "group_locked", - "insufficient_funds", - "cvv2_mismatch", - "transaction_not_allowed", - "breaches_limit", - "webhook_declined", - "webhook_timed_out", - "declined_by_stand_in_processing", - "invalid_physical_card", - "missing_original_authorization", - "suspected_fraud", + scheme_fees: List[ElementCardFinancialSchemeFee] + """The scheme fees associated with this card financial.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + transaction_id: str + """The identifier of the Transaction associated with this Transaction.""" + + type: Literal["card_financial"] + """A constant representing the object's type. + + For this resource it will always be `card_financial`. + """ + + verification: ElementCardFinancialVerification + """Fields related to verification of cardholder-provided values.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardFuelConfirmationNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + + retrieval_reference_number: Optional[str] = None + """A life-cycle identifier used across e.g., an authorization and a reversal. + + Expected to be unique per acquirer within a window of time. For some card + networks the retrieval reference number includes the trace counter. + """ + + trace_number: Optional[str] = None + """A counter used to verify an individual authorization. + + Expected to be unique per acquirer within a window of time. + """ + + transaction_id: Optional[str] = None + """ + A globally unique transaction identifier provided by the card network, used + across multiple life-cycle requests. + """ + + +class ElementCardFuelConfirmationSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", ] - """Why the transaction was declined. + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + +class ElementCardFuelConfirmation(BaseModel): + """A Card Fuel Confirmation object. + + This field will be present in the JSON response if and only if `category` is equal to `card_fuel_confirmation`. Card Fuel Confirmations update the amount of a Card Authorization after a fuel pump transaction is completed. + """ + + id: str + """The Card Fuel Confirmation identifier.""" + + card_authorization_id: str + """The identifier for the Card Authorization this updates.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's + currency. + + - `USD` - US Dollar (USD) + """ + + network: Literal["visa", "pulse"] + """The card network used to process this card authorization. + + - `visa` - Visa + - `pulse` - Pulse + """ + + network_identifiers: ElementCardFuelConfirmationNetworkIdentifiers + """Network-specific identifiers for a specific request or transaction.""" + + pending_transaction_id: Optional[str] = None + """ + The identifier of the Pending Transaction associated with this Card Fuel + Confirmation. + """ + + scheme_fees: List[ElementCardFuelConfirmationSchemeFee] + """The scheme fees associated with this card fuel confirmation.""" + + type: Literal["card_fuel_confirmation"] + """A constant representing the object's type. + + For this resource it will always be `card_fuel_confirmation`. + """ + + updated_authorization_amount: int + """ + The updated authorization amount after this fuel confirmation, in the minor unit + of the transaction's currency. For dollars, for example, this is cents. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardIncrementAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardIncrementAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardIncrementAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardIncrementAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardIncrementAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ - - `card_not_active` - The Card was not active. - - `physical_card_not_active` - The Physical Card was not active. - - `entity_not_active` - The account's entity was not active. - - `group_locked` - The account was inactive. - - `insufficient_funds` - The Card's Account did not have a sufficient available - balance. - - `cvv2_mismatch` - The given CVV2 did not match the card's value. - - `transaction_not_allowed` - The attempted card transaction is not allowed per - Increase's terms. - - `breaches_limit` - The transaction was blocked by a Limit. - - `webhook_declined` - Your application declined the transaction via webhook. - - `webhook_timed_out` - Your application webhook did not respond without the - required timeout. - - `declined_by_stand_in_processing` - Declined by stand-in processing. - - `invalid_physical_card` - The card read had an invalid CVV, dCVV, or - authorization request cryptogram. - - `missing_original_authorization` - The original card authorization for this - incremental authorization does not exist. - - `suspected_fraud` - The transaction was suspected to be fraudulent. Please - reach out to support@increase.com for more information. + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - verification: ElementCardDeclineVerification - """Fields related to verification of cardholder-provided values.""" +class ElementCardIncrementAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ -class ElementCardFuelConfirmationNetworkIdentifiers(BaseModel): - retrieval_reference_number: Optional[str] = None - """A life-cycle identifier used across e.g., an authorization and a reversal. + amount: int + """The amount in minor units of the `currency` field. - Expected to be unique per acquirer within a window of time. For some card - networks the retrieval reference number includes the trace counter. + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - trace_number: Optional[str] = None - """A counter used to verify an individual authorization. + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ - Expected to be unique per acquirer within a window of time. + +class ElementCardIncrementAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - transaction_id: Optional[str] = None + currency: str """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ -class ElementCardFuelConfirmation(BaseModel): - id: str - """The Card Fuel Confirmation identifier.""" +class ElementCardIncrementAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" - card_authorization_id: str - """The identifier for the Card Authorization this updates.""" + amount: int + """The amount in minor units of the `currency` field. - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's - currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - network: Literal["visa"] - """The card network used to process this card authorization. - - `visa` - Visa +class ElementCardIncrementAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - network_identifiers: ElementCardFuelConfirmationNetworkIdentifiers - """Network-specific identifiers for a specific request or transaction.""" + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ - pending_transaction_id: Optional[str] = None + +class ElementCardIncrementAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The identifier of the Pending Transaction associated with this Card Fuel - Confirmation. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - type: Literal["card_fuel_confirmation"] - """A constant representing the object's type. - For this resource it will always be `card_fuel_confirmation`. +class ElementCardIncrementAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. """ - updated_authorization_amount: int + clinic: Optional[ElementCardIncrementAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[ElementCardIncrementAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[ElementCardIncrementAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[ElementCardIncrementAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[ElementCardIncrementAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[ElementCardIncrementAdditionalAmountsTotalCumulative] = None """ - The updated authorization amount after this fuel confirmation, in the minor unit - of the transaction's currency. For dollars, for example, this is cents. + The total amount of a series of incremental authorizations, optionally provided. """ + total_healthcare: Optional[ElementCardIncrementAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[ElementCardIncrementAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[ElementCardIncrementAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[ElementCardIncrementAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + class ElementCardIncrementNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -841,7 +4652,164 @@ class ElementCardIncrementNetworkIdentifiers(BaseModel): """ +class ElementCardIncrementSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + class ElementCardIncrement(BaseModel): + """A Card Increment object. + + This field will be present in the JSON response if and only if `category` is equal to `card_increment`. Card Increments increase the pending amount of an authorized transaction. + """ + id: str """The Card Increment identifier.""" @@ -856,6 +4824,13 @@ class ElementCardIncrement(BaseModel): processing. """ + additional_amounts: ElementCardIncrementAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + amount: int """The amount of this increment in the minor unit of the transaction's currency. @@ -865,23 +4840,19 @@ class ElementCardIncrement(BaseModel): card_authorization_id: str """The identifier for the Card Authorization this increments.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the increment's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - network: Literal["visa"] + network: Literal["visa", "pulse"] """The card network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ network_identifiers: ElementCardIncrementNetworkIdentifiers @@ -897,12 +4868,27 @@ class ElementCardIncrement(BaseModel): pending_transaction_id: Optional[str] = None """The identifier of the Pending Transaction associated with this Card Increment.""" + presentment_amount: int + """ + The amount of this increment in the minor unit of the transaction's presentment + currency. + """ + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + real_time_decision_id: Optional[str] = None """ The identifier of the Real-Time Decision sent to approve or decline this incremental authorization. """ + scheme_fees: List[ElementCardIncrementSchemeFee] + """The scheme fees associated with this card increment.""" + type: Literal["card_increment"] """A constant representing the object's type. @@ -915,8 +4901,65 @@ class ElementCardIncrement(BaseModel): transaction's currency. For dollars, for example, this is cents. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardRefundCashback(BaseModel): + """Cashback debited for this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + amount: str + """The cashback amount given as a string containing a decimal number. + + The amount is a positive number if it will be credited to you (e.g., + settlements) and a negative number if it will be debited (e.g., refunds). + """ + + currency: Literal["USD"] + """The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + + - `USD` - US Dollar (USD) + """ + + +class ElementCardRefundInterchange(BaseModel): + """Interchange assessed as a part of this transaction.""" + + amount: str + """ + The interchange amount given as a string containing a decimal number in major + units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + credited to Increase (e.g., settlements) and a negative number if it is debited + (e.g., refunds). + """ + + code: Optional[str] = None + """The card network specific interchange code.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + reimbursement. + + - `USD` - US Dollar (USD) + """ + class ElementCardRefundNetworkIdentifiers(BaseModel): + """Network-specific identifiers for this refund.""" + acquirer_business_id: str """ A network assigned business ID that identifies the acquirer that processed this @@ -926,6 +4969,12 @@ class ElementCardRefundNetworkIdentifiers(BaseModel): acquirer_reference_number: str """A globally unique identifier for this settlement.""" + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + transaction_id: Optional[str] = None """ A globally unique transaction identifier provided by the card network, used @@ -934,6 +4983,8 @@ class ElementCardRefundNetworkIdentifiers(BaseModel): class ElementCardRefundPurchaseDetailsCarRental(BaseModel): + """Fields specific to car rentals.""" + car_class_code: Optional[str] = None """Code indicating the vehicle's class.""" @@ -1021,6 +5072,8 @@ class ElementCardRefundPurchaseDetailsCarRental(BaseModel): class ElementCardRefundPurchaseDetailsLodging(BaseModel): + """Fields specific to lodging.""" + check_in_date: Optional[date] = None """Date the customer checked in.""" @@ -1167,6 +5220,8 @@ class ElementCardRefundPurchaseDetailsTravelAncillaryService(BaseModel): class ElementCardRefundPurchaseDetailsTravelAncillary(BaseModel): + """Ancillary purchases in addition to the airfare.""" + connected_ticket_document_number: Optional[str] = None """ If this purchase has a connection or relationship to another purchase, such as a @@ -1228,6 +5283,8 @@ class ElementCardRefundPurchaseDetailsTravelTripLeg(BaseModel): class ElementCardRefundPurchaseDetailsTravel(BaseModel): + """Fields specific to travel.""" + ancillary: Optional[ElementCardRefundPurchaseDetailsTravelAncillary] = None """Ancillary purchases in addition to the airfare.""" @@ -1294,6 +5351,10 @@ class ElementCardRefundPurchaseDetailsTravel(BaseModel): class ElementCardRefundPurchaseDetails(BaseModel): + """ + Additional details about the card purchase, such as tax and industry-specific fields. + """ + car_rental: Optional[ElementCardRefundPurchaseDetailsCarRental] = None """Fields specific to car rentals.""" @@ -1340,33 +5401,194 @@ class ElementCardRefundPurchaseDetails(BaseModel): """Fields specific to travel.""" +class ElementCardRefundSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + class ElementCardRefund(BaseModel): + """A Card Refund object. + + This field will be present in the JSON response if and only if `category` is equal to `card_refund`. Card Refunds move money back to the cardholder. While they are usually connected to a Card Settlement, an acquirer can also refund money directly to a card without relation to a transaction. + """ + id: str """The Card Refund identifier.""" amount: int - """The pending amount in the minor unit of the transaction's currency. + """The amount in the minor unit of the transaction's settlement currency. For dollars, for example, this is cents. """ - card_payment_id: Optional[str] = None + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + cashback: Optional[ElementCardRefundCashback] = None + """Cashback debited for this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. + transaction's settlement currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - merchant_acceptor_id: Optional[str] = None + interchange: Optional[ElementCardRefundInterchange] = None + """Interchange assessed as a part of this transaction.""" + + merchant_acceptor_id: str """ The merchant identifier (commonly abbreviated as MID) of the merchant the card is transacting with. @@ -1375,27 +5597,42 @@ class ElementCardRefund(BaseModel): merchant_category_code: str """The 4-digit MCC describing the merchant's business.""" - merchant_city: Optional[str] = None + merchant_city: str """The city the merchant resides in.""" merchant_country: str """The country the merchant resides in.""" - merchant_name: Optional[str] = None + merchant_name: str """The name of the merchant.""" + merchant_postal_code: Optional[str] = None + """The merchant's postal code. For US merchants this is always a 5-digit ZIP code.""" + merchant_state: Optional[str] = None """The state the merchant resides in.""" network_identifiers: ElementCardRefundNetworkIdentifiers """Network-specific identifiers for this refund.""" + presentment_amount: int + """The amount in the minor unit of the transaction's presentment currency.""" + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + purchase_details: Optional[ElementCardRefundPurchaseDetails] = None """ Additional details about the card purchase, such as tax and industry-specific fields. """ + scheme_fees: List[ElementCardRefundSchemeFee] + """The scheme fees associated with this card refund.""" + transaction_id: str """The identifier of the Transaction associated with this Transaction.""" @@ -1405,8 +5642,28 @@ class ElementCardRefund(BaseModel): For this resource it will always be `card_refund`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class ElementCardReversalNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -1427,30 +5684,214 @@ class ElementCardReversalNetworkIdentifiers(BaseModel): """ +class ElementCardReversalSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + class ElementCardReversal(BaseModel): + """A Card Reversal object. + + This field will be present in the JSON response if and only if `category` is equal to `card_reversal`. Card Reversals cancel parts of or the entirety of an existing Card Authorization. + """ + id: str """The Card Reversal identifier.""" card_authorization_id: str """The identifier for the Card Authorization this reverses.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - network: Literal["visa"] + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: Optional[str] = None + """The city the merchant resides in.""" + + merchant_country: Optional[str] = None + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network: Literal["visa", "pulse"] """The card network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ network_identifiers: ElementCardReversalNetworkIdentifiers @@ -1459,12 +5900,49 @@ class ElementCardReversal(BaseModel): pending_transaction_id: Optional[str] = None """The identifier of the Pending Transaction associated with this Card Reversal.""" + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the reversal's + presentment currency. + """ + reversal_amount: int """The amount of this reversal in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ + reversal_presentment_amount: int + """ + The amount of this reversal in the minor unit of the transaction's presentment + currency. For dollars, for example, this is cents. + """ + + reversal_reason: Optional[ + Literal[ + "reversed_by_customer", "reversed_by_network_or_acquirer", "reversed_by_point_of_sale", "partial_reversal" + ] + ] = None + """Why this reversal was initiated. + + - `reversed_by_customer` - The Card Reversal was initiated at the customer's + request. + - `reversed_by_network_or_acquirer` - The Card Reversal was initiated by the + network or acquirer. + - `reversed_by_point_of_sale` - The Card Reversal was initiated by the point of + sale device. + - `partial_reversal` - The Card Reversal was a partial reversal, for any reason. + """ + + scheme_fees: List[ElementCardReversalSchemeFee] + """The scheme fees associated with this card reversal.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + type: Literal["card_reversal"] """A constant representing the object's type. @@ -1477,8 +5955,71 @@ class ElementCardReversal(BaseModel): transaction's currency. For dollars, for example, this is cents. """ + updated_authorization_presentment_amount: int + """ + The amount left pending on the Card Authorization in the minor unit of the + transaction's presentment currency. For dollars, for example, this is cents. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardSettlementCashback(BaseModel): + """Cashback earned on this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + amount: str + """The cashback amount given as a string containing a decimal number. + + The amount is a positive number if it will be credited to you (e.g., + settlements) and a negative number if it will be debited (e.g., refunds). + """ + + currency: Literal["USD"] + """The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + + - `USD` - US Dollar (USD) + """ + + +class ElementCardSettlementInterchange(BaseModel): + """Interchange assessed as a part of this transaction.""" + + amount: str + """ + The interchange amount given as a string containing a decimal number in major + units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + credited to Increase (e.g., settlements) and a negative number if it is debited + (e.g., refunds). + """ + + code: Optional[str] = None + """The card network specific interchange code.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + reimbursement. + + - `USD` - US Dollar (USD) + """ + class ElementCardSettlementNetworkIdentifiers(BaseModel): + """Network-specific identifiers for this refund.""" + acquirer_business_id: str """ A network assigned business ID that identifies the acquirer that processed this @@ -1488,6 +6029,12 @@ class ElementCardSettlementNetworkIdentifiers(BaseModel): acquirer_reference_number: str """A globally unique identifier for this settlement.""" + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + transaction_id: Optional[str] = None """ A globally unique transaction identifier provided by the card network, used @@ -1496,6 +6043,8 @@ class ElementCardSettlementNetworkIdentifiers(BaseModel): class ElementCardSettlementPurchaseDetailsCarRental(BaseModel): + """Fields specific to car rentals.""" + car_class_code: Optional[str] = None """Code indicating the vehicle's class.""" @@ -1583,6 +6132,8 @@ class ElementCardSettlementPurchaseDetailsCarRental(BaseModel): class ElementCardSettlementPurchaseDetailsLodging(BaseModel): + """Fields specific to lodging.""" + check_in_date: Optional[date] = None """Date the customer checked in.""" @@ -1729,6 +6280,8 @@ class ElementCardSettlementPurchaseDetailsTravelAncillaryService(BaseModel): class ElementCardSettlementPurchaseDetailsTravelAncillary(BaseModel): + """Ancillary purchases in addition to the airfare.""" + connected_ticket_document_number: Optional[str] = None """ If this purchase has a connection or relationship to another purchase, such as a @@ -1790,6 +6343,8 @@ class ElementCardSettlementPurchaseDetailsTravelTripLeg(BaseModel): class ElementCardSettlementPurchaseDetailsTravel(BaseModel): + """Fields specific to travel.""" + ancillary: Optional[ElementCardSettlementPurchaseDetailsTravelAncillary] = None """Ancillary purchases in addition to the airfare.""" @@ -1856,6 +6411,10 @@ class ElementCardSettlementPurchaseDetailsTravel(BaseModel): class ElementCardSettlementPurchaseDetails(BaseModel): + """ + Additional details about the card purchase, such as tax and industry-specific fields. + """ + car_rental: Optional[ElementCardSettlementPurchaseDetailsCarRental] = None """Fields specific to car rentals.""" @@ -1902,91 +6461,521 @@ class ElementCardSettlementPurchaseDetails(BaseModel): """Fields specific to travel.""" -class ElementCardSettlement(BaseModel): - id: str - """The Card Settlement identifier.""" +class ElementCardSettlementSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + +class ElementCardSettlementSurcharge(BaseModel): + """Surcharge amount details, if applicable. + + The amount is positive if the surcharge is added to the overall transaction amount (surcharge), and negative if the surcharge is deducted from the overall transaction amount (discount). + """ + + amount: int + """ + The surcharge amount in the minor unit of the transaction's settlement currency. + """ + + presentment_amount: int + """ + The surcharge amount in the minor unit of the transaction's presentment + currency. + """ + + +class ElementCardSettlement(BaseModel): + """A Card Settlement object. + + This field will be present in the JSON response if and only if `category` is equal to `card_settlement`. Card Settlements are card transactions that have cleared and settled. While a settlement is usually preceded by an authorization, an acquirer can also directly clear a transaction without first authorizing it. + """ + + id: str + """The Card Settlement identifier.""" + + amount: int + """The amount in the minor unit of the transaction's settlement currency. + + For dollars, for example, this is cents. + """ + + card_authorization: Optional[str] = None + """ + The Card Authorization that was created prior to this Card Settlement, if one + exists. + """ + + card_payment_id: str + """The ID of the Card Payment this transaction belongs to.""" + + cashback: Optional[ElementCardSettlementCashback] = None + """Cashback earned on this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's settlement currency. + + - `USD` - US Dollar (USD) + """ + + interchange: Optional[ElementCardSettlementInterchange] = None + """Interchange assessed as a part of this transaction.""" + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """The 4-digit MCC describing the merchant's business.""" + + merchant_city: str + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_name: str + """The name of the merchant.""" + + merchant_postal_code: Optional[str] = None + """The merchant's postal code. For US merchants this is always a 5-digit ZIP code.""" + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network: Literal["visa", "pulse"] + """The card network on which this transaction was processed. + + - `visa` - Visa + - `pulse` - Pulse + """ + + network_identifiers: ElementCardSettlementNetworkIdentifiers + """Network-specific identifiers for this refund.""" + + pending_transaction_id: Optional[str] = None + """The identifier of the Pending Transaction associated with this Transaction.""" + + presentment_amount: int + """The amount in the minor unit of the transaction's presentment currency.""" + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + + purchase_details: Optional[ElementCardSettlementPurchaseDetails] = None + """ + Additional details about the card purchase, such as tax and industry-specific + fields. + """ + + scheme_fees: List[ElementCardSettlementSchemeFee] + """The scheme fees associated with this card settlement.""" + + surcharge: Optional[ElementCardSettlementSurcharge] = None + """Surcharge amount details, if applicable. + + The amount is positive if the surcharge is added to the overall transaction + amount (surcharge), and negative if the surcharge is deducted from the overall + transaction amount (discount). + """ + + transaction_id: str + """The identifier of the Transaction associated with this Transaction.""" + + type: Literal["card_settlement"] + """A constant representing the object's type. + + For this resource it will always be `card_settlement`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementCardValidationAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class ElementCardValidationAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" amount: int - """The amount in the minor unit of the transaction's settlement currency. + """The amount in minor units of the `currency` field. - For dollars, for example, this is cents. + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - card_authorization: Optional[str] = None + currency: str """ - The Card Authorization that was created prior to this Card Settlement, if one - exists. + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - card_payment_id: Optional[str] = None - """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's settlement currency. +class ElementCardValidationAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - merchant_acceptor_id: Optional[str] = None + currency: str """ - The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - merchant_category_code: str - """The 4-digit MCC describing the merchant's business.""" - - merchant_city: Optional[str] = None - """The city the merchant resides in.""" - merchant_country: str - """The country the merchant resides in.""" +class ElementCardValidationAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ - merchant_name: Optional[str] = None - """The name of the merchant.""" + clinic: Optional[ElementCardValidationAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" - merchant_state: Optional[str] = None - """The state the merchant resides in.""" + dental: Optional[ElementCardValidationAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" - network_identifiers: ElementCardSettlementNetworkIdentifiers - """Network-specific identifiers for this refund.""" + original: Optional[ElementCardValidationAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" - pending_transaction_id: Optional[str] = None - """The identifier of the Pending Transaction associated with this Transaction.""" + prescription: Optional[ElementCardValidationAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" - presentment_amount: int - """The amount in the minor unit of the transaction's presentment currency.""" + surcharge: Optional[ElementCardValidationAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" - presentment_currency: str + total_cumulative: Optional[ElementCardValidationAdditionalAmountsTotalCumulative] = None """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's presentment currency. + The total amount of a series of incremental authorizations, optionally provided. """ - purchase_details: Optional[ElementCardSettlementPurchaseDetails] = None - """ - Additional details about the card purchase, such as tax and industry-specific - fields. - """ + total_healthcare: Optional[ElementCardValidationAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" - transaction_id: str - """The identifier of the Transaction associated with this Transaction.""" + transit: Optional[ElementCardValidationAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" - type: Literal["card_settlement"] - """A constant representing the object's type. + unknown: Optional[ElementCardValidationAdditionalAmountsUnknown] = None + """An unknown additional amount.""" - For this resource it will always be `card_settlement`. - """ + vision: Optional[ElementCardValidationAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class ElementCardValidationNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass class ElementCardValidationNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + electronic_commerce_indicator: Optional[ Literal[ "mail_phone_order", @@ -2029,7 +7018,7 @@ class ElementCardValidationNetworkDetailsVisa(BaseModel): 3-D Secure program. - `non_authenticated_security_transaction` - Non-authenticated security transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed + encryption for security however, cardholder authentication is not performed using 3-D Secure. - `non_secure_transaction` - Non-secure transaction: Use to identify an electronic commerce transaction that has no data protection. @@ -2068,19 +7057,106 @@ class ElementCardValidationNetworkDetailsVisa(BaseModel): verification value """ + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + class ElementCardValidationNetworkDetails(BaseModel): - category: Literal["visa"] + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] """The payment network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ + pulse: Optional[ElementCardValidationNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + visa: Optional[ElementCardValidationNetworkDetailsVisa] = None """Fields specific to the `visa` network.""" class ElementCardValidationNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -2101,7 +7177,163 @@ class ElementCardValidationNetworkIdentifiers(BaseModel): """ +class ElementCardValidationSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + class ElementCardValidationVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + result: Literal["not_checked", "match", "no_match"] """The result of verifying the Card Verification Code. @@ -2113,6 +7345,10 @@ class ElementCardValidationVerificationCardVerificationCode(BaseModel): class ElementCardValidationVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + actual_line1: Optional[str] = None """Line 1 of the address on file for the cardholder.""" @@ -2130,27 +7366,43 @@ class ElementCardValidationVerificationCardholderAddress(BaseModel): result: Literal[ "not_checked", - "postal_code_match_address_not_checked", "postal_code_match_address_no_match", "postal_code_no_match_address_match", "match", "no_match", + "postal_code_match_address_not_checked", ] """The address verification result returned to the card network. - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. + - `not_checked` - No address information was provided in the authorization + request. - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. + address does not match or was not provided. - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. + street address matches or was not provided. - `match` - Postal code and street address match. - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) """ +class ElementCardValidationVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + class ElementCardValidationVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + card_verification_code: ElementCardValidationVerificationCardVerificationCode """ Fields related to verification of the Card Verification Code, a 3-digit code on @@ -2163,8 +7415,16 @@ class ElementCardValidationVerification(BaseModel): we verified it against. """ + cardholder_name: Optional[ElementCardValidationVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + class ElementCardValidation(BaseModel): + """An Inbound Card Validation object. + + This field will be present in the JSON response if and only if `category` is equal to `card_validation`. Inbound Card Validations are requests from a merchant to verify that a card number and optionally its address and/or Card Verification Value are valid. + """ + id: str """The Card Validation identifier.""" @@ -2179,19 +7439,21 @@ class ElementCardValidation(BaseModel): processing. """ - card_payment_id: Optional[str] = None + additional_amounts: ElementCardValidationAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -2207,7 +7469,7 @@ class ElementCardValidation(BaseModel): is transacting with. """ - merchant_category_code: Optional[str] = None + merchant_category_code: str """ The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is transacting with. @@ -2216,12 +7478,22 @@ class ElementCardValidation(BaseModel): merchant_city: Optional[str] = None """The city the merchant resides in.""" - merchant_country: Optional[str] = None + merchant_country: str """The country the merchant resides in.""" merchant_descriptor: str """The merchant descriptor of the merchant the card is transacting with.""" + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + network_details: ElementCardValidationNetworkDetails """Fields specific to the `network`.""" @@ -2232,7 +7504,8 @@ class ElementCardValidation(BaseModel): """The risk score generated by the card network. For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. """ physical_card_id: Optional[str] = None @@ -2247,29 +7520,129 @@ class ElementCardValidation(BaseModel): transaction. """ - type: Literal["card_validation"] + scheme_fees: List[ElementCardValidationSchemeFee] + """The scheme fees associated with this card validation.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + type: Literal["inbound_card_validation"] """A constant representing the object's type. - For this resource it will always be `card_validation`. + For this resource it will always be `inbound_card_validation`. """ verification: ElementCardValidationVerification """Fields related to verification of cardholder-provided values.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ElementOther(BaseModel): + """ + If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. + """ + + pass + class Element(BaseModel): + category: Literal[ + "card_authorization", + "card_authentication", + "card_balance_inquiry", + "card_validation", + "card_decline", + "card_reversal", + "card_authorization_expiration", + "card_increment", + "card_settlement", + "card_refund", + "card_fuel_confirmation", + "card_financial", + "other", + ] + """The type of the resource. + + We may add additional possible values for this enum over time; your application + should be able to handle such additions gracefully. + + - `card_authorization` - Card Authorization: details will be under the + `card_authorization` object. + - `card_authentication` - Card Authentication: details will be under the + `card_authentication` object. + - `card_balance_inquiry` - Card Balance Inquiry: details will be under the + `card_balance_inquiry` object. + - `card_validation` - Inbound Card Validation: details will be under the + `card_validation` object. + - `card_decline` - Card Decline: details will be under the `card_decline` + object. + - `card_reversal` - Card Reversal: details will be under the `card_reversal` + object. + - `card_authorization_expiration` - Card Authorization Expiration: details will + be under the `card_authorization_expiration` object. + - `card_increment` - Card Increment: details will be under the `card_increment` + object. + - `card_settlement` - Card Settlement: details will be under the + `card_settlement` object. + - `card_refund` - Card Refund: details will be under the `card_refund` object. + - `card_fuel_confirmation` - Card Fuel Confirmation: details will be under the + `card_fuel_confirmation` object. + - `card_financial` - Card Financial: details will be under the `card_financial` + object. + - `other` - Unknown card payment element. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the card payment element was created. + """ + + card_authentication: Optional[ElementCardAuthentication] = None + """A Card Authentication object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_authentication`. Card Authentications are attempts to + authenticate a transaction or a card with 3DS. + """ + card_authorization: Optional[ElementCardAuthorization] = None """A Card Authorization object. This field will be present in the JSON response if and only if `category` is - equal to `card_authorization`. + equal to `card_authorization`. Card Authorizations are temporary holds placed on + a customer's funds with the intent to later clear a transaction. """ card_authorization_expiration: Optional[ElementCardAuthorizationExpiration] = None """A Card Authorization Expiration object. This field will be present in the JSON response if and only if `category` is - equal to `card_authorization_expiration`. + equal to `card_authorization_expiration`. Card Authorization Expirations are + cancellations of authorizations that were never settled by the acquirer. + """ + + card_balance_inquiry: Optional[ElementCardBalanceInquiry] = None + """A Card Balance Inquiry object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_balance_inquiry`. Card Balance Inquiries are transactions that + allow merchants to check the available balance on a card without placing a hold + on funds, commonly used when a customer requests their balance at an ATM. """ card_decline: Optional[ElementCardDecline] = None @@ -2279,93 +7652,75 @@ class Element(BaseModel): equal to `card_decline`. """ + card_financial: Optional[ElementCardFinancial] = None + """A Card Financial object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_financial`. Card Financials are temporary holds placed on a + customer's funds with the intent to later clear a transaction. + """ + card_fuel_confirmation: Optional[ElementCardFuelConfirmation] = None """A Card Fuel Confirmation object. This field will be present in the JSON response if and only if `category` is - equal to `card_fuel_confirmation`. + equal to `card_fuel_confirmation`. Card Fuel Confirmations update the amount of + a Card Authorization after a fuel pump transaction is completed. """ card_increment: Optional[ElementCardIncrement] = None """A Card Increment object. This field will be present in the JSON response if and only if `category` is - equal to `card_increment`. + equal to `card_increment`. Card Increments increase the pending amount of an + authorized transaction. """ card_refund: Optional[ElementCardRefund] = None """A Card Refund object. This field will be present in the JSON response if and only if `category` is - equal to `card_refund`. + equal to `card_refund`. Card Refunds move money back to the cardholder. While + they are usually connected to a Card Settlement, an acquirer can also refund + money directly to a card without relation to a transaction. """ card_reversal: Optional[ElementCardReversal] = None """A Card Reversal object. This field will be present in the JSON response if and only if `category` is - equal to `card_reversal`. + equal to `card_reversal`. Card Reversals cancel parts of or the entirety of an + existing Card Authorization. """ card_settlement: Optional[ElementCardSettlement] = None """A Card Settlement object. This field will be present in the JSON response if and only if `category` is - equal to `card_settlement`. + equal to `card_settlement`. Card Settlements are card transactions that have + cleared and settled. While a settlement is usually preceded by an authorization, + an acquirer can also directly clear a transaction without first authorizing it. """ card_validation: Optional[ElementCardValidation] = None - """A Card Validation object. + """An Inbound Card Validation object. This field will be present in the JSON response if and only if `category` is - equal to `card_validation`. - """ - - category: Literal[ - "card_authorization", - "card_validation", - "card_decline", - "card_reversal", - "card_authorization_expiration", - "card_increment", - "card_settlement", - "card_refund", - "card_fuel_confirmation", - "other", - ] - """The type of the resource. - - We may add additional possible values for this enum over time; your application - should be able to handle such additions gracefully. - - - `card_authorization` - Card Authorization: details will be under the - `card_authorization` object. - - `card_validation` - Card Validation: details will be under the - `card_validation` object. - - `card_decline` - Card Decline: details will be under the `card_decline` - object. - - `card_reversal` - Card Reversal: details will be under the `card_reversal` - object. - - `card_authorization_expiration` - Card Authorization Expiration: details will - be under the `card_authorization_expiration` object. - - `card_increment` - Card Increment: details will be under the `card_increment` - object. - - `card_settlement` - Card Settlement: details will be under the - `card_settlement` object. - - `card_refund` - Card Refund: details will be under the `card_refund` object. - - `card_fuel_confirmation` - Card Fuel Confirmation: details will be under the - `card_fuel_confirmation` object. - - `other` - Unknown card payment element. + equal to `card_validation`. Inbound Card Validations are requests from a + merchant to verify that a card number and optionally its address and/or Card + Verification Value are valid. """ - created_at: datetime + other: Optional[ElementOther] = None """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the card payment element was created. + If the category of this Transaction source is equal to `other`, this field will + contain an empty object, otherwise it will contain null. """ class State(BaseModel): + """The summarized state of this card payment.""" + authorized_amount: int """The total authorized amount in the minor unit of the transaction's currency. @@ -2384,6 +7739,18 @@ class State(BaseModel): transaction's currency. For dollars, for example, this is cents. """ + refund_authorized_amount: int + """ + The total refund authorized amount in the minor unit of the transaction's + currency. For dollars, for example, this is cents. + """ + + refunded_amount: int + """The total refunded amount in the minor unit of the transaction's currency. + + For dollars, for example, this is cents. + """ + reversed_amount: int """The total reversed amount in the minor unit of the transaction's currency. @@ -2391,13 +7758,17 @@ class State(BaseModel): """ settled_amount: int - """ - The total settled or refunded amount in the minor unit of the transaction's - currency. For dollars, for example, this is cents. + """The total settled amount in the minor unit of the transaction's currency. + + For dollars, for example, this is cents. """ class CardPayment(BaseModel): + """ + Card Payments group together interactions related to a single card payment, such as an authorization and its corresponding settlement. + """ + id: str """The Card Payment identifier.""" @@ -2413,9 +7784,15 @@ class CardPayment(BaseModel): Payment was created. """ + digital_wallet_token_id: Optional[str] = None + """The Digital Wallet Token identifier for this payment.""" + elements: List[Element] """The interactions related to this card payment.""" + physical_card_id: Optional[str] = None + """The Physical Card identifier for this payment.""" + state: State """The summarized state of this card payment.""" diff --git a/src/increase/types/card_purchase_supplement.py b/src/increase/types/card_purchase_supplement.py index 42e6ce258..03ef7997c 100644 --- a/src/increase/types/card_purchase_supplement.py +++ b/src/increase/types/card_purchase_supplement.py @@ -1,15 +1,19 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import date from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["CardPurchaseSupplement", "Invoice", "LineItem"] class Invoice(BaseModel): + """Invoice-level information about the payment.""" + discount_amount: Optional[int] = None """Discount given to cardholder.""" @@ -94,6 +98,9 @@ class Invoice(BaseModel): class LineItem(BaseModel): + id: str + """The Card Purchase Supplement Line Item identifier.""" + detail_indicator: Optional[Literal["normal", "credit", "payment"]] = None """Indicates the type of line item. @@ -168,6 +175,10 @@ class LineItem(BaseModel): class CardPurchaseSupplement(BaseModel): + """ + Additional information about a card purchase (e.g., settlement or refund), such as level 3 line item data. + """ + id: str """The Card Purchase Supplement identifier.""" @@ -188,3 +199,15 @@ class CardPurchaseSupplement(BaseModel): For this resource it will always be `card_purchase_supplement`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/card_push_transfer.py b/src/increase/types/card_push_transfer.py new file mode 100644 index 000000000..3b11c2c29 --- /dev/null +++ b/src/increase/types/card_push_transfer.py @@ -0,0 +1,896 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = [ + "CardPushTransfer", + "Acceptance", + "Approval", + "Cancellation", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "Decline", + "PresentmentAmount", + "Submission", +] + + +class Acceptance(BaseModel): + """ + If the transfer is accepted by the recipient bank, this will contain supplemental details. + """ + + accepted_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was accepted by the issuing bank. + """ + + authorization_identification_response: str + """The authorization identification response from the issuing bank.""" + + card_verification_value2_result: Optional[Literal["match", "no_match"]] = None + """The result of the Card Verification Value 2 match. + + - `match` - The Card Verification Value 2 (CVV2) matches the expected value. + - `no_match` - The Card Verification Value 2 (CVV2) does not match the expected + value. + """ + + network_transaction_identifier: Optional[str] = None + """A unique identifier for the transaction on the card network.""" + + settlement_amount: int + """The transfer amount in USD cents.""" + + +class Approval(BaseModel): + """ + If your account requires approvals for transfers and the transfer was approved, this will contain details of the approval. + """ + + approved_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was approved. + """ + + approved_by: Optional[str] = None + """ + If the Transfer was approved by a user in the dashboard, the email address of + that user. + """ + + +class Cancellation(BaseModel): + """ + If your account requires approvals for transfers and the transfer was not approved, this will contain details of the cancellation. + """ + + canceled_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Transfer was canceled. + """ + + canceled_by: Optional[str] = None + """ + If the Transfer was canceled by a user in the dashboard, the email address of + that user. + """ + + +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + +class Decline(BaseModel): + """ + If the transfer is rejected by the card network or the destination financial institution, this will contain supplemental details. + """ + + declined_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer declined. + """ + + network_transaction_identifier: Optional[str] = None + """A unique identifier for the transaction on the card network.""" + + reason: Literal[ + "do_not_honor", + "activity_count_limit_exceeded", + "refer_to_card_issuer", + "refer_to_card_issuer_special_condition", + "invalid_merchant", + "pick_up_card", + "error", + "pick_up_card_special", + "invalid_transaction", + "invalid_amount", + "invalid_account_number", + "no_such_issuer", + "re_enter_transaction", + "no_credit_account", + "pick_up_card_lost", + "pick_up_card_stolen", + "closed_account", + "insufficient_funds", + "no_checking_account", + "no_savings_account", + "expired_card", + "transaction_not_permitted_to_cardholder", + "transaction_not_allowed_at_terminal", + "transaction_not_supported_or_blocked_by_issuer", + "suspected_fraud", + "activity_amount_limit_exceeded", + "restricted_card", + "security_violation", + "transaction_does_not_fulfill_anti_money_laundering_requirement", + "blocked_by_cardholder", + "blocked_first_use", + "credit_issuer_unavailable", + "negative_card_verification_value_results", + "issuer_unavailable", + "financial_institution_cannot_be_found", + "transaction_cannot_be_completed", + "duplicate_transaction", + "system_malfunction", + "additional_customer_authentication_required", + "surcharge_amount_not_permitted", + "decline_for_cvv2_failure", + "stop_payment_order", + "revocation_of_authorization_order", + "revocation_of_all_authorizations_order", + "unable_to_locate_record", + "file_is_temporarily_unavailable", + "incorrect_pin", + "allowable_number_of_pin_entry_tries_exceeded", + "unable_to_locate_previous_message", + "pin_error_found", + "cannot_verify_pin", + "verification_data_failed", + "surcharge_amount_not_supported_by_debit_network_issuer", + "cash_service_not_available", + "cashback_request_exceeds_issuer_limit", + "transaction_amount_exceeds_pre_authorized_approval_amount", + "transaction_does_not_qualify_for_visa_pin", + "offline_declined", + "unable_to_go_online", + "valid_account_but_amount_not_supported", + "invalid_use_of_merchant_category_code_correct_and_reattempt", + "card_authentication_failed", + ] + """The reason why the transfer was declined. + + - `do_not_honor` - The card issuer has declined the transaction without + providing a specific reason. + - `activity_count_limit_exceeded` - The number of transactions for the card has + exceeded the limit set by the issuer. + - `refer_to_card_issuer` - The card issuer requires the cardholder to contact + them for further information regarding the transaction. + - `refer_to_card_issuer_special_condition` - The card issuer requires the + cardholder to contact them due to a special condition related to the + transaction. + - `invalid_merchant` - The merchant is not valid for this transaction. + - `pick_up_card` - The card should be retained by the terminal. + - `error` - An error occurred during processing of the transaction. + - `pick_up_card_special` - The card should be retained by the terminal due to a + special condition. + - `invalid_transaction` - The transaction is invalid and cannot be processed. + - `invalid_amount` - The amount of the transaction is invalid. + - `invalid_account_number` - The account number provided is invalid. + - `no_such_issuer` - The issuer of the card could not be found. + - `re_enter_transaction` - The transaction should be re-entered for processing. + - `no_credit_account` - There is no credit account associated with the card. + - `pick_up_card_lost` - The card should be retained by the terminal because it + has been reported lost. + - `pick_up_card_stolen` - The card should be retained by the terminal because it + has been reported stolen. + - `closed_account` - The account associated with the card has been closed. + - `insufficient_funds` - There are insufficient funds in the account to complete + the transaction. + - `no_checking_account` - There is no checking account associated with the card. + - `no_savings_account` - There is no savings account associated with the card. + - `expired_card` - The card has expired and cannot be used for transactions. + - `transaction_not_permitted_to_cardholder` - The transaction is not permitted + for this cardholder. + - `transaction_not_allowed_at_terminal` - The transaction is not allowed at this + terminal. + - `transaction_not_supported_or_blocked_by_issuer` - The transaction is not + supported or has been blocked by the issuer. + - `suspected_fraud` - The transaction has been flagged as suspected fraud and + cannot be processed. + - `activity_amount_limit_exceeded` - The amount of activity on the card has + exceeded the limit set by the issuer. + - `restricted_card` - The card has restrictions that prevent it from being used + for this transaction. + - `security_violation` - A security violation has occurred, preventing the + transaction from being processed. + - `transaction_does_not_fulfill_anti_money_laundering_requirement` - The + transaction does not meet the anti-money laundering requirements set by the + issuer. + - `blocked_by_cardholder` - The transaction was blocked by the cardholder. + - `blocked_first_use` - The first use of the card has been blocked by the + issuer. + - `credit_issuer_unavailable` - The credit issuer is currently unavailable to + process the transaction. + - `negative_card_verification_value_results` - The card verification value (CVV) + results were negative, indicating a potential issue with the card. + - `issuer_unavailable` - The issuer of the card is currently unavailable to + process the transaction. + - `financial_institution_cannot_be_found` - The financial institution associated + with the card could not be found. + - `transaction_cannot_be_completed` - The transaction cannot be completed due to + an unspecified reason. + - `duplicate_transaction` - The transaction is a duplicate of a previous + transaction and cannot be processed again. + - `system_malfunction` - A system malfunction occurred, preventing the + transaction from being processed. + - `additional_customer_authentication_required` - Additional customer + authentication is required to complete the transaction. + - `surcharge_amount_not_permitted` - The surcharge amount applied to the + transaction is not permitted by the issuer. + - `decline_for_cvv2_failure` - The transaction was declined due to a failure in + verifying the CVV2 code. + - `stop_payment_order` - A stop payment order has been placed on this + transaction. + - `revocation_of_authorization_order` - An order has been placed to revoke + authorization for this transaction. + - `revocation_of_all_authorizations_order` - An order has been placed to revoke + all authorizations for this cardholder. + - `unable_to_locate_record` - The record associated with the transaction could + not be located. + - `file_is_temporarily_unavailable` - The file needed for the transaction is + temporarily unavailable. + - `incorrect_pin` - The PIN entered for the transaction is incorrect. + - `allowable_number_of_pin_entry_tries_exceeded` - The allowable number of PIN + entry tries has been exceeded. + - `unable_to_locate_previous_message` - The previous message associated with the + transaction could not be located. + - `pin_error_found` - An error was found with the PIN associated with the + transaction. + - `cannot_verify_pin` - The PIN associated with the transaction could not be + verified. + - `verification_data_failed` - The verification data associated with the + transaction has failed. + - `surcharge_amount_not_supported_by_debit_network_issuer` - The surcharge + amount is not supported by the debit network issuer. + - `cash_service_not_available` - Cash service is not available for this + transaction. + - `cashback_request_exceeds_issuer_limit` - The cashback request exceeds the + issuer limit. + - `transaction_amount_exceeds_pre_authorized_approval_amount` - The transaction + amount exceeds the pre-authorized approval amount. + - `transaction_does_not_qualify_for_visa_pin` - The transaction does not qualify + for Visa PIN processing. + - `offline_declined` - The transaction was declined offline. + - `unable_to_go_online` - The terminal was unable to go online to process the + transaction. + - `valid_account_but_amount_not_supported` - The account is valid but the + transaction amount is not supported. + - `invalid_use_of_merchant_category_code_correct_and_reattempt` - The merchant + category code was used incorrectly; correct it and reattempt the transaction. + - `card_authentication_failed` - The card authentication process has failed. + """ + + +class PresentmentAmount(BaseModel): + """The amount that was transferred. + + The receiving bank will have converted this to the cardholder's currency. The amount that is applied to your Increase account matches the currency of your account. + """ + + currency: Literal[ + "AFN", + "EUR", + "ALL", + "DZD", + "USD", + "AOA", + "ARS", + "AMD", + "AWG", + "AUD", + "AZN", + "BSD", + "BHD", + "BDT", + "BBD", + "BYN", + "BZD", + "BMD", + "INR", + "BTN", + "BOB", + "BOV", + "BAM", + "BWP", + "NOK", + "BRL", + "BND", + "BGN", + "BIF", + "CVE", + "KHR", + "CAD", + "KYD", + "CLP", + "CLF", + "CNY", + "COP", + "COU", + "KMF", + "CDF", + "NZD", + "CRC", + "CUP", + "CZK", + "DKK", + "DJF", + "DOP", + "EGP", + "SVC", + "ERN", + "SZL", + "ETB", + "FKP", + "FJD", + "GMD", + "GEL", + "GHS", + "GIP", + "GTQ", + "GBP", + "GNF", + "GYD", + "HTG", + "HNL", + "HKD", + "HUF", + "ISK", + "IDR", + "IRR", + "IQD", + "ILS", + "JMD", + "JPY", + "JOD", + "KZT", + "KES", + "KPW", + "KRW", + "KWD", + "KGS", + "LAK", + "LBP", + "LSL", + "ZAR", + "LRD", + "LYD", + "CHF", + "MOP", + "MKD", + "MGA", + "MWK", + "MYR", + "MVR", + "MRU", + "MUR", + "MXN", + "MXV", + "MDL", + "MNT", + "MAD", + "MZN", + "MMK", + "NAD", + "NPR", + "NIO", + "NGN", + "OMR", + "PKR", + "PAB", + "PGK", + "PYG", + "PEN", + "PHP", + "PLN", + "QAR", + "RON", + "RUB", + "RWF", + "SHP", + "WST", + "STN", + "SAR", + "RSD", + "SCR", + "SLE", + "SGD", + "SBD", + "SOS", + "SSP", + "LKR", + "SDG", + "SRD", + "SEK", + "CHE", + "CHW", + "SYP", + "TWD", + "TJS", + "TZS", + "THB", + "TOP", + "TTD", + "TND", + "TRY", + "TMT", + "UGX", + "UAH", + "AED", + "USN", + "UYU", + "UYI", + "UYW", + "UZS", + "VUV", + "VES", + "VED", + "VND", + "YER", + "ZMW", + "ZWG", + ] + """The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code. + + - `AFN` - AFN + - `EUR` - EUR + - `ALL` - ALL + - `DZD` - DZD + - `USD` - USD + - `AOA` - AOA + - `ARS` - ARS + - `AMD` - AMD + - `AWG` - AWG + - `AUD` - AUD + - `AZN` - AZN + - `BSD` - BSD + - `BHD` - BHD + - `BDT` - BDT + - `BBD` - BBD + - `BYN` - BYN + - `BZD` - BZD + - `BMD` - BMD + - `INR` - INR + - `BTN` - BTN + - `BOB` - BOB + - `BOV` - BOV + - `BAM` - BAM + - `BWP` - BWP + - `NOK` - NOK + - `BRL` - BRL + - `BND` - BND + - `BGN` - BGN + - `BIF` - BIF + - `CVE` - CVE + - `KHR` - KHR + - `CAD` - CAD + - `KYD` - KYD + - `CLP` - CLP + - `CLF` - CLF + - `CNY` - CNY + - `COP` - COP + - `COU` - COU + - `KMF` - KMF + - `CDF` - CDF + - `NZD` - NZD + - `CRC` - CRC + - `CUP` - CUP + - `CZK` - CZK + - `DKK` - DKK + - `DJF` - DJF + - `DOP` - DOP + - `EGP` - EGP + - `SVC` - SVC + - `ERN` - ERN + - `SZL` - SZL + - `ETB` - ETB + - `FKP` - FKP + - `FJD` - FJD + - `GMD` - GMD + - `GEL` - GEL + - `GHS` - GHS + - `GIP` - GIP + - `GTQ` - GTQ + - `GBP` - GBP + - `GNF` - GNF + - `GYD` - GYD + - `HTG` - HTG + - `HNL` - HNL + - `HKD` - HKD + - `HUF` - HUF + - `ISK` - ISK + - `IDR` - IDR + - `IRR` - IRR + - `IQD` - IQD + - `ILS` - ILS + - `JMD` - JMD + - `JPY` - JPY + - `JOD` - JOD + - `KZT` - KZT + - `KES` - KES + - `KPW` - KPW + - `KRW` - KRW + - `KWD` - KWD + - `KGS` - KGS + - `LAK` - LAK + - `LBP` - LBP + - `LSL` - LSL + - `ZAR` - ZAR + - `LRD` - LRD + - `LYD` - LYD + - `CHF` - CHF + - `MOP` - MOP + - `MKD` - MKD + - `MGA` - MGA + - `MWK` - MWK + - `MYR` - MYR + - `MVR` - MVR + - `MRU` - MRU + - `MUR` - MUR + - `MXN` - MXN + - `MXV` - MXV + - `MDL` - MDL + - `MNT` - MNT + - `MAD` - MAD + - `MZN` - MZN + - `MMK` - MMK + - `NAD` - NAD + - `NPR` - NPR + - `NIO` - NIO + - `NGN` - NGN + - `OMR` - OMR + - `PKR` - PKR + - `PAB` - PAB + - `PGK` - PGK + - `PYG` - PYG + - `PEN` - PEN + - `PHP` - PHP + - `PLN` - PLN + - `QAR` - QAR + - `RON` - RON + - `RUB` - RUB + - `RWF` - RWF + - `SHP` - SHP + - `WST` - WST + - `STN` - STN + - `SAR` - SAR + - `RSD` - RSD + - `SCR` - SCR + - `SLE` - SLE + - `SGD` - SGD + - `SBD` - SBD + - `SOS` - SOS + - `SSP` - SSP + - `LKR` - LKR + - `SDG` - SDG + - `SRD` - SRD + - `SEK` - SEK + - `CHE` - CHE + - `CHW` - CHW + - `SYP` - SYP + - `TWD` - TWD + - `TJS` - TJS + - `TZS` - TZS + - `THB` - THB + - `TOP` - TOP + - `TTD` - TTD + - `TND` - TND + - `TRY` - TRY + - `TMT` - TMT + - `UGX` - UGX + - `UAH` - UAH + - `AED` - AED + - `USN` - USN + - `UYU` - UYU + - `UYI` - UYI + - `UYW` - UYW + - `UZS` - UZS + - `VUV` - VUV + - `VES` - VES + - `VED` - VED + - `VND` - VND + - `YER` - YER + - `ZMW` - ZMW + - `ZWG` - ZWG + """ + + value: str + """ + The amount value represented as a string containing a decimal number in major + units (so e.g., "12.34" for $12.34). + """ + + +class Submission(BaseModel): + """ + After the transfer is submitted to the card network, this will contain supplemental details. + """ + + retrieval_reference_number: str + """A 12-digit retrieval reference number that identifies the transfer. + + Usually a combination of a timestamp and the trace number. + """ + + sender_reference: str + """A unique reference for the transfer.""" + + submitted_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was submitted to the card network. + """ + + trace_number: str + """ + A 6-digit trace number that identifies the transfer within a small window of + time. + """ + + +class CardPushTransfer(BaseModel): + """Card Push Transfers send funds to a recipient's payment card in real-time.""" + + id: str + """The Card Push Transfer's identifier.""" + + acceptance: Optional[Acceptance] = None + """ + If the transfer is accepted by the recipient bank, this will contain + supplemental details. + """ + + account_id: str + """The Account from which the transfer was sent.""" + + approval: Optional[Approval] = None + """ + If your account requires approvals for transfers and the transfer was approved, + this will contain details of the approval. + """ + + business_application_identifier: Literal[ + "account_to_account", + "business_to_business", + "money_transfer_bank_initiated", + "non_card_bill_payment", + "consumer_bill_payment", + "card_bill_payment", + "funds_disbursement", + "funds_transfer", + "loyalty_and_offers", + "merchant_disbursement", + "merchant_payment", + "person_to_person", + "top_up", + "wallet_transfer", + ] + """ + The Business Application Identifier describes the type of transaction being + performed. Your program must be approved for the specified Business Application + Identifier in order to use it. + + - `account_to_account` - Account to Account + - `business_to_business` - Business to Business + - `money_transfer_bank_initiated` - Money Transfer Bank Initiated + - `non_card_bill_payment` - Non-Card Bill Payment + - `consumer_bill_payment` - Consumer Bill Payment + - `card_bill_payment` - Card Bill Payment + - `funds_disbursement` - Funds Disbursement + - `funds_transfer` - Funds Transfer + - `loyalty_and_offers` - Loyalty and Offers + - `merchant_disbursement` - Merchant Disbursement + - `merchant_payment` - Merchant Payment + - `person_to_person` - Person to Person + - `top_up` - Top Up + - `wallet_transfer` - Wallet Transfer + """ + + cancellation: Optional[Cancellation] = None + """ + If your account requires approvals for transfers and the transfer was not + approved, this will contain details of the cancellation. + """ + + card_token_id: str + """The ID of the Card Token that was used to validate the card.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was created. + """ + + created_by: Optional[CreatedBy] = None + """What object created the transfer, either via the API or the dashboard.""" + + decline: Optional[Decline] = None + """ + If the transfer is rejected by the card network or the destination financial + institution, this will contain supplemental details. + """ + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + merchant_category_code: str + """ + The merchant category code (MCC) of the merchant (generally your business) + sending the transfer. This is a four-digit code that describes the type of + business or service provided by the merchant. Your program must be approved for + the specified MCC in order to use it. + """ + + merchant_city_name: str + """The city name of the merchant (generally your business) sending the transfer.""" + + merchant_name: str + """The merchant name shows up as the statement descriptor for the transfer. + + This is typically the name of your business or organization. + """ + + merchant_name_prefix: str + """ + For certain Business Application Identifiers, the statement descriptor is + `merchant_name_prefix*sender_name`, where the `merchant_name_prefix` is a one to + four character prefix that identifies the merchant. + """ + + merchant_postal_code: str + """The postal code of the merchant (generally your business) sending the transfer.""" + + merchant_state: str + """The state of the merchant (generally your business) sending the transfer.""" + + presentment_amount: PresentmentAmount + """The amount that was transferred. + + The receiving bank will have converted this to the cardholder's currency. The + amount that is applied to your Increase account matches the currency of your + account. + """ + + recipient_name: str + """The name of the funds recipient.""" + + route: Literal["visa", "mastercard"] + """The card network route used for the transfer. + + - `visa` - Visa and Interlink + - `mastercard` - Mastercard and Maestro + """ + + sender_address_city: str + """The city of the sender.""" + + sender_address_line1: str + """The address line 1 of the sender.""" + + sender_address_postal_code: str + """The postal code of the sender.""" + + sender_address_state: str + """The state of the sender.""" + + sender_name: str + """The name of the funds originator.""" + + source_account_number_id: str + """The Account Number the recipient will see as having sent the transfer.""" + + status: Literal[ + "pending_approval", + "canceled", + "pending_reviewing", + "requires_attention", + "pending_submission", + "submitted", + "complete", + "declined", + ] + """The lifecycle status of the transfer. + + - `pending_approval` - The transfer is pending approval. + - `canceled` - The transfer has been canceled. + - `pending_reviewing` - The transfer is pending review by Increase. + - `requires_attention` - The transfer requires attention from an Increase + operator. + - `pending_submission` - The transfer is queued to be submitted to the card + network. + - `submitted` - The transfer has been submitted and is pending a response from + the card network. + - `complete` - The transfer has been sent successfully and is complete. + - `declined` - The transfer was declined by the network or the recipient's bank. + """ + + submission: Optional[Submission] = None + """ + After the transfer is submitted to the card network, this will contain + supplemental details. + """ + + type: Literal["card_push_transfer"] + """A constant representing the object's type. + + For this resource it will always be `card_push_transfer`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/card_push_transfer_create_params.py b/src/increase/types/card_push_transfer_create_params.py new file mode 100644 index 000000000..ae66703f8 --- /dev/null +++ b/src/increase/types/card_push_transfer_create_params.py @@ -0,0 +1,490 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CardPushTransferCreateParams", "PresentmentAmount"] + + +class CardPushTransferCreateParams(TypedDict, total=False): + business_application_identifier: Required[ + Literal[ + "account_to_account", + "business_to_business", + "money_transfer_bank_initiated", + "non_card_bill_payment", + "consumer_bill_payment", + "card_bill_payment", + "funds_disbursement", + "funds_transfer", + "loyalty_and_offers", + "merchant_disbursement", + "merchant_payment", + "person_to_person", + "top_up", + "wallet_transfer", + ] + ] + """ + The Business Application Identifier describes the type of transaction being + performed. Your program must be approved for the specified Business Application + Identifier in order to use it. + + - `account_to_account` - Account to Account + - `business_to_business` - Business to Business + - `money_transfer_bank_initiated` - Money Transfer Bank Initiated + - `non_card_bill_payment` - Non-Card Bill Payment + - `consumer_bill_payment` - Consumer Bill Payment + - `card_bill_payment` - Card Bill Payment + - `funds_disbursement` - Funds Disbursement + - `funds_transfer` - Funds Transfer + - `loyalty_and_offers` - Loyalty and Offers + - `merchant_disbursement` - Merchant Disbursement + - `merchant_payment` - Merchant Payment + - `person_to_person` - Person to Person + - `top_up` - Top Up + - `wallet_transfer` - Wallet Transfer + """ + + card_token_id: Required[str] + """ + The Increase identifier for the Card Token that represents the card number + you're pushing funds to. + """ + + merchant_category_code: Required[str] + """ + The merchant category code (MCC) of the merchant (generally your business) + sending the transfer. This is a four-digit code that describes the type of + business or service provided by the merchant. Your program must be approved for + the specified MCC in order to use it. + """ + + merchant_city_name: Required[str] + """The city name of the merchant (generally your business) sending the transfer.""" + + merchant_name: Required[str] + """The merchant name shows up as the statement descriptor for the transfer. + + This is typically the name of your business or organization. + """ + + merchant_name_prefix: Required[str] + """ + For certain Business Application Identifiers, the statement descriptor is + `merchant_name_prefix*sender_name`, where the `merchant_name_prefix` is a one to + four character prefix that identifies the merchant. + """ + + merchant_postal_code: Required[str] + """The postal code of the merchant (generally your business) sending the transfer.""" + + merchant_state: Required[str] + """The state of the merchant (generally your business) sending the transfer.""" + + presentment_amount: Required[PresentmentAmount] + """The amount to transfer. + + The receiving bank will convert this to the cardholder's currency. The amount + that is applied to your Increase account matches the currency of your account. + """ + + recipient_name: Required[str] + """The name of the funds recipient.""" + + sender_address_city: Required[str] + """The city of the sender.""" + + sender_address_line1: Required[str] + """The address line 1 of the sender.""" + + sender_address_postal_code: Required[str] + """The postal code of the sender.""" + + sender_address_state: Required[str] + """The state of the sender.""" + + sender_name: Required[str] + """The name of the funds originator.""" + + source_account_number_id: Required[str] + """The identifier of the Account Number from which to send the transfer.""" + + merchant_legal_business_name: str + """ + The legal business name of the merchant (generally your business) sending the + transfer. Required if the card is issued in Canada. + """ + + merchant_street_address: str + """ + The street address of the merchant (generally your business) sending the + transfer. Required if the card is issued in Canada. + """ + + recipient_address_city: str + """The city of the recipient. Required if the card is issued in Canada.""" + + recipient_address_line1: str + """The first line of the recipient's address. + + Required if the card is issued in Canada. + """ + + recipient_address_postal_code: str + """The postal code of the recipient. Required if the card is issued in Canada.""" + + recipient_address_state: str + """The state or province of the recipient. + + Required if the card is issued in Canada. + """ + + require_approval: bool + """Whether the transfer requires explicit approval via the dashboard or API.""" + + +class PresentmentAmount(TypedDict, total=False): + """The amount to transfer. + + The receiving bank will convert this to the cardholder's currency. The amount that is applied to your Increase account matches the currency of your account. + """ + + currency: Required[ + Literal[ + "AFN", + "EUR", + "ALL", + "DZD", + "USD", + "AOA", + "ARS", + "AMD", + "AWG", + "AUD", + "AZN", + "BSD", + "BHD", + "BDT", + "BBD", + "BYN", + "BZD", + "BMD", + "INR", + "BTN", + "BOB", + "BOV", + "BAM", + "BWP", + "NOK", + "BRL", + "BND", + "BGN", + "BIF", + "CVE", + "KHR", + "CAD", + "KYD", + "CLP", + "CLF", + "CNY", + "COP", + "COU", + "KMF", + "CDF", + "NZD", + "CRC", + "CUP", + "CZK", + "DKK", + "DJF", + "DOP", + "EGP", + "SVC", + "ERN", + "SZL", + "ETB", + "FKP", + "FJD", + "GMD", + "GEL", + "GHS", + "GIP", + "GTQ", + "GBP", + "GNF", + "GYD", + "HTG", + "HNL", + "HKD", + "HUF", + "ISK", + "IDR", + "IRR", + "IQD", + "ILS", + "JMD", + "JPY", + "JOD", + "KZT", + "KES", + "KPW", + "KRW", + "KWD", + "KGS", + "LAK", + "LBP", + "LSL", + "ZAR", + "LRD", + "LYD", + "CHF", + "MOP", + "MKD", + "MGA", + "MWK", + "MYR", + "MVR", + "MRU", + "MUR", + "MXN", + "MXV", + "MDL", + "MNT", + "MAD", + "MZN", + "MMK", + "NAD", + "NPR", + "NIO", + "NGN", + "OMR", + "PKR", + "PAB", + "PGK", + "PYG", + "PEN", + "PHP", + "PLN", + "QAR", + "RON", + "RUB", + "RWF", + "SHP", + "WST", + "STN", + "SAR", + "RSD", + "SCR", + "SLE", + "SGD", + "SBD", + "SOS", + "SSP", + "LKR", + "SDG", + "SRD", + "SEK", + "CHE", + "CHW", + "SYP", + "TWD", + "TJS", + "TZS", + "THB", + "TOP", + "TTD", + "TND", + "TRY", + "TMT", + "UGX", + "UAH", + "AED", + "USN", + "UYU", + "UYI", + "UYW", + "UZS", + "VUV", + "VES", + "VED", + "VND", + "YER", + "ZMW", + "ZWG", + ] + ] + """The ISO 4217 currency code representing the currency of the amount. + + - `AFN` - AFN + - `EUR` - EUR + - `ALL` - ALL + - `DZD` - DZD + - `USD` - USD + - `AOA` - AOA + - `ARS` - ARS + - `AMD` - AMD + - `AWG` - AWG + - `AUD` - AUD + - `AZN` - AZN + - `BSD` - BSD + - `BHD` - BHD + - `BDT` - BDT + - `BBD` - BBD + - `BYN` - BYN + - `BZD` - BZD + - `BMD` - BMD + - `INR` - INR + - `BTN` - BTN + - `BOB` - BOB + - `BOV` - BOV + - `BAM` - BAM + - `BWP` - BWP + - `NOK` - NOK + - `BRL` - BRL + - `BND` - BND + - `BGN` - BGN + - `BIF` - BIF + - `CVE` - CVE + - `KHR` - KHR + - `CAD` - CAD + - `KYD` - KYD + - `CLP` - CLP + - `CLF` - CLF + - `CNY` - CNY + - `COP` - COP + - `COU` - COU + - `KMF` - KMF + - `CDF` - CDF + - `NZD` - NZD + - `CRC` - CRC + - `CUP` - CUP + - `CZK` - CZK + - `DKK` - DKK + - `DJF` - DJF + - `DOP` - DOP + - `EGP` - EGP + - `SVC` - SVC + - `ERN` - ERN + - `SZL` - SZL + - `ETB` - ETB + - `FKP` - FKP + - `FJD` - FJD + - `GMD` - GMD + - `GEL` - GEL + - `GHS` - GHS + - `GIP` - GIP + - `GTQ` - GTQ + - `GBP` - GBP + - `GNF` - GNF + - `GYD` - GYD + - `HTG` - HTG + - `HNL` - HNL + - `HKD` - HKD + - `HUF` - HUF + - `ISK` - ISK + - `IDR` - IDR + - `IRR` - IRR + - `IQD` - IQD + - `ILS` - ILS + - `JMD` - JMD + - `JPY` - JPY + - `JOD` - JOD + - `KZT` - KZT + - `KES` - KES + - `KPW` - KPW + - `KRW` - KRW + - `KWD` - KWD + - `KGS` - KGS + - `LAK` - LAK + - `LBP` - LBP + - `LSL` - LSL + - `ZAR` - ZAR + - `LRD` - LRD + - `LYD` - LYD + - `CHF` - CHF + - `MOP` - MOP + - `MKD` - MKD + - `MGA` - MGA + - `MWK` - MWK + - `MYR` - MYR + - `MVR` - MVR + - `MRU` - MRU + - `MUR` - MUR + - `MXN` - MXN + - `MXV` - MXV + - `MDL` - MDL + - `MNT` - MNT + - `MAD` - MAD + - `MZN` - MZN + - `MMK` - MMK + - `NAD` - NAD + - `NPR` - NPR + - `NIO` - NIO + - `NGN` - NGN + - `OMR` - OMR + - `PKR` - PKR + - `PAB` - PAB + - `PGK` - PGK + - `PYG` - PYG + - `PEN` - PEN + - `PHP` - PHP + - `PLN` - PLN + - `QAR` - QAR + - `RON` - RON + - `RUB` - RUB + - `RWF` - RWF + - `SHP` - SHP + - `WST` - WST + - `STN` - STN + - `SAR` - SAR + - `RSD` - RSD + - `SCR` - SCR + - `SLE` - SLE + - `SGD` - SGD + - `SBD` - SBD + - `SOS` - SOS + - `SSP` - SSP + - `LKR` - LKR + - `SDG` - SDG + - `SRD` - SRD + - `SEK` - SEK + - `CHE` - CHE + - `CHW` - CHW + - `SYP` - SYP + - `TWD` - TWD + - `TJS` - TJS + - `TZS` - TZS + - `THB` - THB + - `TOP` - TOP + - `TTD` - TTD + - `TND` - TND + - `TRY` - TRY + - `TMT` - TMT + - `UGX` - UGX + - `UAH` - UAH + - `AED` - AED + - `USN` - USN + - `UYU` - UYU + - `UYI` - UYI + - `UYW` - UYW + - `UZS` - UZS + - `VUV` - VUV + - `VES` - VES + - `VED` - VED + - `VND` - VND + - `YER` - YER + - `ZMW` - ZMW + - `ZWG` - ZWG + """ + + value: Required[str] + """The amount value as a decimal string in the currency's major unit. + + For example, for USD, '1234.56' represents 1234 dollars and 56 cents. For JPY, + '1234' represents 1234 yen. A currency with minor units requires at least one + decimal place and supports up to the number of decimal places defined by the + currency's minor units. A currency without minor units does not support any + decimal places. + """ diff --git a/src/increase/types/card_push_transfer_list_params.py b/src/increase/types/card_push_transfer_list_params.py new file mode 100644 index 000000000..27b290596 --- /dev/null +++ b/src/increase/types/card_push_transfer_list_params.py @@ -0,0 +1,87 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["CardPushTransferListParams", "CreatedAt", "Status"] + + +class CardPushTransferListParams(TypedDict, total=False): + account_id: str + """Filter Card Push Transfers to ones belonging to the specified Account.""" + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + status: Status + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[ + Literal[ + "pending_approval", + "canceled", + "pending_reviewing", + "requires_attention", + "pending_submission", + "submitted", + "complete", + "declined", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/card_token.py b/src/increase/types/card_token.py new file mode 100644 index 000000000..d687979a0 --- /dev/null +++ b/src/increase/types/card_token.py @@ -0,0 +1,44 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import date, datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["CardToken"] + + +class CardToken(BaseModel): + """ + Card Tokens represent a tokenized card number that can be used for Card Push Transfers and Card Validations. + """ + + id: str + """The Card Token's identifier.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the card token was created. + """ + + expiration_date: date + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date when the card + expires. + """ + + last4: str + """The last 4 digits of the card number.""" + + length: int + """The length of the card number.""" + + prefix: str + """The prefix of the card number, usually 8 digits.""" + + type: Literal["card_token"] + """A constant representing the object's type. + + For this resource it will always be `card_token`. + """ diff --git a/src/increase/types/card_token_capabilities.py b/src/increase/types/card_token_capabilities.py new file mode 100644 index 000000000..78e22dbe7 --- /dev/null +++ b/src/increase/types/card_token_capabilities.py @@ -0,0 +1,49 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["CardTokenCapabilities", "Route"] + + +class Route(BaseModel): + cross_border_push_transfers: Literal["supported", "not_supported"] + """Whether you can push funds to the card using cross-border Card Push Transfers. + + - `supported` - The capability is supported. + - `not_supported` - The capability is not supported. + """ + + domestic_push_transfers: Literal["supported", "not_supported"] + """Whether you can push funds to the card using domestic Card Push Transfers. + + - `supported` - The capability is supported. + - `not_supported` - The capability is not supported. + """ + + issuer_country: str + """The ISO-3166-1 alpha-2 country code of the card's issuing bank.""" + + route: Literal["visa", "mastercard"] + """The card network route the capabilities apply to. + + - `visa` - Visa and Interlink + - `mastercard` - Mastercard and Maestro + """ + + +class CardTokenCapabilities(BaseModel): + """ + The capabilities of a Card Token describe whether the card can be used for specific operations, such as Card Push Transfers. The capabilities can change over time based on the issuing bank's configuration of the card range. + """ + + routes: List[Route] + """Each route represent a path e.g., a push transfer can take.""" + + type: Literal["card_token_capabilities"] + """A constant representing the object's type. + + For this resource it will always be `card_token_capabilities`. + """ diff --git a/src/increase/types/proof_of_authorization_request_list_params.py b/src/increase/types/card_token_list_params.py similarity index 90% rename from src/increase/types/proof_of_authorization_request_list_params.py rename to src/increase/types/card_token_list_params.py index 48cf68d02..68c5a04db 100644 --- a/src/increase/types/proof_of_authorization_request_list_params.py +++ b/src/increase/types/card_token_list_params.py @@ -8,10 +8,10 @@ from .._utils import PropertyInfo -__all__ = ["ProofOfAuthorizationRequestListParams", "CreatedAt"] +__all__ = ["CardTokenListParams", "CreatedAt"] -class ProofOfAuthorizationRequestListParams(TypedDict, total=False): +class CardTokenListParams(TypedDict, total=False): created_at: CreatedAt cursor: str diff --git a/src/increase/types/card_update_params.py b/src/increase/types/card_update_params.py index 85c1842d9..192fb7086 100644 --- a/src/increase/types/card_update_params.py +++ b/src/increase/types/card_update_params.py @@ -2,12 +2,36 @@ from __future__ import annotations +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["CardUpdateParams", "BillingAddress", "DigitalWallet"] +__all__ = [ + "CardUpdateParams", + "AuthorizationControls", + "AuthorizationControlsMerchantAcceptorIdentifier", + "AuthorizationControlsMerchantAcceptorIdentifierAllowed", + "AuthorizationControlsMerchantAcceptorIdentifierBlocked", + "AuthorizationControlsMerchantCategoryCode", + "AuthorizationControlsMerchantCategoryCodeAllowed", + "AuthorizationControlsMerchantCategoryCodeBlocked", + "AuthorizationControlsMerchantCountry", + "AuthorizationControlsMerchantCountryAllowed", + "AuthorizationControlsMerchantCountryBlocked", + "AuthorizationControlsUsage", + "AuthorizationControlsUsageMultiUse", + "AuthorizationControlsUsageMultiUseSpendingLimit", + "AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode", + "AuthorizationControlsUsageSingleUse", + "AuthorizationControlsUsageSingleUseSettlementAmount", + "BillingAddress", + "DigitalWallet", +] class CardUpdateParams(TypedDict, total=False): + authorization_controls: AuthorizationControls + """Controls that restrict how this card can be used.""" + billing_address: BillingAddress """The card's updated billing address.""" @@ -37,7 +61,208 @@ class CardUpdateParams(TypedDict, total=False): """ +class AuthorizationControlsMerchantAcceptorIdentifierAllowed(TypedDict, total=False): + identifier: Required[str] + """The Merchant Acceptor ID.""" + + +class AuthorizationControlsMerchantAcceptorIdentifierBlocked(TypedDict, total=False): + identifier: Required[str] + """The Merchant Acceptor ID.""" + + +class AuthorizationControlsMerchantAcceptorIdentifier(TypedDict, total=False): + """ + Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations on this card. + """ + + allowed: Iterable[AuthorizationControlsMerchantAcceptorIdentifierAllowed] + """The Merchant Acceptor IDs that are allowed for authorizations on this card. + + Authorizations with Merchant Acceptor IDs not in this list will be declined. + """ + + blocked: Iterable[AuthorizationControlsMerchantAcceptorIdentifierBlocked] + """The Merchant Acceptor IDs that are blocked for authorizations on this card. + + Authorizations with Merchant Acceptor IDs in this list will be declined. + """ + + +class AuthorizationControlsMerchantCategoryCodeAllowed(TypedDict, total=False): + code: Required[str] + """The Merchant Category Code.""" + + +class AuthorizationControlsMerchantCategoryCodeBlocked(TypedDict, total=False): + code: Required[str] + """The Merchant Category Code.""" + + +class AuthorizationControlsMerchantCategoryCode(TypedDict, total=False): + """ + Restricts which Merchant Category Codes are allowed or blocked for authorizations on this card. + """ + + allowed: Iterable[AuthorizationControlsMerchantCategoryCodeAllowed] + """The Merchant Category Codes that are allowed for authorizations on this card. + + Authorizations with Merchant Category Codes not in this list will be declined. + """ + + blocked: Iterable[AuthorizationControlsMerchantCategoryCodeBlocked] + """The Merchant Category Codes that are blocked for authorizations on this card. + + Authorizations with Merchant Category Codes in this list will be declined. + """ + + +class AuthorizationControlsMerchantCountryAllowed(TypedDict, total=False): + country: Required[str] + """The ISO 3166-1 alpha-2 country code.""" + + +class AuthorizationControlsMerchantCountryBlocked(TypedDict, total=False): + country: Required[str] + """The ISO 3166-1 alpha-2 country code.""" + + +class AuthorizationControlsMerchantCountry(TypedDict, total=False): + """ + Restricts which merchant countries are allowed or blocked for authorizations on this card. + """ + + allowed: Iterable[AuthorizationControlsMerchantCountryAllowed] + """The merchant countries that are allowed for authorizations on this card. + + Authorizations with merchant countries not in this list will be declined. + """ + + blocked: Iterable[AuthorizationControlsMerchantCountryBlocked] + """The merchant countries that are blocked for authorizations on this card. + + Authorizations with merchant countries in this list will be declined. + """ + + +class AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode(TypedDict, total=False): + code: Required[str] + """The Merchant Category Code.""" + + +class AuthorizationControlsUsageMultiUseSpendingLimit(TypedDict, total=False): + interval: Required[Literal["all_time", "per_transaction", "per_day", "per_week", "per_month"]] + """The interval at which the spending limit is enforced. + + - `all_time` - The spending limit applies over the lifetime of the card. + - `per_transaction` - The spending limit applies per transaction. + - `per_day` - The spending limit applies per day. Resets nightly at midnight + UTC. + - `per_week` - The spending limit applies per week. Resets weekly on Mondays at + midnight UTC. + - `per_month` - The spending limit applies per month. Resets on the first of the + month, midnight UTC. + """ + + settlement_amount: Required[int] + """The maximum settlement amount permitted in the given interval.""" + + merchant_category_codes: Iterable[AuthorizationControlsUsageMultiUseSpendingLimitMerchantCategoryCode] + """The Merchant Category Codes this spending limit applies to. + + If not set, the limit applies to all transactions. + """ + + +class AuthorizationControlsUsageMultiUse(TypedDict, total=False): + """Controls for multi-use cards. + + Required if and only if `category` is `multi_use`. + """ + + spending_limits: Iterable[AuthorizationControlsUsageMultiUseSpendingLimit] + """Spending limits for this card. + + The most restrictive limit applies if multiple limits match. + """ + + +class AuthorizationControlsUsageSingleUseSettlementAmount(TypedDict, total=False): + """The settlement amount constraint for this single-use card.""" + + comparison: Required[Literal["equals", "less_than_or_equals"]] + """The operator used to compare the settlement amount. + + - `equals` - The settlement amount must be exactly the specified value. + - `less_than_or_equals` - The settlement amount must be less than or equal to + the specified value. + """ + + value: Required[int] + """The settlement amount value.""" + + +class AuthorizationControlsUsageSingleUse(TypedDict, total=False): + """Controls for single-use cards. + + Required if and only if `category` is `single_use`. + """ + + settlement_amount: Required[AuthorizationControlsUsageSingleUseSettlementAmount] + """The settlement amount constraint for this single-use card.""" + + +class AuthorizationControlsUsage(TypedDict, total=False): + """Controls how many times this card can be used.""" + + category: Required[Literal["single_use", "multi_use"]] + """Whether the card is for a single use or multiple uses. + + - `single_use` - The card can only be used for a single authorization. + - `multi_use` - The card can be used for multiple authorizations. + """ + + multi_use: AuthorizationControlsUsageMultiUse + """Controls for multi-use cards. + + Required if and only if `category` is `multi_use`. + """ + + single_use: AuthorizationControlsUsageSingleUse + """Controls for single-use cards. + + Required if and only if `category` is `single_use`. + """ + + +class AuthorizationControls(TypedDict, total=False): + """Controls that restrict how this card can be used.""" + + merchant_acceptor_identifier: AuthorizationControlsMerchantAcceptorIdentifier + """ + Restricts which Merchant Acceptor IDs are allowed or blocked for authorizations + on this card. + """ + + merchant_category_code: AuthorizationControlsMerchantCategoryCode + """ + Restricts which Merchant Category Codes are allowed or blocked for + authorizations on this card. + """ + + merchant_country: AuthorizationControlsMerchantCountry + """ + Restricts which merchant countries are allowed or blocked for authorizations on + this card. + """ + + usage: AuthorizationControlsUsage + """Controls how many times this card can be used.""" + + class BillingAddress(TypedDict, total=False): + """The card's updated billing address.""" + city: Required[str] """The city of the billing address.""" @@ -55,6 +280,10 @@ class BillingAddress(TypedDict, total=False): class DigitalWallet(TypedDict, total=False): + """ + The contact information used in the two-factor steps for digital wallet card creation. At least one field must be present to complete the digital wallet steps. + """ + digital_card_profile_id: str """The digital card profile assigned to this digital card.""" diff --git a/src/increase/types/card_update_pin_params.py b/src/increase/types/card_update_pin_params.py new file mode 100644 index 000000000..8c4380609 --- /dev/null +++ b/src/increase/types/card_update_pin_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CardUpdatePinParams"] + + +class CardUpdatePinParams(TypedDict, total=False): + pin: Required[str] + """The 4-digit PIN for the card, for use with ATMs.""" diff --git a/src/increase/types/card_validation.py b/src/increase/types/card_validation.py new file mode 100644 index 000000000..fd0450c01 --- /dev/null +++ b/src/increase/types/card_validation.py @@ -0,0 +1,483 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = [ + "CardValidation", + "Acceptance", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "Decline", + "Submission", +] + + +class Acceptance(BaseModel): + """ + If the validation is accepted by the recipient bank, this will contain supplemental details. + """ + + accepted_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the validation was accepted by the issuing bank. + """ + + authorization_identification_response: str + """The authorization identification response from the issuing bank.""" + + card_verification_value2_result: Optional[Literal["match", "no_match"]] = None + """The result of the Card Verification Value 2 match. + + - `match` - The Card Verification Value 2 (CVV2) matches the expected value. + - `no_match` - The Card Verification Value 2 (CVV2) does not match the expected + value. + """ + + cardholder_first_name_result: Optional[Literal["match", "no_match", "partial_match"]] = None + """The result of the cardholder first name match. + + - `match` - The cardholder name component matches the expected value. + - `no_match` - The cardholder name component does not match the expected value. + - `partial_match` - The cardholder name component partially matches the expected + value. + """ + + cardholder_full_name_result: Optional[Literal["match", "no_match", "partial_match"]] = None + """The result of the cardholder full name match. + + - `match` - The cardholder name component matches the expected value. + - `no_match` - The cardholder name component does not match the expected value. + - `partial_match` - The cardholder name component partially matches the expected + value. + """ + + cardholder_last_name_result: Optional[Literal["match", "no_match", "partial_match"]] = None + """The result of the cardholder last name match. + + - `match` - The cardholder name component matches the expected value. + - `no_match` - The cardholder name component does not match the expected value. + - `partial_match` - The cardholder name component partially matches the expected + value. + """ + + cardholder_middle_name_result: Optional[Literal["match", "no_match", "partial_match"]] = None + """The result of the cardholder middle name match. + + - `match` - The cardholder name component matches the expected value. + - `no_match` - The cardholder name component does not match the expected value. + - `partial_match` - The cardholder name component partially matches the expected + value. + """ + + cardholder_postal_code_result: Optional[Literal["match", "no_match"]] = None + """The result of the cardholder postal code match. + + - `match` - The cardholder address component matches the expected value. + - `no_match` - The cardholder address component does not match the expected + value. + """ + + cardholder_street_address_result: Optional[Literal["match", "no_match"]] = None + """The result of the cardholder street address match. + + - `match` - The cardholder address component matches the expected value. + - `no_match` - The cardholder address component does not match the expected + value. + """ + + network_transaction_identifier: Optional[str] = None + """A unique identifier for the transaction on the card network.""" + + +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the validation, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + +class Decline(BaseModel): + """ + If the validation is rejected by the card network or the destination financial institution, this will contain supplemental details. + """ + + declined_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the validation was declined. + """ + + network_transaction_identifier: Optional[str] = None + """A unique identifier for the transaction on the card network.""" + + reason: Literal[ + "do_not_honor", + "activity_count_limit_exceeded", + "refer_to_card_issuer", + "refer_to_card_issuer_special_condition", + "invalid_merchant", + "pick_up_card", + "error", + "pick_up_card_special", + "invalid_transaction", + "invalid_amount", + "invalid_account_number", + "no_such_issuer", + "re_enter_transaction", + "no_credit_account", + "pick_up_card_lost", + "pick_up_card_stolen", + "closed_account", + "insufficient_funds", + "no_checking_account", + "no_savings_account", + "expired_card", + "transaction_not_permitted_to_cardholder", + "transaction_not_allowed_at_terminal", + "transaction_not_supported_or_blocked_by_issuer", + "suspected_fraud", + "activity_amount_limit_exceeded", + "restricted_card", + "security_violation", + "transaction_does_not_fulfill_anti_money_laundering_requirement", + "blocked_by_cardholder", + "blocked_first_use", + "credit_issuer_unavailable", + "negative_card_verification_value_results", + "issuer_unavailable", + "financial_institution_cannot_be_found", + "transaction_cannot_be_completed", + "duplicate_transaction", + "system_malfunction", + "additional_customer_authentication_required", + "surcharge_amount_not_permitted", + "decline_for_cvv2_failure", + "stop_payment_order", + "revocation_of_authorization_order", + "revocation_of_all_authorizations_order", + "unable_to_locate_record", + "file_is_temporarily_unavailable", + "incorrect_pin", + "allowable_number_of_pin_entry_tries_exceeded", + "unable_to_locate_previous_message", + "pin_error_found", + "cannot_verify_pin", + "verification_data_failed", + "surcharge_amount_not_supported_by_debit_network_issuer", + "cash_service_not_available", + "cashback_request_exceeds_issuer_limit", + "transaction_amount_exceeds_pre_authorized_approval_amount", + "transaction_does_not_qualify_for_visa_pin", + "offline_declined", + "unable_to_go_online", + "valid_account_but_amount_not_supported", + "invalid_use_of_merchant_category_code_correct_and_reattempt", + "card_authentication_failed", + ] + """The reason why the validation was declined. + + - `do_not_honor` - The card issuer has declined the transaction without + providing a specific reason. + - `activity_count_limit_exceeded` - The number of transactions for the card has + exceeded the limit set by the issuer. + - `refer_to_card_issuer` - The card issuer requires the cardholder to contact + them for further information regarding the transaction. + - `refer_to_card_issuer_special_condition` - The card issuer requires the + cardholder to contact them due to a special condition related to the + transaction. + - `invalid_merchant` - The merchant is not valid for this transaction. + - `pick_up_card` - The card should be retained by the terminal. + - `error` - An error occurred during processing of the transaction. + - `pick_up_card_special` - The card should be retained by the terminal due to a + special condition. + - `invalid_transaction` - The transaction is invalid and cannot be processed. + - `invalid_amount` - The amount of the transaction is invalid. + - `invalid_account_number` - The account number provided is invalid. + - `no_such_issuer` - The issuer of the card could not be found. + - `re_enter_transaction` - The transaction should be re-entered for processing. + - `no_credit_account` - There is no credit account associated with the card. + - `pick_up_card_lost` - The card should be retained by the terminal because it + has been reported lost. + - `pick_up_card_stolen` - The card should be retained by the terminal because it + has been reported stolen. + - `closed_account` - The account associated with the card has been closed. + - `insufficient_funds` - There are insufficient funds in the account to complete + the transaction. + - `no_checking_account` - There is no checking account associated with the card. + - `no_savings_account` - There is no savings account associated with the card. + - `expired_card` - The card has expired and cannot be used for transactions. + - `transaction_not_permitted_to_cardholder` - The transaction is not permitted + for this cardholder. + - `transaction_not_allowed_at_terminal` - The transaction is not allowed at this + terminal. + - `transaction_not_supported_or_blocked_by_issuer` - The transaction is not + supported or has been blocked by the issuer. + - `suspected_fraud` - The transaction has been flagged as suspected fraud and + cannot be processed. + - `activity_amount_limit_exceeded` - The amount of activity on the card has + exceeded the limit set by the issuer. + - `restricted_card` - The card has restrictions that prevent it from being used + for this transaction. + - `security_violation` - A security violation has occurred, preventing the + transaction from being processed. + - `transaction_does_not_fulfill_anti_money_laundering_requirement` - The + transaction does not meet the anti-money laundering requirements set by the + issuer. + - `blocked_by_cardholder` - The transaction was blocked by the cardholder. + - `blocked_first_use` - The first use of the card has been blocked by the + issuer. + - `credit_issuer_unavailable` - The credit issuer is currently unavailable to + process the transaction. + - `negative_card_verification_value_results` - The card verification value (CVV) + results were negative, indicating a potential issue with the card. + - `issuer_unavailable` - The issuer of the card is currently unavailable to + process the transaction. + - `financial_institution_cannot_be_found` - The financial institution associated + with the card could not be found. + - `transaction_cannot_be_completed` - The transaction cannot be completed due to + an unspecified reason. + - `duplicate_transaction` - The transaction is a duplicate of a previous + transaction and cannot be processed again. + - `system_malfunction` - A system malfunction occurred, preventing the + transaction from being processed. + - `additional_customer_authentication_required` - Additional customer + authentication is required to complete the transaction. + - `surcharge_amount_not_permitted` - The surcharge amount applied to the + transaction is not permitted by the issuer. + - `decline_for_cvv2_failure` - The transaction was declined due to a failure in + verifying the CVV2 code. + - `stop_payment_order` - A stop payment order has been placed on this + transaction. + - `revocation_of_authorization_order` - An order has been placed to revoke + authorization for this transaction. + - `revocation_of_all_authorizations_order` - An order has been placed to revoke + all authorizations for this cardholder. + - `unable_to_locate_record` - The record associated with the transaction could + not be located. + - `file_is_temporarily_unavailable` - The file needed for the transaction is + temporarily unavailable. + - `incorrect_pin` - The PIN entered for the transaction is incorrect. + - `allowable_number_of_pin_entry_tries_exceeded` - The allowable number of PIN + entry tries has been exceeded. + - `unable_to_locate_previous_message` - The previous message associated with the + transaction could not be located. + - `pin_error_found` - An error was found with the PIN associated with the + transaction. + - `cannot_verify_pin` - The PIN associated with the transaction could not be + verified. + - `verification_data_failed` - The verification data associated with the + transaction has failed. + - `surcharge_amount_not_supported_by_debit_network_issuer` - The surcharge + amount is not supported by the debit network issuer. + - `cash_service_not_available` - Cash service is not available for this + transaction. + - `cashback_request_exceeds_issuer_limit` - The cashback request exceeds the + issuer limit. + - `transaction_amount_exceeds_pre_authorized_approval_amount` - The transaction + amount exceeds the pre-authorized approval amount. + - `transaction_does_not_qualify_for_visa_pin` - The transaction does not qualify + for Visa PIN processing. + - `offline_declined` - The transaction was declined offline. + - `unable_to_go_online` - The terminal was unable to go online to process the + transaction. + - `valid_account_but_amount_not_supported` - The account is valid but the + transaction amount is not supported. + - `invalid_use_of_merchant_category_code_correct_and_reattempt` - The merchant + category code was used incorrectly; correct it and reattempt the transaction. + - `card_authentication_failed` - The card authentication process has failed. + """ + + +class Submission(BaseModel): + """ + After the validation is submitted to the card network, this will contain supplemental details. + """ + + retrieval_reference_number: str + """A 12-digit retrieval reference number that identifies the validation. + + Usually a combination of a timestamp and the trace number. + """ + + submitted_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the validation was submitted to the card network. + """ + + trace_number: str + """ + A 6-digit trace number that identifies the validation within a short time + window. + """ + + +class CardValidation(BaseModel): + """ + Card Validations are used to validate a card and its cardholder before sending funds to or pulling funds from a card. + """ + + id: str + """The Card Validation's identifier.""" + + acceptance: Optional[Acceptance] = None + """ + If the validation is accepted by the recipient bank, this will contain + supplemental details. + """ + + account_id: str + """The identifier of the Account from which to send the validation.""" + + card_token_id: str + """The ID of the Card Token that was used to validate the card.""" + + cardholder_first_name: Optional[str] = None + """The cardholder's first name.""" + + cardholder_last_name: Optional[str] = None + """The cardholder's last name.""" + + cardholder_middle_name: Optional[str] = None + """The cardholder's middle name.""" + + cardholder_postal_code: Optional[str] = None + """The postal code of the cardholder's address.""" + + cardholder_street_address: Optional[str] = None + """The cardholder's street address.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the validation was created. + """ + + created_by: Optional[CreatedBy] = None + """What object created the validation, either via the API or the dashboard.""" + + decline: Optional[Decline] = None + """ + If the validation is rejected by the card network or the destination financial + institution, this will contain supplemental details. + """ + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + merchant_category_code: str + """ + A four-digit code (MCC) identifying the type of business or service provided by + the merchant. + """ + + merchant_city_name: str + """The city where the merchant (typically your business) is located.""" + + merchant_name: str + """The merchant name that will appear in the cardholder’s statement descriptor. + + Typically your business name. + """ + + merchant_postal_code: str + """The postal code for the merchant’s (typically your business’s) location.""" + + merchant_state: str + """The U.S. state where the merchant (typically your business) is located.""" + + route: Literal["visa", "mastercard"] + """The card network route used for the validation. + + - `visa` - Visa and Interlink + - `mastercard` - Mastercard and Maestro + """ + + status: Literal["requires_attention", "pending_submission", "submitted", "complete", "declined"] + """The lifecycle status of the validation. + + - `requires_attention` - The validation requires attention from an Increase + operator. + - `pending_submission` - The validation is queued to be submitted to the card + network. + - `submitted` - The validation has been submitted and is pending a response from + the card network. + - `complete` - The validation has been sent successfully and is complete. + - `declined` - The validation was declined by the network or the recipient's + bank. + """ + + submission: Optional[Submission] = None + """ + After the validation is submitted to the card network, this will contain + supplemental details. + """ + + type: Literal["card_validation"] + """A constant representing the object's type. + + For this resource it will always be `card_validation`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/card_validation_create_params.py b/src/increase/types/card_validation_create_params.py new file mode 100644 index 000000000..e8af74976 --- /dev/null +++ b/src/increase/types/card_validation_create_params.py @@ -0,0 +1,54 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CardValidationCreateParams"] + + +class CardValidationCreateParams(TypedDict, total=False): + account_id: Required[str] + """The identifier of the Account from which to send the validation.""" + + card_token_id: Required[str] + """ + The Increase identifier for the Card Token that represents the card number + you're validating. + """ + + merchant_category_code: Required[str] + """ + A four-digit code (MCC) identifying the type of business or service provided by + the merchant. + """ + + merchant_city_name: Required[str] + """The city where the merchant (typically your business) is located.""" + + merchant_name: Required[str] + """The merchant name that will appear in the cardholder’s statement descriptor. + + Typically your business name. + """ + + merchant_postal_code: Required[str] + """The postal code for the merchant’s (typically your business’s) location.""" + + merchant_state: Required[str] + """The U.S. state where the merchant (typically your business) is located.""" + + cardholder_first_name: str + """The cardholder's first name.""" + + cardholder_last_name: str + """The cardholder's last name.""" + + cardholder_middle_name: str + """The cardholder's middle name.""" + + cardholder_postal_code: str + """The postal code of the cardholder's address.""" + + cardholder_street_address: str + """The cardholder's street address.""" diff --git a/src/increase/types/card_validation_list_params.py b/src/increase/types/card_validation_list_params.py new file mode 100644 index 000000000..f883d98df --- /dev/null +++ b/src/increase/types/card_validation_list_params.py @@ -0,0 +1,76 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["CardValidationListParams", "CreatedAt", "Status"] + + +class CardValidationListParams(TypedDict, total=False): + account_id: str + """Filter Card Validations to ones belonging to the specified Account.""" + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + status: Status + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["requires_attention", "pending_submission", "submitted", "complete", "declined"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/check_deposit.py b/src/increase/types/check_deposit.py index 12c28cf9f..1eebfc28a 100644 --- a/src/increase/types/check_deposit.py +++ b/src/increase/types/check_deposit.py @@ -1,17 +1,34 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["CheckDeposit", "DepositAcceptance", "DepositRejection", "DepositReturn", "DepositSubmission"] +__all__ = [ + "CheckDeposit", + "DepositAcceptance", + "DepositAdjustment", + "DepositRejection", + "DepositReturn", + "DepositSubmission", + "InboundFundsHold", +] class DepositAcceptance(BaseModel): + """ + Once your deposit is successfully parsed and accepted by Increase, this will contain details of the parsed check. + """ + account_number: str - """The account number printed on the check.""" + """The account number printed on the check. + + This is an account at the bank that issued the check. + """ amount: int """The amount to be deposited in the minor unit of the transaction's currency. @@ -28,21 +45,19 @@ class DepositAcceptance(BaseModel): check_deposit_id: str """The ID of the Check Deposit that was accepted.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ routing_number: str - """The routing number printed on the check.""" + """The routing number printed on the check. + + This is a routing number for the bank that issued the check. + """ serial_number: Optional[str] = None """The check serial number, if present, for consumer checks. @@ -51,27 +66,66 @@ class DepositAcceptance(BaseModel): field. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class DepositAdjustment(BaseModel): + adjusted_at: datetime + """The time at which the adjustment was received.""" + + amount: int + """The amount of the adjustment.""" + + reason: Literal["adjusted_amount", "non_conforming_item", "paid"] + """The reason for the adjustment. + + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. + """ + + transaction_id: str + """The id of the transaction for the adjustment.""" + class DepositRejection(BaseModel): + """ + If your deposit is rejected by Increase, this will contain details as to why it was rejected. + """ + amount: int """The rejected amount in the minor unit of check's currency. For dollars, for example, this is cents. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + check_deposit_id: str + """The identifier of the Check Deposit that was rejected.""" + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ + declined_transaction_id: str + """The identifier of the associated declined transaction.""" + reason: Literal[ "incomplete_image", "duplicate", @@ -82,6 +136,8 @@ class DepositRejection(BaseModel): "missing_required_data_elements", "suspected_fraud", "deposit_window_expired", + "requested_by_user", + "international", "unknown", ] """Why the check deposit was rejected. @@ -98,6 +154,9 @@ class DepositRejection(BaseModel): field. - `suspected_fraud` - This check is suspected to be fraudulent. - `deposit_window_expired` - This check's deposit window has expired. + - `requested_by_user` - The check was rejected at the user's request. + - `international` - The check is not a U.S. domestic check and cannot be + processed. - `unknown` - The check was rejected for an unknown reason. """ @@ -107,27 +166,35 @@ class DepositRejection(BaseModel): the check deposit was rejected. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class DepositReturn(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - For dollars, for example, this is cents. + +class DepositReturn(BaseModel): """ + If your deposit is returned, this will contain details as to why it was returned. + """ + + amount: int + """The returned amount in USD cents.""" check_deposit_id: str """The identifier of the Check Deposit that was returned.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -164,34 +231,46 @@ class DepositReturn(BaseModel): against. - `ach_conversion_not_supported` - The check doesn't allow ACH conversion. - - `closed_account` - The account is closed. - - `duplicate_submission` - The check has already been deposited. - - `insufficient_funds` - Insufficient funds - - `no_account` - No account was found matching the check details. - - `not_authorized` - The check was not authorized. - - `stale_dated` - The check is too old. - - `stop_payment` - The payment has been stopped by the account holder. + - `closed_account` - The account is closed. (Check21 return code `D`) + - `duplicate_submission` - The check has already been deposited. (Check21 return + code `Y`) + - `insufficient_funds` - Insufficient funds (Check21 return code `A`) + - `no_account` - No account was found matching the check details. (Check21 + return code `E`) + - `not_authorized` - The check was not authorized. (Check21 return code `Q`) + - `stale_dated` - The check is too old. (Check21 return code `G`) + - `stop_payment` - The payment has been stopped by the account holder. (Check21 + return code `C`) - `unknown_reason` - The reason for the return is unknown. - `unmatched_details` - The image doesn't match the details submitted. - - `unreadable_image` - The image could not be read. - - `endorsement_irregular` - The check endorsement was irregular. + - `unreadable_image` - The image could not be read. (Check21 return code `U`) + - `endorsement_irregular` - The check endorsement was irregular. (Check21 return + code `J`) - `altered_or_fictitious_item` - The check present was either altered or fake. + (Check21 return code `N`) - `frozen_or_blocked_account` - The account this check is drawn on is frozen. - - `post_dated` - The check is post dated. - - `endorsement_missing` - The endorsement was missing. - - `signature_missing` - The check signature was missing. + (Check21 return code `F`) + - `post_dated` - The check is post dated. (Check21 return code `H`) + - `endorsement_missing` - The endorsement was missing. (Check21 return code `I`) + - `signature_missing` - The check signature was missing. (Check21 return code + `K`) - `stop_payment_suspect` - The bank suspects a stop payment will be placed. - - `unusable_image` - The bank cannot read the image. + (Check21 return code `T`) + - `unusable_image` - The bank cannot read the image. (Check21 return code `U`) - `image_fails_security_check` - The check image fails the bank's security - check. - - `cannot_determine_amount` - The bank cannot determine the amount. + check. (Check21 return code `V`) + - `cannot_determine_amount` - The bank cannot determine the amount. (Check21 + return code `W`) - `signature_irregular` - The signature is inconsistent with prior signatures. + (Check21 return code `L`) - `non_cash_item` - The check is a non-cash item and cannot be drawn against the - account. - - `unable_to_process` - The bank is unable to process this check. + account. (Check21 return code `M`) + - `unable_to_process` - The bank is unable to process this check. (Check21 + return code `O`) - `item_exceeds_dollar_limit` - The check exceeds the bank or customer's limit. + (Check21 return code `P`) - `branch_or_account_sold` - The bank sold this account and no longer services - this customer. + this customer. (Check21 return code `R`) """ returned_at: datetime @@ -206,8 +285,37 @@ class DepositReturn(BaseModel): transaction. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class DepositSubmission(BaseModel): + """After the check is parsed, it is submitted to the Check21 network for processing. + + This will contain details of the submission. + """ + + back_file_id: str + """ + The ID for the File containing the check back image that was submitted to the + Check21 network. + """ + + front_file_id: str + """ + The ID for the File containing the check front image that was submitted to the + Check21 network. + """ + submitted_at: datetime """When the check deposit was submitted to the Check21 network for processing. @@ -216,7 +324,76 @@ class DepositSubmission(BaseModel): """ +class InboundFundsHold(BaseModel): + """Increase will sometimes hold the funds for Check Deposits. + + If funds are held, this sub-object will contain details of the hold. + """ + + amount: int + """The held amount in the minor unit of the account's currency. + + For dollars, for example, this is cents. + """ + + automatically_releases_at: datetime + """When the hold will be released automatically. + + Certain conditions may cause it to be released before this time. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the hold + was created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's + currency. + + - `USD` - US Dollar (USD) + """ + + held_transaction_id: Optional[str] = None + """The ID of the Transaction for which funds were held.""" + + pending_transaction_id: Optional[str] = None + """The ID of the Pending Transaction representing the held funds.""" + + released_at: Optional[datetime] = None + """When the hold was released (if it has been released).""" + + status: Literal["held", "complete"] + """The status of the hold. + + - `held` - Funds are still being held. + - `complete` - Funds have been released. + """ + + type: Literal["inbound_funds_hold"] + """A constant representing the object's type. + + For this resource it will always be `inbound_funds_hold`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + class CheckDeposit(BaseModel): + """Check Deposits allow you to deposit images of paper checks into your account.""" + id: str """The deposit's identifier.""" @@ -224,10 +401,7 @@ class CheckDeposit(BaseModel): """The Account the check was deposited into.""" amount: int - """The deposited amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ + """The deposited amount in USD cents.""" back_image_file_id: Optional[str] = None """The ID for the File containing the image of the back of the check.""" @@ -238,23 +412,18 @@ class CheckDeposit(BaseModel): the transfer was created. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the deposit. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - deposit_acceptance: Optional[DepositAcceptance] = None """ - If your deposit is successfully parsed and accepted by Increase, this will + Once your deposit is successfully parsed and accepted by Increase, this will contain details of the parsed check. """ + deposit_adjustments: List[DepositAdjustment] + """ + If the deposit or the return was adjusted by the receiving institution, this + will contain details of the adjustments. + """ + deposit_rejection: Optional[DepositRejection] = None """ If your deposit is rejected by Increase, this will contain details as to why it @@ -274,6 +443,9 @@ class CheckDeposit(BaseModel): This will contain details of the submission. """ + description: Optional[str] = None + """The description of the Check Deposit, for display purposes only.""" + front_image_file_id: str """The ID for the File containing the image of the front of the check.""" @@ -285,6 +457,24 @@ class CheckDeposit(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ + inbound_funds_hold: Optional[InboundFundsHold] = None + """Increase will sometimes hold the funds for Check Deposits. + + If funds are held, this sub-object will contain details of the hold. + """ + + inbound_mail_item_id: Optional[str] = None + """ + If the Check Deposit was the result of an Inbound Mail Item, this will contain + the identifier of the Inbound Mail Item. + """ + + lockbox_id: Optional[str] = None + """ + If the Check Deposit was the result of an Inbound Mail Item, this will contain + the identifier of the Lockbox that received it. + """ + status: Literal["pending", "submitted", "rejected", "returned"] """The status of the Check Deposit. @@ -302,3 +492,15 @@ class CheckDeposit(BaseModel): For this resource it will always be `check_deposit`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/check_deposit_create_params.py b/src/increase/types/check_deposit_create_params.py index 2de3c062e..864cdb832 100644 --- a/src/increase/types/check_deposit_create_params.py +++ b/src/increase/types/check_deposit_create_params.py @@ -12,16 +12,15 @@ class CheckDepositCreateParams(TypedDict, total=False): """The identifier for the Account to deposit the check in.""" amount: Required[int] - """The deposit amount in the minor unit of the account currency. - - For dollars, for example, this is cents. - """ + """The deposit amount in USD cents.""" back_image_file_id: Required[str] """The File containing the check's back image.""" - currency: Required[str] - """The currency to use for the deposit.""" - front_image_file_id: Required[str] """The File containing the check's front image.""" + + description: str + """ + The description you choose to give the Check Deposit, for display purposes only. + """ diff --git a/src/increase/types/check_transfer.py b/src/increase/types/check_transfer.py index d9b67727f..9e31266d5 100644 --- a/src/increase/types/check_transfer.py +++ b/src/increase/types/check_transfer.py @@ -1,26 +1,40 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from datetime import datetime +from typing import TYPE_CHECKING, Dict, List, Optional +from datetime import date, datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = [ "CheckTransfer", "Approval", "Cancellation", - "Deposit", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", "Mailing", "PhysicalCheck", "PhysicalCheckMailingAddress", + "PhysicalCheckPayer", "PhysicalCheckReturnAddress", + "PhysicalCheckSignature", + "PhysicalCheckTrackingUpdate", "StopPaymentRequest", "Submission", + "SubmissionSubmittedAddress", + "ThirdParty", ] class Approval(BaseModel): + """ + If your account requires approvals for transfers and the transfer was approved, this will contain details of the approval. + """ + approved_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -35,6 +49,10 @@ class Approval(BaseModel): class Cancellation(BaseModel): + """ + If your account requires approvals for transfers and the transfer was not approved, this will contain details of the cancellation. + """ + canceled_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -48,47 +66,53 @@ class Cancellation(BaseModel): """ -class Deposit(BaseModel): - back_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the back of the - deposited check. - """ +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" - bank_of_first_deposit_routing_number: Optional[str] = None - """ - The American Bankers' Association (ABA) Routing Transit Number (RTN) for the - bank depositing this check. In some rare cases, this is not transmitted via - Check21 and the value will be null. - """ + description: Optional[str] = None + """The description set for the API key when it was created.""" - deposited_at: datetime - """When the check was deposited.""" - front_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the front of the - deposited check. - """ +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" - transaction_id: Optional[str] = None - """The identifier of the Transaction object created when the check was deposited.""" + name: str + """The name of the OAuth Application.""" - transfer_id: str - """The identifier of the Check Transfer object that was deposited.""" - type: Literal["check_transfer_deposit"] - """A constant representing the object's type. +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" - For this resource it will always be `check_transfer_deposit`. + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. """ + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + class Mailing(BaseModel): - image_id: Optional[str] = None """ - The ID of the file corresponding to an image of the check that was mailed, if - available. + If the check has been mailed by Increase, this will contain details of the shipment. """ mailed_at: datetime @@ -97,8 +121,22 @@ class Mailing(BaseModel): the check was mailed. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class PhysicalCheckMailingAddress(BaseModel): + """Details for where Increase will mail the check.""" + city: Optional[str] = None """The city of the check's destination.""" @@ -111,6 +149,12 @@ class PhysicalCheckMailingAddress(BaseModel): name: Optional[str] = None """The name component of the check's mailing address.""" + phone: Optional[str] = None + """ + The phone number to be used in case of delivery issues at the check's mailing + address. Only used for FedEx overnight shipping. + """ + postal_code: Optional[str] = None """The postal code of the check's destination.""" @@ -118,7 +162,14 @@ class PhysicalCheckMailingAddress(BaseModel): """The state of the check's destination.""" +class PhysicalCheckPayer(BaseModel): + contents: str + """The contents of the line.""" + + class PhysicalCheckReturnAddress(BaseModel): + """The return address to be printed on the check.""" + city: Optional[str] = None """The city of the check's destination.""" @@ -131,6 +182,12 @@ class PhysicalCheckReturnAddress(BaseModel): name: Optional[str] = None """The name component of the check's return address.""" + phone: Optional[str] = None + """The shipper's phone number to be used in case of delivery issues. + + Only used for FedEx overnight shipping. + """ + postal_code: Optional[str] = None """The postal code of the check's destination.""" @@ -138,7 +195,51 @@ class PhysicalCheckReturnAddress(BaseModel): """The state of the check's destination.""" +class PhysicalCheckSignature(BaseModel): + """The signature that will appear on the check.""" + + image_file_id: Optional[str] = None + """The ID of a File containing a PNG of the signature.""" + + text: Optional[str] = None + """The text that will appear as the signature on the check in cursive font.""" + + +class PhysicalCheckTrackingUpdate(BaseModel): + category: Literal["in_transit", "processed_for_delivery", "delivered", "delivery_issue", "returned_to_sender"] + """The type of tracking event. + + - `in_transit` - The check is in transit. + - `processed_for_delivery` - The check has been processed for delivery. + - `delivered` - The check has been delivered. + - `delivery_issue` - There is an issue preventing delivery. The delivery will be + attempted again if possible. If the issue cannot be resolved, the check will + be returned to sender. + - `returned_to_sender` - Delivery failed and the check was returned to sender. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the tracking event took place. + """ + + postal_code: str + """The postal code where the event took place.""" + + class PhysicalCheck(BaseModel): + """Details relating to the physical check that Increase will print and mail. + + Will be present if and only if `fulfillment_method` is equal to `physical_check`. + """ + + attachment_file_id: Optional[str] = None + """The ID of the file for the check attachment.""" + + check_voucher_image_file_id: Optional[str] = None + """The ID of the file for the check voucher image.""" + mailing_address: PhysicalCheckMailingAddress """Details for where Increase will mail the check.""" @@ -148,21 +249,61 @@ class PhysicalCheck(BaseModel): note: Optional[str] = None """The descriptor that will be printed on the letter included with the check.""" + payer: List[PhysicalCheckPayer] + """The payer of the check. + + This will be printed on the top-left portion of the check and defaults to the + return address if unspecified. + """ + recipient_name: str """The name that will be printed on the check.""" return_address: Optional[PhysicalCheckReturnAddress] = None """The return address to be printed on the check.""" + shipping_method: Optional[Literal["usps_first_class", "fedex_overnight"]] = None + """The shipping method for the check. + + - `usps_first_class` - USPS First Class + - `fedex_overnight` - FedEx Overnight + """ + + signature: PhysicalCheckSignature + """The signature that will appear on the check.""" + + tracking_updates: List[PhysicalCheckTrackingUpdate] + """Tracking updates relating to the physical check's delivery.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class StopPaymentRequest(BaseModel): - reason: Literal["mail_delivery_failed", "rejected_by_increase", "not_authorized", "unknown"] + """ + After a stop-payment is requested on the check, this will contain supplemental details. + """ + + reason: Literal[ + "mail_delivery_failed", "rejected_by_increase", "not_authorized", "valid_until_date_passed", "unknown" + ] """The reason why this transfer was stopped. - `mail_delivery_failed` - The check could not be delivered. - `rejected_by_increase` - The check was canceled by an Increase operator who will provide details out-of-band. - `not_authorized` - The check was not authorized. + - `valid_until_date_passed` - The check was stopped for `valid_until_date` being + in the past. - `unknown` - The check was stopped for another reason. """ @@ -178,13 +319,105 @@ class StopPaymentRequest(BaseModel): For this resource it will always be `check_transfer_stop_payment_request`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SubmissionSubmittedAddress(BaseModel): + """The address we submitted to the printer. + + This is what is physically printed on the check. + """ + + city: str + """The submitted address city.""" + + line1: str + """The submitted address line 1.""" + + line2: Optional[str] = None + """The submitted address line 2.""" + + recipient_name: str + """The submitted recipient name.""" + + state: str + """The submitted address state.""" + + zip: str + """The submitted address zip.""" + class Submission(BaseModel): + """After the transfer is submitted, this will contain supplemental details.""" + + preview_file_id: Optional[str] = None + """ + The ID of the file corresponding to an image of the check that was mailed, if + available. + """ + + submitted_address: SubmissionSubmittedAddress + """The address we submitted to the printer. + + This is what is physically printed on the check. + """ + submitted_at: datetime - """When this check transfer was submitted to our check printer.""" + """When this check was submitted to our check printer.""" + + tracking_number: Optional[str] = None + """The tracking number for the check shipment.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class ThirdParty(BaseModel): + """Details relating to the custom fulfillment you will perform. + + Will be present if and only if `fulfillment_method` is equal to `third_party`. + """ + + recipient_name: Optional[str] = None + """The name that you will print on the check.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] class CheckTransfer(BaseModel): + """ + Check Transfers move funds from your Increase account by mailing a physical check. + """ + id: str """The Check transfer's identifier.""" @@ -203,6 +436,23 @@ class CheckTransfer(BaseModel): this will contain details of the approval. """ + approved_inbound_check_deposit_id: Optional[str] = None + """ + If the Check Transfer was successfully deposited, this will contain the + identifier of the Inbound Check Deposit object with details of the deposit. + """ + + balance_check: Optional[Literal["full", "none"]] = None + """How the account's available balance should be checked. + + - `full` - The available balance of the account must be at least the amount of + the check, and a Pending Transaction will be created for the full amount. This + is the default behavior if `balance_check` is omitted. + - `none` - No balance check will performed when the check transfer is initiated. + A zero-dollar Pending Transaction will be created. The balance will still be + checked when the Inbound Check Deposit is created. + """ + cancellation: Optional[Cancellation] = None """ If your account requires approvals for transfers and the transfer was not @@ -218,22 +468,17 @@ class CheckTransfer(BaseModel): the transfer was created. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + created_by: Optional[CreatedBy] = None + """What object created the transfer, either via the API or the dashboard.""" + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - deposit: Optional[Deposit] = None - """After a check transfer is deposited, this will contain supplemental details.""" - fulfillment_method: Literal["physical_check", "third_party"] """Whether Increase will print and mail the check or if you will do it yourself. @@ -283,28 +528,28 @@ class CheckTransfer(BaseModel): status: Literal[ "pending_approval", + "canceled", "pending_submission", + "requires_attention", + "rejected", "pending_mailing", "mailed", - "canceled", "deposited", "stopped", - "rejected", - "requires_attention", "returned", ] """The lifecycle status of the transfer. - `pending_approval` - The transfer is awaiting approval. + - `canceled` - The transfer has been canceled. - `pending_submission` - The transfer is pending submission. + - `requires_attention` - The transfer requires attention from an Increase + operator. + - `rejected` - The transfer has been rejected. - `pending_mailing` - The check is queued for mailing. - `mailed` - The check has been mailed. - - `canceled` - The transfer has been canceled. - `deposited` - The check has been deposited. - `stopped` - A stop-payment was requested for this check. - - `rejected` - The transfer has been rejected. - - `requires_attention` - The transfer requires attention from an Increase - operator. - `returned` - The transfer has been returned. """ @@ -317,8 +562,34 @@ class CheckTransfer(BaseModel): submission: Optional[Submission] = None """After the transfer is submitted, this will contain supplemental details.""" + third_party: Optional[ThirdParty] = None + """Details relating to the custom fulfillment you will perform. + + Will be present if and only if `fulfillment_method` is equal to `third_party`. + """ + type: Literal["check_transfer"] """A constant representing the object's type. For this resource it will always be `check_transfer`. """ + + valid_until_date: Optional[date] = None + """If set, the check will be valid on or before this date. + + After this date, the check transfer will be automatically stopped and deposits + will not be accepted. For checks printed by Increase, this date is included on + the check as its expiry. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/check_transfer_create_params.py b/src/increase/types/check_transfer_create_params.py index 983ac5b77..183996766 100644 --- a/src/increase/types/check_transfer_create_params.py +++ b/src/increase/types/check_transfer_create_params.py @@ -2,9 +2,21 @@ from __future__ import annotations -from typing_extensions import Literal, Required, TypedDict +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict -__all__ = ["CheckTransferCreateParams", "PhysicalCheck", "PhysicalCheckMailingAddress", "PhysicalCheckReturnAddress"] +from .._utils import PropertyInfo + +__all__ = [ + "CheckTransferCreateParams", + "PhysicalCheck", + "PhysicalCheckMailingAddress", + "PhysicalCheckPayer", + "PhysicalCheckReturnAddress", + "PhysicalCheckSignature", + "ThirdParty", +] class CheckTransferCreateParams(TypedDict, total=False): @@ -12,7 +24,16 @@ class CheckTransferCreateParams(TypedDict, total=False): """The identifier for the account that will send the transfer.""" amount: Required[int] - """The transfer amount in cents.""" + """The transfer amount in USD cents.""" + + fulfillment_method: Required[Literal["physical_check", "third_party"]] + """Whether Increase will print and mail the check or if you will do it yourself. + + - `physical_check` - Increase will print and mail a physical check. + - `third_party` - Increase will not print a check; you are responsible for + printing and mailing a check with the provided account number, routing number, + check number, and amount. + """ source_account_number_id: Required[str] """ @@ -20,13 +41,25 @@ class CheckTransferCreateParams(TypedDict, total=False): on the check. """ - fulfillment_method: Literal["physical_check", "third_party"] - """Whether Increase will print and mail the check or if you will do it yourself. + balance_check: Literal["full", "none"] + """How the account's available balance should be checked. - - `physical_check` - Increase will print and mail a physical check. - - `third_party` - Increase will not print a check; you are responsible for - printing and mailing a check with the provided account number, routing number, - check number, and amount. + If omitted, the default behavior is `balance_check: full`. + + - `full` - The available balance of the account must be at least the amount of + the check, and a Pending Transaction will be created for the full amount. This + is the default behavior if `balance_check` is omitted. + - `none` - No balance check will performed when the check transfer is initiated. + A zero-dollar Pending Transaction will be created. The balance will still be + checked when the Inbound Check Deposit is created. + """ + + check_number: str + """The check number Increase should use for the check. + + This should not contain leading zeroes and must be unique across the + `source_account_number`. If this is omitted, Increase will generate a check + number for you. """ physical_check: PhysicalCheck @@ -39,8 +72,25 @@ class CheckTransferCreateParams(TypedDict, total=False): require_approval: bool """Whether the transfer requires explicit approval via the dashboard or API.""" + third_party: ThirdParty + """Details relating to the custom fulfillment you will perform. + + This is required if `fulfillment_method` is equal to `third_party`. It must not + be included if any other `fulfillment_method` is provided. + """ + + valid_until_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """If provided, the check will be valid on or before this date. + + After this date, the check transfer will be automatically stopped and deposits + will not be accepted. For checks printed by Increase, this date is included on + the check as its expiry. + """ + class PhysicalCheckMailingAddress(TypedDict, total=False): + """Details for where Increase will mail the check.""" + city: Required[str] """The city component of the check's destination address.""" @@ -59,11 +109,28 @@ class PhysicalCheckMailingAddress(TypedDict, total=False): name: str """The name component of the check's destination address. - Defaults to the provided `recipient_name` parameter. + Defaults to the provided `recipient_name` parameter if `name` is not provided. + """ + + phone: str + """The phone number to associate with the check's destination address. + + The phone number is only used when `shipping_method` is `fedex_overnight` and + will be supplied to FedEx to be used in case of delivery issues. """ +class PhysicalCheckPayer(TypedDict, total=False): + contents: Required[str] + """The contents of the line.""" + + class PhysicalCheckReturnAddress(TypedDict, total=False): + """The return address to be printed on the check. + + If omitted this will default to an Increase-owned address that will mark checks as delivery failed and shred them. + """ + city: Required[str] """The city of the return address.""" @@ -82,8 +149,36 @@ class PhysicalCheckReturnAddress(TypedDict, total=False): line2: str """The second line of the return address.""" + phone: str + """The phone number to associate with the shipper. + + The phone number is only used when `shipping_method` is `fedex_overnight` and + will be supplied to FedEx to be used in case of delivery issues. + """ + + +class PhysicalCheckSignature(TypedDict, total=False): + """The signature that will appear on the check. + + If not provided, the check will be printed with 'No Signature Required'. At most one of `text` and `image_file_id` may be provided. + """ + + image_file_id: str + """The ID of a File containing a PNG of the signature. + + This must have `purpose: check_signature` and be a 1320x120 pixel PNG. + """ + + text: str + """The text that will appear as the signature on the check in cursive font.""" + + +class PhysicalCheck(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """Details relating to the physical check that Increase will print and mail. + + This is required if `fulfillment_method` is equal to `physical_check`. It must not be included if any other `fulfillment_method` is provided. + """ -class PhysicalCheck(TypedDict, total=False): mailing_address: Required[PhysicalCheckMailingAddress] """Details for where Increase will mail the check.""" @@ -93,12 +188,68 @@ class PhysicalCheck(TypedDict, total=False): recipient_name: Required[str] """The name that will be printed on the check in the 'To:' field.""" + attachment_file_id: str + """The ID of a File to be attached to the check. + + This must have `purpose: check_attachment`. For details on pricing and + restrictions, see + https://increase.com/documentation/originating-checks#printing-checks . + """ + + check_voucher_image_file_id: str + """The ID of a File to be used as the check voucher image. + + This must have `purpose: check_voucher_image`. For details on pricing and + restrictions, see + https://increase.com/documentation/originating-checks#printing-checks . + """ + note: str """The descriptor that will be printed on the letter included with the check.""" + payer: Iterable[PhysicalCheckPayer] + """The payer of the check. + + This will be printed on the top-left portion of the check and defaults to the + return address if unspecified. This should be an array of up to 4 elements, each + of which represents a line of the payer. + """ + return_address: PhysicalCheckReturnAddress """The return address to be printed on the check. - If omitted this will default to the address of the Entity of the Account used to - make the Check Transfer. + If omitted this will default to an Increase-owned address that will mark checks + as delivery failed and shred them. + """ + + shipping_method: Literal["usps_first_class", "fedex_overnight"] + """How to ship the check. + + For details on pricing, timing, and restrictions, see + https://increase.com/documentation/originating-checks#printing-checks . + + - `usps_first_class` - USPS First Class + - `fedex_overnight` - FedEx Overnight + """ + + signature: PhysicalCheckSignature + """The signature that will appear on the check. + + If not provided, the check will be printed with 'No Signature Required'. At most + one of `text` and `image_file_id` may be provided. + """ + + +class ThirdParty(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """Details relating to the custom fulfillment you will perform. + + This is required if `fulfillment_method` is equal to `third_party`. It must not be included if any other `fulfillment_method` is provided. + """ + + recipient_name: str + """The pay-to name you will print on the check. + + If provided, this is used for [Positive Pay](/documentation/positive-pay). If + this is omitted, Increase will be unable to validate the payer name when the + check is deposited. """ diff --git a/src/increase/types/check_transfer_list_params.py b/src/increase/types/check_transfer_list_params.py index 4ec86b6d4..2f8ccf2c3 100644 --- a/src/increase/types/check_transfer_list_params.py +++ b/src/increase/types/check_transfer_list_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["CheckTransferListParams", "CreatedAt"] +__all__ = ["CheckTransferListParams", "CreatedAt", "Status"] class CheckTransferListParams(TypedDict, total=False): @@ -34,6 +34,8 @@ class CheckTransferListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ + status: Status + class CreatedAt(TypedDict, total=False): after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] @@ -59,3 +61,29 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[ + Literal[ + "pending_approval", + "canceled", + "pending_submission", + "requires_attention", + "rejected", + "pending_mailing", + "mailed", + "deposited", + "stopped", + "returned", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/check_transfer_stop_payment_params.py b/src/increase/types/check_transfer_stop_payment_params.py index ca1c86ece..50ac231ec 100644 --- a/src/increase/types/check_transfer_stop_payment_params.py +++ b/src/increase/types/check_transfer_stop_payment_params.py @@ -8,10 +8,12 @@ class CheckTransferStopPaymentParams(TypedDict, total=False): - reason: Literal["mail_delivery_failed", "not_authorized", "unknown"] + reason: Literal["mail_delivery_failed", "not_authorized", "valid_until_date_passed", "unknown"] """The reason why this transfer should be stopped. - `mail_delivery_failed` - The check could not be delivered. - `not_authorized` - The check was not authorized. + - `valid_until_date_passed` - The check was stopped for `valid_until_date` being + in the past. - `unknown` - The check was stopped for another reason. """ diff --git a/src/increase/types/declined_transaction.py b/src/increase/types/declined_transaction.py index 09fa80678..7b1f5f3f2 100644 --- a/src/increase/types/declined_transaction.py +++ b/src/increase/types/declined_transaction.py @@ -1,9 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = [ @@ -11,28 +13,49 @@ "Source", "SourceACHDecline", "SourceCardDecline", + "SourceCardDeclineAdditionalAmounts", + "SourceCardDeclineAdditionalAmountsClinic", + "SourceCardDeclineAdditionalAmountsDental", + "SourceCardDeclineAdditionalAmountsOriginal", + "SourceCardDeclineAdditionalAmountsPrescription", + "SourceCardDeclineAdditionalAmountsSurcharge", + "SourceCardDeclineAdditionalAmountsTotalCumulative", + "SourceCardDeclineAdditionalAmountsTotalHealthcare", + "SourceCardDeclineAdditionalAmountsTransit", + "SourceCardDeclineAdditionalAmountsUnknown", + "SourceCardDeclineAdditionalAmountsVision", "SourceCardDeclineNetworkDetails", + "SourceCardDeclineNetworkDetailsPulse", "SourceCardDeclineNetworkDetailsVisa", "SourceCardDeclineNetworkIdentifiers", + "SourceCardDeclineSchemeFee", "SourceCardDeclineVerification", "SourceCardDeclineVerificationCardVerificationCode", "SourceCardDeclineVerificationCardholderAddress", + "SourceCardDeclineVerificationCardholderName", "SourceCheckDecline", + "SourceCheckDepositRejection", + "SourceInboundFednowTransferDecline", "SourceInboundRealTimePaymentsTransferDecline", - "SourceInternationalACHDecline", + "SourceOther", "SourceWireDecline", ] class SourceACHDecline(BaseModel): + """An ACH Decline object. + + This field will be present in the JSON response if and only if `category` is equal to `ach_decline`. + """ + id: str """The ACH Decline's identifier.""" amount: int - """The declined amount in the minor unit of the destination account currency. + """The declined amount in USD cents.""" - For dollars, for example, this is cents. - """ + inbound_ach_transfer_id: str + """The identifier of the Inbound ACH Transfer object associated with this decline.""" originator_company_descriptive_date: Optional[str] = None """The descriptive date of the transfer.""" @@ -50,17 +73,20 @@ class SourceACHDecline(BaseModel): "ach_route_canceled", "ach_route_disabled", "breaches_limit", - "credit_entry_refused_by_receiver", - "duplicate_return", "entity_not_active", "group_locked", - "insufficient_funds", - "misrouted_return", - "return_of_erroneous_or_reversing_debit", - "no_ach_route", - "originator_request", "transaction_not_allowed", + "returned_per_odfi_request", "user_initiated", + "insufficient_funds", + "authorization_revoked_by_customer", + "payment_stopped", + "customer_advised_unauthorized_improper_ineligible_or_incomplete", + "representative_payee_deceased_or_unable_to_continue_in_that_capacity", + "beneficiary_or_account_holder_deceased", + "credit_entry_refused_by_receiver", + "duplicate_entry", + "corporate_customer_advised_not_authorized", ] """Why the ACH transfer was declined. @@ -68,23 +94,28 @@ class SourceACHDecline(BaseModel): - `ach_route_disabled` - The account number is disabled. - `breaches_limit` - The transaction would cause an Increase limit to be exceeded. - - `credit_entry_refused_by_receiver` - A credit was refused. This is a - reasonable default reason for decline of credits. - - `duplicate_return` - A rare return reason. The return this message refers to - was a duplicate. - `entity_not_active` - The account's entity is not active. - `group_locked` - Your account is inactive. - - `insufficient_funds` - Your account contains insufficient funds. - - `misrouted_return` - A rare return reason. The return this message refers to - was misrouted. - - `return_of_erroneous_or_reversing_debit` - The originating financial - institution made a mistake and this return corrects it. - - `no_ach_route` - The account number that was debited does not exist. - - `originator_request` - The originating financial institution asked for this - transfer to be returned. - `transaction_not_allowed` - The transaction is not allowed per Increase's terms. - - `user_initiated` - The user initiated the decline. + - `returned_per_odfi_request` - The originating financial institution asked for + this transfer to be returned. The receiving bank is complying with the + request. + - `user_initiated` - Your integration declined this transfer via the API. + - `insufficient_funds` - Your account contains insufficient funds. + - `authorization_revoked_by_customer` - The customer no longer authorizes this + transaction. + - `payment_stopped` - The customer asked for the payment to be stopped. + - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - The + customer advises that the debit was unauthorized. + - `representative_payee_deceased_or_unable_to_continue_in_that_capacity` - The + payee is deceased. + - `beneficiary_or_account_holder_deceased` - The account holder is deceased. + - `credit_entry_refused_by_receiver` - The customer refused a credit entry. + - `duplicate_entry` - The account holder identified this transaction as a + duplicate. + - `corporate_customer_advised_not_authorized` - The corporate customer no longer + authorizes this transaction. """ receiver_id_number: Optional[str] = None @@ -102,8 +133,238 @@ class SourceACHDecline(BaseModel): For this resource it will always be `ach_decline`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCardDeclineAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardDeclineAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[SourceCardDeclineAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[SourceCardDeclineAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[SourceCardDeclineAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[SourceCardDeclineAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[SourceCardDeclineAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[SourceCardDeclineAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[SourceCardDeclineAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[SourceCardDeclineAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[SourceCardDeclineAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[SourceCardDeclineAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class SourceCardDeclineNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + class SourceCardDeclineNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + electronic_commerce_indicator: Optional[ Literal[ "mail_phone_order", @@ -146,7 +407,7 @@ class SourceCardDeclineNetworkDetailsVisa(BaseModel): 3-D Secure program. - `non_authenticated_security_transaction` - Non-authenticated security transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed + encryption for security however, cardholder authentication is not performed using 3-D Secure. - `non_secure_transaction` - Non-secure transaction: Use to identify an electronic commerce transaction that has no data protection. @@ -185,19 +446,106 @@ class SourceCardDeclineNetworkDetailsVisa(BaseModel): verification value """ + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + class SourceCardDeclineNetworkDetails(BaseModel): - category: Literal["visa"] + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] """The payment network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ + pulse: Optional[SourceCardDeclineNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + visa: Optional[SourceCardDeclineNetworkDetailsVisa] = None """Fields specific to the `visa` network.""" class SourceCardDeclineNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -218,7 +566,163 @@ class SourceCardDeclineNetworkIdentifiers(BaseModel): """ +class SourceCardDeclineSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + class SourceCardDeclineVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + result: Literal["not_checked", "match", "no_match"] """The result of verifying the Card Verification Code. @@ -230,6 +734,10 @@ class SourceCardDeclineVerificationCardVerificationCode(BaseModel): class SourceCardDeclineVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + actual_line1: Optional[str] = None """Line 1 of the address on file for the cardholder.""" @@ -247,27 +755,43 @@ class SourceCardDeclineVerificationCardholderAddress(BaseModel): result: Literal[ "not_checked", - "postal_code_match_address_not_checked", "postal_code_match_address_no_match", "postal_code_no_match_address_match", "match", "no_match", + "postal_code_match_address_not_checked", ] """The address verification result returned to the card network. - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. + - `not_checked` - No address information was provided in the authorization + request. - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. + address does not match or was not provided. - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. + street address matches or was not provided. - `match` - Postal code and street address match. - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) """ +class SourceCardDeclineVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + class SourceCardDeclineVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + card_verification_code: SourceCardDeclineVerificationCardVerificationCode """ Fields related to verification of the Card Verification Code, a 3-digit code on @@ -280,8 +804,16 @@ class SourceCardDeclineVerification(BaseModel): we verified it against. """ + cardholder_name: Optional[SourceCardDeclineVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + class SourceCardDecline(BaseModel): + """A Card Decline object. + + This field will be present in the JSON response if and only if `category` is equal to `card_decline`. + """ + id: str """The Card Decline identifier.""" @@ -296,41 +828,63 @@ class SourceCardDecline(BaseModel): processing. """ + additional_amounts: SourceCardDeclineAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + amount: int """The declined amount in the minor unit of the destination account currency. For dollars, for example, this is cents. """ - card_payment_id: Optional[str] = None + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination account currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ + declined_transaction_id: str + """The identifier of the declined transaction created for this Card Decline.""" + digital_wallet_token_id: Optional[str] = None """ If the authorization was made via a Digital Wallet Token (such as an Apple Pay purchase), the identifier of the token that was used. """ + direction: Literal["settlement", "refund"] + """ + The direction describes the direction the funds will move, either from the + cardholder to the merchant or from the merchant to the cardholder. + + - `settlement` - A regular card authorization where funds are debited from the + cardholder. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + """ + + incremented_card_authorization_id: Optional[str] = None + """ + The identifier of the card authorization this request attempted to incrementally + authorize. + """ + merchant_acceptor_id: str """ The merchant identifier (commonly abbreviated as MID) of the merchant the card is transacting with. """ - merchant_category_code: Optional[str] = None + merchant_category_code: str """ The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is transacting with. @@ -339,12 +893,19 @@ class SourceCardDecline(BaseModel): merchant_city: Optional[str] = None """The city the merchant resides in.""" - merchant_country: Optional[str] = None + merchant_country: str """The country the merchant resides in.""" merchant_descriptor: str """The merchant descriptor of the merchant the card is transacting with.""" + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + merchant_state: Optional[str] = None """The state the merchant resides in.""" @@ -358,7 +919,8 @@ class SourceCardDecline(BaseModel): """The risk score generated by the card network. For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. """ physical_card_id: Optional[str] = None @@ -367,8 +929,28 @@ class SourceCardDecline(BaseModel): that was used. """ + presentment_amount: int + """ + The declined amount in the minor unit of the transaction's presentment currency. + """ + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + "unknown", ] """ The processing category describes the intent behind the authorization, such as @@ -381,11 +963,18 @@ class SourceCardDecline(BaseModel): being known. They are followed by an advice message that updates the amount of the pending transaction. - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. - `purchase` - A regular purchase. - `quasi_cash` - Quasi-cash transactions represent purchases of items which may be convertible to cash. - `refund` - A refund card authorization, sometimes referred to as a credit voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + - `unknown` - The processing category is unknown. """ real_time_decision_id: Optional[str] = None @@ -394,13 +983,45 @@ class SourceCardDecline(BaseModel): transaction. """ + real_time_decision_reason: Optional[ + Literal[ + "insufficient_funds", + "transaction_never_allowed", + "exceeds_approval_limit", + "card_temporarily_disabled", + "suspected_fraud", + "other", + ] + ] = None + """ + This is present if a specific decline reason was given in the real-time + decision. + + - `insufficient_funds` - The cardholder does not have sufficient funds to cover + the transaction. The merchant may attempt to process the transaction again. + - `transaction_never_allowed` - This type of transaction is not allowed for this + card. This transaction should not be retried. + - `exceeds_approval_limit` - The transaction amount exceeds the cardholder's + approval limit. The merchant may attempt to process the transaction again. + - `card_temporarily_disabled` - The card has been temporarily disabled or not + yet activated. The merchant may attempt to process the transaction again. + - `suspected_fraud` - The transaction is suspected to be fraudulent. The + merchant may attempt to process the transaction again. + - `other` - The transaction was declined for another reason. The merchant may + attempt to process the transaction again. This should be used sparingly. + """ + reason: Literal[ + "account_closed", "card_not_active", + "card_canceled", "physical_card_not_active", "entity_not_active", "group_locked", "insufficient_funds", "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", "transaction_not_allowed", "breaches_limit", "webhook_declined", @@ -408,17 +1029,25 @@ class SourceCardDecline(BaseModel): "declined_by_stand_in_processing", "invalid_physical_card", "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", "suspected_fraud", ] """Why the transaction was declined. + - `account_closed` - The account has been closed. - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. - `physical_card_not_active` - The Physical Card was not active. - `entity_not_active` - The account's entity was not active. - `group_locked` - The account was inactive. - `insufficient_funds` - The Card's Account did not have a sufficient available balance. - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. - `transaction_not_allowed` - The attempted card transaction is not allowed per Increase's terms. - `breaches_limit` - The transaction was blocked by a Limit. @@ -426,25 +1055,54 @@ class SourceCardDecline(BaseModel): - `webhook_timed_out` - Your application webhook did not respond without the required timeout. - `declined_by_stand_in_processing` - Declined by stand-in processing. - - `invalid_physical_card` - The card read had an invalid CVV, dCVV, or - authorization request cryptogram. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. - `missing_original_authorization` - The original card authorization for this incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. - `suspected_fraud` - The transaction was suspected to be fraudulent. Please reach out to support@increase.com for more information. """ + scheme_fees: List[SourceCardDeclineSchemeFee] + """The scheme fees associated with this card decline.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + verification: SourceCardDeclineVerification """Fields related to verification of cardholder-provided values.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceCheckDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. + """A Check Decline object. - For dollars, for example, this is cents. + This field will be present in the JSON response if and only if `category` is equal to `check_decline`. """ + amount: int + """The declined amount in USD cents.""" + auxiliary_on_us: Optional[str] = None """ A computer-readable number printed on the MICR line of business checks, usually @@ -458,16 +1116,26 @@ class SourceCheckDecline(BaseModel): declined check. """ + check_transfer_id: Optional[str] = None + """The identifier of the Check Transfer object associated with this decline.""" + front_image_file_id: Optional[str] = None """ The identifier of the API File object containing an image of the front of the declined check. """ + inbound_check_deposit_id: Optional[str] = None + """ + The identifier of the Inbound Check Deposit object associated with this decline. + """ + reason: Literal[ "ach_route_disabled", "ach_route_canceled", + "altered_or_fictitious", "breaches_limit", + "endorsement_irregular", "entity_not_active", "group_locked", "insufficient_funds", @@ -479,12 +1147,16 @@ class SourceCheckDecline(BaseModel): "no_account_number_found", "refer_to_image", "unable_to_process", + "unusable_image", + "user_initiated", ] """Why the check was declined. - `ach_route_disabled` - The account number is disabled. - `ach_route_canceled` - The account number is canceled. + - `altered_or_fictitious` - The deposited check was altered or fictitious. - `breaches_limit` - The transaction would cause a limit to be exceeded. + - `endorsement_irregular` - The check was not endorsed by the payee. - `entity_not_active` - The account's entity is not active. - `group_locked` - Your account is inactive. - `insufficient_funds` - Your account contains insufficient funds. @@ -500,41 +1172,107 @@ class SourceCheckDecline(BaseModel): - `refer_to_image` - The check is not readable. Please refer to the image. - `unable_to_process` - The check cannot be processed. This is rare: please contact support. + - `unusable_image` - The check image is unusable. + - `user_initiated` - Your integration declined this check via the API. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCheckDepositRejection(BaseModel): + """A Check Deposit Rejection object. + + This field will be present in the JSON response if and only if `category` is equal to `check_deposit_rejection`. + """ -class SourceInboundRealTimePaymentsTransferDecline(BaseModel): amount: int - """The declined amount in the minor unit of the destination account currency. + """The rejected amount in the minor unit of check's currency. For dollars, for example, this is cents. """ - creditor_name: str - """The name the sender of the transfer specified as the recipient of the transfer.""" + check_deposit_id: str + """The identifier of the Check Deposit that was rejected.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the declined - transfer's currency. This will always be "USD" for a Real-Time Payments - transfer. + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's + currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - debtor_account_number: str - """The account number of the account that sent the transfer.""" + declined_transaction_id: str + """The identifier of the associated declined transaction.""" - debtor_name: str - """The name provided by the sender of the transfer.""" + reason: Literal[ + "incomplete_image", + "duplicate", + "poor_image_quality", + "incorrect_amount", + "incorrect_recipient", + "not_eligible_for_mobile_deposit", + "missing_required_data_elements", + "suspected_fraud", + "deposit_window_expired", + "requested_by_user", + "international", + "unknown", + ] + """Why the check deposit was rejected. - debtor_routing_number: str - """The routing number of the account that sent the transfer.""" + - `incomplete_image` - The check's image is incomplete. + - `duplicate` - This is a duplicate check submission. + - `poor_image_quality` - This check has poor image quality. + - `incorrect_amount` - The check was deposited with the incorrect amount. + - `incorrect_recipient` - The check is made out to someone other than the + account holder. + - `not_eligible_for_mobile_deposit` - This check was not eligible for mobile + deposit. + - `missing_required_data_elements` - This check is missing at least one required + field. + - `suspected_fraud` - This check is suspected to be fraudulent. + - `deposit_window_expired` - This check's deposit window has expired. + - `requested_by_user` - The check was rejected at the user's request. + - `international` - The check is not a U.S. domestic check and cannot be + processed. + - `unknown` - The check was rejected for an unknown reason. + """ + + rejected_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the check deposit was rejected. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceInboundFednowTransferDecline(BaseModel): + """An Inbound FedNow Transfer Decline object. + + This field will be present in the JSON response if and only if `category` is equal to `inbound_fednow_transfer_decline`. + """ reason: Literal[ "account_number_canceled", @@ -542,7 +1280,7 @@ class SourceInboundRealTimePaymentsTransferDecline(BaseModel): "account_restricted", "group_locked", "entity_not_active", - "real_time_payments_not_enabled", + "fednow_not_enabled", ] """Why the transfer was declined. @@ -551,264 +1289,114 @@ class SourceInboundRealTimePaymentsTransferDecline(BaseModel): - `account_restricted` - Your account is restricted. - `group_locked` - Your account is inactive. - `entity_not_active` - The account's entity is not active. - - `real_time_payments_not_enabled` - Your account is not enabled to receive - Real-Time Payments transfers. + - `fednow_not_enabled` - Your account is not enabled to receive FedNow + transfers. """ - remittance_information: Optional[str] = None - """Additional information included with the transfer.""" + transfer_id: str + """The identifier of the FedNow Transfer that led to this declined transaction.""" - transaction_identification: str - """The Real-Time Payments network identification of the declined transfer.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] -class SourceInternationalACHDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. - For dollars, for example, this is cents. - """ - - destination_country_code: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the destination country. - """ - - destination_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - destination bank account. - """ - - foreign_exchange_indicator: Literal["fixed_to_variable", "variable_to_fixed", "fixed_to_fixed"] - """A description of how the foreign exchange rate was calculated. - - - `fixed_to_variable` - The originator chose an amount in their own currency. - The settled amount in USD was converted using the exchange rate. - - `variable_to_fixed` - The originator chose an amount to settle in USD. The - originator's amount was variable; known only after the foreign exchange - conversion. - - `fixed_to_fixed` - The amount was originated and settled as a fixed amount in - USD. There is no foreign exchange conversion. - """ - - foreign_exchange_reference: Optional[str] = None - """ - Depending on the `foreign_exchange_reference_indicator`, an exchange rate or a - reference to a well-known rate. - """ - - foreign_exchange_reference_indicator: Literal["foreign_exchange_rate", "foreign_exchange_reference_number", "blank"] - """ - An instruction of how to interpret the `foreign_exchange_reference` field for - this Transaction. +class SourceInboundRealTimePaymentsTransferDecline(BaseModel): + """An Inbound Real-Time Payments Transfer Decline object. - - `foreign_exchange_rate` - The ACH file contains a foreign exchange rate. - - `foreign_exchange_reference_number` - The ACH file contains a reference to a - well-known foreign exchange rate. - - `blank` - There is no foreign exchange for this transfer, so the - `foreign_exchange_reference` field is blank. + This field will be present in the JSON response if and only if `category` is equal to `inbound_real_time_payments_transfer_decline`. """ - foreign_payment_amount: int - """The amount in the minor unit of the foreign payment currency. + amount: int + """The declined amount in the minor unit of the destination account currency. For dollars, for example, this is cents. """ - foreign_trace_number: Optional[str] = None - """A reference number in the foreign banking infrastructure.""" - - international_transaction_type_code: Literal[ - "annuity", - "business_or_commercial", - "deposit", - "loan", - "miscellaneous", - "mortgage", - "pension", - "remittance", - "rent_or_lease", - "salary_or_payroll", - "tax", - "accounts_receivable", - "back_office_conversion", - "machine_transfer", - "point_of_purchase", - "point_of_sale", - "represented_check", - "shared_network_transaction", - "telphone_initiated", - "internet_initiated", - ] - """The type of transfer. Set by the originator. + creditor_name: str + """The name the sender of the transfer specified as the recipient of the transfer.""" - - `annuity` - Sent as `ANN` in the Nacha file. - - `business_or_commercial` - Sent as `BUS` in the Nacha file. - - `deposit` - Sent as `DEP` in the Nacha file. - - `loan` - Sent as `LOA` in the Nacha file. - - `miscellaneous` - Sent as `MIS` in the Nacha file. - - `mortgage` - Sent as `MOR` in the Nacha file. - - `pension` - Sent as `PEN` in the Nacha file. - - `remittance` - Sent as `REM` in the Nacha file. - - `rent_or_lease` - Sent as `RLS` in the Nacha file. - - `salary_or_payroll` - Sent as `SAL` in the Nacha file. - - `tax` - Sent as `TAX` in the Nacha file. - - `accounts_receivable` - Sent as `ARC` in the Nacha file. - - `back_office_conversion` - Sent as `BOC` in the Nacha file. - - `machine_transfer` - Sent as `MTE` in the Nacha file. - - `point_of_purchase` - Sent as `POP` in the Nacha file. - - `point_of_sale` - Sent as `POS` in the Nacha file. - - `represented_check` - Sent as `RCK` in the Nacha file. - - `shared_network_transaction` - Sent as `SHR` in the Nacha file. - - `telphone_initiated` - Sent as `TEL` in the Nacha file. - - `internet_initiated` - Sent as `WEB` in the Nacha file. + currency: Literal["USD"] """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the declined + transfer's currency. This will always be "USD" for a Real-Time Payments + transfer. - originating_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - originating bank account. + - `USD` - US Dollar (USD) """ - originating_depository_financial_institution_branch_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originating branch country. - """ + debtor_account_number: str + """The account number of the account that sent the transfer.""" - originating_depository_financial_institution_id: str - """An identifier for the originating bank. + debtor_name: str + """The name provided by the sender of the transfer.""" - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ + debtor_routing_number: str + """The routing number of the account that sent the transfer.""" - originating_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" + reason: Literal[ + "account_number_canceled", + "account_number_disabled", + "account_restricted", + "group_locked", + "entity_not_active", + "real_time_payments_not_enabled", ] - """ - An instruction of how to interpret the - `originating_depository_financial_institution_id` field for this Transaction. - - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - - originating_depository_financial_institution_name: str - """The name of the originating bank. - - Sometimes this will refer to an American bank and obscure the correspondent - foreign bank. - """ - - originator_city: str - """A portion of the originator address. This may be incomplete.""" - - originator_company_entry_description: str - """A description field set by the originator.""" - - originator_country: str - """A portion of the originator address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originator country. - """ - - originator_identification: str - """An identifier for the originating company. + """Why the transfer was declined. - This is generally stable across multiple ACH transfers. + - `account_number_canceled` - The account number is canceled. + - `account_number_disabled` - The account number is disabled. + - `account_restricted` - Your account is restricted. + - `group_locked` - Your account is inactive. + - `entity_not_active` - The account's entity is not active. + - `real_time_payments_not_enabled` - Your account is not enabled to receive + Real-Time Payments transfers. """ - originator_name: str - """Either the name of the originator or an intermediary money transmitter.""" - - originator_postal_code: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_state_or_province: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_street_address: str - """A portion of the originator address. This may be incomplete.""" - - payment_related_information: Optional[str] = None - """A description field set by the originator.""" - - payment_related_information2: Optional[str] = None - """A description field set by the originator.""" - - receiver_city: str - """A portion of the receiver address. This may be incomplete.""" - - receiver_country: str - """A portion of the receiver address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiver country. - """ + transaction_identification: str + """The Real-Time Payments network identification of the declined transfer.""" - receiver_identification_number: Optional[str] = None - """An identification number the originator uses for the receiver.""" + transfer_id: str + """The identifier of the Real-Time Payments Transfer that led to this Transaction.""" - receiver_postal_code: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" + unstructured_remittance_information: Optional[str] = None + """Additional information included with the transfer.""" - receiver_state_or_province: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - receiver_street_address: str - """A portion of the receiver address. This may be incomplete.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - receiving_company_or_individual_name: str - """The name of the receiver of the transfer. This is not verified by Increase.""" - receiving_depository_financial_institution_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiving bank country. +class SourceOther(BaseModel): """ - - receiving_depository_financial_institution_id: str - """An identifier for the receiving bank. - - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. + If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. """ - receiving_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `receiving_depository_financial_institution_id` field for this Transaction. + pass - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - receiving_depository_financial_institution_name: str - """The name of the receiving bank, as set by the sending financial institution.""" +class SourceWireDecline(BaseModel): + """A Wire Decline object. - trace_number: str + This field will be present in the JSON response if and only if `category` is equal to `wire_decline`. """ - A 15 digit number recorded in the Nacha file and available to both the - originating and receiving bank. Along with the amount, date, and originating - routing number, this can be used to identify the ACH transfer at either bank. - ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). - """ - -class SourceWireDecline(BaseModel): inbound_wire_transfer_id: str """The identifier of the Inbound Wire Transfer that was declined.""" @@ -831,20 +1419,22 @@ class SourceWireDecline(BaseModel): terms. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class Source(BaseModel): - ach_decline: Optional[SourceACHDecline] = None - """An ACH Decline object. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - This field will be present in the JSON response if and only if `category` is - equal to `ach_decline`. - """ - card_decline: Optional[SourceCardDecline] = None - """A Card Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_decline`. +class Source(BaseModel): + """ + This is an object giving more details on the network-level event that caused the Declined Transaction. For example, for a card transaction this lists the merchant's industry and location. Note that for backwards compatibility reasons, additional undocumented keys may appear in this object. These should be treated as deprecated and will be removed in the future. """ category: Literal[ @@ -852,8 +1442,9 @@ class Source(BaseModel): "card_decline", "check_decline", "inbound_real_time_payments_transfer_decline", - "international_ach_decline", + "inbound_fednow_transfer_decline", "wire_decline", + "check_deposit_rejection", "other", ] """The type of the resource. @@ -869,14 +1460,30 @@ class Source(BaseModel): - `inbound_real_time_payments_transfer_decline` - Inbound Real-Time Payments Transfer Decline: details will be under the `inbound_real_time_payments_transfer_decline` object. - - `international_ach_decline` - International ACH Decline: details will be under - the `international_ach_decline` object. + - `inbound_fednow_transfer_decline` - Inbound FedNow Transfer Decline: details + will be under the `inbound_fednow_transfer_decline` object. - `wire_decline` - Wire Decline: details will be under the `wire_decline` object. + - `check_deposit_rejection` - Check Deposit Rejection: details will be under the + `check_deposit_rejection` object. - `other` - The Declined Transaction was made for an undocumented or deprecated reason. """ + ach_decline: Optional[SourceACHDecline] = None + """An ACH Decline object. + + This field will be present in the JSON response if and only if `category` is + equal to `ach_decline`. + """ + + card_decline: Optional[SourceCardDecline] = None + """A Card Decline object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_decline`. + """ + check_decline: Optional[SourceCheckDecline] = None """A Check Decline object. @@ -884,6 +1491,20 @@ class Source(BaseModel): equal to `check_decline`. """ + check_deposit_rejection: Optional[SourceCheckDepositRejection] = None + """A Check Deposit Rejection object. + + This field will be present in the JSON response if and only if `category` is + equal to `check_deposit_rejection`. + """ + + inbound_fednow_transfer_decline: Optional[SourceInboundFednowTransferDecline] = None + """An Inbound FedNow Transfer Decline object. + + This field will be present in the JSON response if and only if `category` is + equal to `inbound_fednow_transfer_decline`. + """ + inbound_real_time_payments_transfer_decline: Optional[SourceInboundRealTimePaymentsTransferDecline] = None """An Inbound Real-Time Payments Transfer Decline object. @@ -891,11 +1512,10 @@ class Source(BaseModel): equal to `inbound_real_time_payments_transfer_decline`. """ - international_ach_decline: Optional[SourceInternationalACHDecline] = None - """An International ACH Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `international_ach_decline`. + other: Optional[SourceOther] = None + """ + If the category of this Transaction source is equal to `other`, this field will + contain an empty object, otherwise it will contain null. """ wire_decline: Optional[SourceWireDecline] = None @@ -905,8 +1525,24 @@ class Source(BaseModel): equal to `wire_decline`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class DeclinedTransaction(BaseModel): + """ + Declined Transactions are refused additions and removals of money from your bank account. For example, Declined Transactions are caused when your Account has an insufficient balance or your Limits are triggered. + """ + id: str """The Declined Transaction identifier.""" @@ -925,17 +1561,12 @@ class DeclinedTransaction(BaseModel): Transaction occurred. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Declined Transaction's currency. This will match the currency on the Declined Transaction's Account. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -948,11 +1579,12 @@ class DeclinedTransaction(BaseModel): Routes are things like cards and ACH details. """ - route_type: Optional[Literal["account_number", "card"]] = None + route_type: Optional[Literal["account_number", "card", "lockbox"]] = None """The type of the route this Declined Transaction came through. - `account_number` - An Account Number. - `card` - A Card. + - `lockbox` - A Lockbox. """ source: Source @@ -969,3 +1601,15 @@ class DeclinedTransaction(BaseModel): For this resource it will always be `declined_transaction`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/declined_transaction_list_params.py b/src/increase/types/declined_transaction_list_params.py index 53321d6c5..49183efb2 100644 --- a/src/increase/types/declined_transaction_list_params.py +++ b/src/increase/types/declined_transaction_list_params.py @@ -41,8 +41,9 @@ class DeclinedTransactionListParams(TypedDict, total=False): "card_decline", "check_decline", "inbound_real_time_payments_transfer_decline", - "international_ach_decline", + "inbound_fednow_transfer_decline", "wire_decline", + "check_deposit_rejection", "other", ] ], diff --git a/src/increase/types/digital_card_profile.py b/src/increase/types/digital_card_profile.py index 042f27cfd..347f9a6a2 100644 --- a/src/increase/types/digital_card_profile.py +++ b/src/increase/types/digital_card_profile.py @@ -1,15 +1,19 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["DigitalCardProfile", "TextColor"] class TextColor(BaseModel): + """The Card's text color, specified as an RGB triple.""" + blue: int """The value of the blue channel in the RGB color.""" @@ -21,6 +25,10 @@ class TextColor(BaseModel): class DigitalCardProfile(BaseModel): + """ + This contains artwork and metadata relating to a Card's appearance in digital wallet apps like Apple Pay and Google Pay. For more information, see our guide on [digital card artwork](https://increase.com/documentation/card-art). + """ + id: str """The Card Profile identifier.""" @@ -45,7 +53,7 @@ class DigitalCardProfile(BaseModel): created_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the Card Dispute was created. + the Digital Card Profile was created. """ description: str @@ -59,12 +67,6 @@ class DigitalCardProfile(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ - is_default: bool - """ - Whether this Digital Card Profile is the default for all cards in its Increase - group. - """ - issuer_name: str """A user-facing description for whoever is issuing the card.""" @@ -86,3 +88,15 @@ class DigitalCardProfile(BaseModel): For this resource it will always be `digital_card_profile`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/digital_card_profile_clone_params.py b/src/increase/types/digital_card_profile_clone_params.py index 5945deea1..a1469bc8f 100644 --- a/src/increase/types/digital_card_profile_clone_params.py +++ b/src/increase/types/digital_card_profile_clone_params.py @@ -37,6 +37,8 @@ class DigitalCardProfileCloneParams(TypedDict, total=False): class TextColor(TypedDict, total=False): + """The Card's text color, specified as an RGB triple. The default is white.""" + blue: Required[int] """The value of the blue channel in the RGB color.""" diff --git a/src/increase/types/digital_card_profile_create_params.py b/src/increase/types/digital_card_profile_create_params.py index 6da1fd7c5..f3d2bdb8b 100644 --- a/src/increase/types/digital_card_profile_create_params.py +++ b/src/increase/types/digital_card_profile_create_params.py @@ -37,6 +37,8 @@ class DigitalCardProfileCreateParams(TypedDict, total=False): class TextColor(TypedDict, total=False): + """The Card's text color, specified as an RGB triple. The default is white.""" + blue: Required[int] """The value of the blue channel in the RGB color.""" diff --git a/src/increase/types/digital_wallet_token.py b/src/increase/types/digital_wallet_token.py index 8539cf74d..83fb5ed2f 100644 --- a/src/increase/types/digital_wallet_token.py +++ b/src/increase/types/digital_wallet_token.py @@ -1,26 +1,114 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import List, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -__all__ = ["DigitalWalletToken"] +__all__ = ["DigitalWalletToken", "Cardholder", "Device", "DynamicPrimaryAccountNumber", "Update"] + + +class Cardholder(BaseModel): + """The cardholder information given when the Digital Wallet Token was created.""" + + name: Optional[str] = None + """Name of the cardholder, for example "John Smith".""" + + +class Device(BaseModel): + """The device that was used to create the Digital Wallet Token.""" + + device_type: Optional[ + Literal[ + "unknown", + "mobile_phone", + "tablet", + "watch", + "mobilephone_or_tablet", + "pc", + "household_device", + "wearable_device", + "automobile_device", + ] + ] = None + """Device type. + + - `unknown` - Unknown + - `mobile_phone` - Mobile Phone + - `tablet` - Tablet + - `watch` - Watch + - `mobilephone_or_tablet` - Mobile Phone or Tablet + - `pc` - PC + - `household_device` - Household Device + - `wearable_device` - Wearable Device + - `automobile_device` - Automobile Device + """ + + identifier: Optional[str] = None + """ID assigned to the device by the digital wallet provider.""" + + ip_address: Optional[str] = None + """IP address of the device.""" + + name: Optional[str] = None + """Name of the device, for example "My Work Phone".""" + + +class DynamicPrimaryAccountNumber(BaseModel): + """The redacted Dynamic Primary Account Number.""" + + first6: str + """The first 6 digits of the token's Dynamic Primary Account Number.""" + + last4: str + """The last 4 digits of the token's Dynamic Primary Account Number.""" + + +class Update(BaseModel): + status: Literal["active", "inactive", "suspended", "deactivated"] + """The status the update changed this Digital Wallet Token to. + + - `active` - The digital wallet token is active. + - `inactive` - The digital wallet token has been created but not successfully + activated via two-factor authentication yet. + - `suspended` - The digital wallet token has been temporarily paused. + - `deactivated` - The digital wallet token has been permanently canceled. + """ + + timestamp: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the update happened. + """ class DigitalWalletToken(BaseModel): + """ + A Digital Wallet Token is created when a user adds a Card to their Apple Pay or Google Pay app. The Digital Wallet Token can be used for purchases just like a Card. + """ + id: str """The Digital Wallet Token identifier.""" card_id: str """The identifier for the Card this Digital Wallet Token belongs to.""" + cardholder: Cardholder + """The cardholder information given when the Digital Wallet Token was created.""" + created_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the Card was created. + the Digital Wallet Token was created. """ + device: Device + """The device that was used to create the Digital Wallet Token.""" + + dynamic_primary_account_number: Optional[DynamicPrimaryAccountNumber] = None + """The redacted Dynamic Primary Account Number.""" + status: Literal["active", "inactive", "suspended", "deactivated"] """This indicates if payments can be made with the Digital Wallet Token. @@ -31,11 +119,12 @@ class DigitalWalletToken(BaseModel): - `deactivated` - The digital wallet token has been permanently canceled. """ - token_requestor: Literal["apple_pay", "google_pay", "unknown"] + token_requestor: Literal["apple_pay", "google_pay", "samsung_pay", "unknown"] """The digital wallet app being used. - `apple_pay` - Apple Pay - `google_pay` - Google Pay + - `samsung_pay` - Samsung Pay - `unknown` - Unknown """ @@ -44,3 +133,6 @@ class DigitalWalletToken(BaseModel): For this resource it will always be `digital_wallet_token`. """ + + updates: List[Update] + """Updates to the Digital Wallet Token.""" diff --git a/src/increase/types/document.py b/src/increase/types/document.py deleted file mode 100644 index de09b640b..000000000 --- a/src/increase/types/document.py +++ /dev/null @@ -1,42 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["Document"] - - -class Document(BaseModel): - id: str - """The Document identifier.""" - - category: Literal["form_1099_int", "proof_of_authorization", "company_information"] - """The type of document. - - - `form_1099_int` - Internal Revenue Service Form 1099-INT. - - `proof_of_authorization` - A document submitted in response to a proof of - authorization request for an ACH transfer. - - `company_information` - Company information, such a policies or procedures, - typically submitted during our due diligence process. - """ - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the - Document was created. - """ - - entity_id: Optional[str] = None - """The identifier of the Entity the document was generated for.""" - - file_id: str - """The identifier of the File containing the Document's contents.""" - - type: Literal["document"] - """A constant representing the object's type. - - For this resource it will always be `document`. - """ diff --git a/src/increase/types/entities/__init__.py b/src/increase/types/entities/__init__.py deleted file mode 100644 index e7b6ad184..000000000 --- a/src/increase/types/entities/__init__.py +++ /dev/null @@ -1,13 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .supplemental_document import SupplementalDocument as SupplementalDocument -from .industry_code_create_params import IndustryCodeCreateParams as IndustryCodeCreateParams -from .beneficial_owner_create_params import BeneficialOwnerCreateParams as BeneficialOwnerCreateParams -from .beneficial_owner_archive_params import BeneficialOwnerArchiveParams as BeneficialOwnerArchiveParams -from .supplemental_document_list_params import SupplementalDocumentListParams as SupplementalDocumentListParams -from .supplemental_document_create_params import SupplementalDocumentCreateParams as SupplementalDocumentCreateParams -from .beneficial_owner_update_address_params import ( - BeneficialOwnerUpdateAddressParams as BeneficialOwnerUpdateAddressParams, -) diff --git a/src/increase/types/entities/beneficial_owner_archive_params.py b/src/increase/types/entities/beneficial_owner_archive_params.py deleted file mode 100644 index cd13deb9c..000000000 --- a/src/increase/types/entities/beneficial_owner_archive_params.py +++ /dev/null @@ -1,18 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["BeneficialOwnerArchiveParams"] - - -class BeneficialOwnerArchiveParams(TypedDict, total=False): - beneficial_owner_id: Required[str] - """ - The identifying details of anyone controlling or owning 25% or more of the - corporation. - """ - - entity_id: Required[str] - """The identifier of the Entity to retrieve.""" diff --git a/src/increase/types/entities/beneficial_owner_update_address_params.py b/src/increase/types/entities/beneficial_owner_update_address_params.py deleted file mode 100644 index 00db2088a..000000000 --- a/src/increase/types/entities/beneficial_owner_update_address_params.py +++ /dev/null @@ -1,44 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["BeneficialOwnerUpdateAddressParams", "Address"] - - -class BeneficialOwnerUpdateAddressParams(TypedDict, total=False): - address: Required[Address] - """The individual's physical address. - - Mail receiving locations like PO Boxes and PMB's are disallowed. - """ - - beneficial_owner_id: Required[str] - """ - The identifying details of anyone controlling or owning 25% or more of the - corporation. - """ - - entity_id: Required[str] - """The identifier of the Entity to retrieve.""" - - -class Address(TypedDict, total=False): - city: Required[str] - """The city of the address.""" - - line1: Required[str] - """The first line of the address. This is usually the street number and street.""" - - state: Required[str] - """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. - """ - - zip: Required[str] - """The ZIP code of the address.""" - - line2: str - """The second line of the address. This might be the floor or room number.""" diff --git a/src/increase/types/entities/industry_code_create_params.py b/src/increase/types/entities/industry_code_create_params.py deleted file mode 100644 index 033976c3a..000000000 --- a/src/increase/types/entities/industry_code_create_params.py +++ /dev/null @@ -1,17 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["IndustryCodeCreateParams"] - - -class IndustryCodeCreateParams(TypedDict, total=False): - industry_code: Required[str] - """ - The North American Industry Classification System (NAICS) code for the - corporation's primary line of business. This is a number, like `5132` for - `Software Publishers`. A full list of classification codes is available at - https://www.naics.com. - """ diff --git a/src/increase/types/entity.py b/src/increase/types/entity.py index 32418f475..7d35c75fb 100644 --- a/src/increase/types/entity.py +++ b/src/increase/types/entity.py @@ -1,10 +1,13 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import date, datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel +from .entity_supplemental_document import EntitySupplementalDocument __all__ = [ "Entity", @@ -14,6 +17,10 @@ "CorporationBeneficialOwnerIndividual", "CorporationBeneficialOwnerIndividualAddress", "CorporationBeneficialOwnerIndividualIdentification", + "CorporationLegalIdentifier", + "GovernmentAuthority", + "GovernmentAuthorityAddress", + "GovernmentAuthorityAuthorizedPerson", "Joint", "JointIndividual", "JointIndividualAddress", @@ -21,7 +28,9 @@ "NaturalPerson", "NaturalPersonAddress", "NaturalPersonIdentification", - "SupplementalDocument", + "RiskRating", + "TermsAgreement", + "ThirdPartyVerification", "Trust", "TrustAddress", "TrustGrantor", @@ -31,12 +40,23 @@ "TrustTrusteeIndividual", "TrustTrusteeIndividualAddress", "TrustTrusteeIndividualIdentification", + "Validation", + "ValidationIssue", + "ValidationIssueBeneficialOwnerAddress", + "ValidationIssueBeneficialOwnerIdentity", + "ValidationIssueEntityAddress", + "ValidationIssueEntityTaxIdentifier", ] class CorporationAddress(BaseModel): - city: str - """The city of the address.""" + """The corporation's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: str """The first line of the address.""" @@ -44,19 +64,24 @@ class CorporationAddress(BaseModel): line2: Optional[str] = None """The second line of the address.""" - state: str + state: Optional[str] = None """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. """ - zip: str - """The ZIP code of the address.""" + zip: Optional[str] = None + """The ZIP or postal code of the address.""" class CorporationBeneficialOwnerIndividualAddress(BaseModel): - city: str - """The city of the address.""" + """The person's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: str """The first line of the address.""" @@ -64,17 +89,19 @@ class CorporationBeneficialOwnerIndividualAddress(BaseModel): line2: Optional[str] = None """The second line of the address.""" - state: str + state: Optional[str] = None """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. """ - zip: str - """The ZIP code of the address.""" + zip: Optional[str] = None + """The ZIP or postal code of the address.""" class CorporationBeneficialOwnerIndividualIdentification(BaseModel): + """A means of verifying the person's identity.""" + method: Literal[ "social_security_number", "individual_taxpayer_identification_number", "passport", "drivers_license", "other" ] @@ -94,8 +121,22 @@ class CorporationBeneficialOwnerIndividualIdentification(BaseModel): individual's identity. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class CorporationBeneficialOwnerIndividual(BaseModel): + """Personal details for the beneficial owner.""" + address: CorporationBeneficialOwnerIndividualAddress """The person's address.""" @@ -110,7 +151,7 @@ class CorporationBeneficialOwnerIndividual(BaseModel): class CorporationBeneficialOwner(BaseModel): - beneficial_owner_id: str + id: str """The identifier of this beneficial owner.""" company_title: Optional[str] = None @@ -119,17 +160,44 @@ class CorporationBeneficialOwner(BaseModel): individual: CorporationBeneficialOwnerIndividual """Personal details for the beneficial owner.""" - prong: Literal["ownership", "control"] - """Why this person is considered a beneficial owner of the entity. + prongs: List[Literal["ownership", "control"]] + """Why this person is considered a beneficial owner of the entity.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class CorporationLegalIdentifier(BaseModel): + """The legal identifier of the corporation.""" + + category: Literal["us_employer_identification_number", "other"] + """The category of the legal identifier. - - `ownership` - A person with 25% or greater direct or indirect ownership of the - entity. - - `control` - A person who manages, directs, or has significant control of the - entity. + - `us_employer_identification_number` - The Employer Identification Number (EIN) + for the company. The EIN is a 9-digit number assigned by the IRS. + - `other` - A legal identifier issued by a foreign government, like a tax + identification number or registration number. """ + value: str + """The identifier of the legal identifier.""" + class Corporation(BaseModel): + """Details of the corporation entity. + + Will be present if `structure` is equal to `corporation`. + """ + address: CorporationAddress """The corporation's address.""" @@ -139,6 +207,9 @@ class Corporation(BaseModel): corporation. """ + email: Optional[str] = None + """An email address for the business.""" + incorporation_state: Optional[str] = None """ The two-letter United States Postal Service (USPS) abbreviation for the @@ -151,19 +222,100 @@ class Corporation(BaseModel): for the corporation. """ + legal_identifier: Optional[CorporationLegalIdentifier] = None + """The legal identifier of the corporation.""" + name: str """The legal name of the corporation.""" + website: Optional[str] = None + """The website of the corporation.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class GovernmentAuthorityAddress(BaseModel): + """The government authority's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" + + line1: str + """The first line of the address.""" + + line2: Optional[str] = None + """The second line of the address.""" + + state: Optional[str] = None + """ + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. + """ + + zip: Optional[str] = None + """The ZIP or postal code of the address.""" + + +class GovernmentAuthorityAuthorizedPerson(BaseModel): + authorized_person_id: str + """The identifier of this authorized person.""" + + name: str + """The person's legal name.""" + + +class GovernmentAuthority(BaseModel): + """Details of the government authority entity. + + Will be present if `structure` is equal to `government_authority`. + """ + + address: GovernmentAuthorityAddress + """The government authority's address.""" + + authorized_persons: List[GovernmentAuthorityAuthorizedPerson] + """The identifying details of authorized persons of the government authority.""" + + category: Literal["municipality", "state_agency", "state_government", "federal_agency"] + """The category of the government authority. + + - `municipality` - A municipality. + - `state_agency` - A state agency. + - `state_government` - A state government. + - `federal_agency` - A federal agency. + """ + + name: str + """The government authority's name.""" + tax_identifier: Optional[str] = None - """The Employer Identification Number (EIN) for the corporation.""" + """The Employer Identification Number (EIN) of the government authority.""" website: Optional[str] = None - """The website of the corporation.""" + """The government authority's website.""" class JointIndividualAddress(BaseModel): - city: str - """The city of the address.""" + """The person's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: str """The first line of the address.""" @@ -171,17 +323,19 @@ class JointIndividualAddress(BaseModel): line2: Optional[str] = None """The second line of the address.""" - state: str + state: Optional[str] = None """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. """ - zip: str - """The ZIP code of the address.""" + zip: Optional[str] = None + """The ZIP or postal code of the address.""" class JointIndividualIdentification(BaseModel): + """A means of verifying the person's identity.""" + method: Literal[ "social_security_number", "individual_taxpayer_identification_number", "passport", "drivers_license", "other" ] @@ -201,6 +355,18 @@ class JointIndividualIdentification(BaseModel): individual's identity. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class JointIndividual(BaseModel): address: JointIndividualAddress @@ -217,6 +383,11 @@ class JointIndividual(BaseModel): class Joint(BaseModel): + """Details of the joint entity. + + Will be present if `structure` is equal to `joint`. + """ + individuals: List[JointIndividual] """The two individuals that share control of the entity.""" @@ -225,8 +396,13 @@ class Joint(BaseModel): class NaturalPersonAddress(BaseModel): - city: str - """The city of the address.""" + """The person's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: str """The first line of the address.""" @@ -234,17 +410,19 @@ class NaturalPersonAddress(BaseModel): line2: Optional[str] = None """The second line of the address.""" - state: str + state: Optional[str] = None """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. """ - zip: str - """The ZIP code of the address.""" + zip: Optional[str] = None + """The ZIP or postal code of the address.""" class NaturalPersonIdentification(BaseModel): + """A means of verifying the person's identity.""" + method: Literal[ "social_security_number", "individual_taxpayer_identification_number", "passport", "drivers_license", "other" ] @@ -264,8 +442,25 @@ class NaturalPersonIdentification(BaseModel): individual's identity. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class NaturalPerson(BaseModel): + """Details of the natural person entity. + + Will be present if `structure` is equal to `natural_person`. + """ + address: NaturalPersonAddress """The person's address.""" @@ -279,34 +474,67 @@ class NaturalPerson(BaseModel): """The person's legal name.""" -class SupplementalDocument(BaseModel): - created_at: datetime +class RiskRating(BaseModel): """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the - Supplemental Document was created. + An assessment of the entity’s potential risk of involvement in financial crimes, such as money laundering. """ - file_id: str - """The File containing the document.""" + rated_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the risk + rating was performed. + """ - idempotency_key: Optional[str] = None - """The idempotency key you chose for this object. + rating: Literal["low", "medium", "high"] + """The rating given to this entity. - This value is unique across Increase and is used to ensure that a request is - only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). + - `low` - Minimal risk of involvement in financial crime. + - `medium` - Moderate risk of involvement in financial crime. + - `high` - Elevated risk of involvement in financial crime. """ - type: Literal["entity_supplemental_document"] - """A constant representing the object's type. - For this resource it will always be `entity_supplemental_document`. +class TermsAgreement(BaseModel): + agreed_at: datetime + """The timestamp of when the Entity agreed to the terms.""" + + ip_address: str + """The IP address the Entity accessed reviewed the terms from.""" + + terms_url: str + """The URL of the terms agreement. + + This link will be provided by your bank partner. + """ + + +class ThirdPartyVerification(BaseModel): + """ + If you are using a third-party service for identity verification, you can use this field to associate this Entity with the identifier that represents them in that service. + """ + + reference: str + """The reference identifier for the third party verification.""" + + vendor: Literal["alloy", "middesk", "oscilar", "persona", "taktile"] + """The vendor that was used to perform the verification. + + - `alloy` - Alloy. See https://alloy.com for more information. + - `middesk` - Middesk. See https://middesk.com for more information. + - `oscilar` - Oscilar. See https://oscilar.com for more information. + - `persona` - Persona. See https://withpersona.com for more information. + - `taktile` - Taktile. See https://taktile.com for more information. """ class TrustAddress(BaseModel): - city: str - """The city of the address.""" + """The trust's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: str """The first line of the address.""" @@ -314,19 +542,24 @@ class TrustAddress(BaseModel): line2: Optional[str] = None """The second line of the address.""" - state: str + state: Optional[str] = None """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. """ - zip: str - """The ZIP code of the address.""" + zip: Optional[str] = None + """The ZIP or postal code of the address.""" class TrustGrantorAddress(BaseModel): - city: str - """The city of the address.""" + """The person's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: str """The first line of the address.""" @@ -334,17 +567,19 @@ class TrustGrantorAddress(BaseModel): line2: Optional[str] = None """The second line of the address.""" - state: str + state: Optional[str] = None """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. """ - zip: str - """The ZIP code of the address.""" + zip: Optional[str] = None + """The ZIP or postal code of the address.""" class TrustGrantorIdentification(BaseModel): + """A means of verifying the person's identity.""" + method: Literal[ "social_security_number", "individual_taxpayer_identification_number", "passport", "drivers_license", "other" ] @@ -364,8 +599,22 @@ class TrustGrantorIdentification(BaseModel): individual's identity. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class TrustGrantor(BaseModel): + """The grantor of the trust. Will be present if the `category` is `revocable`.""" + address: TrustGrantorAddress """The person's address.""" @@ -380,8 +629,13 @@ class TrustGrantor(BaseModel): class TrustTrusteeIndividualAddress(BaseModel): - city: str - """The city of the address.""" + """The person's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: str """The first line of the address.""" @@ -389,17 +643,19 @@ class TrustTrusteeIndividualAddress(BaseModel): line2: Optional[str] = None """The second line of the address.""" - state: str + state: Optional[str] = None """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. """ - zip: str - """The ZIP code of the address.""" + zip: Optional[str] = None + """The ZIP or postal code of the address.""" class TrustTrusteeIndividualIdentification(BaseModel): + """A means of verifying the person's identity.""" + method: Literal[ "social_security_number", "individual_taxpayer_identification_number", "passport", "drivers_license", "other" ] @@ -419,8 +675,25 @@ class TrustTrusteeIndividualIdentification(BaseModel): individual's identity. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class TrustTrusteeIndividual(BaseModel): + """The individual trustee of the trust. + + Will be present if the trustee's `structure` is equal to `individual`. + """ + address: TrustTrusteeIndividualAddress """The person's address.""" @@ -449,6 +722,11 @@ class TrustTrustee(BaseModel): class Trust(BaseModel): + """Details of the trust entity. + + Will be present if `structure` is equal to `trust`. + """ + address: TrustAddress """The trust's address.""" @@ -481,7 +759,104 @@ class Trust(BaseModel): """The trustees of the trust.""" +class ValidationIssueBeneficialOwnerAddress(BaseModel): + """Details when the issue is with a beneficial owner's address.""" + + beneficial_owner_id: str + """The ID of the beneficial owner.""" + + reason: Literal["mailbox_address"] + """The reason the address is invalid. + + - `mailbox_address` - The address is a mailbox or other non-physical address. + """ + + +class ValidationIssueBeneficialOwnerIdentity(BaseModel): + """Details when the issue is with a beneficial owner's identity verification.""" + + beneficial_owner_id: str + """The ID of the beneficial owner.""" + + +class ValidationIssueEntityAddress(BaseModel): + """Details when the issue is with the entity's address.""" + + reason: Literal["mailbox_address"] + """The reason the address is invalid. + + - `mailbox_address` - The address is a mailbox or other non-physical address. + """ + + +class ValidationIssueEntityTaxIdentifier(BaseModel): + """Details when the issue is with the entity's tax ID.""" + + pass + + +class ValidationIssue(BaseModel): + beneficial_owner_address: Optional[ValidationIssueBeneficialOwnerAddress] = None + """Details when the issue is with a beneficial owner's address.""" + + beneficial_owner_identity: Optional[ValidationIssueBeneficialOwnerIdentity] = None + """Details when the issue is with a beneficial owner's identity verification.""" + + category: Literal[ + "entity_tax_identifier", "entity_address", "beneficial_owner_identity", "beneficial_owner_address" + ] + """The type of issue. + + We may add additional possible values for this enum over time; your application + should be able to handle such additions gracefully. + + - `entity_tax_identifier` - The entity's tax identifier could not be validated. + Update the tax ID with the + [update an entity API](/documentation/api/entities#update-an-entity.corporation.legal_identifier). + - `entity_address` - The entity's address could not be validated. Update the + address with the + [update an entity API](/documentation/api/entities#update-an-entity.corporation.address). + - `beneficial_owner_identity` - A beneficial owner's identity could not be + verified. Update the identification with the + [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + - `beneficial_owner_address` - A beneficial owner's address could not be + validated. Update the address with the + [update a beneficial owner API](/documentation/api/beneficial-owners#update-a-beneficial-owner). + """ + + entity_address: Optional[ValidationIssueEntityAddress] = None + """Details when the issue is with the entity's address.""" + + entity_tax_identifier: Optional[ValidationIssueEntityTaxIdentifier] = None + """Details when the issue is with the entity's tax ID.""" + + +class Validation(BaseModel): + """The validation results for the entity. + + Learn more about [validations](/documentation/entity-validation). + """ + + issues: List[ValidationIssue] + """The list of issues that need to be addressed.""" + + status: Literal["pending", "valid", "invalid"] + """The validation status for the entity. + + If the status is `invalid`, the `issues` array will be populated. + + - `pending` - The submitted data is being validated. + - `valid` - The submitted data is valid. + - `invalid` - Additional information is required to validate the data. + """ + + class Entity(BaseModel): + """Entities are the legal entities that own accounts. + + They can be people, corporations, partnerships, government authorities, or trusts. To learn more, see [Entities](/documentation/entities). + """ + id: str """The entity's identifier.""" @@ -491,11 +866,26 @@ class Entity(BaseModel): Will be present if `structure` is equal to `corporation`. """ + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Entity + was created. + """ + description: Optional[str] = None """The entity's description for display purposes.""" details_confirmed_at: Optional[datetime] = None - """The date and time at which the entity's details were most recently confirmed.""" + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the + Entity's details were most recently confirmed. + """ + + government_authority: Optional[GovernmentAuthority] = None + """Details of the government authority entity. + + Will be present if `structure` is equal to `government_authority`. + """ idempotency_key: Optional[str] = None """The idempotency key you chose for this object. @@ -517,6 +907,12 @@ class Entity(BaseModel): Will be present if `structure` is equal to `natural_person`. """ + risk_rating: Optional[RiskRating] = None + """ + An assessment of the entity’s potential risk of involvement in financial crimes, + such as money laundering. + """ + status: Literal["active", "archived", "disabled"] """The status of the entity. @@ -527,16 +923,17 @@ class Entity(BaseModel): financial activity. """ - structure: Literal["corporation", "natural_person", "joint", "trust"] + structure: Literal["corporation", "natural_person", "joint", "trust", "government_authority"] """The entity's legal structure. - `corporation` - A corporation. - `natural_person` - An individual person. - `joint` - Multiple individual people. - `trust` - A trust. + - `government_authority` - A government authority. """ - supplemental_documents: List[SupplementalDocument] + supplemental_documents: List[EntitySupplementalDocument] """Additional documentation associated with the entity. This is limited to the first 10 documents for an entity. If an entity has more @@ -544,6 +941,19 @@ class Entity(BaseModel): retrieve them. """ + terms_agreements: List[TermsAgreement] + """The terms that the Entity agreed to. + + Not all programs are required to submit this data. + """ + + third_party_verification: Optional[ThirdPartyVerification] = None + """ + If you are using a third-party service for identity verification, you can use + this field to associate this Entity with the identifier that represents them in + that service. + """ + trust: Optional[Trust] = None """Details of the trust entity. @@ -555,3 +965,21 @@ class Entity(BaseModel): For this resource it will always be `entity`. """ + + validation: Optional[Validation] = None + """The validation results for the entity. + + Learn more about [validations](/documentation/entity-validation). + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/entity_beneficial_owner.py b/src/increase/types/entity_beneficial_owner.py new file mode 100644 index 000000000..8352e148c --- /dev/null +++ b/src/increase/types/entity_beneficial_owner.py @@ -0,0 +1,128 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, List, Optional +from datetime import date, datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["EntityBeneficialOwner", "Individual", "IndividualAddress", "IndividualIdentification"] + + +class IndividualAddress(BaseModel): + """The person's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" + + line1: str + """The first line of the address.""" + + line2: Optional[str] = None + """The second line of the address.""" + + state: Optional[str] = None + """ + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. + """ + + zip: Optional[str] = None + """The ZIP or postal code of the address.""" + + +class IndividualIdentification(BaseModel): + """A means of verifying the person's identity.""" + + method: Literal[ + "social_security_number", "individual_taxpayer_identification_number", "passport", "drivers_license", "other" + ] + """A method that can be used to verify the individual's identity. + + - `social_security_number` - A social security number. + - `individual_taxpayer_identification_number` - An individual taxpayer + identification number (ITIN). + - `passport` - A passport number. + - `drivers_license` - A driver's license number. + - `other` - Another identifying document. + """ + + number_last4: str + """ + The last 4 digits of the identification number that can be used to verify the + individual's identity. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Individual(BaseModel): + """Personal details for the beneficial owner.""" + + address: IndividualAddress + """The person's address.""" + + date_of_birth: date + """The person's date of birth in YYYY-MM-DD format.""" + + identification: IndividualIdentification + """A means of verifying the person's identity.""" + + name: str + """The person's legal name.""" + + +class EntityBeneficialOwner(BaseModel): + """ + Beneficial owners are the individuals who control or own 25% or more of a `corporation` entity. Beneficial owners are always people, and never organizations. Generally, you will need to submit between 1 and 5 beneficial owners for every `corporation` entity. You should update and archive beneficial owners for a corporation entity as their details change. + """ + + id: str + """The identifier of this beneficial owner.""" + + company_title: Optional[str] = None + """This person's role or title within the entity.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the + Beneficial Owner was created. + """ + + entity_id: str + """The identifier of the Entity to which this beneficial owner belongs.""" + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + individual: Individual + """Personal details for the beneficial owner.""" + + prongs: List[Literal["ownership", "control"]] + """Why this person is considered a beneficial owner of the entity.""" + + type: Literal["entity_beneficial_owner"] + """A constant representing the object's type. + + For this resource it will always be `entity_beneficial_owner`. + """ diff --git a/src/increase/types/entity_confirm_params.py b/src/increase/types/entity_confirm_params.py deleted file mode 100644 index cf9a0dfc8..000000000 --- a/src/increase/types/entity_confirm_params.py +++ /dev/null @@ -1,19 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["EntityConfirmParams"] - - -class EntityConfirmParams(TypedDict, total=False): - confirmed_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """When your user confirmed the Entity's details. - - If not provided, the current time will be used. - """ diff --git a/src/increase/types/entity_create_params.py b/src/increase/types/entity_create_params.py index 01e1afd82..055e0bb2d 100644 --- a/src/increase/types/entity_create_params.py +++ b/src/increase/types/entity_create_params.py @@ -3,7 +3,7 @@ from __future__ import annotations from typing import List, Union, Iterable -from datetime import date +from datetime import date, datetime from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo @@ -19,6 +19,10 @@ "CorporationBeneficialOwnerIndividualIdentificationDriversLicense", "CorporationBeneficialOwnerIndividualIdentificationOther", "CorporationBeneficialOwnerIndividualIdentificationPassport", + "CorporationLegalIdentifier", + "GovernmentAuthority", + "GovernmentAuthorityAddress", + "GovernmentAuthorityAuthorizedPerson", "Joint", "JointIndividual", "JointIndividualAddress", @@ -32,7 +36,10 @@ "NaturalPersonIdentificationDriversLicense", "NaturalPersonIdentificationOther", "NaturalPersonIdentificationPassport", + "RiskRating", "SupplementalDocument", + "TermsAgreement", + "ThirdPartyVerification", "Trust", "TrustAddress", "TrustTrustee", @@ -52,13 +59,14 @@ class EntityCreateParams(TypedDict, total=False): - structure: Required[Literal["corporation", "natural_person", "joint", "trust"]] + structure: Required[Literal["corporation", "natural_person", "joint", "trust", "government_authority"]] """The type of Entity to create. - `corporation` - A corporation. - `natural_person` - An individual person. - `joint` - Multiple individual people. - `trust` - A trust. + - `government_authority` - A government authority. """ corporation: Corporation @@ -70,6 +78,12 @@ class EntityCreateParams(TypedDict, total=False): description: str """The description you choose to give the entity.""" + government_authority: GovernmentAuthority + """Details of the Government Authority entity to create. + + Required if `structure` is equal to `government_authority`. + """ + joint: Joint """Details of the joint entity to create. @@ -84,18 +98,28 @@ class EntityCreateParams(TypedDict, total=False): `individual_taxpayer_identification_number` identification methods. """ - relationship: Literal["affiliated", "informational", "unaffiliated"] - """The relationship between your group and the entity. - - - `affiliated` - The entity is controlled by your group. - - `informational` - The entity is for informational purposes only. - - `unaffiliated` - The entity is not controlled by your group, but can still - directly open accounts. + risk_rating: RiskRating + """ + An assessment of the entity's potential risk of involvement in financial crimes, + such as money laundering. """ supplemental_documents: Iterable[SupplementalDocument] """Additional documentation associated with the entity.""" + terms_agreements: Iterable[TermsAgreement] + """The terms that the Entity agreed to. + + Not all programs are required to submit this data. + """ + + third_party_verification: ThirdPartyVerification + """ + If you are using a third-party service for identity verification, you can use + this field to associate this Entity with the identifier that represents them in + that service. + """ + trust: Trust """Details of the trust entity to create. @@ -104,46 +128,67 @@ class EntityCreateParams(TypedDict, total=False): class CorporationAddress(TypedDict, total=False): + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + city: Required[str] - """The city of the address.""" + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: Required[str] """The first line of the address. This is usually the street number and street.""" - state: Required[str] + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. """ - zip: Required[str] - """The ZIP code of the address.""" - - line2: str - """The second line of the address. This might be the floor or room number.""" + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" class CorporationBeneficialOwnerIndividualAddress(TypedDict, total=False): + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + city: Required[str] - """The city of the address.""" + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: Required[str] """The first line of the address. This is usually the street number and street.""" - state: Required[str] + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. """ - zip: Required[str] - """The ZIP code of the address.""" - - line2: str - """The second line of the address. This might be the floor or room number.""" + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" class CorporationBeneficialOwnerIndividualIdentificationDriversLicense(TypedDict, total=False): + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ + expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The driver's license's expiration date in YYYY-MM-DD format.""" @@ -158,10 +203,15 @@ class CorporationBeneficialOwnerIndividualIdentificationDriversLicense(TypedDict class CorporationBeneficialOwnerIndividualIdentificationOther(TypedDict, total=False): + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + country: Required[str] """ The two-character ISO 3166-1 code representing the country that issued the - document. + document (e.g., `US`). """ description: Required[str] @@ -181,8 +231,16 @@ class CorporationBeneficialOwnerIndividualIdentificationOther(TypedDict, total=F class CorporationBeneficialOwnerIndividualIdentificationPassport(TypedDict, total=False): + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ + country: Required[str] - """The country that issued the passport.""" + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The passport's expiration date in YYYY-MM-DD format.""" @@ -191,7 +249,9 @@ class CorporationBeneficialOwnerIndividualIdentificationPassport(TypedDict, tota """The identifier of the File containing the passport.""" -class CorporationBeneficialOwnerIndividualIdentification(TypedDict, total=False): +class CorporationBeneficialOwnerIndividualIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """A means of verifying the person's identity.""" + method: Required[ Literal[ "social_security_number", @@ -237,6 +297,8 @@ class CorporationBeneficialOwnerIndividualIdentification(TypedDict, total=False) class CorporationBeneficialOwnerIndividual(TypedDict, total=False): + """Personal details for the beneficial owner.""" + address: Required[CorporationBeneficialOwnerIndividualAddress] """The individual's physical address. @@ -261,7 +323,7 @@ class CorporationBeneficialOwnerIndividual(TypedDict, total=False): """ -class CorporationBeneficialOwner(TypedDict, total=False): +class CorporationBeneficialOwner(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] individual: Required[CorporationBeneficialOwnerIndividual] """Personal details for the beneficial owner.""" @@ -276,7 +338,33 @@ class CorporationBeneficialOwner(TypedDict, total=False): """This person's role or title within the entity.""" -class Corporation(TypedDict, total=False): +class CorporationLegalIdentifier(TypedDict, total=False): + """The legal identifier of the corporation. + + This is usually the Employer Identification Number (EIN). + """ + + value: Required[str] + """The legal identifier.""" + + category: Literal["us_employer_identification_number", "other"] + """The category of the legal identifier. + + If not provided, the default is `us_employer_identification_number`. + + - `us_employer_identification_number` - The Employer Identification Number (EIN) + for the company. The EIN is a 9-digit number assigned by the IRS. + - `other` - A legal identifier issued by a foreign government, like a tax + identification number or registration number. + """ + + +class Corporation(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """Details of the corporation entity to create. + + Required if `structure` is equal to `corporation`. + """ + address: Required[CorporationAddress] """The entity's physical address. @@ -285,15 +373,42 @@ class Corporation(TypedDict, total=False): beneficial_owners: Required[Iterable[CorporationBeneficialOwner]] """ - The identifying details of anyone controlling or owning 25% or more of the - corporation. + The identifying details of each person who owns 25% or more of the business and + one control person, like the CEO, CFO, or other executive. You can submit + between 1 and 5 people to this list. + """ + + legal_identifier: Required[CorporationLegalIdentifier] + """The legal identifier of the corporation. + + This is usually the Employer Identification Number (EIN). """ name: Required[str] """The legal name of the corporation.""" - tax_identifier: Required[str] - """The Employer Identification Number (EIN) for the corporation.""" + beneficial_ownership_exemption_reason: Literal[ + "regulated_financial_institution", "publicly_traded_company", "public_entity", "other" + ] + """ + If the entity is exempt from the requirement to submit beneficial owners, + provide the justification. If a reason is provided, you do not need to submit a + list of beneficial owners. + + - `regulated_financial_institution` - A regulated financial institution. + - `publicly_traded_company` - A publicly traded company. + - `public_entity` - A public entity acting on behalf of the federal or a state + government. + - `other` - Any other reason why this entity is exempt from the requirement to + submit beneficial owners. You can only use this exemption after approval from + your bank partner. + """ + + email: str + """An email address for the business. + + Not every program requires an email for submitted Entities. + """ incorporation_state: str """ @@ -305,15 +420,20 @@ class Corporation(TypedDict, total=False): """ The North American Industry Classification System (NAICS) code for the corporation's primary line of business. This is a number, like `5132` for - `Software Publishers`. A full list of classification codes is available at - https://www.naics.com. + `Software Publishers`. A full list of classification codes is available + [here](https://increase.com/documentation/data-dictionary#north-american-industry-classification-system-codes). """ website: str """The website of the corporation.""" -class JointIndividualAddress(TypedDict, total=False): +class GovernmentAuthorityAddress(TypedDict, total=False): + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + city: Required[str] """The city of the address.""" @@ -333,7 +453,79 @@ class JointIndividualAddress(TypedDict, total=False): """The second line of the address. This might be the floor or room number.""" +class GovernmentAuthorityAuthorizedPerson(TypedDict, total=False): + name: Required[str] + """The person's legal name.""" + + +class GovernmentAuthority(TypedDict, total=False): + """Details of the Government Authority entity to create. + + Required if `structure` is equal to `government_authority`. + """ + + address: Required[GovernmentAuthorityAddress] + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + authorized_persons: Required[Iterable[GovernmentAuthorityAuthorizedPerson]] + """The identifying details of authorized officials acting on the entity's behalf.""" + + category: Required[Literal["municipality", "state_agency", "state_government", "federal_agency"]] + """The category of the government authority. + + - `municipality` - A municipality. + - `state_agency` - A state agency. + - `state_government` - A state government. + - `federal_agency` - A federal agency. + """ + + name: Required[str] + """The legal name of the government authority.""" + + tax_identifier: Required[str] + """The Employer Identification Number (EIN) for the government authority.""" + + website: str + """The website of the government authority.""" + + +class JointIndividualAddress(TypedDict, total=False): + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + city: Required[str] + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str + """ + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. + """ + + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" + + class JointIndividualIdentificationDriversLicense(TypedDict, total=False): + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ + expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The driver's license's expiration date in YYYY-MM-DD format.""" @@ -348,10 +540,15 @@ class JointIndividualIdentificationDriversLicense(TypedDict, total=False): class JointIndividualIdentificationOther(TypedDict, total=False): + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + country: Required[str] """ The two-character ISO 3166-1 code representing the country that issued the - document. + document (e.g., `US`). """ description: Required[str] @@ -371,8 +568,16 @@ class JointIndividualIdentificationOther(TypedDict, total=False): class JointIndividualIdentificationPassport(TypedDict, total=False): + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ + country: Required[str] - """The country that issued the passport.""" + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The passport's expiration date in YYYY-MM-DD format.""" @@ -381,7 +586,9 @@ class JointIndividualIdentificationPassport(TypedDict, total=False): """The identifier of the File containing the passport.""" -class JointIndividualIdentification(TypedDict, total=False): +class JointIndividualIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """A means of verifying the person's identity.""" + method: Required[ Literal[ "social_security_number", @@ -452,34 +659,49 @@ class JointIndividual(TypedDict, total=False): class Joint(TypedDict, total=False): + """Details of the joint entity to create. + + Required if `structure` is equal to `joint`. + """ + individuals: Required[Iterable[JointIndividual]] """The two individuals that share control of the entity.""" - name: str - """The name of the joint entity.""" - class NaturalPersonAddress(TypedDict, total=False): + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + city: Required[str] - """The city of the address.""" + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: Required[str] """The first line of the address. This is usually the street number and street.""" - state: Required[str] + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. """ - zip: Required[str] - """The ZIP code of the address.""" - - line2: str - """The second line of the address. This might be the floor or room number.""" + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" class NaturalPersonIdentificationDriversLicense(TypedDict, total=False): + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ + expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The driver's license's expiration date in YYYY-MM-DD format.""" @@ -494,10 +716,15 @@ class NaturalPersonIdentificationDriversLicense(TypedDict, total=False): class NaturalPersonIdentificationOther(TypedDict, total=False): + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + country: Required[str] """ The two-character ISO 3166-1 code representing the country that issued the - document. + document (e.g., `US`). """ description: Required[str] @@ -517,8 +744,16 @@ class NaturalPersonIdentificationOther(TypedDict, total=False): class NaturalPersonIdentificationPassport(TypedDict, total=False): + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ + country: Required[str] - """The country that issued the passport.""" + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The passport's expiration date in YYYY-MM-DD format.""" @@ -527,7 +762,9 @@ class NaturalPersonIdentificationPassport(TypedDict, total=False): """The identifier of the File containing the passport.""" -class NaturalPersonIdentification(TypedDict, total=False): +class NaturalPersonIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """A means of verifying the person's identity.""" + method: Required[ Literal[ "social_security_number", @@ -573,6 +810,11 @@ class NaturalPersonIdentification(TypedDict, total=False): class NaturalPerson(TypedDict, total=False): + """Details of the natural person entity to create. + + Required if `structure` is equal to `natural_person`. Natural people entities should be submitted with `social_security_number` or `individual_taxpayer_identification_number` identification methods. + """ + address: Required[NaturalPersonAddress] """The individual's physical address. @@ -597,12 +839,70 @@ class NaturalPerson(TypedDict, total=False): """ +class RiskRating(TypedDict, total=False): + """ + An assessment of the entity's potential risk of involvement in financial crimes, such as money laundering. + """ + + rated_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the risk + rating was performed. + """ + + rating: Required[Literal["low", "medium", "high"]] + """The rating given to this entity. + + - `low` - Minimal risk of involvement in financial crime. + - `medium` - Moderate risk of involvement in financial crime. + - `high` - Elevated risk of involvement in financial crime. + """ + + class SupplementalDocument(TypedDict, total=False): file_id: Required[str] """The identifier of the File containing the document.""" +class TermsAgreement(TypedDict, total=False): + agreed_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """The timestamp of when the Entity agreed to the terms.""" + + ip_address: Required[str] + """The IP address the Entity accessed reviewed the terms from.""" + + terms_url: Required[str] + """The URL of the terms agreement. + + This link will be provided by your bank partner. + """ + + +class ThirdPartyVerification(TypedDict, total=False): + """ + If you are using a third-party service for identity verification, you can use this field to associate this Entity with the identifier that represents them in that service. + """ + + reference: Required[str] + """The reference identifier for the third party verification.""" + + vendor: Required[Literal["alloy", "middesk", "oscilar", "persona", "taktile"]] + """The vendor that was used to perform the verification. + + - `alloy` - Alloy. See https://alloy.com for more information. + - `middesk` - Middesk. See https://middesk.com for more information. + - `oscilar` - Oscilar. See https://oscilar.com for more information. + - `persona` - Persona. See https://withpersona.com for more information. + - `taktile` - Taktile. See https://taktile.com for more information. + """ + + class TrustAddress(TypedDict, total=False): + """The trust's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + city: Required[str] """The city of the address.""" @@ -623,26 +923,39 @@ class TrustAddress(TypedDict, total=False): class TrustTrusteeIndividualAddress(TypedDict, total=False): + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + city: Required[str] - """The city of the address.""" + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: Required[str] """The first line of the address. This is usually the street number and street.""" - state: Required[str] + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. """ - zip: Required[str] - """The ZIP code of the address.""" - - line2: str - """The second line of the address. This might be the floor or room number.""" + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" class TrustTrusteeIndividualIdentificationDriversLicense(TypedDict, total=False): + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ + expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The driver's license's expiration date in YYYY-MM-DD format.""" @@ -657,10 +970,15 @@ class TrustTrusteeIndividualIdentificationDriversLicense(TypedDict, total=False) class TrustTrusteeIndividualIdentificationOther(TypedDict, total=False): + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + country: Required[str] """ The two-character ISO 3166-1 code representing the country that issued the - document. + document (e.g., `US`). """ description: Required[str] @@ -680,8 +998,16 @@ class TrustTrusteeIndividualIdentificationOther(TypedDict, total=False): class TrustTrusteeIndividualIdentificationPassport(TypedDict, total=False): + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ + country: Required[str] - """The country that issued the passport.""" + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The passport's expiration date in YYYY-MM-DD format.""" @@ -690,7 +1016,9 @@ class TrustTrusteeIndividualIdentificationPassport(TypedDict, total=False): """The identifier of the File containing the passport.""" -class TrustTrusteeIndividualIdentification(TypedDict, total=False): +class TrustTrusteeIndividualIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """A means of verifying the person's identity.""" + method: Required[ Literal[ "social_security_number", @@ -736,6 +1064,11 @@ class TrustTrusteeIndividualIdentification(TypedDict, total=False): class TrustTrusteeIndividual(TypedDict, total=False): + """Details of the individual trustee. + + Within the trustee object, this is required if `structure` is equal to `individual`. + """ + address: Required[TrustTrusteeIndividualAddress] """The individual's physical address. @@ -770,31 +1103,45 @@ class TrustTrustee(TypedDict, total=False): individual: TrustTrusteeIndividual """Details of the individual trustee. - Required when the trustee `structure` is equal to `individual`. + Within the trustee object, this is required if `structure` is equal to + `individual`. """ class TrustGrantorAddress(TypedDict, total=False): + """The individual's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + city: Required[str] - """The city of the address.""" + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" line1: Required[str] """The first line of the address. This is usually the street number and street.""" - state: Required[str] + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. """ - zip: Required[str] - """The ZIP code of the address.""" - - line2: str - """The second line of the address. This might be the floor or room number.""" + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" class TrustGrantorIdentificationDriversLicense(TypedDict, total=False): + """Information about the United States driver's license used for identification. + + Required if `method` is equal to `drivers_license`. + """ + expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The driver's license's expiration date in YYYY-MM-DD format.""" @@ -809,10 +1156,15 @@ class TrustGrantorIdentificationDriversLicense(TypedDict, total=False): class TrustGrantorIdentificationOther(TypedDict, total=False): + """Information about the identification document provided. + + Required if `method` is equal to `other`. + """ + country: Required[str] """ The two-character ISO 3166-1 code representing the country that issued the - document. + document (e.g., `US`). """ description: Required[str] @@ -832,8 +1184,16 @@ class TrustGrantorIdentificationOther(TypedDict, total=False): class TrustGrantorIdentificationPassport(TypedDict, total=False): + """Information about the passport used for identification. + + Required if `method` is equal to `passport`. + """ + country: Required[str] - """The country that issued the passport.""" + """ + The two-character ISO 3166-1 code representing the country that issued the + document (e.g., `US`). + """ expiration_date: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] """The passport's expiration date in YYYY-MM-DD format.""" @@ -842,7 +1202,9 @@ class TrustGrantorIdentificationPassport(TypedDict, total=False): """The identifier of the File containing the passport.""" -class TrustGrantorIdentification(TypedDict, total=False): +class TrustGrantorIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """A means of verifying the person's identity.""" + method: Required[ Literal[ "social_security_number", @@ -888,6 +1250,8 @@ class TrustGrantorIdentification(TypedDict, total=False): class TrustGrantor(TypedDict, total=False): + """The grantor of the trust. Required if `category` is equal to `revocable`.""" + address: Required[TrustGrantorAddress] """The individual's physical address. @@ -913,6 +1277,11 @@ class TrustGrantor(TypedDict, total=False): class Trust(TypedDict, total=False): + """Details of the trust entity to create. + + Required if `structure` is equal to `trust`. + """ + address: Required[TrustAddress] """The trust's physical address. diff --git a/src/increase/types/entity_onboarding_session.py b/src/increase/types/entity_onboarding_session.py new file mode 100644 index 000000000..97ab25e70 --- /dev/null +++ b/src/increase/types/entity_onboarding_session.py @@ -0,0 +1,74 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["EntityOnboardingSession"] + + +class EntityOnboardingSession(BaseModel): + """ + Entity Onboarding Sessions let your customers onboard themselves by completing Increase-hosted forms. Create a session and redirect your customer to the returned URL. When they're done, they'll be redirected back to your site. This API is used for [hosted onboarding](/documentation/hosted-onboarding). + """ + + id: str + """The Entity Onboarding Session's identifier.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Entity Onboarding Session was created. + """ + + entity_id: Optional[str] = None + """ + The identifier of the Entity associated with this session, if one has been + created or was provided when creating the session. + """ + + expires_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Entity Onboarding Session will expire. + """ + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + program_id: str + """The identifier of the Program the Entity will be onboarded to.""" + + redirect_url: str + """The URL to redirect to after the onboarding session is complete. + + Increase will include the query parameters `entity_onboarding_session_id` and + `entity_id` when redirecting. + """ + + session_url: Optional[str] = None + """The URL containing the onboarding form. + + You should share this link with your customer. Only present when the session is + active. + """ + + status: Literal["active", "expired"] + """The status of the onboarding session. + + - `active` - The Entity Onboarding Session is active. + - `expired` - The Entity Onboarding Session has expired. + """ + + type: Literal["entity_onboarding_session"] + """A constant representing the object's type. + + For this resource it will always be `entity_onboarding_session`. + """ diff --git a/src/increase/types/entity_onboarding_session_create_params.py b/src/increase/types/entity_onboarding_session_create_params.py new file mode 100644 index 000000000..6ccf843dd --- /dev/null +++ b/src/increase/types/entity_onboarding_session_create_params.py @@ -0,0 +1,26 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["EntityOnboardingSessionCreateParams"] + + +class EntityOnboardingSessionCreateParams(TypedDict, total=False): + program_id: Required[str] + """The identifier of the Program the Entity will be onboarded to.""" + + redirect_url: Required[str] + """The URL to redirect the customer to after they complete the onboarding form. + + The redirect will include `entity_onboarding_session_id` and `entity_id` query + parameters. + """ + + entity_id: str + """The identifier of an existing Entity to associate with the onboarding session. + + If provided, the onboarding form will display any outstanding tasks required to + complete the Entity's onboarding. + """ diff --git a/src/increase/types/entity_onboarding_session_list_params.py b/src/increase/types/entity_onboarding_session_list_params.py new file mode 100644 index 000000000..96c5d017a --- /dev/null +++ b/src/increase/types/entity_onboarding_session_list_params.py @@ -0,0 +1,42 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List +from typing_extensions import Literal, TypedDict + +__all__ = ["EntityOnboardingSessionListParams", "Status"] + + +class EntityOnboardingSessionListParams(TypedDict, total=False): + cursor: str + """Return the page of entries after this one.""" + + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + status: Status + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["active", "expired"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/entities/supplemental_document.py b/src/increase/types/entity_supplemental_document.py similarity index 74% rename from src/increase/types/entities/supplemental_document.py rename to src/increase/types/entity_supplemental_document.py index fbee31bb4..fcf8fbbd2 100644 --- a/src/increase/types/entities/supplemental_document.py +++ b/src/increase/types/entity_supplemental_document.py @@ -4,18 +4,25 @@ from datetime import datetime from typing_extensions import Literal -from ..._models import BaseModel +from .._models import BaseModel -__all__ = ["SupplementalDocument"] +__all__ = ["EntitySupplementalDocument"] -class SupplementalDocument(BaseModel): +class EntitySupplementalDocument(BaseModel): + """ + Supplemental Documents are uploaded files connected to an Entity during onboarding. + """ + created_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Supplemental Document was created. """ + entity_id: str + """The Entity the supplemental document is attached to.""" + file_id: str """The File containing the document.""" diff --git a/src/increase/types/entity_update_address_params.py b/src/increase/types/entity_update_address_params.py deleted file mode 100644 index 0b2ede59b..000000000 --- a/src/increase/types/entity_update_address_params.py +++ /dev/null @@ -1,35 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["EntityUpdateAddressParams", "Address"] - - -class EntityUpdateAddressParams(TypedDict, total=False): - address: Required[Address] - """The entity's physical address. - - Mail receiving locations like PO Boxes and PMB's are disallowed. - """ - - -class Address(TypedDict, total=False): - city: Required[str] - """The city of the address.""" - - line1: Required[str] - """The first line of the address. This is usually the street number and street.""" - - state: Required[str] - """ - The two-letter United States Postal Service (USPS) abbreviation for the state of - the address. - """ - - zip: Required[str] - """The ZIP code of the address.""" - - line2: str - """The second line of the address. This might be the floor or room number.""" diff --git a/src/increase/types/entity_update_params.py b/src/increase/types/entity_update_params.py new file mode 100644 index 000000000..0c2611663 --- /dev/null +++ b/src/increase/types/entity_update_params.py @@ -0,0 +1,328 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = [ + "EntityUpdateParams", + "Corporation", + "CorporationAddress", + "CorporationLegalIdentifier", + "GovernmentAuthority", + "GovernmentAuthorityAddress", + "NaturalPerson", + "NaturalPersonAddress", + "RiskRating", + "ThirdPartyVerification", + "Trust", + "TrustAddress", +] + + +class EntityUpdateParams(TypedDict, total=False): + corporation: Corporation + """Details of the corporation entity to update. + + If you specify this parameter and the entity is not a corporation, the request + will fail. + """ + + details_confirmed_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """When your user last confirmed the Entity's details. + + Depending on your program, you may be required to affirmatively confirm details + with your users on an annual basis. + """ + + government_authority: GovernmentAuthority + """Details of the government authority entity to update. + + If you specify this parameter and the entity is not a government authority, the + request will fail. + """ + + natural_person: NaturalPerson + """Details of the natural person entity to update. + + If you specify this parameter and the entity is not a natural person, the + request will fail. + """ + + risk_rating: RiskRating + """ + An assessment of the entity’s potential risk of involvement in financial crimes, + such as money laundering. + """ + + third_party_verification: ThirdPartyVerification + """ + If you are using a third-party service for identity verification, you can use + this field to associate this Entity with the identifier that represents them in + that service. + """ + + trust: Trust + """Details of the trust entity to update. + + If you specify this parameter and the entity is not a trust, the request will + fail. + """ + + +class CorporationAddress(TypedDict, total=False): + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + city: Required[str] + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str + """ + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. + """ + + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" + + +class CorporationLegalIdentifier(TypedDict, total=False): + """The legal identifier of the corporation. + + This is usually the Employer Identification Number (EIN). + """ + + value: Required[str] + """The identifier of the legal identifier.""" + + category: Literal["us_employer_identification_number", "other"] + """The category of the legal identifier. + + - `us_employer_identification_number` - The Employer Identification Number (EIN) + for the company. The EIN is a 9-digit number assigned by the IRS. + - `other` - A legal identifier issued by a foreign government, like a tax + identification number or registration number. + """ + + +class Corporation(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """Details of the corporation entity to update. + + If you specify this parameter and the entity is not a corporation, the request will fail. + """ + + address: CorporationAddress + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + email: str + """An email address for the business. + + Not every program requires an email for submitted Entities. + """ + + incorporation_state: str + """ + The two-letter United States Postal Service (USPS) abbreviation for the + corporation's state of incorporation. + """ + + industry_code: str + """ + The North American Industry Classification System (NAICS) code for the + corporation's primary line of business. This is a number, like `5132` for + `Software Publishers`. A full list of classification codes is available + [here](https://increase.com/documentation/data-dictionary#north-american-industry-classification-system-codes). + """ + + legal_identifier: CorporationLegalIdentifier + """The legal identifier of the corporation. + + This is usually the Employer Identification Number (EIN). + """ + + name: str + """The legal name of the corporation.""" + + +class GovernmentAuthorityAddress(TypedDict, total=False): + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + city: Required[str] + """The city of the address.""" + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + state: Required[str] + """ + The two-letter United States Postal Service (USPS) abbreviation for the state of + the address. + """ + + zip: Required[str] + """The ZIP code of the address.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + +class GovernmentAuthority(TypedDict, total=False): + """Details of the government authority entity to update. + + If you specify this parameter and the entity is not a government authority, the request will fail. + """ + + address: GovernmentAuthorityAddress + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + name: str + """The legal name of the government authority.""" + + +class NaturalPersonAddress(TypedDict, total=False): + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + city: Required[str] + """The city, district, town, or village of the address.""" + + country: Required[str] + """The two-letter ISO 3166-1 alpha-2 code for the country of the address.""" + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + state: str + """ + The two-letter United States Postal Service (USPS) abbreviation for the US + state, province, or region of the address. Required in certain countries. + """ + + zip: str + """The ZIP or postal code of the address. Required in certain countries.""" + + +class NaturalPerson(TypedDict, total=False): + """Details of the natural person entity to update. + + If you specify this parameter and the entity is not a natural person, the request will fail. + """ + + address: NaturalPersonAddress + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + name: str + """The legal name of the natural person.""" + + +class RiskRating(TypedDict, total=False): + """ + An assessment of the entity’s potential risk of involvement in financial crimes, such as money laundering. + """ + + rated_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the risk + rating was performed. + """ + + rating: Required[Literal["low", "medium", "high"]] + """The rating given to this entity. + + - `low` - Minimal risk of involvement in financial crime. + - `medium` - Moderate risk of involvement in financial crime. + - `high` - Elevated risk of involvement in financial crime. + """ + + +class ThirdPartyVerification(TypedDict, total=False): + """ + If you are using a third-party service for identity verification, you can use this field to associate this Entity with the identifier that represents them in that service. + """ + + reference: Required[str] + """The reference identifier for the third party verification.""" + + vendor: Required[Literal["alloy", "middesk", "oscilar", "persona", "taktile"]] + """The vendor that was used to perform the verification. + + - `alloy` - Alloy. See https://alloy.com for more information. + - `middesk` - Middesk. See https://middesk.com for more information. + - `oscilar` - Oscilar. See https://oscilar.com for more information. + - `persona` - Persona. See https://withpersona.com for more information. + - `taktile` - Taktile. See https://taktile.com for more information. + """ + + +class TrustAddress(TypedDict, total=False): + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + city: Required[str] + """The city of the address.""" + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + state: Required[str] + """ + The two-letter United States Postal Service (USPS) abbreviation for the state of + the address. + """ + + zip: Required[str] + """The ZIP code of the address.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + +class Trust(TypedDict, total=False): + """Details of the trust entity to update. + + If you specify this parameter and the entity is not a trust, the request will fail. + """ + + address: TrustAddress + """The entity's physical address. + + Mail receiving locations like PO Boxes and PMB's are disallowed. + """ + + name: str + """The legal name of the trust.""" diff --git a/src/increase/types/event.py b/src/increase/types/event.py index b0a440245..4e1ae34b6 100644 --- a/src/increase/types/event.py +++ b/src/increase/types/event.py @@ -9,6 +9,11 @@ class Event(BaseModel): + """Events are records of things that happened to objects at Increase. + + Events are accessible via the List Events endpoint and can be delivered to your application via webhooks. For more information, see our [webhooks guide](https://increase.com/documentation/webhooks). + """ + id: str """The Event identifier.""" @@ -30,6 +35,12 @@ class Event(BaseModel): "ach_prenotification.updated", "ach_transfer.created", "ach_transfer.updated", + "blockchain_address.created", + "blockchain_address.updated", + "blockchain_offramp_transfer.created", + "blockchain_offramp_transfer.updated", + "blockchain_onramp_transfer.created", + "blockchain_onramp_transfer.updated", "bookkeeping_account.created", "bookkeeping_account.updated", "bookkeeping_entry_set.updated", @@ -59,6 +70,8 @@ class Event(BaseModel): "export.updated", "external_account.created", "external_account.updated", + "fednow_transfer.created", + "fednow_transfer.updated", "file.created", "group.updated", "group.heartbeat", @@ -66,6 +79,14 @@ class Event(BaseModel): "inbound_ach_transfer.updated", "inbound_ach_transfer_return.created", "inbound_ach_transfer_return.updated", + "inbound_check_deposit.created", + "inbound_check_deposit.updated", + "inbound_fednow_transfer.created", + "inbound_fednow_transfer.updated", + "inbound_mail_item.created", + "inbound_mail_item.updated", + "inbound_real_time_payments_transfer.created", + "inbound_real_time_payments_transfer.updated", "inbound_wire_drawdown_request.created", "inbound_wire_transfer.created", "inbound_wire_transfer.updated", @@ -73,25 +94,40 @@ class Event(BaseModel): "intrafi_account_enrollment.updated", "intrafi_exclusion.created", "intrafi_exclusion.updated", + "legacy_card_dispute.created", + "legacy_card_dispute.updated", + "lockbox.created", + "lockbox.updated", "oauth_connection.created", "oauth_connection.deactivated", + "card_push_transfer.created", + "card_push_transfer.updated", + "card_validation.created", + "card_validation.updated", "pending_transaction.created", "pending_transaction.updated", "physical_card.created", "physical_card.updated", "physical_card_profile.created", "physical_card_profile.updated", + "physical_check.created", + "physical_check.updated", + "program.created", + "program.updated", "proof_of_authorization_request.created", "proof_of_authorization_request.updated", - "proof_of_authorization_request_submission.created", - "proof_of_authorization_request_submission.updated", "real_time_decision.card_authorization_requested", + "real_time_decision.card_balance_inquiry_requested", "real_time_decision.digital_wallet_token_requested", "real_time_decision.digital_wallet_authentication_requested", + "real_time_decision.card_authentication_requested", + "real_time_decision.card_authentication_challenge_requested", "real_time_payments_transfer.created", "real_time_payments_transfer.updated", "real_time_payments_request_for_payment.created", "real_time_payments_request_for_payment.updated", + "swift_transfer.created", + "swift_transfer.updated", "transaction.created", "wire_drawdown_request.created", "wire_drawdown_request.updated", @@ -116,6 +152,18 @@ class Event(BaseModel): updated. - `ach_transfer.created` - Occurs whenever an ACH Transfer is created. - `ach_transfer.updated` - Occurs whenever an ACH Transfer is updated. + - `blockchain_address.created` - Occurs whenever a Blockchain Address is + created. + - `blockchain_address.updated` - Occurs whenever a Blockchain Address is + updated. + - `blockchain_offramp_transfer.created` - Occurs whenever a Blockchain Off-Ramp + Transfer is created. + - `blockchain_offramp_transfer.updated` - Occurs whenever a Blockchain Off-Ramp + Transfer is updated. + - `blockchain_onramp_transfer.created` - Occurs whenever a Blockchain On-Ramp + Transfer is created. + - `blockchain_onramp_transfer.updated` - Occurs whenever a Blockchain On-Ramp + Transfer is updated. - `bookkeeping_account.created` - Occurs whenever a Bookkeeping Account is created. - `bookkeeping_account.updated` - Occurs whenever a Bookkeeping Account is @@ -155,6 +203,8 @@ class Event(BaseModel): - `export.updated` - Occurs whenever an Export is updated. - `external_account.created` - Occurs whenever an External Account is created. - `external_account.updated` - Occurs whenever an External Account is updated. + - `fednow_transfer.created` - Occurs whenever a FedNow Transfer is created. + - `fednow_transfer.updated` - Occurs whenever a FedNow Transfer is updated. - `file.created` - Occurs whenever a File is created. - `group.updated` - Occurs whenever a Group is updated. - `group.heartbeat` - Increase may send webhooks with this category to see if a @@ -167,6 +217,20 @@ class Event(BaseModel): Transfer Return is created. - `inbound_ach_transfer_return.updated` - Occurs whenever an Inbound ACH Transfer Return is updated. + - `inbound_check_deposit.created` - Occurs whenever an Inbound Check Deposit is + created. + - `inbound_check_deposit.updated` - Occurs whenever an Inbound Check Deposit is + updated. + - `inbound_fednow_transfer.created` - Occurs whenever an Inbound FedNow Transfer + is created. + - `inbound_fednow_transfer.updated` - Occurs whenever an Inbound FedNow Transfer + is updated. + - `inbound_mail_item.created` - Occurs whenever an Inbound Mail Item is created. + - `inbound_mail_item.updated` - Occurs whenever an Inbound Mail Item is updated. + - `inbound_real_time_payments_transfer.created` - Occurs whenever an Inbound + Real-Time Payments Transfer is created. + - `inbound_real_time_payments_transfer.updated` - Occurs whenever an Inbound + Real-Time Payments Transfer is updated. - `inbound_wire_drawdown_request.created` - Occurs whenever an Inbound Wire Drawdown Request is created. - `inbound_wire_transfer.created` - Occurs whenever an Inbound Wire Transfer is @@ -179,9 +243,21 @@ class Event(BaseModel): Enrollment is updated. - `intrafi_exclusion.created` - Occurs whenever an IntraFi Exclusion is created. - `intrafi_exclusion.updated` - Occurs whenever an IntraFi Exclusion is updated. + - `legacy_card_dispute.created` - Occurs whenever a Legacy Card Dispute is + created. + - `legacy_card_dispute.updated` - Occurs whenever a Legacy Card Dispute is + updated. + - `lockbox.created` - Occurs whenever a Lockbox is created. + - `lockbox.updated` - Occurs whenever a Lockbox is updated. - `oauth_connection.created` - Occurs whenever an OAuth Connection is created. - `oauth_connection.deactivated` - Occurs whenever an OAuth Connection is deactivated. + - `card_push_transfer.created` - Occurs whenever a Card Push Transfer is + created. + - `card_push_transfer.updated` - Occurs whenever a Card Push Transfer is + updated. + - `card_validation.created` - Occurs whenever a Card Validation is created. + - `card_validation.updated` - Occurs whenever a Card Validation is updated. - `pending_transaction.created` - Occurs whenever a Pending Transaction is created. - `pending_transaction.updated` - Occurs whenever a Pending Transaction is @@ -192,22 +268,28 @@ class Event(BaseModel): created. - `physical_card_profile.updated` - Occurs whenever a Physical Card Profile is updated. + - `physical_check.created` - Occurs whenever a Physical Check is created. + - `physical_check.updated` - Occurs whenever a Physical Check is updated. + - `program.created` - Occurs whenever a Program is created. + - `program.updated` - Occurs whenever a Program is updated. - `proof_of_authorization_request.created` - Occurs whenever a Proof of Authorization Request is created. - `proof_of_authorization_request.updated` - Occurs whenever a Proof of Authorization Request is updated. - - `proof_of_authorization_request_submission.created` - Occurs whenever a Proof - of Authorization Request Submission is created. - - `proof_of_authorization_request_submission.updated` - Occurs whenever a Proof - of Authorization Request Submission is updated. - `real_time_decision.card_authorization_requested` - Occurs whenever a Real-Time Decision is created in response to a card authorization. + - `real_time_decision.card_balance_inquiry_requested` - Occurs whenever a + Real-Time Decision is created in response to a card balance inquiry. - `real_time_decision.digital_wallet_token_requested` - Occurs whenever a Real-Time Decision is created in response to a digital wallet provisioning attempt. - `real_time_decision.digital_wallet_authentication_requested` - Occurs whenever a Real-Time Decision is created in response to a digital wallet requiring two-factor authentication. + - `real_time_decision.card_authentication_requested` - Occurs whenever a + Real-Time Decision is created in response to 3DS authentication. + - `real_time_decision.card_authentication_challenge_requested` - Occurs whenever + a Real-Time Decision is created in response to 3DS authentication challenges. - `real_time_payments_transfer.created` - Occurs whenever a Real-Time Payments Transfer is created. - `real_time_payments_transfer.updated` - Occurs whenever a Real-Time Payments @@ -216,6 +298,8 @@ class Event(BaseModel): Payments Request for Payment is created. - `real_time_payments_request_for_payment.updated` - Occurs whenever a Real-Time Payments Request for Payment is updated. + - `swift_transfer.created` - Occurs whenever a Swift Transfer is created. + - `swift_transfer.updated` - Occurs whenever a Swift Transfer is updated. - `transaction.created` - Occurs whenever a Transaction is created. - `wire_drawdown_request.created` - Occurs whenever a Wire Drawdown Request is created. diff --git a/src/increase/types/event_list_params.py b/src/increase/types/event_list_params.py index a00866882..bc0e7ba34 100644 --- a/src/increase/types/event_list_params.py +++ b/src/increase/types/event_list_params.py @@ -45,6 +45,12 @@ class EventListParams(TypedDict, total=False): "ach_prenotification.updated", "ach_transfer.created", "ach_transfer.updated", + "blockchain_address.created", + "blockchain_address.updated", + "blockchain_offramp_transfer.created", + "blockchain_offramp_transfer.updated", + "blockchain_onramp_transfer.created", + "blockchain_onramp_transfer.updated", "bookkeeping_account.created", "bookkeeping_account.updated", "bookkeeping_entry_set.updated", @@ -74,6 +80,8 @@ class EventListParams(TypedDict, total=False): "export.updated", "external_account.created", "external_account.updated", + "fednow_transfer.created", + "fednow_transfer.updated", "file.created", "group.updated", "group.heartbeat", @@ -81,6 +89,14 @@ class EventListParams(TypedDict, total=False): "inbound_ach_transfer.updated", "inbound_ach_transfer_return.created", "inbound_ach_transfer_return.updated", + "inbound_check_deposit.created", + "inbound_check_deposit.updated", + "inbound_fednow_transfer.created", + "inbound_fednow_transfer.updated", + "inbound_mail_item.created", + "inbound_mail_item.updated", + "inbound_real_time_payments_transfer.created", + "inbound_real_time_payments_transfer.updated", "inbound_wire_drawdown_request.created", "inbound_wire_transfer.created", "inbound_wire_transfer.updated", @@ -88,25 +104,40 @@ class EventListParams(TypedDict, total=False): "intrafi_account_enrollment.updated", "intrafi_exclusion.created", "intrafi_exclusion.updated", + "legacy_card_dispute.created", + "legacy_card_dispute.updated", + "lockbox.created", + "lockbox.updated", "oauth_connection.created", "oauth_connection.deactivated", + "card_push_transfer.created", + "card_push_transfer.updated", + "card_validation.created", + "card_validation.updated", "pending_transaction.created", "pending_transaction.updated", "physical_card.created", "physical_card.updated", "physical_card_profile.created", "physical_card_profile.updated", + "physical_check.created", + "physical_check.updated", + "program.created", + "program.updated", "proof_of_authorization_request.created", "proof_of_authorization_request.updated", - "proof_of_authorization_request_submission.created", - "proof_of_authorization_request_submission.updated", "real_time_decision.card_authorization_requested", + "real_time_decision.card_balance_inquiry_requested", "real_time_decision.digital_wallet_token_requested", "real_time_decision.digital_wallet_authentication_requested", + "real_time_decision.card_authentication_requested", + "real_time_decision.card_authentication_challenge_requested", "real_time_payments_transfer.created", "real_time_payments_transfer.updated", "real_time_payments_request_for_payment.created", "real_time_payments_request_for_payment.updated", + "swift_transfer.created", + "swift_transfer.updated", "transaction.created", "wire_drawdown_request.created", "wire_drawdown_request.updated", diff --git a/src/increase/types/event_subscription.py b/src/increase/types/event_subscription.py index 1984a41ea..3663f5c4f 100644 --- a/src/increase/types/event_subscription.py +++ b/src/increase/types/event_subscription.py @@ -1,30 +1,18 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import datetime from typing_extensions import Literal -from .._models import BaseModel - -__all__ = ["EventSubscription"] - - -class EventSubscription(BaseModel): - id: str - """The event subscription identifier.""" +from pydantic import Field as FieldInfo - created_at: datetime - """The time the event subscription was created.""" +from .._models import BaseModel - idempotency_key: Optional[str] = None - """The idempotency key you chose for this object. +__all__ = ["EventSubscription", "SelectedEventCategory"] - This value is unique across Increase and is used to ensure that a request is - only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). - """ - selected_event_category: Optional[ +class SelectedEventCategory(BaseModel): + event_category: Optional[ Literal[ "account.created", "account.updated", @@ -37,6 +25,12 @@ class EventSubscription(BaseModel): "ach_prenotification.updated", "ach_transfer.created", "ach_transfer.updated", + "blockchain_address.created", + "blockchain_address.updated", + "blockchain_offramp_transfer.created", + "blockchain_offramp_transfer.updated", + "blockchain_onramp_transfer.created", + "blockchain_onramp_transfer.updated", "bookkeeping_account.created", "bookkeeping_account.updated", "bookkeeping_entry_set.updated", @@ -66,6 +60,8 @@ class EventSubscription(BaseModel): "export.updated", "external_account.created", "external_account.updated", + "fednow_transfer.created", + "fednow_transfer.updated", "file.created", "group.updated", "group.heartbeat", @@ -73,6 +69,14 @@ class EventSubscription(BaseModel): "inbound_ach_transfer.updated", "inbound_ach_transfer_return.created", "inbound_ach_transfer_return.updated", + "inbound_check_deposit.created", + "inbound_check_deposit.updated", + "inbound_fednow_transfer.created", + "inbound_fednow_transfer.updated", + "inbound_mail_item.created", + "inbound_mail_item.updated", + "inbound_real_time_payments_transfer.created", + "inbound_real_time_payments_transfer.updated", "inbound_wire_drawdown_request.created", "inbound_wire_transfer.created", "inbound_wire_transfer.updated", @@ -80,25 +84,40 @@ class EventSubscription(BaseModel): "intrafi_account_enrollment.updated", "intrafi_exclusion.created", "intrafi_exclusion.updated", + "legacy_card_dispute.created", + "legacy_card_dispute.updated", + "lockbox.created", + "lockbox.updated", "oauth_connection.created", "oauth_connection.deactivated", + "card_push_transfer.created", + "card_push_transfer.updated", + "card_validation.created", + "card_validation.updated", "pending_transaction.created", "pending_transaction.updated", "physical_card.created", "physical_card.updated", "physical_card_profile.created", "physical_card_profile.updated", + "physical_check.created", + "physical_check.updated", + "program.created", + "program.updated", "proof_of_authorization_request.created", "proof_of_authorization_request.updated", - "proof_of_authorization_request_submission.created", - "proof_of_authorization_request_submission.updated", "real_time_decision.card_authorization_requested", + "real_time_decision.card_balance_inquiry_requested", "real_time_decision.digital_wallet_token_requested", "real_time_decision.digital_wallet_authentication_requested", + "real_time_decision.card_authentication_requested", + "real_time_decision.card_authentication_challenge_requested", "real_time_payments_transfer.created", "real_time_payments_transfer.updated", "real_time_payments_request_for_payment.created", "real_time_payments_request_for_payment.updated", + "swift_transfer.created", + "swift_transfer.updated", "transaction.created", "wire_drawdown_request.created", "wire_drawdown_request.updated", @@ -106,9 +125,7 @@ class EventSubscription(BaseModel): "wire_transfer.updated", ] ] = None - """ - If specified, this subscription will only receive webhooks for Events with the - specified `category`. + """The category of the Event. - `account.created` - Occurs whenever an Account is created. - `account.updated` - Occurs whenever an Account is updated. @@ -123,6 +140,18 @@ class EventSubscription(BaseModel): updated. - `ach_transfer.created` - Occurs whenever an ACH Transfer is created. - `ach_transfer.updated` - Occurs whenever an ACH Transfer is updated. + - `blockchain_address.created` - Occurs whenever a Blockchain Address is + created. + - `blockchain_address.updated` - Occurs whenever a Blockchain Address is + updated. + - `blockchain_offramp_transfer.created` - Occurs whenever a Blockchain Off-Ramp + Transfer is created. + - `blockchain_offramp_transfer.updated` - Occurs whenever a Blockchain Off-Ramp + Transfer is updated. + - `blockchain_onramp_transfer.created` - Occurs whenever a Blockchain On-Ramp + Transfer is created. + - `blockchain_onramp_transfer.updated` - Occurs whenever a Blockchain On-Ramp + Transfer is updated. - `bookkeeping_account.created` - Occurs whenever a Bookkeeping Account is created. - `bookkeeping_account.updated` - Occurs whenever a Bookkeeping Account is @@ -162,6 +191,8 @@ class EventSubscription(BaseModel): - `export.updated` - Occurs whenever an Export is updated. - `external_account.created` - Occurs whenever an External Account is created. - `external_account.updated` - Occurs whenever an External Account is updated. + - `fednow_transfer.created` - Occurs whenever a FedNow Transfer is created. + - `fednow_transfer.updated` - Occurs whenever a FedNow Transfer is updated. - `file.created` - Occurs whenever a File is created. - `group.updated` - Occurs whenever a Group is updated. - `group.heartbeat` - Increase may send webhooks with this category to see if a @@ -174,6 +205,20 @@ class EventSubscription(BaseModel): Transfer Return is created. - `inbound_ach_transfer_return.updated` - Occurs whenever an Inbound ACH Transfer Return is updated. + - `inbound_check_deposit.created` - Occurs whenever an Inbound Check Deposit is + created. + - `inbound_check_deposit.updated` - Occurs whenever an Inbound Check Deposit is + updated. + - `inbound_fednow_transfer.created` - Occurs whenever an Inbound FedNow Transfer + is created. + - `inbound_fednow_transfer.updated` - Occurs whenever an Inbound FedNow Transfer + is updated. + - `inbound_mail_item.created` - Occurs whenever an Inbound Mail Item is created. + - `inbound_mail_item.updated` - Occurs whenever an Inbound Mail Item is updated. + - `inbound_real_time_payments_transfer.created` - Occurs whenever an Inbound + Real-Time Payments Transfer is created. + - `inbound_real_time_payments_transfer.updated` - Occurs whenever an Inbound + Real-Time Payments Transfer is updated. - `inbound_wire_drawdown_request.created` - Occurs whenever an Inbound Wire Drawdown Request is created. - `inbound_wire_transfer.created` - Occurs whenever an Inbound Wire Transfer is @@ -186,9 +231,21 @@ class EventSubscription(BaseModel): Enrollment is updated. - `intrafi_exclusion.created` - Occurs whenever an IntraFi Exclusion is created. - `intrafi_exclusion.updated` - Occurs whenever an IntraFi Exclusion is updated. + - `legacy_card_dispute.created` - Occurs whenever a Legacy Card Dispute is + created. + - `legacy_card_dispute.updated` - Occurs whenever a Legacy Card Dispute is + updated. + - `lockbox.created` - Occurs whenever a Lockbox is created. + - `lockbox.updated` - Occurs whenever a Lockbox is updated. - `oauth_connection.created` - Occurs whenever an OAuth Connection is created. - `oauth_connection.deactivated` - Occurs whenever an OAuth Connection is deactivated. + - `card_push_transfer.created` - Occurs whenever a Card Push Transfer is + created. + - `card_push_transfer.updated` - Occurs whenever a Card Push Transfer is + updated. + - `card_validation.created` - Occurs whenever a Card Validation is created. + - `card_validation.updated` - Occurs whenever a Card Validation is updated. - `pending_transaction.created` - Occurs whenever a Pending Transaction is created. - `pending_transaction.updated` - Occurs whenever a Pending Transaction is @@ -199,22 +256,28 @@ class EventSubscription(BaseModel): created. - `physical_card_profile.updated` - Occurs whenever a Physical Card Profile is updated. + - `physical_check.created` - Occurs whenever a Physical Check is created. + - `physical_check.updated` - Occurs whenever a Physical Check is updated. + - `program.created` - Occurs whenever a Program is created. + - `program.updated` - Occurs whenever a Program is updated. - `proof_of_authorization_request.created` - Occurs whenever a Proof of Authorization Request is created. - `proof_of_authorization_request.updated` - Occurs whenever a Proof of Authorization Request is updated. - - `proof_of_authorization_request_submission.created` - Occurs whenever a Proof - of Authorization Request Submission is created. - - `proof_of_authorization_request_submission.updated` - Occurs whenever a Proof - of Authorization Request Submission is updated. - `real_time_decision.card_authorization_requested` - Occurs whenever a Real-Time Decision is created in response to a card authorization. + - `real_time_decision.card_balance_inquiry_requested` - Occurs whenever a + Real-Time Decision is created in response to a card balance inquiry. - `real_time_decision.digital_wallet_token_requested` - Occurs whenever a Real-Time Decision is created in response to a digital wallet provisioning attempt. - `real_time_decision.digital_wallet_authentication_requested` - Occurs whenever a Real-Time Decision is created in response to a digital wallet requiring two-factor authentication. + - `real_time_decision.card_authentication_requested` - Occurs whenever a + Real-Time Decision is created in response to 3DS authentication. + - `real_time_decision.card_authentication_challenge_requested` - Occurs whenever + a Real-Time Decision is created in response to 3DS authentication challenges. - `real_time_payments_transfer.created` - Occurs whenever a Real-Time Payments Transfer is created. - `real_time_payments_transfer.updated` - Occurs whenever a Real-Time Payments @@ -223,6 +286,8 @@ class EventSubscription(BaseModel): Payments Request for Payment is created. - `real_time_payments_request_for_payment.updated` - Occurs whenever a Real-Time Payments Request for Payment is updated. + - `swift_transfer.created` - Occurs whenever a Swift Transfer is created. + - `swift_transfer.updated` - Occurs whenever a Swift Transfer is updated. - `transaction.created` - Occurs whenever a Transaction is created. - `wire_drawdown_request.created` - Occurs whenever a Wire Drawdown Request is created. @@ -232,6 +297,39 @@ class EventSubscription(BaseModel): - `wire_transfer.updated` - Occurs whenever a Wire Transfer is updated. """ + +class EventSubscription(BaseModel): + """Webhooks are event notifications we send to you by HTTPS POST requests. + + Event Subscriptions are how you configure your application to listen for them. You can create an Event Subscription through your [developer dashboard](https://dashboard.increase.com/developers/webhooks) or the API. For more information, see our [webhooks guide](https://increase.com/documentation/webhooks). + """ + + id: str + """The event subscription identifier.""" + + created_at: datetime + """The time the event subscription was created.""" + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + oauth_connection_id: Optional[str] = None + """ + If specified, this subscription will only receive webhooks for Events associated + with this OAuth Connection. + """ + + selected_event_categories: Optional[List[SelectedEventCategory]] = None + """ + If specified, this subscription will only receive webhooks for Events with the + specified `category`. + """ + status: Literal["active", "disabled", "deleted", "requires_attention"] """This indicates if we'll send notifications to this subscription. @@ -252,3 +350,15 @@ class EventSubscription(BaseModel): url: str """The webhook url where we'll send notifications.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/event_subscription_create_params.py b/src/increase/types/event_subscription_create_params.py index d4e06f72d..c683d54e3 100644 --- a/src/increase/types/event_subscription_create_params.py +++ b/src/increase/types/event_subscription_create_params.py @@ -2,98 +2,159 @@ from __future__ import annotations +from typing import Iterable from typing_extensions import Literal, Required, TypedDict -__all__ = ["EventSubscriptionCreateParams"] +__all__ = ["EventSubscriptionCreateParams", "SelectedEventCategory"] class EventSubscriptionCreateParams(TypedDict, total=False): url: Required[str] """The URL you'd like us to send webhooks to.""" - selected_event_category: Literal[ - "account.created", - "account.updated", - "account_number.created", - "account_number.updated", - "account_statement.created", - "account_transfer.created", - "account_transfer.updated", - "ach_prenotification.created", - "ach_prenotification.updated", - "ach_transfer.created", - "ach_transfer.updated", - "bookkeeping_account.created", - "bookkeeping_account.updated", - "bookkeeping_entry_set.updated", - "card.created", - "card.updated", - "card_payment.created", - "card_payment.updated", - "card_profile.created", - "card_profile.updated", - "card_dispute.created", - "card_dispute.updated", - "check_deposit.created", - "check_deposit.updated", - "check_transfer.created", - "check_transfer.updated", - "declined_transaction.created", - "digital_card_profile.created", - "digital_card_profile.updated", - "digital_wallet_token.created", - "digital_wallet_token.updated", - "document.created", - "entity.created", - "entity.updated", - "event_subscription.created", - "event_subscription.updated", - "export.created", - "export.updated", - "external_account.created", - "external_account.updated", - "file.created", - "group.updated", - "group.heartbeat", - "inbound_ach_transfer.created", - "inbound_ach_transfer.updated", - "inbound_ach_transfer_return.created", - "inbound_ach_transfer_return.updated", - "inbound_wire_drawdown_request.created", - "inbound_wire_transfer.created", - "inbound_wire_transfer.updated", - "intrafi_account_enrollment.created", - "intrafi_account_enrollment.updated", - "intrafi_exclusion.created", - "intrafi_exclusion.updated", - "oauth_connection.created", - "oauth_connection.deactivated", - "pending_transaction.created", - "pending_transaction.updated", - "physical_card.created", - "physical_card.updated", - "physical_card_profile.created", - "physical_card_profile.updated", - "proof_of_authorization_request.created", - "proof_of_authorization_request.updated", - "proof_of_authorization_request_submission.created", - "proof_of_authorization_request_submission.updated", - "real_time_decision.card_authorization_requested", - "real_time_decision.digital_wallet_token_requested", - "real_time_decision.digital_wallet_authentication_requested", - "real_time_payments_transfer.created", - "real_time_payments_transfer.updated", - "real_time_payments_request_for_payment.created", - "real_time_payments_request_for_payment.updated", - "transaction.created", - "wire_drawdown_request.created", - "wire_drawdown_request.updated", - "wire_transfer.created", - "wire_transfer.updated", - ] + oauth_connection_id: str + """ + If specified, this subscription will only receive webhooks for Events associated + with the specified OAuth Connection. + """ + + selected_event_categories: Iterable[SelectedEventCategory] """ If specified, this subscription will only receive webhooks for Events with the - specified `category`. + specified `category`. If specifying a Real-Time Decision event category, only + one Event Category can be specified for the Event Subscription. + """ + + shared_secret: str + """The key that will be used to sign webhooks. + + If no value is passed, a random string will be used as default. + """ + + status: Literal["active", "disabled"] + """The status of the event subscription. Defaults to `active` if not specified. + + - `active` - The subscription is active and Events will be delivered normally. + - `disabled` - The subscription is temporarily disabled and Events will not be + delivered. + """ + + +class SelectedEventCategory(TypedDict, total=False): + event_category: Required[ + Literal[ + "account.created", + "account.updated", + "account_number.created", + "account_number.updated", + "account_statement.created", + "account_transfer.created", + "account_transfer.updated", + "ach_prenotification.created", + "ach_prenotification.updated", + "ach_transfer.created", + "ach_transfer.updated", + "blockchain_address.created", + "blockchain_address.updated", + "blockchain_offramp_transfer.created", + "blockchain_offramp_transfer.updated", + "blockchain_onramp_transfer.created", + "blockchain_onramp_transfer.updated", + "bookkeeping_account.created", + "bookkeeping_account.updated", + "bookkeeping_entry_set.updated", + "card.created", + "card.updated", + "card_payment.created", + "card_payment.updated", + "card_profile.created", + "card_profile.updated", + "card_dispute.created", + "card_dispute.updated", + "check_deposit.created", + "check_deposit.updated", + "check_transfer.created", + "check_transfer.updated", + "declined_transaction.created", + "digital_card_profile.created", + "digital_card_profile.updated", + "digital_wallet_token.created", + "digital_wallet_token.updated", + "document.created", + "entity.created", + "entity.updated", + "event_subscription.created", + "event_subscription.updated", + "export.created", + "export.updated", + "external_account.created", + "external_account.updated", + "fednow_transfer.created", + "fednow_transfer.updated", + "file.created", + "group.updated", + "group.heartbeat", + "inbound_ach_transfer.created", + "inbound_ach_transfer.updated", + "inbound_ach_transfer_return.created", + "inbound_ach_transfer_return.updated", + "inbound_check_deposit.created", + "inbound_check_deposit.updated", + "inbound_fednow_transfer.created", + "inbound_fednow_transfer.updated", + "inbound_mail_item.created", + "inbound_mail_item.updated", + "inbound_real_time_payments_transfer.created", + "inbound_real_time_payments_transfer.updated", + "inbound_wire_drawdown_request.created", + "inbound_wire_transfer.created", + "inbound_wire_transfer.updated", + "intrafi_account_enrollment.created", + "intrafi_account_enrollment.updated", + "intrafi_exclusion.created", + "intrafi_exclusion.updated", + "legacy_card_dispute.created", + "legacy_card_dispute.updated", + "lockbox.created", + "lockbox.updated", + "oauth_connection.created", + "oauth_connection.deactivated", + "card_push_transfer.created", + "card_push_transfer.updated", + "card_validation.created", + "card_validation.updated", + "pending_transaction.created", + "pending_transaction.updated", + "physical_card.created", + "physical_card.updated", + "physical_card_profile.created", + "physical_card_profile.updated", + "physical_check.created", + "physical_check.updated", + "program.created", + "program.updated", + "proof_of_authorization_request.created", + "proof_of_authorization_request.updated", + "real_time_decision.card_authorization_requested", + "real_time_decision.card_balance_inquiry_requested", + "real_time_decision.digital_wallet_token_requested", + "real_time_decision.digital_wallet_authentication_requested", + "real_time_decision.card_authentication_requested", + "real_time_decision.card_authentication_challenge_requested", + "real_time_payments_transfer.created", + "real_time_payments_transfer.updated", + "real_time_payments_request_for_payment.created", + "real_time_payments_request_for_payment.updated", + "swift_transfer.created", + "swift_transfer.updated", + "transaction.created", + "wire_drawdown_request.created", + "wire_drawdown_request.updated", + "wire_transfer.created", + "wire_transfer.updated", + ] + ] + """The category of the Event to subscribe to. - `account.created` - Occurs whenever an Account is created. - `account.updated` - Occurs whenever an Account is updated. @@ -108,6 +169,18 @@ class EventSubscriptionCreateParams(TypedDict, total=False): updated. - `ach_transfer.created` - Occurs whenever an ACH Transfer is created. - `ach_transfer.updated` - Occurs whenever an ACH Transfer is updated. + - `blockchain_address.created` - Occurs whenever a Blockchain Address is + created. + - `blockchain_address.updated` - Occurs whenever a Blockchain Address is + updated. + - `blockchain_offramp_transfer.created` - Occurs whenever a Blockchain Off-Ramp + Transfer is created. + - `blockchain_offramp_transfer.updated` - Occurs whenever a Blockchain Off-Ramp + Transfer is updated. + - `blockchain_onramp_transfer.created` - Occurs whenever a Blockchain On-Ramp + Transfer is created. + - `blockchain_onramp_transfer.updated` - Occurs whenever a Blockchain On-Ramp + Transfer is updated. - `bookkeeping_account.created` - Occurs whenever a Bookkeeping Account is created. - `bookkeeping_account.updated` - Occurs whenever a Bookkeeping Account is @@ -147,6 +220,8 @@ class EventSubscriptionCreateParams(TypedDict, total=False): - `export.updated` - Occurs whenever an Export is updated. - `external_account.created` - Occurs whenever an External Account is created. - `external_account.updated` - Occurs whenever an External Account is updated. + - `fednow_transfer.created` - Occurs whenever a FedNow Transfer is created. + - `fednow_transfer.updated` - Occurs whenever a FedNow Transfer is updated. - `file.created` - Occurs whenever a File is created. - `group.updated` - Occurs whenever a Group is updated. - `group.heartbeat` - Increase may send webhooks with this category to see if a @@ -159,6 +234,20 @@ class EventSubscriptionCreateParams(TypedDict, total=False): Transfer Return is created. - `inbound_ach_transfer_return.updated` - Occurs whenever an Inbound ACH Transfer Return is updated. + - `inbound_check_deposit.created` - Occurs whenever an Inbound Check Deposit is + created. + - `inbound_check_deposit.updated` - Occurs whenever an Inbound Check Deposit is + updated. + - `inbound_fednow_transfer.created` - Occurs whenever an Inbound FedNow Transfer + is created. + - `inbound_fednow_transfer.updated` - Occurs whenever an Inbound FedNow Transfer + is updated. + - `inbound_mail_item.created` - Occurs whenever an Inbound Mail Item is created. + - `inbound_mail_item.updated` - Occurs whenever an Inbound Mail Item is updated. + - `inbound_real_time_payments_transfer.created` - Occurs whenever an Inbound + Real-Time Payments Transfer is created. + - `inbound_real_time_payments_transfer.updated` - Occurs whenever an Inbound + Real-Time Payments Transfer is updated. - `inbound_wire_drawdown_request.created` - Occurs whenever an Inbound Wire Drawdown Request is created. - `inbound_wire_transfer.created` - Occurs whenever an Inbound Wire Transfer is @@ -171,9 +260,21 @@ class EventSubscriptionCreateParams(TypedDict, total=False): Enrollment is updated. - `intrafi_exclusion.created` - Occurs whenever an IntraFi Exclusion is created. - `intrafi_exclusion.updated` - Occurs whenever an IntraFi Exclusion is updated. + - `legacy_card_dispute.created` - Occurs whenever a Legacy Card Dispute is + created. + - `legacy_card_dispute.updated` - Occurs whenever a Legacy Card Dispute is + updated. + - `lockbox.created` - Occurs whenever a Lockbox is created. + - `lockbox.updated` - Occurs whenever a Lockbox is updated. - `oauth_connection.created` - Occurs whenever an OAuth Connection is created. - `oauth_connection.deactivated` - Occurs whenever an OAuth Connection is deactivated. + - `card_push_transfer.created` - Occurs whenever a Card Push Transfer is + created. + - `card_push_transfer.updated` - Occurs whenever a Card Push Transfer is + updated. + - `card_validation.created` - Occurs whenever a Card Validation is created. + - `card_validation.updated` - Occurs whenever a Card Validation is updated. - `pending_transaction.created` - Occurs whenever a Pending Transaction is created. - `pending_transaction.updated` - Occurs whenever a Pending Transaction is @@ -184,22 +285,28 @@ class EventSubscriptionCreateParams(TypedDict, total=False): created. - `physical_card_profile.updated` - Occurs whenever a Physical Card Profile is updated. + - `physical_check.created` - Occurs whenever a Physical Check is created. + - `physical_check.updated` - Occurs whenever a Physical Check is updated. + - `program.created` - Occurs whenever a Program is created. + - `program.updated` - Occurs whenever a Program is updated. - `proof_of_authorization_request.created` - Occurs whenever a Proof of Authorization Request is created. - `proof_of_authorization_request.updated` - Occurs whenever a Proof of Authorization Request is updated. - - `proof_of_authorization_request_submission.created` - Occurs whenever a Proof - of Authorization Request Submission is created. - - `proof_of_authorization_request_submission.updated` - Occurs whenever a Proof - of Authorization Request Submission is updated. - `real_time_decision.card_authorization_requested` - Occurs whenever a Real-Time Decision is created in response to a card authorization. + - `real_time_decision.card_balance_inquiry_requested` - Occurs whenever a + Real-Time Decision is created in response to a card balance inquiry. - `real_time_decision.digital_wallet_token_requested` - Occurs whenever a Real-Time Decision is created in response to a digital wallet provisioning attempt. - `real_time_decision.digital_wallet_authentication_requested` - Occurs whenever a Real-Time Decision is created in response to a digital wallet requiring two-factor authentication. + - `real_time_decision.card_authentication_requested` - Occurs whenever a + Real-Time Decision is created in response to 3DS authentication. + - `real_time_decision.card_authentication_challenge_requested` - Occurs whenever + a Real-Time Decision is created in response to 3DS authentication challenges. - `real_time_payments_transfer.created` - Occurs whenever a Real-Time Payments Transfer is created. - `real_time_payments_transfer.updated` - Occurs whenever a Real-Time Payments @@ -208,6 +315,8 @@ class EventSubscriptionCreateParams(TypedDict, total=False): Payments Request for Payment is created. - `real_time_payments_request_for_payment.updated` - Occurs whenever a Real-Time Payments Request for Payment is updated. + - `swift_transfer.created` - Occurs whenever a Swift Transfer is created. + - `swift_transfer.updated` - Occurs whenever a Swift Transfer is updated. - `transaction.created` - Occurs whenever a Transaction is created. - `wire_drawdown_request.created` - Occurs whenever a Wire Drawdown Request is created. @@ -216,9 +325,3 @@ class EventSubscriptionCreateParams(TypedDict, total=False): - `wire_transfer.created` - Occurs whenever a Wire Transfer is created. - `wire_transfer.updated` - Occurs whenever a Wire Transfer is updated. """ - - shared_secret: str - """The key that will be used to sign webhooks. - - If no value is passed, a random string will be used as default. - """ diff --git a/src/increase/types/export.py b/src/increase/types/export.py index 3c7c9796b..c4d3bcfc7 100644 --- a/src/increase/types/export.py +++ b/src/increase/types/export.py @@ -1,20 +1,362 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from datetime import datetime +from typing import TYPE_CHECKING, Dict, List, Optional +from datetime import date, datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["Export"] +__all__ = [ + "Export", + "AccountStatementBai2", + "AccountStatementOfx", + "AccountStatementOfxCreatedAt", + "AccountVerificationLetter", + "BalanceCsv", + "BalanceCsvCreatedAt", + "BookkeepingAccountBalanceCsv", + "BookkeepingAccountBalanceCsvCreatedAt", + "DailyAccountBalanceCsv", + "DashboardTableCsv", + "EntityCsv", + "FeeCsv", + "FeeCsvCreatedAt", + "Form1099Int", + "Form1099Misc", + "FundingInstructions", + "Result", + "TransactionCsv", + "TransactionCsvCreatedAt", + "VendorCsv", + "VoidedCheck", + "VoidedCheckPayer", +] + + +class AccountStatementBai2(BaseModel): + """Details of the account statement BAI2 export. + + This field will be present when the `category` is equal to `account_statement_bai2`. + """ + + account_id: Optional[str] = None + """Filter results by Account.""" + + effective_date: Optional[date] = None + """The date for which to retrieve the balance.""" + + program_id: Optional[str] = None + """Filter results by Program.""" + + +class AccountStatementOfxCreatedAt(BaseModel): + """Filter transactions by their created date.""" + + after: Optional[datetime] = None + """Filter results to transactions created after this time.""" + + before: Optional[datetime] = None + """Filter results to transactions created before this time.""" + + +class AccountStatementOfx(BaseModel): + """Details of the account statement OFX export. + + This field will be present when the `category` is equal to `account_statement_ofx`. + """ + + account_id: str + """The Account to create a statement for.""" + + created_at: Optional[AccountStatementOfxCreatedAt] = None + """Filter transactions by their created date.""" + + +class AccountVerificationLetter(BaseModel): + """Details of the account verification letter export. + + This field will be present when the `category` is equal to `account_verification_letter`. + """ + + account_number_id: str + """The Account Number to create a letter for.""" + + balance_date: Optional[date] = None + """The date of the balance to include in the letter.""" + + +class BalanceCsvCreatedAt(BaseModel): + """Filter balances by their created date.""" + + after: Optional[datetime] = None + """Filter balances created after this time.""" + + before: Optional[datetime] = None + """Filter balances created before this time.""" + + +class BalanceCsv(BaseModel): + """Details of the balance CSV export. + + This field will be present when the `category` is equal to `balance_csv`. + """ + + account_id: Optional[str] = None + """Filter results by Account.""" + + created_at: Optional[BalanceCsvCreatedAt] = None + """Filter balances by their created date.""" + + +class BookkeepingAccountBalanceCsvCreatedAt(BaseModel): + """Filter balances by their created date.""" + + after: Optional[datetime] = None + """Filter balances created after this time.""" + + before: Optional[datetime] = None + """Filter balances created before this time.""" + + +class BookkeepingAccountBalanceCsv(BaseModel): + """Details of the bookkeeping account balance CSV export. + + This field will be present when the `category` is equal to `bookkeeping_account_balance_csv`. + """ + + bookkeeping_account_id: Optional[str] = None + """Filter results by Bookkeeping Account.""" + + created_at: Optional[BookkeepingAccountBalanceCsvCreatedAt] = None + """Filter balances by their created date.""" + + +class DailyAccountBalanceCsv(BaseModel): + """Details of the daily account balance CSV export. + + This field will be present when the `category` is equal to `daily_account_balance_csv`. + """ + + account_id: Optional[str] = None + """Filter results by Account.""" + + on_or_after_date: Optional[date] = None + """Filter balances on or after this date.""" + + on_or_before_date: Optional[date] = None + """Filter balances on or before this date.""" + + +class DashboardTableCsv(BaseModel): + """Details of the dashboard table CSV export. + + This field will be present when the `category` is equal to `dashboard_table_csv`. + """ + + pass + + +class EntityCsv(BaseModel): + """Details of the entity CSV export. + + This field will be present when the `category` is equal to `entity_csv`. + """ + + pass + + +class FeeCsvCreatedAt(BaseModel): + """Filter fees by their created date. + + The time range must not include any fees that are part of an open fee statement. + """ + + after: Optional[datetime] = None + """Filter fees created after this time.""" + + before: Optional[datetime] = None + """Filter fees created before this time.""" + + +class FeeCsv(BaseModel): + """Details of the fee CSV export. + + This field will be present when the `category` is equal to `fee_csv`. + """ + + created_at: Optional[FeeCsvCreatedAt] = None + """Filter fees by their created date. + + The time range must not include any fees that are part of an open fee statement. + """ + + +class Form1099Int(BaseModel): + """Details of the Form 1099-INT export. + + This field will be present when the `category` is equal to `form_1099_int`. + """ + + account_id: str + """The Account the tax form is for.""" + + corrected: bool + """Whether the tax form is a corrected form.""" + + description: str + """A description of the tax form.""" + + year: int + """The tax year for the tax form.""" + + +class Form1099Misc(BaseModel): + """Details of the Form 1099-MISC export. + + This field will be present when the `category` is equal to `form_1099_misc`. + """ + + account_id: str + """The Account the tax form is for.""" + + corrected: bool + """Whether the tax form is a corrected form.""" + + year: int + """The tax year for the tax form.""" + + +class FundingInstructions(BaseModel): + """Details of the funding instructions export. + + This field will be present when the `category` is equal to `funding_instructions`. + """ + + account_number_id: str + """The Account Number to create funding instructions for.""" + + +class Result(BaseModel): + """The result of the Export. + + This will be present when the Export's status transitions to `complete`. + """ + + file_id: str + """The File containing the contents of the Export.""" + + +class TransactionCsvCreatedAt(BaseModel): + """Filter transactions by their created date.""" + + after: Optional[datetime] = None + """Filter transactions created after this time.""" + + before: Optional[datetime] = None + """Filter transactions created before this time.""" + + +class TransactionCsv(BaseModel): + """Details of the transaction CSV export. + + This field will be present when the `category` is equal to `transaction_csv`. + """ + + account_id: Optional[str] = None + """Filter results by Account.""" + + created_at: Optional[TransactionCsvCreatedAt] = None + """Filter transactions by their created date.""" + + +class VendorCsv(BaseModel): + """Details of the vendor CSV export. + + This field will be present when the `category` is equal to `vendor_csv`. + """ + + pass + + +class VoidedCheckPayer(BaseModel): + line: str + """The contents of the line.""" + + +class VoidedCheck(BaseModel): + """Details of the voided check export. + + This field will be present when the `category` is equal to `voided_check`. + """ + + account_number_id: str + """The Account Number for the voided check.""" + + payer: List[VoidedCheckPayer] + """The payer information printed on the check.""" class Export(BaseModel): + """Exports are generated files. + + Some exports can contain a lot of data, like a CSV of your transactions. Others can be a single document, like a tax form. Since they can take a while, they are generated asynchronously. We send a webhook when they are ready. For more information, please read our [Exports documentation](https://increase.com/documentation/exports). + """ + id: str """The Export identifier.""" + account_statement_bai2: Optional[AccountStatementBai2] = None + """Details of the account statement BAI2 export. + + This field will be present when the `category` is equal to + `account_statement_bai2`. + """ + + account_statement_ofx: Optional[AccountStatementOfx] = None + """Details of the account statement OFX export. + + This field will be present when the `category` is equal to + `account_statement_ofx`. + """ + + account_verification_letter: Optional[AccountVerificationLetter] = None + """Details of the account verification letter export. + + This field will be present when the `category` is equal to + `account_verification_letter`. + """ + + balance_csv: Optional[BalanceCsv] = None + """Details of the balance CSV export. + + This field will be present when the `category` is equal to `balance_csv`. + """ + + bookkeeping_account_balance_csv: Optional[BookkeepingAccountBalanceCsv] = None + """Details of the bookkeeping account balance CSV export. + + This field will be present when the `category` is equal to + `bookkeeping_account_balance_csv`. + """ + category: Literal[ - "account_statement_ofx", "transaction_csv", "balance_csv", "bookkeeping_account_balance_csv", "entity_csv" + "account_statement_ofx", + "account_statement_bai2", + "transaction_csv", + "balance_csv", + "bookkeeping_account_balance_csv", + "entity_csv", + "vendor_csv", + "dashboard_table_csv", + "account_verification_letter", + "funding_instructions", + "form_1099_int", + "form_1099_misc", + "fee_csv", + "voided_check", + "daily_account_balance_csv", ] """The category of the Export. @@ -23,27 +365,75 @@ class Export(BaseModel): - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of transactions and balances for a given time range and Account. + - `account_statement_bai2` - Export a BAI2 file of transactions and balances for + a given date and optional Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. - `bookkeeping_account_balance_csv` - Export a CSV of bookkeeping account balances for the dates in a given range. - `entity_csv` - Export a CSV of entities with a given status. + - `vendor_csv` - Export a CSV of vendors added to the third-party risk + management dashboard. + - `dashboard_table_csv` - Certain dashboard tables are available as CSV exports. + This export cannot be created via the API. + - `account_verification_letter` - A PDF of an account verification letter. + - `funding_instructions` - A PDF of funding instructions. + - `form_1099_int` - A PDF of an Internal Revenue Service Form 1099-INT. + - `form_1099_misc` - A PDF of an Internal Revenue Service Form 1099-MISC. + - `fee_csv` - Export a CSV of fees. The time range must not include any fees + that are part of an open fee statement. + - `voided_check` - A PDF of a voided check. + - `daily_account_balance_csv` - Export a CSV of daily account balances with + starting and ending balances for a given date range. """ created_at: datetime """The time the Export was created.""" - file_download_url: Optional[str] = None - """A URL at which the Export's file can be downloaded. + daily_account_balance_csv: Optional[DailyAccountBalanceCsv] = None + """Details of the daily account balance CSV export. - This will be present when the Export's status transitions to `complete`. + This field will be present when the `category` is equal to + `daily_account_balance_csv`. """ - file_id: Optional[str] = None - """The File containing the contents of the Export. + dashboard_table_csv: Optional[DashboardTableCsv] = None + """Details of the dashboard table CSV export. - This will be present when the Export's status transitions to `complete`. + This field will be present when the `category` is equal to + `dashboard_table_csv`. + """ + + entity_csv: Optional[EntityCsv] = None + """Details of the entity CSV export. + + This field will be present when the `category` is equal to `entity_csv`. + """ + + fee_csv: Optional[FeeCsv] = None + """Details of the fee CSV export. + + This field will be present when the `category` is equal to `fee_csv`. + """ + + form_1099_int: Optional[Form1099Int] = None + """Details of the Form 1099-INT export. + + This field will be present when the `category` is equal to `form_1099_int`. + """ + + form_1099_misc: Optional[Form1099Misc] = None + """Details of the Form 1099-MISC export. + + This field will be present when the `category` is equal to `form_1099_misc`. + """ + + funding_instructions: Optional[FundingInstructions] = None + """Details of the funding instructions export. + + This field will be present when the `category` is equal to + `funding_instructions`. """ idempotency_key: Optional[str] = None @@ -54,6 +444,12 @@ class Export(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ + result: Optional[Result] = None + """The result of the Export. + + This will be present when the Export's status transitions to `complete`. + """ + status: Literal["pending", "complete", "failed"] """The status of the Export. @@ -63,8 +459,38 @@ class Export(BaseModel): resolve the issue. """ + transaction_csv: Optional[TransactionCsv] = None + """Details of the transaction CSV export. + + This field will be present when the `category` is equal to `transaction_csv`. + """ + type: Literal["export"] """A constant representing the object's type. For this resource it will always be `export`. """ + + vendor_csv: Optional[VendorCsv] = None + """Details of the vendor CSV export. + + This field will be present when the `category` is equal to `vendor_csv`. + """ + + voided_check: Optional[VoidedCheck] = None + """Details of the voided check export. + + This field will be present when the `category` is equal to `voided_check`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/export_create_params.py b/src/increase/types/export_create_params.py index bd7f2ed35..8de18358d 100644 --- a/src/increase/types/export_create_params.py +++ b/src/increase/types/export_create_params.py @@ -2,43 +2,74 @@ from __future__ import annotations -from typing import List, Union -from datetime import datetime +from typing import Union, Iterable +from datetime import date, datetime from typing_extensions import Literal, Required, Annotated, TypedDict from .._utils import PropertyInfo __all__ = [ "ExportCreateParams", + "AccountStatementBai2", "AccountStatementOfx", "AccountStatementOfxCreatedAt", + "AccountVerificationLetter", "BalanceCsv", "BalanceCsvCreatedAt", "BookkeepingAccountBalanceCsv", "BookkeepingAccountBalanceCsvCreatedAt", + "DailyAccountBalanceCsv", "EntityCsv", - "EntityCsvStatus", + "FundingInstructions", "TransactionCsv", "TransactionCsvCreatedAt", + "VendorCsv", + "VoidedCheck", + "VoidedCheckPayer", ] class ExportCreateParams(TypedDict, total=False): category: Required[ Literal[ - "account_statement_ofx", "transaction_csv", "balance_csv", "bookkeeping_account_balance_csv", "entity_csv" + "account_statement_ofx", + "account_statement_bai2", + "transaction_csv", + "balance_csv", + "bookkeeping_account_balance_csv", + "entity_csv", + "vendor_csv", + "account_verification_letter", + "funding_instructions", + "voided_check", + "daily_account_balance_csv", ] ] """The type of Export to create. - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of transactions and balances for a given time range and Account. + - `account_statement_bai2` - Export a BAI2 file of transactions and balances for + a given date and optional Account. - `transaction_csv` - Export a CSV of all transactions for a given time range. - `balance_csv` - Export a CSV of account balances for the dates in a given range. - `bookkeeping_account_balance_csv` - Export a CSV of bookkeeping account balances for the dates in a given range. - `entity_csv` - Export a CSV of entities with a given status. + - `vendor_csv` - Export a CSV of vendors added to the third-party risk + management dashboard. + - `account_verification_letter` - A PDF of an account verification letter. + - `funding_instructions` - A PDF of funding instructions. + - `voided_check` - A PDF of a voided check. + - `daily_account_balance_csv` - Export a CSV of daily account balances with + starting and ending balances for a given date range. + """ + + account_statement_bai2: AccountStatementBai2 + """Options for the created export. + + Required if `category` is equal to `account_statement_bai2`. """ account_statement_ofx: AccountStatementOfx @@ -47,6 +78,12 @@ class ExportCreateParams(TypedDict, total=False): Required if `category` is equal to `account_statement_ofx`. """ + account_verification_letter: AccountVerificationLetter + """Options for the created export. + + Required if `category` is equal to `account_verification_letter`. + """ + balance_csv: BalanceCsv """Options for the created export. @@ -59,20 +96,73 @@ class ExportCreateParams(TypedDict, total=False): Required if `category` is equal to `bookkeeping_account_balance_csv`. """ + daily_account_balance_csv: DailyAccountBalanceCsv + """Options for the created export. + + Required if `category` is equal to `daily_account_balance_csv`. + """ + entity_csv: EntityCsv """Options for the created export. Required if `category` is equal to `entity_csv`. """ + funding_instructions: FundingInstructions + """Options for the created export. + + Required if `category` is equal to `funding_instructions`. + """ + transaction_csv: TransactionCsv """Options for the created export. Required if `category` is equal to `transaction_csv`. """ + vendor_csv: VendorCsv + """Options for the created export. + + Required if `category` is equal to `vendor_csv`. + """ + + voided_check: VoidedCheck + """Options for the created export. + + Required if `category` is equal to `voided_check`. + """ + + +class AccountStatementBai2(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `account_statement_bai2`. + """ + + account_id: str + """The Account to create a BAI2 report for. + + If not provided, all open accounts will be included. + """ + + effective_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """The date to create a BAI2 report for. + + If not provided, the current date will be used. The timezone is UTC. If the + current date is used, the report will include intraday balances, otherwise it + will include end-of-day balances for the provided date. + """ + + program_id: str + """The Program to create a BAI2 report for. + + If not provided, all open accounts will be included. + """ + class AccountStatementOfxCreatedAt(TypedDict, total=False): + """Filter results by time range on the `created_at` attribute.""" + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) @@ -99,6 +189,11 @@ class AccountStatementOfxCreatedAt(TypedDict, total=False): class AccountStatementOfx(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `account_statement_ofx`. + """ + account_id: Required[str] """The Account to create a statement for.""" @@ -106,7 +201,22 @@ class AccountStatementOfx(TypedDict, total=False): """Filter results by time range on the `created_at` attribute.""" +class AccountVerificationLetter(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `account_verification_letter`. + """ + + account_number_id: Required[str] + """The Account Number to create a letter for.""" + + balance_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """The date of the balance to include in the letter. Defaults to the current date.""" + + class BalanceCsvCreatedAt(TypedDict, total=False): + """Filter results by time range on the `created_at` attribute.""" + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) @@ -133,14 +243,21 @@ class BalanceCsvCreatedAt(TypedDict, total=False): class BalanceCsv(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `balance_csv`. + """ + account_id: str - """Filter exported Transactions to the specified Account.""" + """Filter exported Balances to the specified Account.""" created_at: BalanceCsvCreatedAt """Filter results by time range on the `created_at` attribute.""" class BookkeepingAccountBalanceCsvCreatedAt(TypedDict, total=False): + """Filter results by time range on the `created_at` attribute.""" + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) @@ -167,32 +284,59 @@ class BookkeepingAccountBalanceCsvCreatedAt(TypedDict, total=False): class BookkeepingAccountBalanceCsv(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `bookkeeping_account_balance_csv`. + """ + bookkeeping_account_id: str - """Filter exported Transactions to the specified BookkeepingAccount.""" + """ + Filter exported Bookkeeping Account Balances to the specified Bookkeeping + Account. + """ created_at: BookkeepingAccountBalanceCsvCreatedAt """Filter results by time range on the `created_at` attribute.""" -_EntityCsvStatusReservedKeywords = TypedDict( - "_EntityCsvStatusReservedKeywords", - { - "in": List[Literal["active", "archived", "disabled"]], - }, - total=False, -) +class DailyAccountBalanceCsv(TypedDict, total=False): + """Options for the created export. + Required if `category` is equal to `daily_account_balance_csv`. + """ -class EntityCsvStatus(_EntityCsvStatusReservedKeywords, total=False): - pass + account_id: str + """Filter exported Balances to the specified Account.""" + + on_or_after_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Filter exported Balances to those on or after this date.""" + + on_or_before_date: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Filter exported Balances to those on or before this date.""" class EntityCsv(TypedDict, total=False): - status: EntityCsvStatus - """Entity statuses to filter by.""" + """Options for the created export. + + Required if `category` is equal to `entity_csv`. + """ + + pass + + +class FundingInstructions(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `funding_instructions`. + """ + + account_number_id: Required[str] + """The Account Number to create funding instructions for.""" class TransactionCsvCreatedAt(TypedDict, total=False): + """Filter results by time range on the `created_at` attribute.""" + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """ Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) @@ -219,8 +363,40 @@ class TransactionCsvCreatedAt(TypedDict, total=False): class TransactionCsv(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `transaction_csv`. + """ + account_id: str """Filter exported Transactions to the specified Account.""" created_at: TransactionCsvCreatedAt """Filter results by time range on the `created_at` attribute.""" + + +class VendorCsv(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `vendor_csv`. + """ + + pass + + +class VoidedCheckPayer(TypedDict, total=False): + line: Required[str] + """The contents of the line.""" + + +class VoidedCheck(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `voided_check`. + """ + + account_number_id: Required[str] + """The Account Number for the voided check.""" + + payer: Iterable[VoidedCheckPayer] + """The payer information to be printed on the check.""" diff --git a/src/increase/types/export_list_params.py b/src/increase/types/export_list_params.py index e918fdaf4..7bfff6993 100644 --- a/src/increase/types/export_list_params.py +++ b/src/increase/types/export_list_params.py @@ -2,17 +2,130 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict -__all__ = ["ExportListParams"] +from .._utils import PropertyInfo + +__all__ = ["ExportListParams", "CreatedAt", "Form1099Int", "Form1099Misc", "Status"] class ExportListParams(TypedDict, total=False): + category: Literal[ + "account_statement_ofx", + "account_statement_bai2", + "transaction_csv", + "balance_csv", + "bookkeeping_account_balance_csv", + "entity_csv", + "vendor_csv", + "dashboard_table_csv", + "account_verification_letter", + "funding_instructions", + "form_1099_int", + "form_1099_misc", + "fee_csv", + "voided_check", + "daily_account_balance_csv", + ] + """Filter Exports for those with the specified category. + + - `account_statement_ofx` - Export an Open Financial Exchange (OFX) file of + transactions and balances for a given time range and Account. + - `account_statement_bai2` - Export a BAI2 file of transactions and balances for + a given date and optional Account. + - `transaction_csv` - Export a CSV of all transactions for a given time range. + - `balance_csv` - Export a CSV of account balances for the dates in a given + range. + - `bookkeeping_account_balance_csv` - Export a CSV of bookkeeping account + balances for the dates in a given range. + - `entity_csv` - Export a CSV of entities with a given status. + - `vendor_csv` - Export a CSV of vendors added to the third-party risk + management dashboard. + - `dashboard_table_csv` - Certain dashboard tables are available as CSV exports. + This export cannot be created via the API. + - `account_verification_letter` - A PDF of an account verification letter. + - `funding_instructions` - A PDF of funding instructions. + - `form_1099_int` - A PDF of an Internal Revenue Service Form 1099-INT. + - `form_1099_misc` - A PDF of an Internal Revenue Service Form 1099-MISC. + - `fee_csv` - Export a CSV of fees. The time range must not include any fees + that are part of an open fee statement. + - `voided_check` - A PDF of a voided check. + - `daily_account_balance_csv` - Export a CSV of daily account balances with + starting and ending balances for a given date range. + """ + + created_at: CreatedAt + cursor: str """Return the page of entries after this one.""" + form_1099_int: Form1099Int + + form_1099_misc: Form1099Misc + + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + limit: int """Limit the size of the list that is returned. The default (and maximum) is 100 objects. """ + + status: Status + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + +class Form1099Int(TypedDict, total=False): + account_id: str + """Filter Form 1099-INT Exports to those for the specified Account.""" + + +class Form1099Misc(TypedDict, total=False): + account_id: str + """Filter Form 1099-MISC Exports to those for the specified Account.""" + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["pending", "complete", "failed"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/external_account.py b/src/increase/types/external_account.py index d263f8e1c..939830548 100644 --- a/src/increase/types/external_account.py +++ b/src/increase/types/external_account.py @@ -1,15 +1,21 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["ExternalAccount"] class ExternalAccount(BaseModel): + """ + External Accounts represent accounts at financial institutions other than Increase. You can use this API to store their details for reuse. + """ + id: str """The External Account's identifier.""" @@ -33,11 +39,12 @@ class ExternalAccount(BaseModel): description: str """The External Account's description for display purposes.""" - funding: Literal["checking", "savings", "other"] + funding: Literal["checking", "savings", "general_ledger", "other"] """The type of the account to which the transfer will be sent. - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A general ledger account. - `other` - A different type of account. """ @@ -66,10 +73,14 @@ class ExternalAccount(BaseModel): For this resource it will always be `external_account`. """ - verification_status: Literal["unverified", "pending", "verified"] - """If you have verified ownership of the External Account. - - - `unverified` - The External Account has not been verified. - - `pending` - The External Account is in the process of being verified. - - `verified` - The External Account is verified. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/external_account_create_params.py b/src/increase/types/external_account_create_params.py index 9e867766b..92e46b9de 100644 --- a/src/increase/types/external_account_create_params.py +++ b/src/increase/types/external_account_create_params.py @@ -28,10 +28,11 @@ class ExternalAccountCreateParams(TypedDict, total=False): - `unknown` - It's unknown what kind of entity owns the External Account. """ - funding: Literal["checking", "savings", "other"] + funding: Literal["checking", "savings", "general_ledger", "other"] """The type of the destination account. Defaults to `checking`. - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A general ledger account. - `other` - A different type of account. """ diff --git a/src/increase/types/external_account_update_params.py b/src/increase/types/external_account_update_params.py index 9e776857f..574b6dcc3 100644 --- a/src/increase/types/external_account_update_params.py +++ b/src/increase/types/external_account_update_params.py @@ -18,11 +18,12 @@ class ExternalAccountUpdateParams(TypedDict, total=False): description: str """The description you choose to give the external account.""" - funding: Literal["checking", "savings", "other"] + funding: Literal["checking", "savings", "general_ledger", "other"] """The funding type of the External Account. - `checking` - A checking account. - `savings` - A savings account. + - `general_ledger` - A general ledger account. - `other` - A different type of account. """ diff --git a/src/increase/types/fednow_transfer.py b/src/increase/types/fednow_transfer.py new file mode 100644 index 000000000..cefd454e1 --- /dev/null +++ b/src/increase/types/fednow_transfer.py @@ -0,0 +1,306 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = [ + "FednowTransfer", + "Acknowledgement", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "CreditorAddress", + "Rejection", + "Submission", +] + + +class Acknowledgement(BaseModel): + """ + If the transfer is acknowledged by the recipient bank, this will contain supplemental details. + """ + + acknowledged_at: datetime + """When the transfer was acknowledged.""" + + +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + +class CreditorAddress(BaseModel): + """The creditor's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + line1: Optional[str] = None + """The first line of the address.""" + + postal_code: Optional[str] = None + """The ZIP code of the address.""" + + state: Optional[str] = None + """The address state.""" + + +class Rejection(BaseModel): + """ + If the transfer is rejected by FedNow or the destination financial institution, this will contain supplemental details. + """ + + reject_reason_additional_information: Optional[str] = None + """Additional information about the rejection provided by the recipient bank.""" + + reject_reason_code: Literal[ + "account_closed", + "account_blocked", + "invalid_creditor_account_type", + "invalid_creditor_account_number", + "invalid_creditor_financial_institution_identifier", + "end_customer_deceased", + "narrative", + "transaction_forbidden", + "transaction_type_not_supported", + "amount_exceeds_bank_limits", + "invalid_creditor_address", + "invalid_debtor_address", + "timeout", + "processing_error", + "other", + ] + """ + The reason the transfer was rejected as provided by the recipient bank or the + FedNow network. + + - `account_closed` - The destination account is closed. Corresponds to the + FedNow reason code `AC04`. + - `account_blocked` - The destination account is currently blocked from + receiving transactions. Corresponds to the FedNow reason code `AC06`. + - `invalid_creditor_account_type` - The destination account is ineligible to + receive FedNow transfers. Corresponds to the FedNow reason code `AC14`. + - `invalid_creditor_account_number` - The destination account does not exist. + Corresponds to the FedNow reason code `AC03`. + - `invalid_creditor_financial_institution_identifier` - The destination routing + number is invalid. Corresponds to the FedNow reason code `RC04`. + - `end_customer_deceased` - The destination account holder is deceased. + Corresponds to the FedNow reason code `MD07`. + - `narrative` - The reason is provided as narrative information in the + additional information field. Corresponds to the FedNow reason code `NARR`. + - `transaction_forbidden` - FedNow transfers are not allowed to the destination + account. Corresponds to the FedNow reason code `AG01`. + - `transaction_type_not_supported` - FedNow transfers are not enabled for the + destination account. Corresponds to the FedNow reason code `AG03`. + - `amount_exceeds_bank_limits` - The amount is higher than the recipient is + authorized to send or receive. Corresponds to the FedNow reason code `E990`. + - `invalid_creditor_address` - The creditor's address is required, but missing + or invalid. Corresponds to the FedNow reason code `BE04`. + - `invalid_debtor_address` - The debtor's address is required, but missing or + invalid. Corresponds to the FedNow reason code `BE07`. + - `timeout` - There was a timeout processing the transfer. Corresponds to the + FedNow reason code `E997`. + - `processing_error` - The transfer was rejected due to an internal Increase + issue. We have been notified. + - `other` - Some other error or issue has occurred. + """ + + rejected_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was rejected. + """ + + +class Submission(BaseModel): + """ + After the transfer is submitted to FedNow, this will contain supplemental details. + """ + + message_identification: str + """The FedNow network identification of the message submitted.""" + + submitted_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was submitted to FedNow. + """ + + +class FednowTransfer(BaseModel): + """ + FedNow transfers move funds, within seconds, between your Increase account and any other account supporting FedNow. + """ + + id: str + """The FedNow Transfer's identifier.""" + + account_id: str + """The Account from which the transfer was sent.""" + + account_number: str + """The destination account number.""" + + acknowledgement: Optional[Acknowledgement] = None + """ + If the transfer is acknowledged by the recipient bank, this will contain + supplemental details. + """ + + amount: int + """The transfer amount in USD cents.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was created. + """ + + created_by: Optional[CreatedBy] = None + """What object created the transfer, either via the API or the dashboard.""" + + creditor_address: Optional[CreditorAddress] = None + """The creditor's address.""" + + creditor_name: str + """The name of the transfer's recipient. + + This is set by the sender when creating the transfer. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transfer's + currency. For FedNow transfers this is always equal to `USD`. + + - `USD` - US Dollar (USD) + """ + + debtor_name: str + """The name of the transfer's sender. + + If not provided, defaults to the name of the account's entity. + """ + + external_account_id: Optional[str] = None + """The identifier of the External Account the transfer was made to, if any.""" + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + pending_transaction_id: Optional[str] = None + """The ID for the pending transaction representing the transfer.""" + + rejection: Optional[Rejection] = None + """ + If the transfer is rejected by FedNow or the destination financial institution, + this will contain supplemental details. + """ + + routing_number: str + """ + The destination American Bankers' Association (ABA) Routing Transit Number + (RTN). + """ + + source_account_number_id: str + """The Account Number the recipient will see as having sent the transfer.""" + + status: Literal[ + "pending_reviewing", + "canceled", + "reviewing_rejected", + "requires_attention", + "pending_approval", + "pending_submitting", + "pending_response", + "complete", + "rejected", + ] + """The lifecycle status of the transfer. + + - `pending_reviewing` - The transfer is pending review by Increase. + - `canceled` - The transfer has been canceled. + - `reviewing_rejected` - The transfer has been rejected by Increase. + - `requires_attention` - The transfer requires attention from an Increase + operator. + - `pending_approval` - The transfer is pending approval. + - `pending_submitting` - The transfer is queued to be submitted to FedNow. + - `pending_response` - The transfer has been submitted and is pending a response + from FedNow. + - `complete` - The transfer has been sent successfully and is complete. + - `rejected` - The transfer was rejected by the network or the recipient's bank. + """ + + submission: Optional[Submission] = None + """ + After the transfer is submitted to FedNow, this will contain supplemental + details. + """ + + transaction_id: Optional[str] = None + """The Transaction funding the transfer once it is complete.""" + + type: Literal["fednow_transfer"] + """A constant representing the object's type. + + For this resource it will always be `fednow_transfer`. + """ + + unique_end_to_end_transaction_reference: str + """ + The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + of the transfer. + """ + + unstructured_remittance_information: str + """Unstructured information that will show on the recipient's bank statement.""" diff --git a/src/increase/types/fednow_transfer_create_params.py b/src/increase/types/fednow_transfer_create_params.py new file mode 100644 index 000000000..72986a54d --- /dev/null +++ b/src/increase/types/fednow_transfer_create_params.py @@ -0,0 +1,78 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["FednowTransferCreateParams", "CreditorAddress", "DebtorAddress"] + + +class FednowTransferCreateParams(TypedDict, total=False): + amount: Required[int] + """The amount, in minor units, to send to the creditor.""" + + creditor_name: Required[str] + """The creditor's name.""" + + debtor_name: Required[str] + """The debtor's name.""" + + source_account_number_id: Required[str] + """The Account Number to include in the transfer as the debtor's account number.""" + + unstructured_remittance_information: Required[str] + """Unstructured remittance information to include in the transfer.""" + + account_number: str + """The creditor's account number.""" + + creditor_address: CreditorAddress + """The creditor's address.""" + + debtor_address: DebtorAddress + """The debtor's address.""" + + external_account_id: str + """The ID of an External Account to initiate a transfer to. + + If this parameter is provided, `account_number` and `routing_number` must be + absent. + """ + + require_approval: bool + """Whether the transfer requires explicit approval via the dashboard or API.""" + + routing_number: str + """The creditor's bank account routing number.""" + + +class CreditorAddress(TypedDict, total=False): + """The creditor's address.""" + + city: Required[str] + """The city, district, town, or village of the address.""" + + postal_code: Required[str] + """The postal code component of the address.""" + + state: Required[str] + """The US state component of the address.""" + + line1: str + """The first line of the address. This is usually the street number and street.""" + + +class DebtorAddress(TypedDict, total=False): + """The debtor's address.""" + + city: Required[str] + """The city, district, town, or village of the address.""" + + postal_code: Required[str] + """The postal code component of the address.""" + + state: Required[str] + """The US state component of the address.""" + + line1: str + """The first line of the address. This is usually the street number and street.""" diff --git a/src/increase/types/fednow_transfer_list_params.py b/src/increase/types/fednow_transfer_list_params.py new file mode 100644 index 000000000..d3cd2ae3a --- /dev/null +++ b/src/increase/types/fednow_transfer_list_params.py @@ -0,0 +1,91 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FednowTransferListParams", "CreatedAt", "Status"] + + +class FednowTransferListParams(TypedDict, total=False): + account_id: str + """Filter FedNow Transfers to those that originated from the specified Account.""" + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + external_account_id: str + """Filter FedNow Transfers to those made to the specified External Account.""" + + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + status: Status + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[ + Literal[ + "pending_reviewing", + "canceled", + "reviewing_rejected", + "requires_attention", + "pending_approval", + "pending_submitting", + "pending_response", + "complete", + "rejected", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/file.py b/src/increase/types/file.py index 6e0c50ecf..3cf091ae3 100644 --- a/src/increase/types/file.py +++ b/src/increase/types/file.py @@ -1,15 +1,22 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["File"] class File(BaseModel): + """Files are objects that represent a file hosted on Increase's servers. + + The file may have been uploaded by you (for example, when uploading a check image) or it may have been created by Increase (for example, an autogenerated statement PDF). If you need to download a File, create a File Link. + """ + id: str """The File's identifier.""" @@ -26,12 +33,6 @@ class File(BaseModel): - `from_increase` - This File was generated by Increase. """ - download_url: Optional[str] = None - """A URL from where the File can be downloaded at this point in time. - - The location of this URL may change over time. - """ - filename: Optional[str] = None """The filename that was provided upon upload or generated by Increase.""" @@ -47,14 +48,22 @@ class File(BaseModel): """The MIME type of the file.""" purpose: Literal[ + "card_dispute_attachment", "check_image_front", "check_image_back", + "processed_check_image_front", + "processed_check_image_back", "mailed_check_image", - "check_deposit_mail_item", + "check_attachment", + "check_voucher_image", + "check_signature", + "inbound_mail_item", "form_1099_int", + "form_1099_misc", "form_ss_4", "identity_document", "increase_statement", + "loan_application_supplemental_document", "other", "trust_formation_document", "digital_wallet_artwork", @@ -65,23 +74,44 @@ class File(BaseModel): "document_request", "entity_supplemental_document", "export", + "fee_statement", "unusual_activity_report_attachment", + "deposit_account_control_agreement", + "proof_of_authorization_request_submission", + "account_verification_letter", + "funding_instructions", + "hold_harmless_letter", ] """What the File will be used for. We may add additional possible values for this enum over time; your application should be able to handle such additions gracefully. + - `card_dispute_attachment` - A file to be attached to a Card Dispute. - `check_image_front` - An image of the front of a check, used for check deposits. - `check_image_back` - An image of the back of a check, used for check deposits. + - `processed_check_image_front` - An image of the front of a deposited check + after processing by Increase and submission to the Federal Reserve. + - `processed_check_image_back` - An image of the back of a deposited check after + processing by Increase and submission to the Federal Reserve. - `mailed_check_image` - An image of a check that was mailed to a recipient. - - `check_deposit_mail_item` - A scanned mail item sent to Increase containing a - check to deposit. + - `check_attachment` - A document to be printed on an additional page and mailed + with a check that you've requested Increase print. This must be a PDF whose + pages are all US letter size and all have the same orientation. + - `check_voucher_image` - An image to be used as the check voucher image, which + is printed in the middle of the trifold area of a check. This must be a + 2550x1100 pixel PNG. + - `check_signature` - A signature image to be printed on a check. This must be a + 1320x120 pixel PNG. + - `inbound_mail_item` - A scanned mail item sent to Increase. - `form_1099_int` - IRS Form 1099-INT. + - `form_1099_misc` - IRS Form 1099-MISC. - `form_ss_4` - IRS Form SS-4. - `identity_document` - An image of a government-issued ID. - `increase_statement` - A statement generated by Increase. + - `loan_application_supplemental_document` - A supplemental document for a Loan + Application. - `other` - A file purpose not covered by any of the other cases. - `trust_formation_document` - A legal document forming a trust. - `digital_wallet_artwork` - A card image to be rendered inside digital wallet @@ -89,7 +119,7 @@ class File(BaseModel): - `digital_wallet_app_icon` - An icon for you app to be rendered inside digital wallet apps. This must be a 100x100 pixel PNG. - `physical_card_front` - A card image to be printed on the front of a physical - card. This must be a 2100x1340 pixel PNG with no other color but black. + card. This must be a 2100x1344 pixel PNG with no other color but black. - `physical_card_back` - The image to be printed on the back of a physical card. - `physical_card_carrier` - An image representing the entirety of the carrier used for a physical card. This must be a 2550x3300 pixel PNG with no other @@ -98,8 +128,16 @@ class File(BaseModel): - `entity_supplemental_document` - A supplemental document associated an an Entity. - `export` - The results of an Export you requested via the dashboard or API. + - `fee_statement` - A fee statement. - `unusual_activity_report_attachment` - An attachment to an Unusual Activity Report. + - `deposit_account_control_agreement` - A document granting another entity + access to the funds into your account. + - `proof_of_authorization_request_submission` - A file containing additional + evidence for a Proof of Authorization Request Submission. + - `account_verification_letter` - An account verification letter. + - `funding_instructions` - Funding instructions. + - `hold_harmless_letter` - A Hold Harmless Letter. """ type: Literal["file"] @@ -107,3 +145,15 @@ class File(BaseModel): For this resource it will always be `file`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/file_create_params.py b/src/increase/types/file_create_params.py index 18d1117ee..069840ff4 100644 --- a/src/increase/types/file_create_params.py +++ b/src/increase/types/file_create_params.py @@ -20,11 +20,16 @@ class FileCreateParams(TypedDict, total=False): purpose: Required[ Literal[ + "card_dispute_attachment", "check_image_front", "check_image_back", "mailed_check_image", + "check_attachment", + "check_voucher_image", + "check_signature", "form_ss_4", "identity_document", + "loan_application_supplemental_document", "other", "trust_formation_document", "digital_wallet_artwork", @@ -34,16 +39,28 @@ class FileCreateParams(TypedDict, total=False): "document_request", "entity_supplemental_document", "unusual_activity_report_attachment", + "proof_of_authorization_request_submission", ] ] """What the File will be used for in Increase's systems. + - `card_dispute_attachment` - A file to be attached to a Card Dispute. - `check_image_front` - An image of the front of a check, used for check deposits. - `check_image_back` - An image of the back of a check, used for check deposits. - `mailed_check_image` - An image of a check that was mailed to a recipient. + - `check_attachment` - A document to be printed on an additional page and mailed + with a check that you've requested Increase print. This must be a PDF whose + pages are all US letter size and all have the same orientation. + - `check_voucher_image` - An image to be used as the check voucher image, which + is printed in the middle of the trifold area of a check. This must be a + 2550x1100 pixel PNG. + - `check_signature` - A signature image to be printed on a check. This must be a + 1320x120 pixel PNG. - `form_ss_4` - IRS Form SS-4. - `identity_document` - An image of a government-issued ID. + - `loan_application_supplemental_document` - A supplemental document for a Loan + Application. - `other` - A file purpose not covered by any of the other cases. - `trust_formation_document` - A legal document forming a trust. - `digital_wallet_artwork` - A card image to be rendered inside digital wallet @@ -51,7 +68,7 @@ class FileCreateParams(TypedDict, total=False): - `digital_wallet_app_icon` - An icon for you app to be rendered inside digital wallet apps. This must be a 100x100 pixel PNG. - `physical_card_front` - A card image to be printed on the front of a physical - card. This must be a 2100x1340 pixel PNG with no other color but black. + card. This must be a 2100x1344 pixel PNG with no other color but black. - `physical_card_carrier` - An image representing the entirety of the carrier used for a physical card. This must be a 2550x3300 pixel PNG with no other color but black. @@ -60,6 +77,8 @@ class FileCreateParams(TypedDict, total=False): Entity. - `unusual_activity_report_attachment` - An attachment to an Unusual Activity Report. + - `proof_of_authorization_request_submission` - A file containing additional + evidence for a Proof of Authorization Request Submission. """ description: str diff --git a/src/increase/types/file_link.py b/src/increase/types/file_link.py new file mode 100644 index 000000000..d3118075b --- /dev/null +++ b/src/increase/types/file_link.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["FileLink"] + + +class FileLink(BaseModel): + """File Links let you generate a URL that can be used to download a File.""" + + id: str + """The File Link identifier.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the File + Link was created. + """ + + expires_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the File + Link will expire. + """ + + file_id: str + """The identifier of the File the File Link points to.""" + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + type: Literal["file_link"] + """A constant representing the object's type. + + For this resource it will always be `file_link`. + """ + + unauthenticated_url: str + """A URL where the File can be downloaded. + + The URL will expire after the `expires_at` time. This URL is unauthenticated and + can be used to download the File without an Increase API key. + """ diff --git a/src/increase/types/file_link_create_params.py b/src/increase/types/file_link_create_params.py new file mode 100644 index 000000000..e41647b08 --- /dev/null +++ b/src/increase/types/file_link_create_params.py @@ -0,0 +1,23 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["FileLinkCreateParams"] + + +class FileLinkCreateParams(TypedDict, total=False): + file_id: Required[str] + """The File to create a File Link for.""" + + expires_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The time at which the File Link will expire. + + The default is 1 hour from the time of the request. The maximum is 1 day from + the time of the request. + """ diff --git a/src/increase/types/file_list_params.py b/src/increase/types/file_list_params.py index 9987eb945..6376de639 100644 --- a/src/increase/types/file_list_params.py +++ b/src/increase/types/file_list_params.py @@ -65,14 +65,22 @@ class CreatedAt(TypedDict, total=False): { "in": List[ Literal[ + "card_dispute_attachment", "check_image_front", "check_image_back", + "processed_check_image_front", + "processed_check_image_back", "mailed_check_image", - "check_deposit_mail_item", + "check_attachment", + "check_voucher_image", + "check_signature", + "inbound_mail_item", "form_1099_int", + "form_1099_misc", "form_ss_4", "identity_document", "increase_statement", + "loan_application_supplemental_document", "other", "trust_formation_document", "digital_wallet_artwork", @@ -83,7 +91,13 @@ class CreatedAt(TypedDict, total=False): "document_request", "entity_supplemental_document", "export", + "fee_statement", "unusual_activity_report_attachment", + "deposit_account_control_agreement", + "proof_of_authorization_request_submission", + "account_verification_letter", + "funding_instructions", + "hold_harmless_letter", ] ], }, diff --git a/src/increase/types/group.py b/src/increase/types/group.py index 0920f4a2d..38f2fdb34 100644 --- a/src/increase/types/group.py +++ b/src/increase/types/group.py @@ -1,30 +1,24 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import TYPE_CHECKING, Dict from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["Group"] class Group(BaseModel): - id: str - """The Group identifier.""" + """Groups represent organizations using Increase. - ach_debit_status: Literal["disabled", "enabled"] - """If the Group is allowed to create ACH debits. - - - `disabled` - The Group cannot make ACH debits. - - `enabled` - The Group can make ACH debits. + You can retrieve information about your own organization via the API. More commonly, OAuth platforms can retrieve information about the organizations that have granted them access. Learn more about OAuth [here](https://increase.com/documentation/oauth). """ - activation_status: Literal["unactivated", "activated"] - """If the Group is activated or not. - - - `unactivated` - The Group is not activated. - - `activated` - The Group is activated. - """ + id: str + """The Group identifier.""" created_at: datetime """ @@ -37,3 +31,15 @@ class Group(BaseModel): For this resource it will always be `group`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/inbound_ach_transfer.py b/src/increase/types/inbound_ach_transfer.py index f4bba8747..37dc2fbe5 100644 --- a/src/increase/types/inbound_ach_transfer.py +++ b/src/increase/types/inbound_ach_transfer.py @@ -1,9 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional -from datetime import datetime +from typing import TYPE_CHECKING, Dict, List, Optional +from datetime import date, datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = [ @@ -13,12 +15,16 @@ "AddendaFreeform", "AddendaFreeformEntry", "Decline", + "InternationalAddenda", "NotificationOfChange", + "Settlement", "TransferReturn", ] class Acceptance(BaseModel): + """If your transfer is accepted, this will contain details of the acceptance.""" + accepted_at: datetime """The time at which the transfer was accepted.""" @@ -32,11 +38,15 @@ class AddendaFreeformEntry(BaseModel): class AddendaFreeform(BaseModel): + """Unstructured `payment_related_information` passed through by the originator.""" + entries: List[AddendaFreeformEntry] """Each entry represents an addendum received from the originator.""" class Addenda(BaseModel): + """Additional information sent from the originator.""" + category: Literal["freeform"] """The type of addendum. @@ -48,6 +58,8 @@ class Addenda(BaseModel): class Decline(BaseModel): + """If your transfer is declined, this will contain details of the decline.""" + declined_at: datetime """The time at which the transfer was declined.""" @@ -58,17 +70,20 @@ class Decline(BaseModel): "ach_route_canceled", "ach_route_disabled", "breaches_limit", - "credit_entry_refused_by_receiver", - "duplicate_return", "entity_not_active", "group_locked", - "insufficient_funds", - "misrouted_return", - "return_of_erroneous_or_reversing_debit", - "no_ach_route", - "originator_request", "transaction_not_allowed", + "returned_per_odfi_request", "user_initiated", + "insufficient_funds", + "authorization_revoked_by_customer", + "payment_stopped", + "customer_advised_unauthorized_improper_ineligible_or_incomplete", + "representative_payee_deceased_or_unable_to_continue_in_that_capacity", + "beneficiary_or_account_holder_deceased", + "credit_entry_refused_by_receiver", + "duplicate_entry", + "corporate_customer_advised_not_authorized", ] """The reason for the transfer decline. @@ -76,36 +91,299 @@ class Decline(BaseModel): - `ach_route_disabled` - The account number is disabled. - `breaches_limit` - The transaction would cause an Increase limit to be exceeded. - - `credit_entry_refused_by_receiver` - A credit was refused. This is a - reasonable default reason for decline of credits. - - `duplicate_return` - A rare return reason. The return this message refers to - was a duplicate. - `entity_not_active` - The account's entity is not active. - `group_locked` - Your account is inactive. - - `insufficient_funds` - Your account contains insufficient funds. - - `misrouted_return` - A rare return reason. The return this message refers to - was misrouted. - - `return_of_erroneous_or_reversing_debit` - The originating financial - institution made a mistake and this return corrects it. - - `no_ach_route` - The account number that was debited does not exist. - - `originator_request` - The originating financial institution asked for this - transfer to be returned. - `transaction_not_allowed` - The transaction is not allowed per Increase's terms. - - `user_initiated` - The user initiated the decline. + - `returned_per_odfi_request` - The originating financial institution asked for + this transfer to be returned. The receiving bank is complying with the + request. + - `user_initiated` - Your integration declined this transfer via the API. + - `insufficient_funds` - Your account contains insufficient funds. + - `authorization_revoked_by_customer` - The customer no longer authorizes this + transaction. + - `payment_stopped` - The customer asked for the payment to be stopped. + - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - The + customer advises that the debit was unauthorized. + - `representative_payee_deceased_or_unable_to_continue_in_that_capacity` - The + payee is deceased. + - `beneficiary_or_account_holder_deceased` - The account holder is deceased. + - `credit_entry_refused_by_receiver` - The customer refused a credit entry. + - `duplicate_entry` - The account holder identified this transaction as a + duplicate. + - `corporate_customer_advised_not_authorized` - The corporate customer no longer + authorizes this transaction. + """ + + +class InternationalAddenda(BaseModel): + """ + If the Inbound ACH Transfer has a Standard Entry Class Code of IAT, this will contain fields pertaining to the International ACH Transaction. + """ + + destination_country_code: str + """ + The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 + country code of the destination country. + """ + + destination_currency_code: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the + destination bank account. + """ + + foreign_exchange_indicator: Literal["fixed_to_variable", "variable_to_fixed", "fixed_to_fixed"] + """A description of how the foreign exchange rate was calculated. + + - `fixed_to_variable` - The originator chose an amount in their own currency. + The settled amount in USD was converted using the exchange rate. + - `variable_to_fixed` - The originator chose an amount to settle in USD. The + originator's amount was variable; known only after the foreign exchange + conversion. + - `fixed_to_fixed` - The amount was originated and settled as a fixed amount in + USD. There is no foreign exchange conversion. + """ + + foreign_exchange_reference: Optional[str] = None + """ + Depending on the `foreign_exchange_reference_indicator`, an exchange rate or a + reference to a well-known rate. + """ + + foreign_exchange_reference_indicator: Literal["foreign_exchange_rate", "foreign_exchange_reference_number", "blank"] + """ + An instruction of how to interpret the `foreign_exchange_reference` field for + this Transaction. + + - `foreign_exchange_rate` - The ACH file contains a foreign exchange rate. + - `foreign_exchange_reference_number` - The ACH file contains a reference to a + well-known foreign exchange rate. + - `blank` - There is no foreign exchange for this transfer, so the + `foreign_exchange_reference` field is blank. + """ + + foreign_payment_amount: int + """The amount in the minor unit of the foreign payment currency. + + For dollars, for example, this is cents. + """ + + foreign_trace_number: Optional[str] = None + """A reference number in the foreign banking infrastructure.""" + + international_transaction_type_code: Literal[ + "annuity", + "business_or_commercial", + "deposit", + "loan", + "miscellaneous", + "mortgage", + "pension", + "remittance", + "rent_or_lease", + "salary_or_payroll", + "tax", + "accounts_receivable", + "back_office_conversion", + "machine_transfer", + "point_of_purchase", + "point_of_sale", + "represented_check", + "shared_network_transaction", + "telphone_initiated", + "internet_initiated", + ] + """The type of transfer. Set by the originator. + + - `annuity` - Sent as `ANN` in the Nacha file. + - `business_or_commercial` - Sent as `BUS` in the Nacha file. + - `deposit` - Sent as `DEP` in the Nacha file. + - `loan` - Sent as `LOA` in the Nacha file. + - `miscellaneous` - Sent as `MIS` in the Nacha file. + - `mortgage` - Sent as `MOR` in the Nacha file. + - `pension` - Sent as `PEN` in the Nacha file. + - `remittance` - Sent as `REM` in the Nacha file. + - `rent_or_lease` - Sent as `RLS` in the Nacha file. + - `salary_or_payroll` - Sent as `SAL` in the Nacha file. + - `tax` - Sent as `TAX` in the Nacha file. + - `accounts_receivable` - Sent as `ARC` in the Nacha file. + - `back_office_conversion` - Sent as `BOC` in the Nacha file. + - `machine_transfer` - Sent as `MTE` in the Nacha file. + - `point_of_purchase` - Sent as `POP` in the Nacha file. + - `point_of_sale` - Sent as `POS` in the Nacha file. + - `represented_check` - Sent as `RCK` in the Nacha file. + - `shared_network_transaction` - Sent as `SHR` in the Nacha file. + - `telphone_initiated` - Sent as `TEL` in the Nacha file. + - `internet_initiated` - Sent as `WEB` in the Nacha file. + """ + + originating_currency_code: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the + originating bank account. + """ + + originating_depository_financial_institution_branch_country: str + """ + The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 + country code of the originating branch country. + """ + + originating_depository_financial_institution_id: str + """An identifier for the originating bank. + + One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank + Identification Code (BIC), or a domestic identifier like a US Routing Number. + """ + + originating_depository_financial_institution_id_qualifier: Literal[ + "national_clearing_system_number", "bic_code", "iban" + ] + """ + An instruction of how to interpret the + `originating_depository_financial_institution_id` field for this Transaction. + + - `national_clearing_system_number` - A domestic clearing system number. In the + US, for example, this is the American Banking Association (ABA) routing + number. + - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. + - `iban` - An International Bank Account Number. + """ + + originating_depository_financial_institution_name: str + """The name of the originating bank. + + Sometimes this will refer to an American bank and obscure the correspondent + foreign bank. """ + originator_city: str + """A portion of the originator address. This may be incomplete.""" + + originator_country: str + """A portion of the originator address. + + The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 + country code of the originator country. + """ + + originator_identification: str + """An identifier for the originating company. + + This is generally stable across multiple ACH transfers. + """ + + originator_name: str + """Either the name of the originator or an intermediary money transmitter.""" + + originator_postal_code: Optional[str] = None + """A portion of the originator address. This may be incomplete.""" + + originator_state_or_province: Optional[str] = None + """A portion of the originator address. This may be incomplete.""" + + originator_street_address: str + """A portion of the originator address. This may be incomplete.""" + + payment_related_information: Optional[str] = None + """A description field set by the originator.""" + + payment_related_information2: Optional[str] = None + """A description field set by the originator.""" + + receiver_city: str + """A portion of the receiver address. This may be incomplete.""" + + receiver_country: str + """A portion of the receiver address. + + The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 + country code of the receiver country. + """ + + receiver_identification_number: Optional[str] = None + """An identification number the originator uses for the receiver.""" + + receiver_postal_code: Optional[str] = None + """A portion of the receiver address. This may be incomplete.""" + + receiver_state_or_province: Optional[str] = None + """A portion of the receiver address. This may be incomplete.""" + + receiver_street_address: str + """A portion of the receiver address. This may be incomplete.""" + + receiving_company_or_individual_name: str + """The name of the receiver of the transfer. This is not verified by Increase.""" + + receiving_depository_financial_institution_country: str + """ + The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 + country code of the receiving bank country. + """ + + receiving_depository_financial_institution_id: str + """An identifier for the receiving bank. + + One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank + Identification Code (BIC), or a domestic identifier like a US Routing Number. + """ + + receiving_depository_financial_institution_id_qualifier: Literal[ + "national_clearing_system_number", "bic_code", "iban" + ] + """ + An instruction of how to interpret the + `receiving_depository_financial_institution_id` field for this Transaction. + + - `national_clearing_system_number` - A domestic clearing system number. In the + US, for example, this is the American Banking Association (ABA) routing + number. + - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. + - `iban` - An International Bank Account Number. + """ + + receiving_depository_financial_institution_name: str + """The name of the receiving bank, as set by the sending financial institution.""" + class NotificationOfChange(BaseModel): + """ + If you initiate a notification of change in response to the transfer, this will contain its details. + """ + updated_account_number: Optional[str] = None """The new account number provided in the notification of change.""" updated_routing_number: Optional[str] = None - """The new account number provided in the notification of change.""" + """The new routing number provided in the notification of change.""" + + +class Settlement(BaseModel): + """ + A subhash containing information about when and how the transfer settled at the Federal Reserve. + """ + + settled_at: datetime + """ + When the funds for this transfer settle at the recipient bank at the Federal + Reserve. + """ + + settlement_schedule: Literal["same_day", "future_dated"] + """The settlement schedule this transfer follows. + + - `same_day` - The transfer is expected to settle same-day. + - `future_dated` - The transfer is expected to settle on a future date. + """ class TransferReturn(BaseModel): + """If your transfer is returned, this will contain details of the return.""" + reason: Literal[ + "insufficient_funds", "returned_per_odfi_request", "authorization_revoked_by_customer", "payment_stopped", @@ -118,6 +396,8 @@ class TransferReturn(BaseModel): ] """The reason for the transfer return. + - `insufficient_funds` - The customer's account has insufficient funds. This + reason is only allowed for debits. The Nacha return code is R01. - `returned_per_odfi_request` - The originating financial institution asked for this transfer to be returned. The receiving bank is complying with the request. The Nacha return code is R06. @@ -148,6 +428,10 @@ class TransferReturn(BaseModel): class InboundACHTransfer(BaseModel): + """ + An Inbound ACH Transfer is an ACH transfer initiated outside of Increase to your account. + """ + id: str """The inbound ACH transfer's identifier.""" @@ -169,6 +453,12 @@ class InboundACHTransfer(BaseModel): automatically_resolves_at: datetime """The time at which the transfer will be automatically resolved.""" + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the inbound ACH transfer was created. + """ + decline: Optional[Decline] = None """If your transfer is declined, this will contain details of the decline.""" @@ -179,6 +469,19 @@ class InboundACHTransfer(BaseModel): - `debit` - Debit """ + effective_date: date + """The effective date of the transfer. + + This is sent by the sending bank and is a factor in determining funds + availability. + """ + + international_addenda: Optional[InternationalAddenda] = None + """ + If the Inbound ACH Transfer has a Standard Entry Class Code of IAT, this will + contain fields pertaining to the International ACH Transaction. + """ + notification_of_change: Optional[NotificationOfChange] = None """ If you initiate a notification of change in response to the transfer, this will @@ -212,6 +515,50 @@ class InboundACHTransfer(BaseModel): receiver_name: Optional[str] = None """The name of the receiver of the transfer.""" + settlement: Settlement + """ + A subhash containing information about when and how the transfer settled at the + Federal Reserve. + """ + + standard_entry_class_code: Literal[ + "corporate_credit_or_debit", + "corporate_trade_exchange", + "prearranged_payments_and_deposit", + "internet_initiated", + "point_of_sale", + "telephone_initiated", + "customer_initiated", + "accounts_receivable", + "machine_transfer", + "shared_network_transaction", + "represented_check", + "back_office_conversion", + "point_of_purchase", + "check_truncation", + "destroyed_check", + "international_ach_transaction", + ] + """The Standard Entry Class (SEC) code of the transfer. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). + - `internet_initiated` - Internet Initiated (WEB). + - `point_of_sale` - Point of Sale (POS). + - `telephone_initiated` - Telephone Initiated (TEL). + - `customer_initiated` - Customer Initiated (CIE). + - `accounts_receivable` - Accounts Receivable (ARC). + - `machine_transfer` - Machine Transfer (MTE). + - `shared_network_transaction` - Shared Network Transaction (SHR). + - `represented_check` - Represented Check (RCK). + - `back_office_conversion` - Back Office Conversion (BOC). + - `point_of_purchase` - Point of Purchase (POP). + - `check_truncation` - Check Truncation (TRC). + - `destroyed_check` - Destroyed Check (XCK). + - `international_ach_transaction` - International ACH Transaction (IAT). + """ + status: Literal["pending", "declined", "accepted", "returned"] """The status of the transfer. @@ -223,7 +570,12 @@ class InboundACHTransfer(BaseModel): """ trace_number: str - """The trace number of the transfer.""" + """A 15 digit number set by the sending bank and transmitted to the receiving bank. + + Along with the amount, date, and originating routing number, this can be used to + identify the ACH transfer. ACH trace numbers are not unique, but are + [used to correlate returns](https://increase.com/documentation/ach-returns#ach-returns). + """ transfer_return: Optional[TransferReturn] = None """If your transfer is returned, this will contain details of the return.""" @@ -233,3 +585,15 @@ class InboundACHTransfer(BaseModel): For this resource it will always be `inbound_ach_transfer`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/inbound_ach_transfer_notification_of_change_params.py b/src/increase/types/inbound_ach_transfer_create_notification_of_change_params.py similarity index 72% rename from src/increase/types/inbound_ach_transfer_notification_of_change_params.py rename to src/increase/types/inbound_ach_transfer_create_notification_of_change_params.py index 239820edc..73920dc71 100644 --- a/src/increase/types/inbound_ach_transfer_notification_of_change_params.py +++ b/src/increase/types/inbound_ach_transfer_create_notification_of_change_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["InboundACHTransferNotificationOfChangeParams"] +__all__ = ["InboundACHTransferCreateNotificationOfChangeParams"] -class InboundACHTransferNotificationOfChangeParams(TypedDict, total=False): +class InboundACHTransferCreateNotificationOfChangeParams(TypedDict, total=False): updated_account_number: str """The updated account number to send in the notification of change.""" diff --git a/src/increase/types/inbound_ach_transfer_decline_params.py b/src/increase/types/inbound_ach_transfer_decline_params.py new file mode 100644 index 000000000..2f248bb54 --- /dev/null +++ b/src/increase/types/inbound_ach_transfer_decline_params.py @@ -0,0 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["InboundACHTransferDeclineParams"] + + +class InboundACHTransferDeclineParams(TypedDict, total=False): + reason: Literal[ + "insufficient_funds", + "authorization_revoked_by_customer", + "payment_stopped", + "customer_advised_unauthorized_improper_ineligible_or_incomplete", + "representative_payee_deceased_or_unable_to_continue_in_that_capacity", + "beneficiary_or_account_holder_deceased", + "credit_entry_refused_by_receiver", + "duplicate_entry", + "corporate_customer_advised_not_authorized", + ] + """The reason why this transfer will be returned. + + If this parameter is unset, the return codes will be `payment_stopped` for + debits and `credit_entry_refused_by_receiver` for credits. + + - `insufficient_funds` - The customer's account has insufficient funds. This + reason is only allowed for debits. The Nacha return code is R01. + - `authorization_revoked_by_customer` - The customer no longer authorizes this + transaction. The Nacha return code is R07. + - `payment_stopped` - The customer asked for the payment to be stopped. This + reason is only allowed for debits. The Nacha return code is R08. + - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - The + customer advises that the debit was unauthorized. The Nacha return code is + R10. + - `representative_payee_deceased_or_unable_to_continue_in_that_capacity` - The + payee is deceased. The Nacha return code is R14. + - `beneficiary_or_account_holder_deceased` - The account holder is deceased. The + Nacha return code is R15. + - `credit_entry_refused_by_receiver` - The customer refused a credit entry. This + reason is only allowed for credits. The Nacha return code is R23. + - `duplicate_entry` - The account holder identified this transaction as a + duplicate. The Nacha return code is R24. + - `corporate_customer_advised_not_authorized` - The corporate customer no longer + authorizes this transaction. The Nacha return code is R29. + """ diff --git a/src/increase/types/inbound_ach_transfer_list_params.py b/src/increase/types/inbound_ach_transfer_list_params.py index cb62d5db8..c5a6b4151 100644 --- a/src/increase/types/inbound_ach_transfer_list_params.py +++ b/src/increase/types/inbound_ach_transfer_list_params.py @@ -2,21 +2,21 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["InboundACHTransferListParams", "CreatedAt"] +__all__ = ["InboundACHTransferListParams", "CreatedAt", "Status"] class InboundACHTransferListParams(TypedDict, total=False): account_id: str - """Filter Inbound ACH Tranfers to ones belonging to the specified Account.""" + """Filter Inbound ACH Transfers to ones belonging to the specified Account.""" account_number_id: str - """Filter Inbound ACH Tranfers to ones belonging to the specified Account Number.""" + """Filter Inbound ACH Transfers to ones belonging to the specified Account Number.""" created_at: CreatedAt @@ -29,15 +29,7 @@ class InboundACHTransferListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ - status: Literal["pending", "declined", "accepted", "returned"] - """Filter Inbound ACH Transfers to those with the specified status. - - - `pending` - The Inbound ACH Transfer is awaiting action, will transition - automatically if no action is taken. - - `declined` - The Inbound ACH Transfer has been declined. - - `accepted` - The Inbound ACH Transfer is accepted. - - `returned` - The Inbound ACH Transfer has been returned. - """ + status: Status class CreatedAt(TypedDict, total=False): @@ -64,3 +56,16 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["pending", "declined", "accepted", "returned"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/inbound_ach_transfer_transfer_return_params.py b/src/increase/types/inbound_ach_transfer_transfer_return_params.py index 979e434f1..9f0535c3c 100644 --- a/src/increase/types/inbound_ach_transfer_transfer_return_params.py +++ b/src/increase/types/inbound_ach_transfer_transfer_return_params.py @@ -10,7 +10,7 @@ class InboundACHTransferTransferReturnParams(TypedDict, total=False): reason: Required[ Literal[ - "returned_per_odfi_request", + "insufficient_funds", "authorization_revoked_by_customer", "payment_stopped", "customer_advised_unauthorized_improper_ineligible_or_incomplete", @@ -26,9 +26,8 @@ class InboundACHTransferTransferReturnParams(TypedDict, total=False): The most usual return codes are `payment_stopped` for debits and `credit_entry_refused_by_receiver` for credits. - - `returned_per_odfi_request` - The originating financial institution asked for - this transfer to be returned. The receiving bank is complying with the - request. The Nacha return code is R06. + - `insufficient_funds` - The customer's account has insufficient funds. This + reason is only allowed for debits. The Nacha return code is R01. - `authorization_revoked_by_customer` - The customer no longer authorizes this transaction. The Nacha return code is R07. - `payment_stopped` - The customer asked for the payment to be stopped. This diff --git a/src/increase/types/inbound_check_deposit.py b/src/increase/types/inbound_check_deposit.py new file mode 100644 index 000000000..44f9e55fc --- /dev/null +++ b/src/increase/types/inbound_check_deposit.py @@ -0,0 +1,178 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["InboundCheckDeposit", "Adjustment", "DepositReturn"] + + +class Adjustment(BaseModel): + adjusted_at: datetime + """The time at which the return adjustment was received.""" + + amount: int + """The amount of the adjustment.""" + + reason: Literal["late_return", "wrong_payee_credit"] + """The reason for the adjustment. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + """ + + transaction_id: str + """The id of the transaction for the adjustment.""" + + +class DepositReturn(BaseModel): + """ + If you requested a return of this deposit, this will contain details of the return. + """ + + reason: Literal[ + "altered_or_fictitious", + "not_authorized", + "duplicate_presentment", + "endorsement_missing", + "endorsement_irregular", + "refer_to_maker", + ] + """The reason the deposit was returned. + + - `altered_or_fictitious` - The check was altered or fictitious. + - `not_authorized` - The check was not authorized. + - `duplicate_presentment` - The check was a duplicate presentment. + - `endorsement_missing` - The check was not endorsed. + - `endorsement_irregular` - The check was not endorsed by the payee. + - `refer_to_maker` - The maker of the check requested its return. + """ + + returned_at: datetime + """The time at which the deposit was returned.""" + + transaction_id: str + """The id of the transaction for the returned deposit.""" + + +class InboundCheckDeposit(BaseModel): + """ + Inbound Check Deposits are records of third-parties attempting to deposit checks against your account. + """ + + id: str + """The deposit's identifier.""" + + accepted_at: Optional[datetime] = None + """ + If the Inbound Check Deposit was accepted, the + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which this + took place. + """ + + account_id: str + """The Account the check is being deposited against.""" + + account_number_id: Optional[str] = None + """The Account Number the check is being deposited against.""" + + adjustments: List[Adjustment] + """ + If the deposit or the return was adjusted by the sending institution, this will + contain details of the adjustments. + """ + + amount: int + """The deposited amount in USD cents.""" + + back_image_file_id: Optional[str] = None + """The ID for the File containing the image of the back of the check.""" + + bank_of_first_deposit_routing_number: Optional[str] = None + """ + The American Bankers' Association (ABA) Routing Transit Number (RTN) for the + bank depositing this check. In some rare cases, this is not transmitted via + Check21 and the value will be null. + """ + + check_number: Optional[str] = None + """The check number printed on the check being deposited.""" + + check_transfer_id: Optional[str] = None + """ + If this deposit is for an existing Check Transfer, the identifier of that Check + Transfer. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the deposit was attempted. + """ + + currency: Literal["USD"] + """The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the deposit. + + - `USD` - US Dollar (USD) + """ + + declined_at: Optional[datetime] = None + """ + If the Inbound Check Deposit was declined, the + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which this + took place. + """ + + declined_transaction_id: Optional[str] = None + """ + If the deposit attempt has been rejected, the identifier of the Declined + Transaction object created as a result of the failed deposit. + """ + + deposit_return: Optional[DepositReturn] = None + """ + If you requested a return of this deposit, this will contain details of the + return. + """ + + front_image_file_id: Optional[str] = None + """The ID for the File containing the image of the front of the check.""" + + payee_name_analysis: Literal["name_matches", "does_not_match", "not_evaluated"] + """Whether the details on the check match the recipient name of the check transfer. + + This is an optional feature, contact sales to enable. + + - `name_matches` - The details on the check match the recipient name of the + check transfer. + - `does_not_match` - The details on the check do not match the recipient name of + the check transfer. + - `not_evaluated` - The payee name analysis was not evaluated. + """ + + status: Literal["pending", "accepted", "declined", "returned", "requires_attention"] + """The status of the Inbound Check Deposit. + + - `pending` - The Inbound Check Deposit is pending. + - `accepted` - The Inbound Check Deposit was accepted. + - `declined` - The Inbound Check Deposit was rejected. + - `returned` - The Inbound Check Deposit was returned. + - `requires_attention` - The Inbound Check Deposit requires attention from an + Increase operator. + """ + + transaction_id: Optional[str] = None + """ + If the deposit attempt has been accepted, the identifier of the Transaction + object created as a result of the successful deposit. + """ + + type: Literal["inbound_check_deposit"] + """A constant representing the object's type. + + For this resource it will always be `inbound_check_deposit`. + """ diff --git a/src/increase/types/inbound_check_deposit_list_params.py b/src/increase/types/inbound_check_deposit_list_params.py new file mode 100644 index 000000000..29c5792d2 --- /dev/null +++ b/src/increase/types/inbound_check_deposit_list_params.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["InboundCheckDepositListParams", "CreatedAt"] + + +class InboundCheckDepositListParams(TypedDict, total=False): + account_id: str + """Filter Inbound Check Deposits to those belonging to the specified Account.""" + + check_transfer_id: str + """ + Filter Inbound Check Deposits to those belonging to the specified Check + Transfer. + """ + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ diff --git a/src/increase/types/inbound_check_deposit_return_params.py b/src/increase/types/inbound_check_deposit_return_params.py new file mode 100644 index 000000000..b47aaf81b --- /dev/null +++ b/src/increase/types/inbound_check_deposit_return_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["InboundCheckDepositReturnParams"] + + +class InboundCheckDepositReturnParams(TypedDict, total=False): + reason: Required[ + Literal[ + "altered_or_fictitious", + "not_authorized", + "duplicate_presentment", + "endorsement_missing", + "endorsement_irregular", + "refer_to_maker", + ] + ] + """The reason to return the Inbound Check Deposit. + + - `altered_or_fictitious` - The check was altered or fictitious. + - `not_authorized` - The check was not authorized. + - `duplicate_presentment` - The check was a duplicate presentment. + - `endorsement_missing` - The check was not endorsed. + - `endorsement_irregular` - The check was not endorsed by the payee. + - `refer_to_maker` - The maker of the check requested its return. + """ diff --git a/src/increase/types/inbound_fednow_transfer.py b/src/increase/types/inbound_fednow_transfer.py new file mode 100644 index 000000000..55470b22f --- /dev/null +++ b/src/increase/types/inbound_fednow_transfer.py @@ -0,0 +1,144 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["InboundFednowTransfer", "Confirmation", "Decline"] + + +class Confirmation(BaseModel): + """If your transfer is confirmed, this will contain details of the confirmation.""" + + transfer_id: str + """The identifier of the FedNow Transfer that led to this Transaction.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class Decline(BaseModel): + """If your transfer is declined, this will contain details of the decline.""" + + reason: Literal[ + "account_number_canceled", + "account_number_disabled", + "account_restricted", + "group_locked", + "entity_not_active", + "fednow_not_enabled", + ] + """Why the transfer was declined. + + - `account_number_canceled` - The account number is canceled. + - `account_number_disabled` - The account number is disabled. + - `account_restricted` - Your account is restricted. + - `group_locked` - Your account is inactive. + - `entity_not_active` - The account's entity is not active. + - `fednow_not_enabled` - Your account is not enabled to receive FedNow + transfers. + """ + + transfer_id: str + """The identifier of the FedNow Transfer that led to this declined transaction.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class InboundFednowTransfer(BaseModel): + """ + An Inbound FedNow Transfer is a FedNow transfer initiated outside of Increase to your account. + """ + + id: str + """The inbound FedNow transfer's identifier.""" + + account_id: str + """The Account to which the transfer was sent.""" + + account_number_id: str + """The identifier of the Account Number to which this transfer was sent.""" + + amount: int + """The amount in USD cents.""" + + confirmation: Optional[Confirmation] = None + """If your transfer is confirmed, this will contain details of the confirmation.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was created. + """ + + creditor_name: str + """The name the sender of the transfer specified as the recipient of the transfer.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the transfer's + currency. This will always be "USD" for a FedNow transfer. + + - `USD` - US Dollar (USD) + """ + + debtor_account_number: str + """The account number of the account that sent the transfer.""" + + debtor_name: str + """The name provided by the sender of the transfer.""" + + debtor_routing_number: str + """The routing number of the account that sent the transfer.""" + + decline: Optional[Decline] = None + """If your transfer is declined, this will contain details of the decline.""" + + status: Literal["pending_confirming", "timed_out", "confirmed", "declined", "requires_attention"] + """The lifecycle status of the transfer. + + - `pending_confirming` - The transfer is pending confirmation. + - `timed_out` - The transfer was not responded to in time. + - `confirmed` - The transfer has been received successfully and is confirmed. + - `declined` - The transfer has been declined. + - `requires_attention` - The transfer requires attention from an Increase + operator. + """ + + transaction_id: Optional[str] = None + """ + The identifier of the Transaction object created when the transfer was + confirmed. + """ + + type: Literal["inbound_fednow_transfer"] + """A constant representing the object's type. + + For this resource it will always be `inbound_fednow_transfer`. + """ + + unstructured_remittance_information: Optional[str] = None + """Additional information included with the transfer.""" diff --git a/src/increase/types/inbound_fednow_transfer_list_params.py b/src/increase/types/inbound_fednow_transfer_list_params.py new file mode 100644 index 000000000..130016d11 --- /dev/null +++ b/src/increase/types/inbound_fednow_transfer_list_params.py @@ -0,0 +1,59 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["InboundFednowTransferListParams", "CreatedAt"] + + +class InboundFednowTransferListParams(TypedDict, total=False): + account_id: str + """Filter Inbound FedNow Transfers to those belonging to the specified Account.""" + + account_number_id: str + """ + Filter Inbound FedNow Transfers to ones belonging to the specified Account + Number. + """ + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ diff --git a/src/increase/types/inbound_mail_item.py b/src/increase/types/inbound_mail_item.py new file mode 100644 index 000000000..3adafc034 --- /dev/null +++ b/src/increase/types/inbound_mail_item.py @@ -0,0 +1,98 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, List, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["InboundMailItem", "Check"] + + +class Check(BaseModel): + """Inbound Mail Item Checks represent the checks in an Inbound Mail Item.""" + + amount: int + """The amount of the check.""" + + back_file_id: Optional[str] = None + """The identifier for the File containing the back of the check.""" + + check_deposit_id: Optional[str] = None + """The identifier of the Check Deposit if this check was deposited.""" + + front_file_id: Optional[str] = None + """The identifier for the File containing the front of the check.""" + + status: Optional[Literal["pending", "deposited", "ignored"]] = None + """The status of the Inbound Mail Item Check. + + - `pending` - The check is pending processing. + - `deposited` - The check has been deposited. + - `ignored` - The check has been ignored. + """ + + +class InboundMailItem(BaseModel): + """Inbound Mail Items represent pieces of physical mail delivered to a Lockbox.""" + + id: str + """The Inbound Mail Item identifier.""" + + checks: List[Check] + """The checks in the mail item.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Inbound + Mail Item was created. + """ + + file_id: str + """The identifier for the File containing the scanned contents of the mail item.""" + + lockbox_id: Optional[str] = None + """The identifier for the Lockbox that received this mail item. + + For mail items that could not be processed due to an invalid address, this will + be null. + """ + + recipient_name: Optional[str] = None + """The recipient name as written on the mail item.""" + + rejection_reason: Optional[Literal["no_matching_lockbox", "no_check", "lockbox_not_active"]] = None + """If the mail item has been rejected, why it was rejected. + + - `no_matching_lockbox` - The mail item does not match any lockbox. + - `no_check` - The mail item does not contain a check. + - `lockbox_not_active` - The Lockbox or its associated Account is not active. + """ + + status: Literal["pending", "processed", "rejected"] + """If the mail item has been processed. + + - `pending` - The mail item is pending processing. + - `processed` - The mail item has been processed. + - `rejected` - The mail item has been rejected. + """ + + type: Literal["inbound_mail_item"] + """A constant representing the object's type. + + For this resource it will always be `inbound_mail_item`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/inbound_mail_item_action_params.py b/src/increase/types/inbound_mail_item_action_params.py new file mode 100644 index 000000000..7bf606be1 --- /dev/null +++ b/src/increase/types/inbound_mail_item_action_params.py @@ -0,0 +1,29 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["InboundMailItemActionParams", "Check"] + + +class InboundMailItemActionParams(TypedDict, total=False): + checks: Required[Iterable[Check]] + """The actions to perform on the Inbound Mail Item.""" + + +class Check(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + action: Required[Literal["deposit", "ignore"]] + """The action to perform on the Inbound Mail Item. + + - `deposit` - The check will be deposited. + - `ignore` - The check will be ignored. + """ + + account_id: str + """The identifier of the Account to deposit the check into. + + If not provided, the check will be deposited into the Account associated with + the Lockbox. + """ diff --git a/src/increase/types/inbound_mail_item_list_params.py b/src/increase/types/inbound_mail_item_list_params.py new file mode 100644 index 000000000..403b80cec --- /dev/null +++ b/src/increase/types/inbound_mail_item_list_params.py @@ -0,0 +1,53 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["InboundMailItemListParams", "CreatedAt"] + + +class InboundMailItemListParams(TypedDict, total=False): + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + lockbox_id: str + """Filter Inbound Mail Items to ones sent to the provided Lockbox.""" + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ diff --git a/src/increase/types/inbound_real_time_payments_transfer.py b/src/increase/types/inbound_real_time_payments_transfer.py new file mode 100755 index 000000000..5c3598e3e --- /dev/null +++ b/src/increase/types/inbound_real_time_payments_transfer.py @@ -0,0 +1,133 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["InboundRealTimePaymentsTransfer", "Confirmation", "Decline"] + + +class Confirmation(BaseModel): + """If your transfer is confirmed, this will contain details of the confirmation.""" + + confirmed_at: datetime + """The time at which the transfer was confirmed.""" + + transaction_id: str + """The id of the transaction for the confirmed transfer.""" + + +class Decline(BaseModel): + """If your transfer is declined, this will contain details of the decline.""" + + declined_at: datetime + """The time at which the transfer was declined.""" + + declined_transaction_id: str + """The id of the transaction for the declined transfer.""" + + reason: Literal[ + "account_number_canceled", + "account_number_disabled", + "account_restricted", + "group_locked", + "entity_not_active", + "real_time_payments_not_enabled", + ] + """The reason for the transfer decline. + + - `account_number_canceled` - The account number is canceled. + - `account_number_disabled` - The account number is disabled. + - `account_restricted` - Your account is restricted. + - `group_locked` - Your account is inactive. + - `entity_not_active` - The account's entity is not active. + - `real_time_payments_not_enabled` - Your account is not enabled to receive + Real-Time Payments transfers. + """ + + +class InboundRealTimePaymentsTransfer(BaseModel): + """ + An Inbound Real-Time Payments Transfer is a Real-Time Payments transfer initiated outside of Increase to your account. + """ + + id: str + """The inbound Real-Time Payments transfer's identifier.""" + + account_id: str + """The Account to which the transfer was sent.""" + + account_number_id: str + """The identifier of the Account Number to which this transfer was sent.""" + + amount: int + """The amount in USD cents.""" + + confirmation: Optional[Confirmation] = None + """If your transfer is confirmed, this will contain details of the confirmation.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was created. + """ + + creditor_name: str + """The name the sender of the transfer specified as the recipient of the transfer.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the transfer's + currency. This will always be "USD" for a Real-Time Payments transfer. + + - `USD` - US Dollar (USD) + """ + + debtor_account_number: str + """The account number of the account that sent the transfer.""" + + debtor_name: str + """The name provided by the sender of the transfer.""" + + debtor_routing_number: str + """The routing number of the account that sent the transfer.""" + + decline: Optional[Decline] = None + """If your transfer is declined, this will contain details of the decline.""" + + status: Literal["pending_confirming", "timed_out", "confirmed", "declined"] + """The lifecycle status of the transfer. + + - `pending_confirming` - The transfer is pending confirmation. + - `timed_out` - The transfer was not responded to in time. + - `confirmed` - The transfer has been received successfully and is confirmed. + - `declined` - The transfer has been declined. + """ + + transaction_identification: str + """The Real-Time Payments network identification of the transfer.""" + + type: Literal["inbound_real_time_payments_transfer"] + """A constant representing the object's type. + + For this resource it will always be `inbound_real_time_payments_transfer`. + """ + + unstructured_remittance_information: Optional[str] = None + """Additional information included with the transfer.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/inbound_real_time_payments_transfer_list_params.py b/src/increase/types/inbound_real_time_payments_transfer_list_params.py new file mode 100755 index 000000000..ed6a7cd19 --- /dev/null +++ b/src/increase/types/inbound_real_time_payments_transfer_list_params.py @@ -0,0 +1,62 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["InboundRealTimePaymentsTransferListParams", "CreatedAt"] + + +class InboundRealTimePaymentsTransferListParams(TypedDict, total=False): + account_id: str + """ + Filter Inbound Real-Time Payments Transfers to those belonging to the specified + Account. + """ + + account_number_id: str + """ + Filter Inbound Real-Time Payments Transfers to ones belonging to the specified + Account Number. + """ + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ diff --git a/src/increase/types/inbound_wire_drawdown_request.py b/src/increase/types/inbound_wire_drawdown_request.py index 9c7e650e4..b6ffce482 100644 --- a/src/increase/types/inbound_wire_drawdown_request.py +++ b/src/increase/types/inbound_wire_drawdown_request.py @@ -1,37 +1,50 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["InboundWireDrawdownRequest"] class InboundWireDrawdownRequest(BaseModel): + """ + Inbound wire drawdown requests are requests from someone else to send them a wire. For more information, see our [Wire Drawdown Requests documentation](/documentation/wire-drawdown-requests). + """ + id: str """The Wire drawdown request identifier.""" amount: int """The amount being requested in cents.""" - beneficiary_account_number: str - """The drawdown request's beneficiary's account number.""" + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the inbound wire drawdown request was created. + """ - beneficiary_address_line1: Optional[str] = None - """Line 1 of the drawdown request's beneficiary's address.""" + creditor_account_number: str + """The creditor's account number.""" - beneficiary_address_line2: Optional[str] = None - """Line 2 of the drawdown request's beneficiary's address.""" + creditor_address_line1: Optional[str] = None + """A free-form address field set by the sender.""" - beneficiary_address_line3: Optional[str] = None - """Line 3 of the drawdown request's beneficiary's address.""" + creditor_address_line2: Optional[str] = None + """A free-form address field set by the sender.""" - beneficiary_name: Optional[str] = None - """The drawdown request's beneficiary's name.""" + creditor_address_line3: Optional[str] = None + """A free-form address field set by the sender.""" - beneficiary_routing_number: str - """The drawdown request's beneficiary's routing number.""" + creditor_name: Optional[str] = None + """A name set by the sender.""" + + creditor_routing_number: str + """The creditor's routing number.""" currency: str """ @@ -39,50 +52,33 @@ class InboundWireDrawdownRequest(BaseModel): requested. Will always be "USD". """ - message_to_recipient: Optional[str] = None - """A message from the drawdown request's originator.""" - - originator_account_number: str - """The drawdown request's originator's account number.""" - - originator_address_line1: Optional[str] = None - """Line 1 of the drawdown request's originator's address.""" + debtor_address_line1: Optional[str] = None + """A free-form address field set by the sender.""" - originator_address_line2: Optional[str] = None - """Line 2 of the drawdown request's originator's address.""" + debtor_address_line2: Optional[str] = None + """A free-form address field set by the sender.""" - originator_address_line3: Optional[str] = None - """Line 3 of the drawdown request's originator's address.""" + debtor_address_line3: Optional[str] = None + """A free-form address field set by the sender.""" - originator_name: Optional[str] = None - """The drawdown request's originator's name.""" + debtor_name: Optional[str] = None + """A name set by the sender.""" - originator_routing_number: str - """The drawdown request's originator's routing number.""" - - originator_to_beneficiary_information_line1: Optional[str] = None + end_to_end_identification: Optional[str] = None """ - Line 1 of the information conveyed from the originator of the message to the - beneficiary. + A free-form reference string set by the sender, to help identify the drawdown + request. """ - originator_to_beneficiary_information_line2: Optional[str] = None + input_message_accountability_data: Optional[str] = None """ - Line 2 of the information conveyed from the originator of the message to the - beneficiary. + A unique identifier available to the originating and receiving banks, commonly + abbreviated as IMAD. It is created when the wire is submitted to the Fedwire + service and is helpful when debugging wires with the originating bank. """ - originator_to_beneficiary_information_line3: Optional[str] = None - """ - Line 3 of the information conveyed from the originator of the message to the - beneficiary. - """ - - originator_to_beneficiary_information_line4: Optional[str] = None - """ - Line 4 of the information conveyed from the originator of the message to the - beneficiary. - """ + instruction_identification: Optional[str] = None + """The sending bank's identifier for the drawdown request.""" recipient_account_number_id: str """ @@ -95,3 +91,25 @@ class InboundWireDrawdownRequest(BaseModel): For this resource it will always be `inbound_wire_drawdown_request`. """ + + unique_end_to_end_transaction_reference: Optional[str] = None + """ + The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + of the drawdown request. + """ + + unstructured_remittance_information: Optional[str] = None + """A free-form message set by the sender.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/inbound_wire_transfer.py b/src/increase/types/inbound_wire_transfer.py index 75e36f1a3..c7cb18c0f 100644 --- a/src/increase/types/inbound_wire_transfer.py +++ b/src/increase/types/inbound_wire_transfer.py @@ -1,17 +1,59 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["InboundWireTransfer"] +__all__ = ["InboundWireTransfer", "Acceptance", "Reversal"] + + +class Acceptance(BaseModel): + """If the transfer is accepted, this will contain details of the acceptance.""" + + accepted_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was accepted. + """ + + transaction_id: str + """The identifier of the transaction for the accepted transfer.""" + + +class Reversal(BaseModel): + """If the transfer is reversed, this will contain details of the reversal.""" + + reason: Literal["duplicate", "creditor_request", "transaction_forbidden"] + """The reason for the reversal. + + - `duplicate` - The inbound wire transfer was a duplicate. + - `creditor_request` - The recipient of the wire transfer requested the funds be + returned to the sender. + - `transaction_forbidden` - The account cannot currently receive inbound wires. + """ + + reversed_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was reversed. + """ class InboundWireTransfer(BaseModel): + """ + An Inbound Wire Transfer is a wire transfer initiated outside of Increase to your account. + """ + id: str """The inbound wire transfer's identifier.""" + acceptance: Optional[Acceptance] = None + """If the transfer is accepted, this will contain details of the acceptance.""" + account_id: str """The Account to which the transfer belongs.""" @@ -21,24 +63,42 @@ class InboundWireTransfer(BaseModel): amount: int """The amount in USD cents.""" - beneficiary_address_line1: Optional[str] = None + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the inbound wire transfer was created. + """ + + creditor_address_line1: Optional[str] = None """A free-form address field set by the sender.""" - beneficiary_address_line2: Optional[str] = None + creditor_address_line2: Optional[str] = None """A free-form address field set by the sender.""" - beneficiary_address_line3: Optional[str] = None + creditor_address_line3: Optional[str] = None """A free-form address field set by the sender.""" - beneficiary_name: Optional[str] = None + creditor_name: Optional[str] = None """A name set by the sender.""" - beneficiary_reference: Optional[str] = None - """A free-form reference string set by the sender, to help identify the transfer.""" + debtor_address_line1: Optional[str] = None + """A free-form address field set by the sender.""" + + debtor_address_line2: Optional[str] = None + """A free-form address field set by the sender.""" + + debtor_address_line3: Optional[str] = None + """A free-form address field set by the sender.""" + + debtor_name: Optional[str] = None + """A name set by the sender.""" description: str """An Increase-constructed description of the transfer.""" + end_to_end_identification: Optional[str] = None + """A free-form reference string set by the sender, to help identify the transfer.""" + input_message_accountability_data: Optional[str] = None """ A unique identifier available to the originating and receiving banks, commonly @@ -46,38 +106,17 @@ class InboundWireTransfer(BaseModel): service and is helpful when debugging wires with the originating bank. """ - originator_address_line1: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line2: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line3: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_name: Optional[str] = None - """The originator of the wire, set by the sending bank.""" - - originator_routing_number: Optional[str] = None + instructing_agent_routing_number: Optional[str] = None """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. + The American Banking Association (ABA) routing number of the bank that sent the + wire. """ - originator_to_beneficiary_information: Optional[str] = None - """An Increase-created concatenation of the Originator-to-Beneficiary lines.""" - - originator_to_beneficiary_information_line1: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line2: Optional[str] = None - """A free-form message set by the wire originator.""" + instruction_identification: Optional[str] = None + """The sending bank's identifier for the wire transfer.""" - originator_to_beneficiary_information_line3: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line4: Optional[str] = None - """A free-form message set by the wire originator.""" + reversal: Optional[Reversal] = None + """If the transfer is reversed, this will contain details of the reversal.""" status: Literal["pending", "accepted", "declined", "reversed"] """The status of the transfer. @@ -94,3 +133,28 @@ class InboundWireTransfer(BaseModel): For this resource it will always be `inbound_wire_transfer`. """ + + unique_end_to_end_transaction_reference: Optional[str] = None + """ + The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + of the transfer. + """ + + unstructured_remittance_information: Optional[str] = None + """A free-form message set by the sender.""" + + wire_drawdown_request_id: Optional[str] = None + """The wire drawdown request the inbound wire transfer is fulfilling.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/inbound_wire_transfer_list_params.py b/src/increase/types/inbound_wire_transfer_list_params.py index 8c49ebb1f..6c65d52d9 100644 --- a/src/increase/types/inbound_wire_transfer_list_params.py +++ b/src/increase/types/inbound_wire_transfer_list_params.py @@ -2,21 +2,23 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["InboundWireTransferListParams", "CreatedAt"] +__all__ = ["InboundWireTransferListParams", "CreatedAt", "Status"] class InboundWireTransferListParams(TypedDict, total=False): account_id: str - """Filter Inbound Wire Tranfers to ones belonging to the specified Account.""" + """Filter Inbound Wire Transfers to ones belonging to the specified Account.""" account_number_id: str - """Filter Inbound Wire Tranfers to ones belonging to the specified Account Number.""" + """ + Filter Inbound Wire Transfers to ones belonging to the specified Account Number. + """ created_at: CreatedAt @@ -29,14 +31,12 @@ class InboundWireTransferListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ - status: Literal["pending", "accepted", "declined", "reversed"] - """Filter Inbound Wire Transfers to those with the specified status. + status: Status - - `pending` - The Inbound Wire Transfer is awaiting action, will transition - automatically if no action is taken. - - `accepted` - The Inbound Wire Transfer is accepted. - - `declined` - The Inbound Wire Transfer was declined. - - `reversed` - The Inbound Wire Transfer was reversed. + wire_drawdown_request_id: str + """ + Filter Inbound Wire Transfers to ones belonging to the specified Wire Drawdown + Request. """ @@ -64,3 +64,16 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["pending", "accepted", "declined", "reversed"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/inbound_wire_transfer_reverse_params.py b/src/increase/types/inbound_wire_transfer_reverse_params.py new file mode 100644 index 000000000..6bee104c6 --- /dev/null +++ b/src/increase/types/inbound_wire_transfer_reverse_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["InboundWireTransferReverseParams"] + + +class InboundWireTransferReverseParams(TypedDict, total=False): + reason: Required[Literal["duplicate", "creditor_request", "transaction_forbidden"]] + """Reason for the reversal. + + - `duplicate` - The inbound wire transfer was a duplicate. + - `creditor_request` - The recipient of the wire transfer requested the funds be + returned to the sender. + - `transaction_forbidden` - The account cannot currently receive inbound wires. + """ diff --git a/src/increase/types/intrafi/__init__.py b/src/increase/types/intrafi/__init__.py deleted file mode 100644 index 89dd10101..000000000 --- a/src/increase/types/intrafi/__init__.py +++ /dev/null @@ -1,11 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from .intrafi_balance import IntrafiBalance as IntrafiBalance -from .intrafi_exclusion import IntrafiExclusion as IntrafiExclusion -from .exclusion_list_params import ExclusionListParams as ExclusionListParams -from .exclusion_create_params import ExclusionCreateParams as ExclusionCreateParams -from .intrafi_account_enrollment import IntrafiAccountEnrollment as IntrafiAccountEnrollment -from .account_enrollment_list_params import AccountEnrollmentListParams as AccountEnrollmentListParams -from .account_enrollment_create_params import AccountEnrollmentCreateParams as AccountEnrollmentCreateParams diff --git a/src/increase/types/intrafi/exclusion_create_params.py b/src/increase/types/intrafi/exclusion_create_params.py deleted file mode 100644 index 8075260bd..000000000 --- a/src/increase/types/intrafi/exclusion_create_params.py +++ /dev/null @@ -1,15 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["ExclusionCreateParams"] - - -class ExclusionCreateParams(TypedDict, total=False): - bank_name: Required[str] - """The name of the financial institution to be excluded.""" - - entity_id: Required[str] - """The identifier of the Entity whose deposits will be excluded.""" diff --git a/src/increase/types/intrafi/intrafi_balance.py b/src/increase/types/intrafi/intrafi_balance.py deleted file mode 100644 index dfab5414f..000000000 --- a/src/increase/types/intrafi/intrafi_balance.py +++ /dev/null @@ -1,72 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import date -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["IntrafiBalance", "Balance", "BalanceBankLocation"] - - -class BalanceBankLocation(BaseModel): - city: str - """The bank's city.""" - - state: str - """The bank's state.""" - - -class Balance(BaseModel): - balance: int - """The balance, in minor units of `currency`, held with this bank.""" - - bank: str - """The name of the bank holding these funds.""" - - bank_location: Optional[BalanceBankLocation] = None - """The primary location of the bank.""" - - fdic_certificate_number: str - """The Federal Deposit Insurance Corporation (FDIC) certificate number of the bank. - - Because many banks have the same or similar names, this can be used to uniquely - identify the institution. - """ - - -class IntrafiBalance(BaseModel): - balances: List[Balance] - """Each entry represents a balance held at a different bank. - - IntraFi separates the total balance across many participating banks in the - network. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - effective_date: date - """The date this balance reflects.""" - - total_balance: int - """The total balance, in minor units of `currency`. - - Increase reports this balance to IntraFi daily. - """ - - type: Literal["intrafi_balance"] - """A constant representing the object's type. - - For this resource it will always be `intrafi_balance`. - """ diff --git a/src/increase/types/intrafi/intrafi_account_enrollment.py b/src/increase/types/intrafi_account_enrollment.py similarity index 69% rename from src/increase/types/intrafi/intrafi_account_enrollment.py rename to src/increase/types/intrafi_account_enrollment.py index bf22fe514..9d77c7651 100644 --- a/src/increase/types/intrafi/intrafi_account_enrollment.py +++ b/src/increase/types/intrafi_account_enrollment.py @@ -1,20 +1,34 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. from typing import Optional +from datetime import datetime from typing_extensions import Literal -from ..._models import BaseModel +from .._models import BaseModel __all__ = ["IntrafiAccountEnrollment"] class IntrafiAccountEnrollment(BaseModel): + """ + IntraFi is a [network of financial institutions](https://www.intrafi.com/network-banks) that allows Increase users to sweep funds to multiple banks. This enables accounts to become eligible for additional Federal Deposit Insurance Corporation (FDIC) insurance. An IntraFi Account Enrollment object represents the status of an account in the network. Sweeping an account to IntraFi doesn't affect funds availability. + """ + id: str """The identifier of this enrollment at IntraFi.""" account_id: str """The identifier of the Increase Account being swept into the network.""" + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the enrollment was created. + """ + + email_address: Optional[str] = None + """The contact email for the account owner, to be shared with IntraFi.""" + idempotency_key: Optional[str] = None """The idempotency key you chose for this object. diff --git a/src/increase/types/intrafi/account_enrollment_create_params.py b/src/increase/types/intrafi_account_enrollment_create_params.py similarity index 76% rename from src/increase/types/intrafi/account_enrollment_create_params.py rename to src/increase/types/intrafi_account_enrollment_create_params.py index a213e0882..0445b37ae 100644 --- a/src/increase/types/intrafi/account_enrollment_create_params.py +++ b/src/increase/types/intrafi_account_enrollment_create_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["AccountEnrollmentCreateParams"] +__all__ = ["IntrafiAccountEnrollmentCreateParams"] -class AccountEnrollmentCreateParams(TypedDict, total=False): +class IntrafiAccountEnrollmentCreateParams(TypedDict, total=False): account_id: Required[str] """The identifier for the account to be added to IntraFi.""" diff --git a/src/increase/types/intrafi/account_enrollment_list_params.py b/src/increase/types/intrafi_account_enrollment_list_params.py similarity index 90% rename from src/increase/types/intrafi/account_enrollment_list_params.py rename to src/increase/types/intrafi_account_enrollment_list_params.py index 86247eb1c..a20c00571 100644 --- a/src/increase/types/intrafi/account_enrollment_list_params.py +++ b/src/increase/types/intrafi_account_enrollment_list_params.py @@ -5,10 +5,10 @@ from typing import List from typing_extensions import Literal, TypedDict -__all__ = ["AccountEnrollmentListParams", "Status"] +__all__ = ["IntrafiAccountEnrollmentListParams", "Status"] -class AccountEnrollmentListParams(TypedDict, total=False): +class IntrafiAccountEnrollmentListParams(TypedDict, total=False): account_id: str """Filter IntraFi Account Enrollments to the one belonging to an account.""" diff --git a/src/increase/types/intrafi_balance.py b/src/increase/types/intrafi_balance.py new file mode 100644 index 000000000..bab736f39 --- /dev/null +++ b/src/increase/types/intrafi_balance.py @@ -0,0 +1,99 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, List, Optional +from datetime import date +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["IntrafiBalance", "Balance", "BalanceBankLocation"] + + +class BalanceBankLocation(BaseModel): + """The primary location of the bank.""" + + city: str + """The bank's city.""" + + state: str + """The bank's state.""" + + +class Balance(BaseModel): + balance: int + """The balance, in minor units of `currency`, held with this bank.""" + + bank: str + """The name of the bank holding these funds.""" + + bank_location: Optional[BalanceBankLocation] = None + """The primary location of the bank.""" + + fdic_certificate_number: str + """The Federal Deposit Insurance Corporation (FDIC) certificate number of the bank. + + Because many banks have the same or similar names, this can be used to uniquely + identify the institution. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class IntrafiBalance(BaseModel): + """ + When using IntraFi, each account's balance over the standard FDIC insurance amount is swept to various other institutions. Funds are rebalanced across banks as needed once per business day. + """ + + balances: List[Balance] + """Each entry represents a balance held at a different bank. + + IntraFi separates the total balance across many participating banks in the + network. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the account + currency. + + - `USD` - US Dollar (USD) + """ + + effective_date: date + """The date this balance reflects.""" + + total_balance: int + """The total balance, in minor units of `currency`. + + Increase reports this balance to IntraFi daily. + """ + + type: Literal["intrafi_balance"] + """A constant representing the object's type. + + For this resource it will always be `intrafi_balance`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/intrafi/intrafi_exclusion.py b/src/increase/types/intrafi_exclusion.py similarity index 69% rename from src/increase/types/intrafi/intrafi_exclusion.py rename to src/increase/types/intrafi_exclusion.py index 775fbfae3..bca24828e 100644 --- a/src/increase/types/intrafi/intrafi_exclusion.py +++ b/src/increase/types/intrafi_exclusion.py @@ -4,18 +4,28 @@ from datetime import datetime from typing_extensions import Literal -from ..._models import BaseModel +from .._models import BaseModel __all__ = ["IntrafiExclusion"] class IntrafiExclusion(BaseModel): + """ + Certain institutions may be excluded per Entity when sweeping funds into the IntraFi network. This is useful when an Entity already has deposits at a particular bank, and does not want to sweep additional funds to it. It may take 5 business days for an exclusion to be processed. + """ + id: str """The identifier of this exclusion request.""" - bank_name: str + bank_name: Optional[str] = None """The name of the excluded institution.""" + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the exclusion was created. + """ + entity_id: str """The entity for which this institution is excluded.""" @@ -36,12 +46,14 @@ class IntrafiExclusion(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ - status: Literal["pending", "completed", "archived"] + status: Literal["pending", "completed", "archived", "ineligible"] """The status of the exclusion request. - `pending` - The exclusion is being added to the IntraFi network. - `completed` - The exclusion has been added to the IntraFi network. - `archived` - The exclusion has been removed from the IntraFi network. + - `ineligible` - The exclusion wasn't eligible to be added to the IntraFi + network. """ submitted_at: Optional[datetime] = None diff --git a/src/increase/types/intrafi_exclusion_create_params.py b/src/increase/types/intrafi_exclusion_create_params.py new file mode 100644 index 000000000..62926b177 --- /dev/null +++ b/src/increase/types/intrafi_exclusion_create_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["IntrafiExclusionCreateParams"] + + +class IntrafiExclusionCreateParams(TypedDict, total=False): + entity_id: Required[str] + """The identifier of the Entity whose deposits will be excluded.""" + + fdic_certificate_number: Required[str] + """The FDIC certificate number of the financial institution to be excluded. + + An FDIC certificate number uniquely identifies a financial institution, and is + different than a routing number. To find one, we recommend searching by Bank + Name using the + [FDIC's bankfind tool](https://banks.data.fdic.gov/bankfind-suite/bankfind). + """ diff --git a/src/increase/types/intrafi/exclusion_list_params.py b/src/increase/types/intrafi_exclusion_list_params.py similarity index 88% rename from src/increase/types/intrafi/exclusion_list_params.py rename to src/increase/types/intrafi_exclusion_list_params.py index 07d9859fb..8b20a277e 100644 --- a/src/increase/types/intrafi/exclusion_list_params.py +++ b/src/increase/types/intrafi_exclusion_list_params.py @@ -4,10 +4,10 @@ from typing_extensions import TypedDict -__all__ = ["ExclusionListParams"] +__all__ = ["IntrafiExclusionListParams"] -class ExclusionListParams(TypedDict, total=False): +class IntrafiExclusionListParams(TypedDict, total=False): cursor: str """Return the page of entries after this one.""" diff --git a/src/increase/types/lockbox.py b/src/increase/types/lockbox.py new file mode 100644 index 000000000..76a76c374 --- /dev/null +++ b/src/increase/types/lockbox.py @@ -0,0 +1,107 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime +from typing_extensions import Literal + +from pydantic import Field as FieldInfo + +from .._models import BaseModel + +__all__ = ["Lockbox", "Address"] + + +class Address(BaseModel): + """The mailing address for the Lockbox.""" + + city: str + """The city of the address.""" + + line1: str + """The first line of the address.""" + + line2: str + """The second line of the address.""" + + postal_code: str + """The postal code of the address.""" + + recipient: Optional[str] = None + """The recipient line of the address. + + This will include the recipient name you provide when creating the address, as + well as an ATTN suffix to help route the mail to your lockbox. Mail senders must + include this ATTN line to receive mail at this Lockbox. + """ + + state: str + """ + The two-letter United States Postal Service (USPS) abbreviation for the state of + the address. + """ + + +class Lockbox(BaseModel): + """Lockboxes are physical locations that can receive mail containing paper checks. + + Increase will automatically create a Check Deposit for checks received this way. + """ + + id: str + """The Lockbox identifier.""" + + account_id: str + """ + The identifier for the Account checks sent to this lockbox will be deposited + into. + """ + + address: Address + """The mailing address for the Lockbox.""" + + check_deposit_behavior: Literal["enabled", "disabled", "pend_for_processing"] + """Indicates if checks mailed to this lockbox will be deposited. + + - `enabled` - Checks mailed to this Lockbox will be deposited. + - `disabled` - Checks mailed to this Lockbox will not be deposited. + - `pend_for_processing` - Checks mailed to this Lockbox will be pending until + actioned. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the Lockbox + was created. + """ + + description: Optional[str] = None + """The description you choose for the Lockbox.""" + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + recipient_name: Optional[str] = None + """The recipient name you choose for the Lockbox.""" + + type: Literal["lockbox"] + """A constant representing the object's type. + + For this resource it will always be `lockbox`. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/lockbox_create_params.py b/src/increase/types/lockbox_create_params.py new file mode 100644 index 000000000..bea106ab9 --- /dev/null +++ b/src/increase/types/lockbox_create_params.py @@ -0,0 +1,18 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["LockboxCreateParams"] + + +class LockboxCreateParams(TypedDict, total=False): + account_id: Required[str] + """The Account checks sent to this Lockbox should be deposited into.""" + + description: str + """The description you choose for the Lockbox, for display purposes.""" + + recipient_name: str + """The name of the recipient that will receive mail at this location.""" diff --git a/src/increase/types/real_time_payments_request_for_payment_list_params.py b/src/increase/types/lockbox_list_params.py similarity index 86% rename from src/increase/types/real_time_payments_request_for_payment_list_params.py rename to src/increase/types/lockbox_list_params.py index 51749cf2a..4cf817765 100644 --- a/src/increase/types/real_time_payments_request_for_payment_list_params.py +++ b/src/increase/types/lockbox_list_params.py @@ -8,15 +8,12 @@ from .._utils import PropertyInfo -__all__ = ["RealTimePaymentsRequestForPaymentListParams", "CreatedAt"] +__all__ = ["LockboxListParams", "CreatedAt"] -class RealTimePaymentsRequestForPaymentListParams(TypedDict, total=False): +class LockboxListParams(TypedDict, total=False): account_id: str - """ - Filter Real-Time Payments Request for Payments to those destined to the - specified Account. - """ + """Filter Lockboxes to those associated with the provided Account.""" created_at: CreatedAt diff --git a/src/increase/types/lockbox_update_params.py b/src/increase/types/lockbox_update_params.py new file mode 100644 index 000000000..ce7a4e72e --- /dev/null +++ b/src/increase/types/lockbox_update_params.py @@ -0,0 +1,24 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["LockboxUpdateParams"] + + +class LockboxUpdateParams(TypedDict, total=False): + check_deposit_behavior: Literal["enabled", "disabled", "pend_for_processing"] + """This indicates if checks mailed to this lockbox will be deposited. + + - `enabled` - Checks mailed to this Lockbox will be deposited. + - `disabled` - Checks mailed to this Lockbox will not be deposited. + - `pend_for_processing` - Checks mailed to this Lockbox will be pending until + actioned. + """ + + description: str + """The description you choose for the Lockbox.""" + + recipient_name: str + """The recipient name you choose for the Lockbox.""" diff --git a/src/increase/types/oauth_application.py b/src/increase/types/oauth_application.py new file mode 100644 index 000000000..dc9ccb187 --- /dev/null +++ b/src/increase/types/oauth_application.py @@ -0,0 +1,52 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["OAuthApplication"] + + +class OAuthApplication(BaseModel): + """ + An OAuth Application lets you build an application for others to use with their Increase data. You can create an OAuth Application via the Dashboard and read information about it with the API. Learn more about OAuth [here](https://increase.com/documentation/oauth). + """ + + id: str + """The OAuth Application's identifier.""" + + client_id: str + """The OAuth Application's client_id. + + Use this to authenticate with the OAuth Application. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp when the OAuth + Application was created. + """ + + deleted_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp when the OAuth + Application was deleted. + """ + + name: Optional[str] = None + """The name you chose for this OAuth Application.""" + + status: Literal["active", "deleted"] + """Whether the application is active. + + - `active` - The application is active and can be used by your users. + - `deleted` - The application is deleted. + """ + + type: Literal["oauth_application"] + """A constant representing the object's type. + + For this resource it will always be `oauth_application`. + """ diff --git a/src/increase/types/document_list_params.py b/src/increase/types/oauth_application_list_params.py similarity index 75% rename from src/increase/types/document_list_params.py rename to src/increase/types/oauth_application_list_params.py index 28b6507cb..f0069a737 100644 --- a/src/increase/types/document_list_params.py +++ b/src/increase/types/oauth_application_list_params.py @@ -8,38 +8,22 @@ from .._utils import PropertyInfo -__all__ = ["DocumentListParams", "Category", "CreatedAt"] +__all__ = ["OAuthApplicationListParams", "CreatedAt", "Status"] -class DocumentListParams(TypedDict, total=False): - category: Category - +class OAuthApplicationListParams(TypedDict, total=False): created_at: CreatedAt cursor: str """Return the page of entries after this one.""" - entity_id: str - """Filter Documents to ones belonging to the specified Entity.""" - limit: int """Limit the size of the list that is returned. The default (and maximum) is 100 objects. """ - -_CategoryReservedKeywords = TypedDict( - "_CategoryReservedKeywords", - { - "in": List[Literal["form_1099_int", "proof_of_authorization", "company_information"]], - }, - total=False, -) - - -class Category(_CategoryReservedKeywords, total=False): - pass + status: Status class CreatedAt(TypedDict, total=False): @@ -66,3 +50,16 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["active", "deleted"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/oauth_connection.py b/src/increase/types/oauth_connection.py index 26f037b1f..db8f2fc0f 100644 --- a/src/increase/types/oauth_connection.py +++ b/src/increase/types/oauth_connection.py @@ -1,5 +1,6 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. +from typing import Optional from datetime import datetime from typing_extensions import Literal @@ -9,6 +10,10 @@ class OAuthConnection(BaseModel): + """ + When a user authorizes your OAuth application, an OAuth Connection object is created. Learn more about OAuth [here](https://increase.com/documentation/oauth). + """ + id: str """The OAuth Connection's identifier.""" @@ -18,9 +23,18 @@ class OAuthConnection(BaseModel): Connection was created. """ + deleted_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp when the OAuth + Connection was deleted. + """ + group_id: str """The identifier of the Group that has authorized your OAuth application.""" + oauth_application_id: str + """The identifier of the OAuth application this connection is for.""" + status: Literal["active", "inactive"] """Whether the connection is active. diff --git a/src/increase/types/oauth_connection_list_params.py b/src/increase/types/oauth_connection_list_params.py index d31e00bcf..152563d20 100644 --- a/src/increase/types/oauth_connection_list_params.py +++ b/src/increase/types/oauth_connection_list_params.py @@ -2,9 +2,10 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import List +from typing_extensions import Literal, TypedDict -__all__ = ["OAuthConnectionListParams"] +__all__ = ["OAuthConnectionListParams", "Status"] class OAuthConnectionListParams(TypedDict, total=False): @@ -16,3 +17,24 @@ class OAuthConnectionListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ + + oauth_application_id: str + """ + Filter results to only include OAuth Connections for a specific OAuth + Application. + """ + + status: Status + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["active", "inactive"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/oauth_token.py b/src/increase/types/oauth_token.py index 0b7af4b96..7013e173e 100644 --- a/src/increase/types/oauth_token.py +++ b/src/increase/types/oauth_token.py @@ -8,12 +8,19 @@ class OAuthToken(BaseModel): + """ + A token that is returned to your application when a user completes the OAuth flow and may be used to authenticate requests. Learn more about OAuth [here](/documentation/oauth). + """ + access_token: str """ You may use this token in place of an API key to make OAuth requests on a user's behalf. """ + group_id: str + """The Group's identifier. A Group is the top-level organization in Increase.""" + token_type: Literal["bearer"] """The type of OAuth token.""" diff --git a/src/increase/types/oauth_token_create_params.py b/src/increase/types/oauth_token_create_params.py index 86b11b79f..f5264b3fa 100644 --- a/src/increase/types/oauth_token_create_params.py +++ b/src/increase/types/oauth_token_create_params.py @@ -24,7 +24,7 @@ class OAuthTokenCreateParams(TypedDict, total=False): client_secret: str """The secret that confirms you own the application. - This is redundent given that the request is made with your API key but it's a + This is redundant given that the request is made with your API key but it's a required component of OAuth 2.0. """ diff --git a/src/increase/types/pending_transaction.py b/src/increase/types/pending_transaction.py index 3ea94a711..7c68bde21 100644 --- a/src/increase/types/pending_transaction.py +++ b/src/increase/types/pending_transaction.py @@ -1,9 +1,11 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = [ @@ -11,57 +13,368 @@ "Source", "SourceAccountTransferInstruction", "SourceACHTransferInstruction", + "SourceBlockchainOfframpTransferInstruction", + "SourceBlockchainOnrampTransferInstruction", "SourceCardAuthorization", + "SourceCardAuthorizationAdditionalAmounts", + "SourceCardAuthorizationAdditionalAmountsClinic", + "SourceCardAuthorizationAdditionalAmountsDental", + "SourceCardAuthorizationAdditionalAmountsOriginal", + "SourceCardAuthorizationAdditionalAmountsPrescription", + "SourceCardAuthorizationAdditionalAmountsSurcharge", + "SourceCardAuthorizationAdditionalAmountsTotalCumulative", + "SourceCardAuthorizationAdditionalAmountsTotalHealthcare", + "SourceCardAuthorizationAdditionalAmountsTransit", + "SourceCardAuthorizationAdditionalAmountsUnknown", + "SourceCardAuthorizationAdditionalAmountsVision", "SourceCardAuthorizationNetworkDetails", + "SourceCardAuthorizationNetworkDetailsPulse", "SourceCardAuthorizationNetworkDetailsVisa", "SourceCardAuthorizationNetworkIdentifiers", + "SourceCardAuthorizationSchemeFee", "SourceCardAuthorizationVerification", "SourceCardAuthorizationVerificationCardVerificationCode", "SourceCardAuthorizationVerificationCardholderAddress", + "SourceCardAuthorizationVerificationCardholderName", + "SourceCardPushTransferInstruction", "SourceCheckDepositInstruction", "SourceCheckTransferInstruction", + "SourceFednowTransferInstruction", "SourceInboundFundsHold", + "SourceInboundWireTransferReversal", + "SourceOther", "SourceRealTimePaymentsTransferInstruction", + "SourceSwiftTransferInstruction", "SourceWireTransferInstruction", ] class SourceAccountTransferInstruction(BaseModel): + """An Account Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `account_transfer_instruction`. + """ + amount: int """The pending amount in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination account currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ transfer_id: str """The identifier of the Account Transfer that led to this Pending Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceACHTransferInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. + """An ACH Transfer Instruction object. - For dollars, for example, this is cents. + This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_instruction`. """ + amount: int + """The pending amount in USD cents.""" + transfer_id: str """The identifier of the ACH Transfer that led to this Pending Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceBlockchainOfframpTransferInstruction(BaseModel): + """A Blockchain Off-Ramp Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `blockchain_offramp_transfer_instruction`. + """ + + source_blockchain_address_id: str + """The identifier of the Blockchain Address the funds were received at.""" + + transfer_id: str + """ + The identifier of the Blockchain Off-Ramp Transfer that led to this Transaction. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceBlockchainOnrampTransferInstruction(BaseModel): + """A Blockchain On-Ramp Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `blockchain_onramp_transfer_instruction`. + """ + + amount: int + """The transfer amount in USD cents.""" + + destination_blockchain_address: str + """The blockchain address the funds are being sent to.""" + + transfer_id: str + """ + The identifier of the Blockchain On-Ramp Transfer that led to this Pending + Transaction. + """ + + +class SourceCardAuthorizationAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class SourceCardAuthorizationAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[SourceCardAuthorizationAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[SourceCardAuthorizationAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[SourceCardAuthorizationAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[SourceCardAuthorizationAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[SourceCardAuthorizationAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[SourceCardAuthorizationAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[SourceCardAuthorizationAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[SourceCardAuthorizationAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[SourceCardAuthorizationAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[SourceCardAuthorizationAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class SourceCardAuthorizationNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + class SourceCardAuthorizationNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + electronic_commerce_indicator: Optional[ Literal[ "mail_phone_order", @@ -104,7 +417,7 @@ class SourceCardAuthorizationNetworkDetailsVisa(BaseModel): 3-D Secure program. - `non_authenticated_security_transaction` - Non-authenticated security transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed + encryption for security however, cardholder authentication is not performed using 3-D Secure. - `non_secure_transaction` - Non-secure transaction: Use to identify an electronic commerce transaction that has no data protection. @@ -143,19 +456,106 @@ class SourceCardAuthorizationNetworkDetailsVisa(BaseModel): verification value """ + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + class SourceCardAuthorizationNetworkDetails(BaseModel): - category: Literal["visa"] + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] """The payment network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ + pulse: Optional[SourceCardAuthorizationNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + visa: Optional[SourceCardAuthorizationNetworkDetailsVisa] = None """Fields specific to the `visa` network.""" class SourceCardAuthorizationNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -176,7 +576,163 @@ class SourceCardAuthorizationNetworkIdentifiers(BaseModel): """ +class SourceCardAuthorizationSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + class SourceCardAuthorizationVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + result: Literal["not_checked", "match", "no_match"] """The result of verifying the Card Verification Code. @@ -188,6 +744,10 @@ class SourceCardAuthorizationVerificationCardVerificationCode(BaseModel): class SourceCardAuthorizationVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + actual_line1: Optional[str] = None """Line 1 of the address on file for the cardholder.""" @@ -205,27 +765,43 @@ class SourceCardAuthorizationVerificationCardholderAddress(BaseModel): result: Literal[ "not_checked", - "postal_code_match_address_not_checked", "postal_code_match_address_no_match", "postal_code_no_match_address_match", "match", "no_match", + "postal_code_match_address_not_checked", ] """The address verification result returned to the card network. - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. + - `not_checked` - No address information was provided in the authorization + request. - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. + address does not match or was not provided. - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. + street address matches or was not provided. - `match` - Postal code and street address match. - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) """ +class SourceCardAuthorizationVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + class SourceCardAuthorizationVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + card_verification_code: SourceCardAuthorizationVerificationCardVerificationCode """ Fields related to verification of the Card Verification Code, a 3-digit code on @@ -238,8 +814,16 @@ class SourceCardAuthorizationVerification(BaseModel): we verified it against. """ + cardholder_name: Optional[SourceCardAuthorizationVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + class SourceCardAuthorization(BaseModel): + """A Card Authorization object. + + This field will be present in the JSON response if and only if `category` is equal to `card_authorization`. Card Authorizations are temporary holds placed on a customer's funds with the intent to later clear a transaction. + """ + id: str """The Card Authorization identifier.""" @@ -254,25 +838,27 @@ class SourceCardAuthorization(BaseModel): processing. """ + additional_amounts: SourceCardAuthorizationAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + amount: int """The pending amount in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ - card_payment_id: Optional[str] = None + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -284,7 +870,7 @@ class SourceCardAuthorization(BaseModel): direction: Literal["settlement", "refund"] """ - The direction descibes the direction the funds will move, either from the + The direction describes the direction the funds will move, either from the cardholder to the merchant or from the merchant to the cardholder. - `settlement` - A regular card authorization where funds are debited from the @@ -305,7 +891,7 @@ class SourceCardAuthorization(BaseModel): is transacting with. """ - merchant_category_code: Optional[str] = None + merchant_category_code: str """ The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is transacting with. @@ -314,12 +900,22 @@ class SourceCardAuthorization(BaseModel): merchant_city: Optional[str] = None """The city the merchant resides in.""" - merchant_country: Optional[str] = None + merchant_country: str """The country the merchant resides in.""" merchant_descriptor: str """The merchant descriptor of the merchant the card is transacting with.""" + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + network_details: SourceCardAuthorizationNetworkDetails """Fields specific to the `network`.""" @@ -330,7 +926,8 @@ class SourceCardAuthorization(BaseModel): """The risk score generated by the card network. For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. """ pending_transaction_id: Optional[str] = None @@ -342,8 +939,26 @@ class SourceCardAuthorization(BaseModel): that was used. """ + presentment_amount: int + """The pending amount in the minor unit of the transaction's presentment currency.""" + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + "unknown", ] """ The processing category describes the intent behind the authorization, such as @@ -356,11 +971,18 @@ class SourceCardAuthorization(BaseModel): being known. They are followed by an advice message that updates the amount of the pending transaction. - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. - `purchase` - A regular purchase. - `quasi_cash` - Quasi-cash transactions represent purchases of items which may be convertible to cash. - `refund` - A refund card authorization, sometimes referred to as a credit voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + - `unknown` - The processing category is unknown. """ real_time_decision_id: Optional[str] = None @@ -369,6 +991,15 @@ class SourceCardAuthorization(BaseModel): transaction. """ + scheme_fees: List[SourceCardAuthorizationSchemeFee] + """The scheme fees associated with this card authorization.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + type: Literal["card_authorization"] """A constant representing the object's type. @@ -378,14 +1009,41 @@ class SourceCardAuthorization(BaseModel): verification: SourceCardAuthorizationVerification """Fields related to verification of cardholder-provided values.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCardPushTransferInstruction(BaseModel): + """A Card Push Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `card_push_transfer_instruction`. + """ -class SourceCheckDepositInstruction(BaseModel): amount: int - """The pending amount in the minor unit of the transaction's currency. + """The transfer amount in USD cents.""" - For dollars, for example, this is cents. + transfer_id: str + """The identifier of the Card Push Transfer that led to this Pending Transaction.""" + + +class SourceCheckDepositInstruction(BaseModel): + """A Check Deposit Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `check_deposit_instruction`. """ + amount: int + """The pending amount in USD cents.""" + back_image_file_id: Optional[str] = None """ The identifier of the File containing the image of the back of the check that @@ -395,16 +1053,11 @@ class SourceCheckDepositInstruction(BaseModel): check_deposit_id: Optional[str] = None """The identifier of the Check Deposit.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -414,34 +1067,79 @@ class SourceCheckDepositInstruction(BaseModel): was deposited. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceCheckTransferInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. + """A Check Transfer Instruction object. - For dollars, for example, this is cents. + This field will be present in the JSON response if and only if `category` is equal to `check_transfer_instruction`. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + amount: int + """The transfer amount in USD cents.""" + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ transfer_id: str """The identifier of the Check Transfer that led to this Pending Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceFednowTransferInstruction(BaseModel): + """A FedNow Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `fednow_transfer_instruction`. + """ + + transfer_id: str + """The identifier of the FedNow Transfer that led to this Pending Transaction.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceInboundFundsHold(BaseModel): - id: str - """The Inbound Funds Hold identifier.""" + """An Inbound Funds Hold object. + + This field will be present in the JSON response if and only if `category` is equal to `inbound_funds_hold`. We hold funds for certain transaction types to account for return windows where funds might still be clawed back by the sending institution. + """ amount: int """The held amount in the minor unit of the account's currency. @@ -461,16 +1159,11 @@ class SourceInboundFundsHold(BaseModel): was created. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -496,14 +1189,58 @@ class SourceInboundFundsHold(BaseModel): For this resource it will always be `inbound_funds_hold`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceInboundWireTransferReversal(BaseModel): + """An Inbound Wire Transfer Reversal object. + + This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_transfer_reversal`. An Inbound Wire Transfer Reversal is created when Increase has received a wire and the User requests that it be reversed. + """ + + inbound_wire_transfer_id: str + """The ID of the Inbound Wire Transfer that is being reversed.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceOther(BaseModel): + """ + If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. + """ + + pass + class SourceRealTimePaymentsTransferInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. + """A Real-Time Payments Transfer Instruction object. - For dollars, for example, this is cents. + This field will be present in the JSON response if and only if `category` is equal to `real_time_payments_transfer_instruction`. """ + amount: int + """The transfer amount in USD cents.""" + transfer_id: str """ The identifier of the Real-Time Payments Transfer that led to this Pending @@ -511,15 +1248,39 @@ class SourceRealTimePaymentsTransferInstruction(BaseModel): """ +class SourceSwiftTransferInstruction(BaseModel): + """A Swift Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `swift_transfer_instruction`. + """ + + transfer_id: str + """The identifier of the Swift Transfer that led to this Pending Transaction.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + class SourceWireTransferInstruction(BaseModel): + """A Wire Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is equal to `wire_transfer_instruction`. + """ + account_number: str """The account number for the destination account.""" amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ + """The transfer amount in USD cents.""" message_to_recipient: str """The message that will show on the recipient's bank statement.""" @@ -533,27 +1294,22 @@ class SourceWireTransferInstruction(BaseModel): transfer_id: str """The identifier of the Wire Transfer that led to this Pending Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class Source(BaseModel): - account_transfer_instruction: Optional[SourceAccountTransferInstruction] = None - """An Account Transfer Instruction object. - - This field will be present in the JSON response if and only if `category` is - equal to `account_transfer_instruction`. - """ + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - ach_transfer_instruction: Optional[SourceACHTransferInstruction] = None - """An ACH Transfer Instruction object. - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_instruction`. +class Source(BaseModel): """ - - card_authorization: Optional[SourceCardAuthorization] = None - """A Card Authorization object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_authorization`. + This is an object giving more details on the network-level event that caused the Pending Transaction. For example, for a card transaction this lists the merchant's industry and location. """ category: Literal[ @@ -562,9 +1318,16 @@ class Source(BaseModel): "card_authorization", "check_deposit_instruction", "check_transfer_instruction", + "fednow_transfer_instruction", "inbound_funds_hold", + "user_initiated_hold", "real_time_payments_transfer_instruction", "wire_transfer_instruction", + "inbound_wire_transfer_reversal", + "swift_transfer_instruction", + "card_push_transfer_instruction", + "blockchain_onramp_transfer_instruction", + "blockchain_offramp_transfer_instruction", "other", ] """The type of the resource. @@ -582,17 +1345,76 @@ class Source(BaseModel): the `check_deposit_instruction` object. - `check_transfer_instruction` - Check Transfer Instruction: details will be under the `check_transfer_instruction` object. + - `fednow_transfer_instruction` - FedNow Transfer Instruction: details will be + under the `fednow_transfer_instruction` object. - `inbound_funds_hold` - Inbound Funds Hold: details will be under the `inbound_funds_hold` object. + - `user_initiated_hold` - User Initiated Hold: details will be under the + `user_initiated_hold` object. - `real_time_payments_transfer_instruction` - Real-Time Payments Transfer Instruction: details will be under the `real_time_payments_transfer_instruction` object. - `wire_transfer_instruction` - Wire Transfer Instruction: details will be under the `wire_transfer_instruction` object. + - `inbound_wire_transfer_reversal` - Inbound Wire Transfer Reversal: details + will be under the `inbound_wire_transfer_reversal` object. + - `swift_transfer_instruction` - Swift Transfer Instruction: details will be + under the `swift_transfer_instruction` object. + - `card_push_transfer_instruction` - Card Push Transfer Instruction: details + will be under the `card_push_transfer_instruction` object. + - `blockchain_onramp_transfer_instruction` - Blockchain On-Ramp Transfer + Instruction: details will be under the + `blockchain_onramp_transfer_instruction` object. + - `blockchain_offramp_transfer_instruction` - Blockchain Off-Ramp Transfer + Instruction: details will be under the + `blockchain_offramp_transfer_instruction` object. - `other` - The Pending Transaction was made for an undocumented or deprecated reason. """ + account_transfer_instruction: Optional[SourceAccountTransferInstruction] = None + """An Account Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is + equal to `account_transfer_instruction`. + """ + + ach_transfer_instruction: Optional[SourceACHTransferInstruction] = None + """An ACH Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is + equal to `ach_transfer_instruction`. + """ + + blockchain_offramp_transfer_instruction: Optional[SourceBlockchainOfframpTransferInstruction] = None + """A Blockchain Off-Ramp Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is + equal to `blockchain_offramp_transfer_instruction`. + """ + + blockchain_onramp_transfer_instruction: Optional[SourceBlockchainOnrampTransferInstruction] = None + """A Blockchain On-Ramp Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is + equal to `blockchain_onramp_transfer_instruction`. + """ + + card_authorization: Optional[SourceCardAuthorization] = None + """A Card Authorization object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_authorization`. Card Authorizations are temporary holds placed on + a customer's funds with the intent to later clear a transaction. + """ + + card_push_transfer_instruction: Optional[SourceCardPushTransferInstruction] = None + """A Card Push Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_push_transfer_instruction`. + """ + check_deposit_instruction: Optional[SourceCheckDepositInstruction] = None """A Check Deposit Instruction object. @@ -607,11 +1429,35 @@ class Source(BaseModel): equal to `check_transfer_instruction`. """ + fednow_transfer_instruction: Optional[SourceFednowTransferInstruction] = None + """A FedNow Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is + equal to `fednow_transfer_instruction`. + """ + inbound_funds_hold: Optional[SourceInboundFundsHold] = None """An Inbound Funds Hold object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_funds_hold`. + equal to `inbound_funds_hold`. We hold funds for certain transaction types to + account for return windows where funds might still be clawed back by the sending + institution. + """ + + inbound_wire_transfer_reversal: Optional[SourceInboundWireTransferReversal] = None + """An Inbound Wire Transfer Reversal object. + + This field will be present in the JSON response if and only if `category` is + equal to `inbound_wire_transfer_reversal`. An Inbound Wire Transfer Reversal is + created when Increase has received a wire and the User requests that it be + reversed. + """ + + other: Optional[SourceOther] = None + """ + If the category of this Transaction source is equal to `other`, this field will + contain an empty object, otherwise it will contain null. """ real_time_payments_transfer_instruction: Optional[SourceRealTimePaymentsTransferInstruction] = None @@ -621,6 +1467,21 @@ class Source(BaseModel): equal to `real_time_payments_transfer_instruction`. """ + swift_transfer_instruction: Optional[SourceSwiftTransferInstruction] = None + """A Swift Transfer Instruction object. + + This field will be present in the JSON response if and only if `category` is + equal to `swift_transfer_instruction`. + """ + + user_initiated_hold: Optional[Dict[str, object]] = None + """An User Initiated Hold object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_initiated_hold`. Created when a user initiates a hold on funds in + their account. + """ + wire_transfer_instruction: Optional[SourceWireTransferInstruction] = None """A Wire Transfer Instruction object. @@ -628,8 +1489,24 @@ class Source(BaseModel): equal to `wire_transfer_instruction`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class PendingTransaction(BaseModel): + """ + Pending Transactions are potential future additions and removals of money from your bank account. They impact your available balance, but not your current balance. To learn more, see [Transactions and Transfers](/documentation/transactions-transfers). + """ + id: str """The Pending Transaction identifier.""" @@ -654,17 +1531,12 @@ class PendingTransaction(BaseModel): Transaction occurred. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Pending Transaction's currency. This will match the currency on the Pending Transaction's Account. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -675,17 +1547,25 @@ class PendingTransaction(BaseModel): the vendor provides. """ + held_amount: int + """ + The amount that this Pending Transaction decrements the available balance of its + Account. This is usually the same as `amount`, but will differ if the amount is + positive. + """ + route_id: Optional[str] = None """The identifier for the route this Pending Transaction came through. Routes are things like cards and ACH details. """ - route_type: Optional[Literal["account_number", "card"]] = None + route_type: Optional[Literal["account_number", "card", "lockbox"]] = None """The type of the route this Pending Transaction came through. - `account_number` - An Account Number. - `card` - A Card. + - `lockbox` - A Lockbox. """ source: Source @@ -711,3 +1591,15 @@ class PendingTransaction(BaseModel): For this resource it will always be `pending_transaction`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/pending_transaction_create_params.py b/src/increase/types/pending_transaction_create_params.py new file mode 100644 index 000000000..3d3f2f798 --- /dev/null +++ b/src/increase/types/pending_transaction_create_params.py @@ -0,0 +1,22 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["PendingTransactionCreateParams"] + + +class PendingTransactionCreateParams(TypedDict, total=False): + account_id: Required[str] + """The Account to place the hold on.""" + + amount: Required[int] + """The amount to hold in the minor unit of the account's currency. + + For dollars, for example, this is cents. This should be a negative amount - to + hold $1.00 from the account, you would pass -100. + """ + + description: str + """The description you choose to give the hold.""" diff --git a/src/increase/types/pending_transaction_list_params.py b/src/increase/types/pending_transaction_list_params.py index 9a1fac279..64ffeb23c 100644 --- a/src/increase/types/pending_transaction_list_params.py +++ b/src/increase/types/pending_transaction_list_params.py @@ -31,9 +31,6 @@ class PendingTransactionListParams(TypedDict, total=False): route_id: str """Filter pending transactions to those belonging to the specified Route.""" - source_id: str - """Filter pending transactions to those caused by the specified source.""" - status: Status @@ -47,9 +44,16 @@ class PendingTransactionListParams(TypedDict, total=False): "card_authorization", "check_deposit_instruction", "check_transfer_instruction", + "fednow_transfer_instruction", "inbound_funds_hold", + "user_initiated_hold", "real_time_payments_transfer_instruction", "wire_transfer_instruction", + "inbound_wire_transfer_reversal", + "swift_transfer_instruction", + "card_push_transfer_instruction", + "blockchain_onramp_transfer_instruction", + "blockchain_offramp_transfer_instruction", "other", ] ], diff --git a/src/increase/types/physical_card.py b/src/increase/types/physical_card.py index 9772051ea..8141cee42 100644 --- a/src/increase/types/physical_card.py +++ b/src/increase/types/physical_card.py @@ -1,15 +1,17 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import List, Optional from datetime import datetime from typing_extensions import Literal from .._models import BaseModel -__all__ = ["PhysicalCard", "Cardholder", "Shipment", "ShipmentAddress", "ShipmentTracking"] +__all__ = ["PhysicalCard", "Cardholder", "Shipment", "ShipmentAddress", "ShipmentTracking", "ShipmentTrackingUpdate"] class Cardholder(BaseModel): + """Details about the cardholder, as it appears on the printed card.""" + first_name: str """The cardholder's first name.""" @@ -18,9 +20,14 @@ class Cardholder(BaseModel): class ShipmentAddress(BaseModel): + """The location to where the card's packing label is addressed.""" + city: str """The city of the shipping address.""" + country: str + """The country of the shipping address.""" + line1: str """The first line of the shipping address.""" @@ -37,12 +44,50 @@ class ShipmentAddress(BaseModel): """The postal code of the shipping address.""" state: str - """The US state of the shipping address.""" + """The state of the shipping address.""" + + +class ShipmentTrackingUpdate(BaseModel): + carrier_estimated_delivery_at: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time when the + carrier expects the card to be delivered. + """ + + category: Literal["in_transit", "processed_for_delivery", "delivered", "delivery_issue", "returned_to_sender"] + """The type of tracking event. + + - `in_transit` - The physical card is in transit. + - `processed_for_delivery` - The physical card has been processed for delivery. + - `delivered` - The physical card has been delivered. + - `delivery_issue` - There is an issue preventing delivery. The delivery will be + attempted again if possible. If the issue cannot be resolved, the physical + card will be returned to sender. + - `returned_to_sender` - Delivery failed and the physical card was returned to + sender. + """ + + city: Optional[str] = None + """The city where the event took place.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the tracking event took place. + """ + + postal_code: Optional[str] = None + """The postal code where the event took place.""" + + state: Optional[str] = None + """The state where the event took place.""" class ShipmentTracking(BaseModel): - number: str - """The tracking number.""" + """Tracking details for the shipment.""" + + number: Optional[str] = None + """The tracking number. Not available for USPS shipments.""" return_number: Optional[str] = None """For returned shipments, the tracking number of the return shipment.""" @@ -57,20 +102,44 @@ class ShipmentTracking(BaseModel): carrier. """ + updates: List[ShipmentTrackingUpdate] + """Tracking updates relating to the physical card's delivery.""" + class Shipment(BaseModel): + """The details used to ship this physical card.""" + address: ShipmentAddress """The location to where the card's packing label is addressed.""" - method: Literal["usps", "fedex_priority_overnight", "fedex_2_day"] + method: Literal["usps", "fedex_priority_overnight", "fedex_2_day", "dhl_worldwide_express"] """The shipping method. - - `usps` - USPS Post with tracking. + - `usps` - USPS Post. - `fedex_priority_overnight` - FedEx Priority Overnight, no signature. - `fedex_2_day` - FedEx 2-day. + - `dhl_worldwide_express` - DHL Worldwide Express, international shipping only. """ - status: Literal["pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned"] + schedule: Literal["next_day", "same_day"] + """When this physical card should be produced by the card printer. + + The default timeline is the day after the card printer receives the order, + except for `FEDEX_PRIORITY_OVERNIGHT` cards, which default to `SAME_DAY`. To use + faster production methods, please reach out to + [support@increase.com](mailto:support@increase.com). + + - `next_day` - The physical card will be shipped one business day after the + order is received by the card printer. A card that is submitted to Increase on + a Monday evening (Pacific Time) will ship out on Wednesday. + - `same_day` - The physical card will be shipped on the same business day that + the order is received by the card printer. A card that is submitted to + Increase on a Monday evening (Pacific Time) will ship out on Tuesday. + """ + + status: Literal[ + "pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned", "requires_attention" + ] """The status of this shipment. - `pending` - The physical card has not yet been shipped. @@ -84,6 +153,8 @@ class Shipment(BaseModel): - `shipped` - The physical card has been shipped. - `returned` - The physical card shipment was returned to the sender and destroyed by the production facility. + - `requires_attention` - The physical card shipment requires attention from + Increase before progressing. """ tracking: Optional[ShipmentTracking] = None @@ -91,13 +162,18 @@ class Shipment(BaseModel): class PhysicalCard(BaseModel): + """Custom physical Visa cards that are shipped to your customers. + + The artwork is configurable by a connected [Card Profile](/documentation/api#card-profiles). The same Card can be used for multiple Physical Cards. Printing cards incurs a fee. Please contact [support@increase.com](mailto:support@increase.com) for pricing! + """ + id: str """The physical card identifier.""" card_id: str """The identifier for the Card this Physical Card represents.""" - cardholder: Optional[Cardholder] = None + cardholder: Cardholder """Details about the cardholder, as it appears on the printed card.""" created_at: datetime diff --git a/src/increase/types/physical_card_create_params.py b/src/increase/types/physical_card_create_params.py index 9ffed26dd..03d872376 100644 --- a/src/increase/types/physical_card_create_params.py +++ b/src/increase/types/physical_card_create_params.py @@ -25,6 +25,8 @@ class PhysicalCardCreateParams(TypedDict, total=False): class Cardholder(TypedDict, total=False): + """Details about the cardholder, as it will appear on the physical card.""" + first_name: Required[str] """The cardholder's first name.""" @@ -33,6 +35,8 @@ class Cardholder(TypedDict, total=False): class ShipmentAddress(TypedDict, total=False): + """The address to where the card should be shipped.""" + city: Required[str] """The city of the shipping address.""" @@ -46,7 +50,15 @@ class ShipmentAddress(TypedDict, total=False): """The postal code of the shipping address.""" state: Required[str] - """The US state of the shipping address.""" + """The state of the shipping address.""" + + country: str + """ + The two-character ISO 3166-1 code of the country where the card should be + shipped (e.g., `US`). Please reach out to + [support@increase.com](mailto:support@increase.com) to ship cards + internationally. + """ line2: str """The second line of the shipping address.""" @@ -59,13 +71,32 @@ class ShipmentAddress(TypedDict, total=False): class Shipment(TypedDict, total=False): + """The details used to ship this physical card.""" + address: Required[ShipmentAddress] """The address to where the card should be shipped.""" - method: Required[Literal["usps", "fedex_priority_overnight", "fedex_2_day"]] + method: Required[Literal["usps", "fedex_priority_overnight", "fedex_2_day", "dhl_worldwide_express"]] """The shipping method to use. - - `usps` - USPS Post with tracking. + - `usps` - USPS Post. - `fedex_priority_overnight` - FedEx Priority Overnight, no signature. - `fedex_2_day` - FedEx 2-day. + - `dhl_worldwide_express` - DHL Worldwide Express, international shipping only. + """ + + schedule: Literal["next_day", "same_day"] + """When this physical card should be produced by the card printer. + + The default timeline is the day after the card printer receives the order, + except for `FEDEX_PRIORITY_OVERNIGHT` cards, which default to `SAME_DAY`. To use + faster production methods, please reach out to + [support@increase.com](mailto:support@increase.com). + + - `next_day` - The physical card will be shipped one business day after the + order is received by the card printer. A card that is submitted to Increase on + a Monday evening (Pacific Time) will ship out on Wednesday. + - `same_day` - The physical card will be shipped on the same business day that + the order is received by the card printer. A card that is submitted to + Increase on a Monday evening (Pacific Time) will ship out on Tuesday. """ diff --git a/src/increase/types/physical_card_profile.py b/src/increase/types/physical_card_profile.py index 85d7cc08d..e5c00eba1 100644 --- a/src/increase/types/physical_card_profile.py +++ b/src/increase/types/physical_card_profile.py @@ -1,23 +1,36 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = ["PhysicalCardProfile"] class PhysicalCardProfile(BaseModel): + """This contains artwork and metadata relating to a Physical Card's appearance. + + For more information, see our guide on [physical card artwork](https://increase.com/documentation/card-art-physical-cards). + """ + id: str """The Card Profile identifier.""" back_image_file_id: Optional[str] = None - """The identifier of the File containing the physical card's back image.""" + """The identifier of the File containing the physical card's back image. + + This will be missing until the image has been post-processed. + """ carrier_image_file_id: Optional[str] = None - """The identifier of the File containing the physical card's carrier image.""" + """The identifier of the File containing the physical card's carrier image. + + This will be missing until the image has been post-processed. + """ contact_phone: Optional[str] = None """A phone number the user can contact to receive support for their card.""" @@ -25,7 +38,7 @@ class PhysicalCardProfile(BaseModel): created_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the Card Dispute was created. + the Physical Card Profile was created. """ creator: Literal["increase", "user"] @@ -39,7 +52,10 @@ class PhysicalCardProfile(BaseModel): """A description you can use to identify the Physical Card Profile.""" front_image_file_id: Optional[str] = None - """The identifier of the File containing the physical card's front image.""" + """The identifier of the File containing the physical card's front image. + + This will be missing until the image has been post-processed. + """ idempotency_key: Optional[str] = None """The idempotency key you chose for this object. @@ -55,6 +71,9 @@ class PhysicalCardProfile(BaseModel): group. """ + program_id: str + """The identifier for the Program this Physical Card Profile belongs to.""" + status: Literal["pending_creating", "pending_reviewing", "rejected", "pending_submitting", "active", "archived"] """The status of the Physical Card Profile. @@ -74,3 +93,15 @@ class PhysicalCardProfile(BaseModel): For this resource it will always be `physical_card_profile`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/physical_card_profile_clone_params.py b/src/increase/types/physical_card_profile_clone_params.py index 3be52b966..597756601 100644 --- a/src/increase/types/physical_card_profile_clone_params.py +++ b/src/increase/types/physical_card_profile_clone_params.py @@ -27,8 +27,16 @@ class PhysicalCardProfileCloneParams(TypedDict, total=False): information. """ + program_id: str + """The identifier of the Program to use for the cloned Physical Card Profile.""" + class FrontText(TypedDict, total=False): + """Text printed on the front of the card. + + Reach out to [support@increase.com](mailto:support@increase.com) for more information. + """ + line1: Required[str] """The first line of text on the front of the card.""" diff --git a/src/increase/types/physical_card_profile_create_params.py b/src/increase/types/physical_card_profile_create_params.py index bd67cd31a..bd98f17c7 100644 --- a/src/increase/types/physical_card_profile_create_params.py +++ b/src/increase/types/physical_card_profile_create_params.py @@ -4,7 +4,7 @@ from typing_extensions import Required, TypedDict -__all__ = ["PhysicalCardProfileCreateParams"] +__all__ = ["PhysicalCardProfileCreateParams", "FrontText"] class PhysicalCardProfileCreateParams(TypedDict, total=False): @@ -19,3 +19,30 @@ class PhysicalCardProfileCreateParams(TypedDict, total=False): front_image_file_id: Required[str] """The identifier of the File containing the physical card's front image.""" + + program_id: Required[str] + """The identifier for the Program that this Physical Card Profile falls under.""" + + front_text: FrontText + """Text printed on the front of the card. + + Reach out to [support@increase.com](mailto:support@increase.com) for more + information. + """ + + +class FrontText(TypedDict, total=False): + """Text printed on the front of the card. + + Reach out to [support@increase.com](mailto:support@increase.com) for more information. + """ + + line1: Required[str] + """The first line of text on the front of the card.""" + + line2: str + """The second line of text on the front of the card. + + Providing a second line moves the first line slightly higher and prints the + second line in the spot where the first line would have otherwise been printed. + """ diff --git a/src/increase/types/program.py b/src/increase/types/program.py index 41ec837f3..a85380686 100644 --- a/src/increase/types/program.py +++ b/src/increase/types/program.py @@ -6,13 +6,33 @@ from .._models import BaseModel -__all__ = ["Program"] +__all__ = ["Program", "Lending"] + + +class Lending(BaseModel): + """The lending details for the program.""" + + maximum_extendable_credit: int + """The maximum extendable credit of the program.""" class Program(BaseModel): + """Programs determine the compliance and commercial terms of Accounts. + + By default, you have a Commercial Banking program for managing your own funds. If you are lending or managing funds on behalf of your customers, or otherwise engaged in regulated activity, we will work together to create additional Programs for you. + """ + id: str """The Program identifier.""" + bank: Literal["core_bank", "first_internet_bank", "grasshopper_bank"] + """The Bank the Program is with. + + - `core_bank` - Core Bank + - `first_internet_bank` - First Internet Bank of Indiana + - `grasshopper_bank` - Grasshopper Bank + """ + billing_account_id: Optional[str] = None """The Program billing account.""" @@ -22,6 +42,19 @@ class Program(BaseModel): was created. """ + default_digital_card_profile_id: Optional[str] = None + """The default configuration for digital cards attached to this Program.""" + + interest_rate: str + """ + The Interest Rate currently being earned on the accounts in this program, as a + string containing a decimal number. For example, a 1% interest rate would be + represented as "0.01". + """ + + lending: Optional[Lending] = None + """The lending details for the program.""" + name: str """The name of the Program.""" diff --git a/src/increase/types/proof_of_authorization_request.py b/src/increase/types/proof_of_authorization_request.py deleted file mode 100644 index cbe737460..000000000 --- a/src/increase/types/proof_of_authorization_request.py +++ /dev/null @@ -1,37 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["ProofOfAuthorizationRequest", "ACHTransfer"] - - -class ACHTransfer(BaseModel): - id: str - """The ACH Transfer identifier.""" - - -class ProofOfAuthorizationRequest(BaseModel): - id: str - """The Proof of Authorization Request identifier.""" - - ach_transfers: List[ACHTransfer] - """The ACH Transfers associated with the request.""" - - created_at: datetime - """The time the Proof of Authorization Request was created.""" - - due_on: datetime - """The time the Proof of Authorization Request is due.""" - - type: Literal["proof_of_authorization_request"] - """A constant representing the object's type. - - For this resource it will always be `proof_of_authorization_request`. - """ - - updated_at: datetime - """The time the Proof of Authorization Request was last updated.""" diff --git a/src/increase/types/proof_of_authorization_request_submission.py b/src/increase/types/proof_of_authorization_request_submission.py deleted file mode 100644 index 2c23f9f3b..000000000 --- a/src/increase/types/proof_of_authorization_request_submission.py +++ /dev/null @@ -1,78 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["ProofOfAuthorizationRequestSubmission"] - - -class ProofOfAuthorizationRequestSubmission(BaseModel): - id: str - """The Proof of Authorization Request Submission identifier.""" - - authorization_terms: str - """Terms of authorization.""" - - authorized_at: datetime - """Time of authorization.""" - - authorizer_company: Optional[str] = None - """Company of the authorizer.""" - - authorizer_email: Optional[str] = None - """Email of the authorizer.""" - - authorizer_ip_address: Optional[str] = None - """IP address of the authorizer.""" - - authorizer_name: Optional[str] = None - """Name of the authorizer.""" - - created_at: datetime - """The time the Proof of Authorization Request Submission was created.""" - - customer_has_been_offboarded: Optional[bool] = None - """Whether the customer has been offboarded.""" - - idempotency_key: Optional[str] = None - """The idempotency key you chose for this object. - - This value is unique across Increase and is used to ensure that a request is - only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). - """ - - proof_of_authorization_request_id: str - """ID of the proof of authorization request.""" - - status: Literal["pending_review", "rejected", "pending_sending", "sent"] - """Status of the proof of authorization request submission. - - - `pending_review` - The proof of authorization request submission is pending - review. - - `rejected` - The proof of authorization request submission was rejected. - - `pending_sending` - The proof of authorization request submission is pending - sending. - - `sent` - The proof of authorization request submission was sent. - """ - - type: Literal["proof_of_authorization_request_submission"] - """A constant representing the object's type. - - For this resource it will always be `proof_of_authorization_request_submission`. - """ - - updated_at: datetime - """The time the Proof of Authorization Request Submission was last updated.""" - - validated_account_ownership_via_credential: Optional[bool] = None - """Whether account ownership was validated via credential (for instance, Plaid).""" - - validated_account_ownership_with_account_statement: Optional[bool] = None - """Whether account ownership was validated with an account statement.""" - - validated_account_ownership_with_microdeposit: Optional[bool] = None - """Whether account ownership was validated with microdeposit.""" diff --git a/src/increase/types/proof_of_authorization_request_submission_create_params.py b/src/increase/types/proof_of_authorization_request_submission_create_params.py deleted file mode 100644 index 8c30d9d3f..000000000 --- a/src/increase/types/proof_of_authorization_request_submission_create_params.py +++ /dev/null @@ -1,46 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["ProofOfAuthorizationRequestSubmissionCreateParams"] - - -class ProofOfAuthorizationRequestSubmissionCreateParams(TypedDict, total=False): - authorization_terms: Required[str] - """Terms of authorization.""" - - authorized_at: Required[Annotated[Union[str, datetime], PropertyInfo(format="iso8601")]] - """Time of authorization.""" - - authorizer_email: Required[str] - """Email of the authorizer.""" - - authorizer_name: Required[str] - """Name of the authorizer.""" - - customer_has_been_offboarded: Required[bool] - """Whether the customer has been offboarded or suspended.""" - - proof_of_authorization_request_id: Required[str] - """ID of the proof of authorization request.""" - - validated_account_ownership_via_credential: Required[bool] - """Whether the account ownership was validated via credential (e.g. Plaid).""" - - validated_account_ownership_with_account_statement: Required[bool] - """Whether the account ownership was validated with an account statement.""" - - validated_account_ownership_with_microdeposit: Required[bool] - """Whether the account ownership was validated with a microdeposit.""" - - authorizer_company: str - """Company of the authorizer.""" - - authorizer_ip_address: str - """IP address of the authorizer.""" diff --git a/src/increase/types/real_time_decision.py b/src/increase/types/real_time_decision.py index 539fa5d0d..316ac348d 100644 --- a/src/increase/types/real_time_decision.py +++ b/src/increase/types/real_time_decision.py @@ -1,28 +1,1488 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = [ - "RealTimeDecision", - "CardAuthorization", - "CardAuthorizationNetworkDetails", - "CardAuthorizationNetworkDetailsVisa", - "CardAuthorizationNetworkIdentifiers", - "CardAuthorizationRequestDetails", - "CardAuthorizationRequestDetailsIncrementalAuthorization", - "CardAuthorizationVerification", - "CardAuthorizationVerificationCardVerificationCode", - "CardAuthorizationVerificationCardholderAddress", - "DigitalWalletAuthentication", - "DigitalWalletToken", -] +__all__ = [ + "RealTimeDecision", + "CardAuthentication", + "CardAuthenticationDeviceChannel", + "CardAuthenticationDeviceChannelBrowser", + "CardAuthenticationDeviceChannelMerchantInitiated", + "CardAuthenticationMessageCategory", + "CardAuthenticationMessageCategoryNonPayment", + "CardAuthenticationMessageCategoryPayment", + "CardAuthenticationChallenge", + "CardAuthorization", + "CardAuthorizationAdditionalAmounts", + "CardAuthorizationAdditionalAmountsClinic", + "CardAuthorizationAdditionalAmountsDental", + "CardAuthorizationAdditionalAmountsOriginal", + "CardAuthorizationAdditionalAmountsPrescription", + "CardAuthorizationAdditionalAmountsSurcharge", + "CardAuthorizationAdditionalAmountsTotalCumulative", + "CardAuthorizationAdditionalAmountsTotalHealthcare", + "CardAuthorizationAdditionalAmountsTransit", + "CardAuthorizationAdditionalAmountsUnknown", + "CardAuthorizationAdditionalAmountsVision", + "CardAuthorizationApproval", + "CardAuthorizationDecline", + "CardAuthorizationNetworkDetails", + "CardAuthorizationNetworkDetailsPulse", + "CardAuthorizationNetworkDetailsVisa", + "CardAuthorizationNetworkIdentifiers", + "CardAuthorizationRequestDetails", + "CardAuthorizationRequestDetailsIncrementalAuthorization", + "CardAuthorizationRequestDetailsInitialAuthorization", + "CardAuthorizationVerification", + "CardAuthorizationVerificationCardVerificationCode", + "CardAuthorizationVerificationCardholderAddress", + "CardAuthorizationVerificationCardholderName", + "CardBalanceInquiry", + "CardBalanceInquiryAdditionalAmounts", + "CardBalanceInquiryAdditionalAmountsClinic", + "CardBalanceInquiryAdditionalAmountsDental", + "CardBalanceInquiryAdditionalAmountsOriginal", + "CardBalanceInquiryAdditionalAmountsPrescription", + "CardBalanceInquiryAdditionalAmountsSurcharge", + "CardBalanceInquiryAdditionalAmountsTotalCumulative", + "CardBalanceInquiryAdditionalAmountsTotalHealthcare", + "CardBalanceInquiryAdditionalAmountsTransit", + "CardBalanceInquiryAdditionalAmountsUnknown", + "CardBalanceInquiryAdditionalAmountsVision", + "CardBalanceInquiryApproval", + "CardBalanceInquiryNetworkDetails", + "CardBalanceInquiryNetworkDetailsPulse", + "CardBalanceInquiryNetworkDetailsVisa", + "CardBalanceInquiryNetworkIdentifiers", + "CardBalanceInquiryVerification", + "CardBalanceInquiryVerificationCardVerificationCode", + "CardBalanceInquiryVerificationCardholderAddress", + "CardBalanceInquiryVerificationCardholderName", + "DigitalWalletAuthentication", + "DigitalWalletToken", + "DigitalWalletTokenDevice", +] + + +class CardAuthenticationDeviceChannelBrowser(BaseModel): + """Fields specific to the browser device channel.""" + + accept_header: Optional[str] = None + """The accept header from the cardholder's browser.""" + + ip_address: Optional[str] = None + """The IP address of the cardholder's browser.""" + + javascript_enabled: Optional[Literal["enabled", "disabled"]] = None + """Whether JavaScript is enabled in the cardholder's browser. + + - `enabled` - JavaScript is enabled in the cardholder's browser. + - `disabled` - JavaScript is not enabled in the cardholder's browser. + """ + + language: Optional[str] = None + """The language of the cardholder's browser.""" + + user_agent: Optional[str] = None + """The user agent of the cardholder's browser.""" + + +class CardAuthenticationDeviceChannelMerchantInitiated(BaseModel): + """Fields specific to merchant initiated transactions.""" + + indicator: Literal[ + "recurring_transaction", + "installment_transaction", + "add_card", + "maintain_card_information", + "account_verification", + "split_delayed_shipment", + "top_up", + "mail_order", + "telephone_order", + "whitelist_status_check", + "other_payment", + "billing_agreement", + "device_binding_status_check", + "card_security_code_status_check", + "delayed_shipment", + "split_payment", + "fido_credential_deletion", + "fido_credential_registration", + "decoupled_authentication_fallback", + ] + """The merchant initiated indicator for the transaction. + + - `recurring_transaction` - Recurring transaction. + - `installment_transaction` - Installment transaction. + - `add_card` - Add card. + - `maintain_card_information` - Maintain card information. + - `account_verification` - Account verification. + - `split_delayed_shipment` - Split or delayed shipment. + - `top_up` - Top up. + - `mail_order` - Mail order. + - `telephone_order` - Telephone order. + - `whitelist_status_check` - Whitelist status check. + - `other_payment` - Other payment. + - `billing_agreement` - Billing agreement. + - `device_binding_status_check` - Device binding status check. + - `card_security_code_status_check` - Card security code status check. + - `delayed_shipment` - Delayed shipment. + - `split_payment` - Split payment. + - `fido_credential_deletion` - FIDO credential deletion. + - `fido_credential_registration` - FIDO credential registration. + - `decoupled_authentication_fallback` - Decoupled authentication fallback. + """ + + +class CardAuthenticationDeviceChannel(BaseModel): + """The device channel of the card authentication attempt.""" + + browser: Optional[CardAuthenticationDeviceChannelBrowser] = None + """Fields specific to the browser device channel.""" + + category: Literal["app", "browser", "three_ds_requestor_initiated"] + """The category of the device channel. + + - `app` - The authentication attempt was made from an app. + - `browser` - The authentication attempt was made from a browser. + - `three_ds_requestor_initiated` - The authentication attempt was initiated by + the 3DS Requestor. + """ + + merchant_initiated: Optional[CardAuthenticationDeviceChannelMerchantInitiated] = None + """Fields specific to merchant initiated transactions.""" + + +class CardAuthenticationMessageCategoryNonPayment(BaseModel): + """Fields specific to non-payment authentication attempts.""" + + pass + + +class CardAuthenticationMessageCategoryPayment(BaseModel): + """Fields specific to payment authentication attempts.""" + + purchase_amount: int + """The purchase amount in minor units.""" + + purchase_amount_cardholder_estimated: Optional[int] = None + """ + The purchase amount in the cardholder's currency (i.e., USD) estimated using + daily conversion rates from the card network. + """ + + purchase_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + authentication attempt's purchase currency. + """ + + transaction_type: Optional[ + Literal[ + "goods_service_purchase", + "check_acceptance", + "account_funding", + "quasi_cash_transaction", + "prepaid_activation_and_load", + ] + ] = None + """The type of transaction being authenticated. + + - `goods_service_purchase` - Purchase of goods or services. + - `check_acceptance` - Check acceptance. + - `account_funding` - Account funding. + - `quasi_cash_transaction` - Quasi-cash transaction. + - `prepaid_activation_and_load` - Prepaid activation and load. + """ + + +class CardAuthenticationMessageCategory(BaseModel): + """The message category of the card authentication attempt.""" + + category: Literal["payment_authentication", "non_payment_authentication"] + """The category of the card authentication attempt. + + - `payment_authentication` - The authentication attempt is for a payment. + - `non_payment_authentication` - The authentication attempt is not for a + payment. + """ + + non_payment: Optional[CardAuthenticationMessageCategoryNonPayment] = None + """Fields specific to non-payment authentication attempts.""" + + payment: Optional[CardAuthenticationMessageCategoryPayment] = None + """Fields specific to payment authentication attempts.""" + + +class CardAuthentication(BaseModel): + """Fields related to a 3DS authentication attempt.""" + + access_control_server_transaction_identifier: str + """ + A unique identifier assigned by the Access Control Server (us) for this + transaction. + """ + + account_id: str + """The identifier of the Account the card belongs to.""" + + billing_address_city: Optional[str] = None + """ + The city of the cardholder billing address associated with the card used for + this purchase. + """ + + billing_address_country: Optional[str] = None + """ + The country of the cardholder billing address associated with the card used for + this purchase. + """ + + billing_address_line1: Optional[str] = None + """ + The first line of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_line2: Optional[str] = None + """ + The second line of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_line3: Optional[str] = None + """ + The third line of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_postal_code: Optional[str] = None + """ + The postal code of the cardholder billing address associated with the card used + for this purchase. + """ + + billing_address_state: Optional[str] = None + """ + The US state of the cardholder billing address associated with the card used for + this purchase. + """ + + card_id: str + """The identifier of the Card.""" + + cardholder_email: Optional[str] = None + """The email address of the cardholder.""" + + cardholder_name: Optional[str] = None + """The name of the cardholder.""" + + decision: Optional[Literal["approve", "challenge", "deny"]] = None + """Whether or not the authentication attempt was approved. + + - `approve` - Approve the authentication attempt without triggering a challenge. + - `challenge` - Request further validation before approving the authentication + attempt. + - `deny` - Deny the authentication attempt. + """ + + device_channel: CardAuthenticationDeviceChannel + """The device channel of the card authentication attempt.""" + + directory_server_transaction_identifier: str + """ + A unique identifier assigned by the Directory Server (the card network) for this + transaction. + """ + + merchant_acceptor_id: Optional[str] = None + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: Optional[str] = None + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_country: Optional[str] = None + """The country the merchant resides in.""" + + merchant_name: Optional[str] = None + """The name of the merchant.""" + + message_category: CardAuthenticationMessageCategory + """The message category of the card authentication attempt.""" + + prior_authenticated_card_payment_id: Optional[str] = None + """ + The ID of a prior Card Authentication that the requestor used to authenticate + this cardholder for a previous transaction. + """ + + requestor_authentication_indicator: Optional[ + Literal[ + "payment_transaction", + "recurring_transaction", + "installment_transaction", + "add_card", + "maintain_card", + "emv_token_cardholder_verification", + "billing_agreement", + ] + ] = None + """ + The 3DS requestor authentication indicator describes why the authentication + attempt is performed, such as for a recurring transaction. + + - `payment_transaction` - The authentication is for a payment transaction. + - `recurring_transaction` - The authentication is for a recurring transaction. + - `installment_transaction` - The authentication is for an installment + transaction. + - `add_card` - The authentication is for adding a card. + - `maintain_card` - The authentication is for maintaining a card. + - `emv_token_cardholder_verification` - The authentication is for EMV token + cardholder verification. + - `billing_agreement` - The authentication is for a billing agreement. + """ + + requestor_challenge_indicator: Optional[ + Literal[ + "no_preference", + "no_challenge_requested", + "challenge_requested_3ds_requestor_preference", + "challenge_requested_mandate", + "no_challenge_requested_transactional_risk_analysis_already_performed", + "no_challenge_requested_data_share_only", + "no_challenge_requested_strong_consumer_authentication_already_performed", + "no_challenge_requested_utilize_whitelist_exemption_if_no_challenge_required", + "challenge_requested_whitelist_prompt_requested_if_challenge_required", + ] + ] = None + """Indicates whether a challenge is requested for this transaction. + + - `no_preference` - No preference. + - `no_challenge_requested` - No challenge requested. + - `challenge_requested_3ds_requestor_preference` - Challenge requested, 3DS + Requestor preference. + - `challenge_requested_mandate` - Challenge requested, mandate. + - `no_challenge_requested_transactional_risk_analysis_already_performed` - No + challenge requested, transactional risk analysis already performed. + - `no_challenge_requested_data_share_only` - No challenge requested, data share + only. + - `no_challenge_requested_strong_consumer_authentication_already_performed` - No + challenge requested, strong consumer authentication already performed. + - `no_challenge_requested_utilize_whitelist_exemption_if_no_challenge_required` - + No challenge requested, utilize whitelist exemption if no challenge required. + - `challenge_requested_whitelist_prompt_requested_if_challenge_required` - + Challenge requested, whitelist prompt requested if challenge required. + """ + + requestor_name: str + """The name of the 3DS requestor.""" + + requestor_url: str + """The URL of the 3DS requestor.""" + + shipping_address_city: Optional[str] = None + """The city of the shipping address associated with this purchase.""" + + shipping_address_country: Optional[str] = None + """The country of the shipping address associated with this purchase.""" + + shipping_address_line1: Optional[str] = None + """The first line of the shipping address associated with this purchase.""" + + shipping_address_line2: Optional[str] = None + """The second line of the shipping address associated with this purchase.""" + + shipping_address_line3: Optional[str] = None + """The third line of the shipping address associated with this purchase.""" + + shipping_address_postal_code: Optional[str] = None + """The postal code of the shipping address associated with this purchase.""" + + shipping_address_state: Optional[str] = None + """The US state of the shipping address associated with this purchase.""" + + three_d_secure_server_transaction_identifier: str + """ + A unique identifier assigned by the 3DS Server initiating the authentication + attempt for this transaction. + """ + + upcoming_card_payment_id: str + """The identifier of the Card Payment this authentication attempt will belong to. + + Available in the API once the card authentication has completed. + """ + + +class CardAuthenticationChallenge(BaseModel): + """Fields related to a 3DS authentication attempt.""" + + account_id: str + """The identifier of the Account the card belongs to.""" + + card_id: str + """The identifier of the Card that is being tokenized.""" + + card_payment_id: str + """ + The identifier of the Card Payment this authentication challenge attempt belongs + to. + """ + + one_time_code: str + """The one-time code delivered to the cardholder.""" + + result: Optional[Literal["success", "failure"]] = None + """Whether or not the challenge was delivered to the cardholder. + + - `success` - Your application successfully delivered the one-time code to the + cardholder. + - `failure` - Your application was unable to deliver the one-time code to the + cardholder. + """ + + +class CardAuthorizationAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardAuthorizationAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[CardAuthorizationAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[CardAuthorizationAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[CardAuthorizationAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[CardAuthorizationAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[CardAuthorizationAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[CardAuthorizationAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[CardAuthorizationAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[CardAuthorizationAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[CardAuthorizationAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[CardAuthorizationAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class CardAuthorizationApproval(BaseModel): + """Present if and only if `decision` is `approve`. + + Contains information related to the approval of the authorization. + """ + + partial_amount: Optional[int] = None + """ + If the authorization was partially approved, this field contains the approved + amount in the minor unit of the settlement currency. + """ + + +class CardAuthorizationDecline(BaseModel): + """Present if and only if `decision` is `decline`. + + Contains information related to the reason the authorization was declined. + """ + + reason: Literal[ + "insufficient_funds", + "transaction_never_allowed", + "exceeds_approval_limit", + "card_temporarily_disabled", + "suspected_fraud", + "other", + ] + """The reason the authorization was declined. + + - `insufficient_funds` - The cardholder does not have sufficient funds to cover + the transaction. The merchant may attempt to process the transaction again. + - `transaction_never_allowed` - This type of transaction is not allowed for this + card. This transaction should not be retried. + - `exceeds_approval_limit` - The transaction amount exceeds the cardholder's + approval limit. The merchant may attempt to process the transaction again. + - `card_temporarily_disabled` - The card has been temporarily disabled or not + yet activated. The merchant may attempt to process the transaction again. + - `suspected_fraud` - The transaction is suspected to be fraudulent. The + merchant may attempt to process the transaction again. + - `other` - The transaction was declined for another reason. The merchant may + attempt to process the transaction again. This should be used sparingly. + """ + + +class CardAuthorizationNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + + +class CardAuthorizationNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + + electronic_commerce_indicator: Optional[ + Literal[ + "mail_phone_order", + "recurring", + "installment", + "unknown_mail_phone_order", + "secure_electronic_commerce", + "non_authenticated_security_transaction_at_3ds_capable_merchant", + "non_authenticated_security_transaction", + "non_secure_transaction", + ] + ] = None + """ + For electronic commerce transactions, this identifies the level of security used + in obtaining the customer's payment credential. For mail or telephone order + transactions, identifies the type of mail or telephone order. + + - `mail_phone_order` - Single transaction of a mail/phone order: Use to indicate + that the transaction is a mail/phone order purchase, not a recurring + transaction or installment payment. For domestic transactions in the US + region, this value may also indicate one bill payment transaction in the + card-present or card-absent environments. + - `recurring` - Recurring transaction: Payment indicator used to indicate a + recurring transaction that originates from an acquirer in the US region. + - `installment` - Installment payment: Payment indicator used to indicate one + purchase of goods or services that is billed to the account in multiple + charges over a period of time agreed upon by the cardholder and merchant from + transactions that originate from an acquirer in the US region. + - `unknown_mail_phone_order` - Unknown classification: other mail order: Use to + indicate that the type of mail/telephone order is unknown. + - `secure_electronic_commerce` - Secure electronic commerce transaction: Use to + indicate that the electronic commerce transaction has been authenticated using + e.g., 3-D Secure + - `non_authenticated_security_transaction_at_3ds_capable_merchant` - + Non-authenticated security transaction at a 3-D Secure-capable merchant, and + merchant attempted to authenticate the cardholder using 3-D Secure: Use to + identify an electronic commerce transaction where the merchant attempted to + authenticate the cardholder using 3-D Secure, but was unable to complete the + authentication because the issuer or cardholder does not participate in the + 3-D Secure program. + - `non_authenticated_security_transaction` - Non-authenticated security + transaction: Use to identify an electronic commerce transaction that uses data + encryption for security however, cardholder authentication is not performed + using 3-D Secure. + - `non_secure_transaction` - Non-secure transaction: Use to identify an + electronic commerce transaction that has no data protection. + """ + + point_of_service_entry_mode: Optional[ + Literal[ + "unknown", + "manual", + "magnetic_stripe_no_cvv", + "optical_code", + "integrated_circuit_card", + "contactless", + "credential_on_file", + "magnetic_stripe", + "contactless_magnetic_stripe", + "integrated_circuit_card_no_cvv", + ] + ] = None + """ + The method used to enter the cardholder's primary account number and card + expiration date. + + - `unknown` - Unknown + - `manual` - Manual key entry + - `magnetic_stripe_no_cvv` - Magnetic stripe read, without card verification + value + - `optical_code` - Optical code + - `integrated_circuit_card` - Contact chip card + - `contactless` - Contactless read of chip card + - `credential_on_file` - Transaction initiated using a credential that has + previously been stored on file + - `magnetic_stripe` - Magnetic stripe read + - `contactless_magnetic_stripe` - Contactless read of magnetic stripe data + - `integrated_circuit_card_no_cvv` - Contact chip card, without card + verification value + """ + + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + + +class CardAuthorizationNetworkDetails(BaseModel): + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] + """The payment network used to process this card authorization. + + - `visa` - Visa + - `pulse` - Pulse + """ + + pulse: Optional[CardAuthorizationNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + + visa: Optional[CardAuthorizationNetworkDetailsVisa] = None + """Fields specific to the `visa` network.""" + + +class CardAuthorizationNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + + retrieval_reference_number: Optional[str] = None + """A life-cycle identifier used across e.g., an authorization and a reversal. + + Expected to be unique per acquirer within a window of time. For some card + networks the retrieval reference number includes the trace counter. + """ + + trace_number: Optional[str] = None + """A counter used to verify an individual authorization. + + Expected to be unique per acquirer within a window of time. + """ + + transaction_id: Optional[str] = None + """ + A globally unique transaction identifier provided by the card network, used + across multiple life-cycle requests. + """ + + +class CardAuthorizationRequestDetailsIncrementalAuthorization(BaseModel): + """Fields specific to the category `incremental_authorization`.""" + + card_payment_id: str + """The card payment for this authorization and increment.""" + + original_card_authorization_id: str + """ + The identifier of the card authorization this request is attempting to + increment. + """ + + +class CardAuthorizationRequestDetailsInitialAuthorization(BaseModel): + """Fields specific to the category `initial_authorization`.""" + + pass + + +class CardAuthorizationRequestDetails(BaseModel): + """Fields specific to the type of request, such as an incremental authorization.""" + + category: Literal["initial_authorization", "incremental_authorization"] + """ + The type of this request (e.g., an initial authorization or an incremental + authorization). + + - `initial_authorization` - A regular, standalone authorization. + - `incremental_authorization` - An incremental request to increase the amount of + an existing authorization. + """ + + incremental_authorization: Optional[CardAuthorizationRequestDetailsIncrementalAuthorization] = None + """Fields specific to the category `incremental_authorization`.""" + + initial_authorization: Optional[CardAuthorizationRequestDetailsInitialAuthorization] = None + """Fields specific to the category `initial_authorization`.""" + + +class CardAuthorizationVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + + result: Literal["not_checked", "match", "no_match"] + """The result of verifying the Card Verification Code. + + - `not_checked` - No card verification code was provided in the authorization + request. + - `match` - The card verification code matched the one on file. + - `no_match` - The card verification code did not match the one on file. + """ + + +class CardAuthorizationVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + + actual_line1: Optional[str] = None + """Line 1 of the address on file for the cardholder.""" + + actual_postal_code: Optional[str] = None + """The postal code of the address on file for the cardholder.""" + + provided_line1: Optional[str] = None + """ + The cardholder address line 1 provided for verification in the authorization + request. + """ + + provided_postal_code: Optional[str] = None + """The postal code provided for verification in the authorization request.""" + + result: Literal[ + "not_checked", + "postal_code_match_address_no_match", + "postal_code_no_match_address_match", + "match", + "no_match", + "postal_code_match_address_not_checked", + ] + """The address verification result returned to the card network. + + - `not_checked` - No address information was provided in the authorization + request. + - `postal_code_match_address_no_match` - Postal code matches, but the street + address does not match or was not provided. + - `postal_code_no_match_address_match` - Postal code does not match, but the + street address matches or was not provided. + - `match` - Postal code and street address match. + - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) + """ + + +class CardAuthorizationVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + +class CardAuthorizationVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + + card_verification_code: CardAuthorizationVerificationCardVerificationCode + """ + Fields related to verification of the Card Verification Code, a 3-digit code on + the back of the card. + """ + + cardholder_address: CardAuthorizationVerificationCardholderAddress + """ + Cardholder address provided in the authorization request and the address on file + we verified it against. + """ + + cardholder_name: Optional[CardAuthorizationVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + + +class CardAuthorization(BaseModel): + """Fields related to a card authorization.""" + + account_id: str + """The identifier of the Account the authorization will debit.""" + + additional_amounts: CardAuthorizationAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + + approval: Optional[CardAuthorizationApproval] = None + """Present if and only if `decision` is `approve`. + + Contains information related to the approval of the authorization. + """ + + card_id: str + """The identifier of the Card that is being authorized.""" + + decision: Optional[Literal["approve", "decline"]] = None + """Whether or not the authorization was approved. + + - `approve` - Approve the authorization. + - `decline` - Decline the authorization. + """ + + decline: Optional[CardAuthorizationDecline] = None + """Present if and only if `decision` is `decline`. + + Contains information related to the reason the authorization was declined. + """ + + digital_wallet_token_id: Optional[str] = None + """ + If the authorization was made via a Digital Wallet Token (such as an Apple Pay + purchase), the identifier of the token that was used. + """ + + direction: Literal["settlement", "refund"] + """ + The direction describes the direction the funds will move, either from the + cardholder to the merchant or from the merchant to the cardholder. + + - `settlement` - A regular card authorization where funds are debited from the + cardholder. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: Optional[str] = None + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network_details: CardAuthorizationNetworkDetails + """Fields specific to the `network`.""" + + network_identifiers: CardAuthorizationNetworkIdentifiers + """Network-specific identifiers for a specific request or transaction.""" + + network_risk_score: Optional[int] = None + """The risk score generated by the card network. + + For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. + """ + + partial_approval_capability: Literal["supported", "not_supported"] + """Whether or not the authorization supports partial approvals. + + - `supported` - This transaction supports partial approvals. + - `not_supported` - This transaction does not support partial approvals. + """ + + physical_card_id: Optional[str] = None + """ + If the authorization was made in-person with a physical card, the Physical Card + that was used. + """ + + presentment_amount: int + """ + The amount of the attempted authorization in the currency the card user sees at + the time of purchase, in the minor unit of that currency. For dollars, for + example, this is cents. + """ + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the currency the + user sees at the time of purchase. + """ + + processing_category: Literal[ + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + "unknown", + ] + """ + The processing category describes the intent behind the authorization, such as + whether it was used for bill payments or an automatic fuel dispenser. + + - `account_funding` - Account funding transactions are transactions used to + e.g., fund an account or transfer funds between accounts. + - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur + when a card is used at a gas pump, prior to the actual transaction amount + being known. They are followed by an advice message that updates the amount of + the pending transaction. + - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. + - `purchase` - A regular purchase. + - `quasi_cash` - Quasi-cash transactions represent purchases of items which may + be convertible to cash. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + - `unknown` - The processing category is unknown. + """ + + request_details: CardAuthorizationRequestDetails + """Fields specific to the type of request, such as an incremental authorization.""" + + settlement_amount: int + """The amount of the attempted authorization in the currency it will be settled in. + + This currency is the same as that of the Account the card belongs to. + """ + + settlement_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the currency the + transaction will be settled in. + """ + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + upcoming_card_payment_id: str + """The identifier of the Card Payment this authorization will belong to. + + Available in the API once the card authorization has completed. + """ + + verification: CardAuthorizationVerification + """Fields related to verification of cardholder-provided values.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class CardBalanceInquiryAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. + """ + + +class CardBalanceInquiryAdditionalAmounts(BaseModel): + """ + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. + """ + + clinic: Optional[CardBalanceInquiryAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" + + dental: Optional[CardBalanceInquiryAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[CardBalanceInquiryAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[CardBalanceInquiryAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[CardBalanceInquiryAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[CardBalanceInquiryAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[CardBalanceInquiryAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[CardBalanceInquiryAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[CardBalanceInquiryAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[CardBalanceInquiryAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class CardBalanceInquiryApproval(BaseModel): + """Present if and only if `decision` is `approve`. + + Contains information related to the approval of the balance inquiry. + """ + + balance: int + """ + If the balance inquiry was approved, this field contains the balance in the + minor unit of the settlement currency. + """ + + +class CardBalanceInquiryNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + + +class CardBalanceInquiryNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" -class CardAuthorizationNetworkDetailsVisa(BaseModel): electronic_commerce_indicator: Optional[ Literal[ "mail_phone_order", @@ -65,7 +1525,7 @@ class CardAuthorizationNetworkDetailsVisa(BaseModel): 3-D Secure program. - `non_authenticated_security_transaction` - Non-authenticated security transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed + encryption for security however, cardholder authentication is not performed using 3-D Secure. - `non_secure_transaction` - Non-secure transaction: Use to identify an electronic commerce transaction that has no data protection. @@ -104,19 +1564,106 @@ class CardAuthorizationNetworkDetailsVisa(BaseModel): verification value """ + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ -class CardAuthorizationNetworkDetails(BaseModel): - category: Literal["visa"] + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + + +class CardBalanceInquiryNetworkDetails(BaseModel): + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] """The payment network used to process this card authorization. - `visa` - Visa + - `pulse` - Pulse """ - visa: Optional[CardAuthorizationNetworkDetailsVisa] = None + pulse: Optional[CardBalanceInquiryNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + + visa: Optional[CardBalanceInquiryNetworkDetailsVisa] = None """Fields specific to the `visa` network.""" -class CardAuthorizationNetworkIdentifiers(BaseModel): +class CardBalanceInquiryNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + retrieval_reference_number: Optional[str] = None """A life-cycle identifier used across e.g., an authorization and a reversal. @@ -137,36 +1684,11 @@ class CardAuthorizationNetworkIdentifiers(BaseModel): """ -class CardAuthorizationRequestDetailsIncrementalAuthorization(BaseModel): - card_payment_id: str - """The card payment for this authorization and increment.""" - - original_card_authorization_id: str - """ - The identifier of the card authorization this request is attempting to - increment. - """ - - -class CardAuthorizationRequestDetails(BaseModel): - category: Literal["initial_authorization", "incremental_authorization"] +class CardBalanceInquiryVerificationCardVerificationCode(BaseModel): """ - The type of this request (e.g., an initial authorization or an incremental - authorization). - - - `initial_authorization` - A regular, standalone authorization. - - `incremental_authorization` - An incremental request to increase the amount of - an existing authorization. + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. """ - incremental_authorization: Optional[CardAuthorizationRequestDetailsIncrementalAuthorization] = None - """Fields specific to the category `incremental_authorization`.""" - - initial_authorization: Optional[object] = None - """Fields specific to the category `initial_authorization`.""" - - -class CardAuthorizationVerificationCardVerificationCode(BaseModel): result: Literal["not_checked", "match", "no_match"] """The result of verifying the Card Verification Code. @@ -177,7 +1699,11 @@ class CardAuthorizationVerificationCardVerificationCode(BaseModel): """ -class CardAuthorizationVerificationCardholderAddress(BaseModel): +class CardBalanceInquiryVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + actual_line1: Optional[str] = None """Line 1 of the address on file for the cardholder.""" @@ -195,44 +1721,78 @@ class CardAuthorizationVerificationCardholderAddress(BaseModel): result: Literal[ "not_checked", - "postal_code_match_address_not_checked", "postal_code_match_address_no_match", "postal_code_no_match_address_match", "match", "no_match", + "postal_code_match_address_not_checked", ] """The address verification result returned to the card network. - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. + - `not_checked` - No address information was provided in the authorization + request. - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. + address does not match or was not provided. - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. + street address matches or was not provided. - `match` - Postal code and street address match. - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) """ -class CardAuthorizationVerification(BaseModel): - card_verification_code: CardAuthorizationVerificationCardVerificationCode +class CardBalanceInquiryVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + +class CardBalanceInquiryVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + + card_verification_code: CardBalanceInquiryVerificationCardVerificationCode """ Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. """ - cardholder_address: CardAuthorizationVerificationCardholderAddress + cardholder_address: CardBalanceInquiryVerificationCardholderAddress """ Cardholder address provided in the authorization request and the address on file we verified it against. """ + cardholder_name: Optional[CardBalanceInquiryVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + + +class CardBalanceInquiry(BaseModel): + """Fields related to a card balance inquiry.""" -class CardAuthorization(BaseModel): account_id: str """The identifier of the Account the authorization will debit.""" + additional_amounts: CardBalanceInquiryAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + + approval: Optional[CardBalanceInquiryApproval] = None + """Present if and only if `decision` is `approve`. + + Contains information related to the approval of the balance inquiry. + """ + card_id: str """The identifier of the Card that is being authorized.""" @@ -255,7 +1815,7 @@ class CardAuthorization(BaseModel): is transacting with. """ - merchant_category_code: Optional[str] = None + merchant_category_code: str """ The Merchant Category Code (commonly abbreviated as MCC) of the merchant the card is transacting with. @@ -264,23 +1824,34 @@ class CardAuthorization(BaseModel): merchant_city: Optional[str] = None """The city the merchant resides in.""" - merchant_country: Optional[str] = None + merchant_country: str """The country the merchant resides in.""" merchant_descriptor: str """The merchant descriptor of the merchant the card is transacting with.""" - network_details: CardAuthorizationNetworkDetails + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network_details: CardBalanceInquiryNetworkDetails """Fields specific to the `network`.""" - network_identifiers: CardAuthorizationNetworkIdentifiers + network_identifiers: CardBalanceInquiryNetworkIdentifiers """Network-specific identifiers for a specific request or transaction.""" network_risk_score: Optional[int] = None """The risk score generated by the card network. For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. """ physical_card_id: Optional[str] = None @@ -289,60 +1860,37 @@ class CardAuthorization(BaseModel): that was used. """ - presentment_amount: int - """ - The amount of the attempted authorization in the currency the card user sees at - the time of purchase, in the minor unit of that currency. For dollars, for - example, this is cents. - """ - - presentment_currency: str + terminal_id: Optional[str] = None """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the currency the - user sees at the time of purchase. + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. """ - processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" - ] - """ - The processing category describes the intent behind the authorization, such as - whether it was used for bill payments or an automatic fuel dispenser. + upcoming_card_payment_id: str + """The identifier of the Card Payment this authorization will belong to. - - `account_funding` - Account funding transactions are transactions used to - e.g., fund an account or transfer funds between accounts. - - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur - when a card is used at a gas pump, prior to the actual transaction amount - being known. They are followed by an advice message that updates the amount of - the pending transaction. - - `bill_payment` - A transaction used to pay a bill. - - `purchase` - A regular purchase. - - `quasi_cash` - Quasi-cash transactions represent purchases of items which may - be convertible to cash. - - `refund` - A refund card authorization, sometimes referred to as a credit - voucher authorization, where funds are credited to the cardholder. + Available in the API once the card authorization has completed. """ - request_details: CardAuthorizationRequestDetails - """Fields specific to the type of request, such as an incremental authorization.""" - - settlement_amount: int - """The amount of the attempted authorization in the currency it will be settled in. - - This currency is the same as that of the Account the card belongs to. - """ + verification: CardBalanceInquiryVerification + """Fields related to verification of cardholder-provided values.""" - settlement_currency: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the currency the - transaction will be settled in. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - verification: CardAuthorizationVerification - """Fields related to verification of cardholder-provided values.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] class DigitalWalletAuthentication(BaseModel): + """Fields related to a digital wallet authentication attempt.""" + card_id: str """The identifier of the Card that is being tokenized.""" @@ -353,11 +1901,12 @@ class DigitalWalletAuthentication(BaseModel): - `email` - Send one-time passcodes over email. """ - digital_wallet: Literal["apple_pay", "google_pay", "unknown"] + digital_wallet: Literal["apple_pay", "google_pay", "samsung_pay", "unknown"] """The digital wallet app being used. - `apple_pay` - Apple Pay - `google_pay` - Google Pay + - `samsung_pay` - Samsung Pay - `unknown` - Unknown """ @@ -383,17 +1932,19 @@ class DigitalWalletAuthentication(BaseModel): """ +class DigitalWalletTokenDevice(BaseModel): + """Device that is being used to provision the digital wallet token.""" + + identifier: Optional[str] = None + """ID assigned to the device by the digital wallet provider.""" + + class DigitalWalletToken(BaseModel): + """Fields related to a digital wallet token provisioning attempt.""" + card_id: str """The identifier of the Card that is being tokenized.""" - card_profile_id: Optional[str] = None - """The identifier of the Card Profile that was set via the real time decision. - - This will be null until the real time decision is responded to or if the real - time decision did not set a card profile. - """ - decision: Optional[Literal["approve", "decline"]] = None """Whether or not the provisioning request was approved. @@ -403,28 +1954,54 @@ class DigitalWalletToken(BaseModel): - `decline` - Decline the provisioning request. """ - digital_wallet: Literal["apple_pay", "google_pay", "unknown"] + device: DigitalWalletTokenDevice + """Device that is being used to provision the digital wallet token.""" + + digital_wallet: Literal["apple_pay", "google_pay", "samsung_pay", "unknown"] """The digital wallet app being used. - `apple_pay` - Apple Pay - `google_pay` - Google Pay + - `samsung_pay` - Samsung Pay - `unknown` - Unknown """ class RealTimeDecision(BaseModel): + """ + Real Time Decisions are created when your application needs to take action in real-time to some event such as a card authorization. For more information, see our [Real-Time Decisions guide](https://increase.com/documentation/real-time-decisions). + """ + id: str """The Real-Time Decision identifier.""" + card_authentication: Optional[CardAuthentication] = None + """Fields related to a 3DS authentication attempt.""" + + card_authentication_challenge: Optional[CardAuthenticationChallenge] = None + """Fields related to a 3DS authentication attempt.""" + card_authorization: Optional[CardAuthorization] = None """Fields related to a card authorization.""" + card_balance_inquiry: Optional[CardBalanceInquiry] = None + """Fields related to a card balance inquiry.""" + category: Literal[ - "card_authorization_requested", "digital_wallet_token_requested", "digital_wallet_authentication_requested" + "card_authorization_requested", + "card_balance_inquiry_requested", + "card_authentication_requested", + "card_authentication_challenge_requested", + "digital_wallet_token_requested", + "digital_wallet_authentication_requested", ] """The category of the Real-Time Decision. - `card_authorization_requested` - A card is being authorized. + - `card_balance_inquiry_requested` - A balance inquiry is being made on a card. + - `card_authentication_requested` - 3DS authentication is requested. + - `card_authentication_challenge_requested` - 3DS authentication challenge + requires cardholder involvement. - `digital_wallet_token_requested` - A card is being loaded into a digital wallet. - `digital_wallet_authentication_requested` - A card is being loaded into a diff --git a/src/increase/types/real_time_decision_action_params.py b/src/increase/types/real_time_decision_action_params.py index 5c10237f0..5e9eeb31d 100644 --- a/src/increase/types/real_time_decision_action_params.py +++ b/src/increase/types/real_time_decision_action_params.py @@ -6,8 +6,17 @@ __all__ = [ "RealTimeDecisionActionParams", + "CardAuthentication", + "CardAuthenticationChallenge", + "CardAuthenticationChallengeSuccess", "CardAuthorization", + "CardAuthorizationApproval", + "CardAuthorizationApprovalCardholderAddressVerificationResult", + "CardAuthorizationDecline", + "CardBalanceInquiry", + "CardBalanceInquiryApproval", "DigitalWalletAuthentication", + "DigitalWalletAuthenticationSuccess", "DigitalWalletToken", "DigitalWalletTokenApproval", "DigitalWalletTokenDecline", @@ -15,12 +24,30 @@ class RealTimeDecisionActionParams(TypedDict, total=False): + card_authentication: CardAuthentication + """ + If the Real-Time Decision relates to a 3DS card authentication attempt, this + object contains your response to the authentication. + """ + + card_authentication_challenge: CardAuthenticationChallenge + """ + If the Real-Time Decision relates to 3DS card authentication challenge delivery, + this object contains your response. + """ + card_authorization: CardAuthorization """ If the Real-Time Decision relates to a card authorization attempt, this object contains your response to the authorization. """ + card_balance_inquiry: CardBalanceInquiry + """ + If the Real-Time Decision relates to a card balance inquiry attempt, this object + contains your response to the inquiry. + """ + digital_wallet_authentication: DigitalWalletAuthentication """ If the Real-Time Decision relates to a digital wallet authentication attempt, @@ -34,7 +61,147 @@ class RealTimeDecisionActionParams(TypedDict, total=False): """ -class CardAuthorization(TypedDict, total=False): +class CardAuthentication(TypedDict, total=False): + """ + If the Real-Time Decision relates to a 3DS card authentication attempt, this object contains your response to the authentication. + """ + + decision: Required[Literal["approve", "challenge", "deny"]] + """Whether the card authentication attempt should be approved or declined. + + - `approve` - Approve the authentication attempt without triggering a challenge. + - `challenge` - Request further validation before approving the authentication + attempt. + - `deny` - Deny the authentication attempt. + """ + + +class CardAuthenticationChallengeSuccess(TypedDict, total=False): + """ + If your application was able to deliver the one-time code, this contains metadata about the delivery. + """ + + email: str + """The email address that was used to deliver the one-time code to the cardholder.""" + + phone: str + """ + The phone number that was used to deliver the one-time code to the cardholder + via SMS. + """ + + +class CardAuthenticationChallenge(TypedDict, total=False): + """ + If the Real-Time Decision relates to 3DS card authentication challenge delivery, this object contains your response. + """ + + result: Required[Literal["success", "failure"]] + """ + Whether the card authentication challenge was successfully delivered to the + cardholder. + + - `success` - Your application successfully delivered the one-time code to the + cardholder. + - `failure` - Your application was unable to deliver the one-time code to the + cardholder. + """ + + success: CardAuthenticationChallengeSuccess + """ + If your application was able to deliver the one-time code, this contains + metadata about the delivery. + """ + + +class CardAuthorizationApprovalCardholderAddressVerificationResult(TypedDict, total=False): + """Your decisions on whether or not each provided address component is a match. + + Your response here is evaluated against the customer's provided `postal_code` and `line1`, and an appropriate network response is generated. For more information, see our [Address Verification System Codes and Overrides](https://increase.com/documentation/address-verification-system-codes-and-overrides) guide. + """ + + line1: Required[Literal["match", "no_match"]] + """Your decision on the address line of the provided address. + + - `match` - The cardholder address verification result matches the address + provided by the merchant. + - `no_match` - The cardholder address verification result does not match the + address provided by the merchant. + """ + + postal_code: Required[Literal["match", "no_match"]] + """Your decision on the postal code of the provided address. + + - `match` - The cardholder address verification result matches the address + provided by the merchant. + - `no_match` - The cardholder address verification result does not match the + address provided by the merchant. + """ + + +class CardAuthorizationApproval(TypedDict, total=False): + """ + If your application approves the authorization, this contains metadata about your decision to approve. Your response here is advisory to the acquiring bank. The bank may choose to reverse the authorization if you approve the transaction but indicate the address does not match. + """ + + cardholder_address_verification_result: CardAuthorizationApprovalCardholderAddressVerificationResult + """Your decisions on whether or not each provided address component is a match. + + Your response here is evaluated against the customer's provided `postal_code` + and `line1`, and an appropriate network response is generated. For more + information, see our + [Address Verification System Codes and Overrides](https://increase.com/documentation/address-verification-system-codes-and-overrides) + guide. + """ + + partial_amount: int + """ + If the transaction supports partial approvals + (`partial_approval_capability: supported`) the `partial_amount` can be provided + in the transaction's settlement currency to approve a lower amount than was + requested. + """ + + +class CardAuthorizationDecline(TypedDict, total=False): + """ + If your application declines the authorization, this contains details about the decline. + """ + + reason: Required[ + Literal[ + "insufficient_funds", + "transaction_never_allowed", + "exceeds_approval_limit", + "card_temporarily_disabled", + "suspected_fraud", + "other", + ] + ] + """The reason the card authorization was declined. + + This translates to a specific decline code that is sent to the card network. + + - `insufficient_funds` - The cardholder does not have sufficient funds to cover + the transaction. The merchant may attempt to process the transaction again. + - `transaction_never_allowed` - This type of transaction is not allowed for this + card. This transaction should not be retried. + - `exceeds_approval_limit` - The transaction amount exceeds the cardholder's + approval limit. The merchant may attempt to process the transaction again. + - `card_temporarily_disabled` - The card has been temporarily disabled or not + yet activated. The merchant may attempt to process the transaction again. + - `suspected_fraud` - The transaction is suspected to be fraudulent. The + merchant may attempt to process the transaction again. + - `other` - The transaction was declined for another reason. The merchant may + attempt to process the transaction again. This should be used sparingly. + """ + + +class CardAuthorization(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] + """ + If the Real-Time Decision relates to a card authorization attempt, this object contains your response to the authorization. + """ + decision: Required[Literal["approve", "decline"]] """Whether the card authorization should be approved or declined. @@ -42,8 +209,69 @@ class CardAuthorization(TypedDict, total=False): - `decline` - Decline the authorization. """ + approval: CardAuthorizationApproval + """ + If your application approves the authorization, this contains metadata about + your decision to approve. Your response here is advisory to the acquiring bank. + The bank may choose to reverse the authorization if you approve the transaction + but indicate the address does not match. + """ + + decline: CardAuthorizationDecline + """ + If your application declines the authorization, this contains details about the + decline. + """ + + +class CardBalanceInquiryApproval(TypedDict, total=False): + """ + If your application approves the balance inquiry, this contains metadata about your decision to approve. + """ + + balance: Required[int] + """The balance on the card in the settlement currency of the transaction.""" + + +class CardBalanceInquiry(TypedDict, total=False): + """ + If the Real-Time Decision relates to a card balance inquiry attempt, this object contains your response to the inquiry. + """ + + decision: Required[Literal["approve", "decline"]] + """Whether the card balance inquiry should be approved or declined. + + - `approve` - Approve the authorization. + - `decline` - Decline the authorization. + """ + + approval: CardBalanceInquiryApproval + """ + If your application approves the balance inquiry, this contains metadata about + your decision to approve. + """ + + +class DigitalWalletAuthenticationSuccess(TypedDict, total=False): + """ + If your application was able to deliver the one-time passcode, this contains metadata about the delivery. Exactly one of `phone` or `email` must be provided. + """ + + email: str + """The email address that was used to verify the cardholder via one-time passcode.""" + + phone: str + """ + The phone number that was used to verify the cardholder via one-time passcode + over SMS. + """ + class DigitalWalletAuthentication(TypedDict, total=False): + """ + If the Real-Time Decision relates to a digital wallet authentication attempt, this object contains your response to the authentication. + """ + result: Required[Literal["success", "failure"]] """Whether your application was able to deliver the one-time passcode. @@ -53,8 +281,18 @@ class DigitalWalletAuthentication(TypedDict, total=False): cardholder. """ + success: DigitalWalletAuthenticationSuccess + """ + If your application was able to deliver the one-time passcode, this contains + metadata about the delivery. Exactly one of `phone` or `email` must be provided. + """ + class DigitalWalletTokenApproval(TypedDict, total=False): + """ + If your application approves the provisioning attempt, this contains metadata about the digital wallet token that will be generated. + """ + email: str """ An email address that can be used to verify the cardholder via one-time @@ -69,6 +307,10 @@ class DigitalWalletTokenApproval(TypedDict, total=False): class DigitalWalletTokenDecline(TypedDict, total=False): + """ + If your application declines the provisioning attempt, this contains details about the decline. + """ + reason: str """Why the tokenization attempt was declined. @@ -77,6 +319,10 @@ class DigitalWalletTokenDecline(TypedDict, total=False): class DigitalWalletToken(TypedDict, total=False): + """ + If the Real-Time Decision relates to a digital wallet token provisioning attempt, this object contains your response to the attempt. + """ + approval: DigitalWalletTokenApproval """ If your application approves the provisioning attempt, this contains metadata diff --git a/src/increase/types/real_time_payments_request_for_payment.py b/src/increase/types/real_time_payments_request_for_payment.py deleted file mode 100644 index a9dff0165..000000000 --- a/src/increase/types/real_time_payments_request_for_payment.py +++ /dev/null @@ -1,245 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import date, datetime -from typing_extensions import Literal - -from .._models import BaseModel - -__all__ = ["RealTimePaymentsRequestForPayment", "Refusal", "Rejection", "Submission"] - - -class Refusal(BaseModel): - refusal_reason_code: Literal[ - "account_blocked", - "transaction_forbidden", - "transaction_type_not_supported", - "unexpected_amount", - "amount_exceeds_bank_limits", - "invalid_debtor_address", - "invalid_creditor_address", - "creditor_identifier_incorrect", - "requested_by_customer", - "order_rejected", - "end_customer_deceased", - "customer_has_opted_out", - "other", - ] - """ - The reason the request for payment was refused as provided by the recipient bank - or the customer. - - - `account_blocked` - The destination account is currently blocked from - receiving transactions. Corresponds to the Real-Time Payments reason code - `AC06`. - - `transaction_forbidden` - Real-Time Payments transfers are not allowed to the - destination account. Corresponds to the Real-Time Payments reason code `AG01`. - - `transaction_type_not_supported` - Real-Time Payments transfers are not - enabled for the destination account. Corresponds to the Real-Time Payments - reason code `AG03`. - - `unexpected_amount` - The amount of the transfer is different than expected by - the recipient. Corresponds to the Real-Time Payments reason code `AM09`. - - `amount_exceeds_bank_limits` - The amount is higher than the recipient is - authorized to send or receive. Corresponds to the Real-Time Payments reason - code `AM14`. - - `invalid_debtor_address` - The debtor's address is required, but missing or - invalid. Corresponds to the Real-Time Payments reason code `BE07`. - - `invalid_creditor_address` - The creditor's address is required, but missing - or invalid. Corresponds to the Real-Time Payments reason code `BE04`. - - `creditor_identifier_incorrect` - Creditor identifier incorrect. Corresponds - to the Real-Time Payments reason code `CH11`. - - `requested_by_customer` - The customer refused the request. Corresponds to the - Real-Time Payments reason code `CUST`. - - `order_rejected` - The order was rejected. Corresponds to the Real-Time - Payments reason code `DS04`. - - `end_customer_deceased` - The destination account holder is deceased. - Corresponds to the Real-Time Payments reason code `MD07`. - - `customer_has_opted_out` - The customer has opted out of receiving requests - for payments from this creditor. Corresponds to the Real-Time Payments reason - code `SL12`. - - `other` - Some other error or issue has occurred. - """ - - -class Rejection(BaseModel): - reject_reason_code: Literal[ - "account_closed", - "account_blocked", - "invalid_creditor_account_type", - "invalid_creditor_account_number", - "invalid_creditor_financial_institution_identifier", - "end_customer_deceased", - "narrative", - "transaction_forbidden", - "transaction_type_not_supported", - "unexpected_amount", - "amount_exceeds_bank_limits", - "invalid_creditor_address", - "unknown_end_customer", - "invalid_debtor_address", - "timeout", - "unsupported_message_for_recipient", - "recipient_connection_not_available", - "real_time_payments_suspended", - "instructed_agent_signed_off", - "processing_error", - "other", - ] - """ - The reason the request for payment was rejected as provided by the recipient - bank or the Real-Time Payments network. - - - `account_closed` - The destination account is closed. Corresponds to the - Real-Time Payments reason code `AC04`. - - `account_blocked` - The destination account is currently blocked from - receiving transactions. Corresponds to the Real-Time Payments reason code - `AC06`. - - `invalid_creditor_account_type` - The destination account is ineligible to - receive Real-Time Payments transfers. Corresponds to the Real-Time Payments - reason code `AC14`. - - `invalid_creditor_account_number` - The destination account does not exist. - Corresponds to the Real-Time Payments reason code `AC03`. - - `invalid_creditor_financial_institution_identifier` - The destination routing - number is invalid. Corresponds to the Real-Time Payments reason code `RC04`. - - `end_customer_deceased` - The destination account holder is deceased. - Corresponds to the Real-Time Payments reason code `MD07`. - - `narrative` - The reason is provided as narrative information in the - additional information field. - - `transaction_forbidden` - Real-Time Payments transfers are not allowed to the - destination account. Corresponds to the Real-Time Payments reason code `AG01`. - - `transaction_type_not_supported` - Real-Time Payments transfers are not - enabled for the destination account. Corresponds to the Real-Time Payments - reason code `AG03`. - - `unexpected_amount` - The amount of the transfer is different than expected by - the recipient. Corresponds to the Real-Time Payments reason code `AM09`. - - `amount_exceeds_bank_limits` - The amount is higher than the recipient is - authorized to send or receive. Corresponds to the Real-Time Payments reason - code `AM14`. - - `invalid_creditor_address` - The creditor's address is required, but missing - or invalid. Corresponds to the Real-Time Payments reason code `BE04`. - - `unknown_end_customer` - The specified creditor is unknown. Corresponds to the - Real-Time Payments reason code `BE06`. - - `invalid_debtor_address` - The debtor's address is required, but missing or - invalid. Corresponds to the Real-Time Payments reason code `BE07`. - - `timeout` - There was a timeout processing the transfer. Corresponds to the - Real-Time Payments reason code `DS24`. - - `unsupported_message_for_recipient` - Real-Time Payments transfers are not - enabled for the destination account. Corresponds to the Real-Time Payments - reason code `NOAT`. - - `recipient_connection_not_available` - The destination financial institution - is currently not connected to Real-Time Payments. Corresponds to the Real-Time - Payments reason code `9912`. - - `real_time_payments_suspended` - Real-Time Payments is currently unavailable. - Corresponds to the Real-Time Payments reason code `9948`. - - `instructed_agent_signed_off` - The destination financial institution is - currently signed off of Real-Time Payments. Corresponds to the Real-Time - Payments reason code `9910`. - - `processing_error` - The transfer was rejected due to an internal Increase - issue. We have been notified. - - `other` - Some other error or issue has occurred. - """ - - -class Submission(BaseModel): - payment_information_identification: str - """The Real-Time Payments payment information identification of the request.""" - - -class RealTimePaymentsRequestForPayment(BaseModel): - id: str - """The Real-Time Payments Request for Payment's identifier.""" - - amount: int - """The transfer amount in USD cents.""" - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the request for payment was created. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transfer's - currency. For real-time payments transfers this is always equal to `USD`. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - debtor_name: str - """The name of the recipient the sender is requesting a transfer from.""" - - destination_account_number_id: str - """The Account Number in which a successful transfer will arrive.""" - - expires_at: date - """The expiration time for this request, in UTC. - - The requestee will not be able to pay after this date. - """ - - fulfillment_transaction_id: Optional[str] = None - """The transaction that fulfilled this request.""" - - idempotency_key: Optional[str] = None - """The idempotency key you chose for this object. - - This value is unique across Increase and is used to ensure that a request is - only processed once. Learn more about - [idempotency](https://increase.com/documentation/idempotency-keys). - """ - - refusal: Optional[Refusal] = None - """ - If the request for payment is refused by the destination financial institution - or the receiving customer, this will contain supplemental details. - """ - - rejection: Optional[Rejection] = None - """ - If the request for payment is rejected by Real-Time Payments or the destination - financial institution, this will contain supplemental details. - """ - - remittance_information: str - """Unstructured information that will show on the recipient's bank statement.""" - - source_account_number: str - """The account number the request is sent to.""" - - source_routing_number: str - """ - The receiver's American Bankers' Association (ABA) Routing Transit Number (RTN). - """ - - status: Literal["pending_submission", "pending_response", "rejected", "accepted", "refused", "fulfilled"] - """The lifecycle status of the request for payment. - - - `pending_submission` - The request for payment is queued to be submitted to - Real-Time Payments. - - `pending_response` - The request for payment has been submitted and is pending - a response from Real-Time Payments. - - `rejected` - The request for payment was rejected by the network or the - recipient. - - `accepted` - The request for payment was accepted by the recipient but has not - yet been paid. - - `refused` - The request for payment was refused by the recipient. - - `fulfilled` - The request for payment was fulfilled by the receiver. - """ - - submission: Optional[Submission] = None - """ - After the request for payment is submitted to Real-Time Payments, this will - contain supplemental details. - """ - - type: Literal["real_time_payments_request_for_payment"] - """A constant representing the object's type. - - For this resource it will always be `real_time_payments_request_for_payment`. - """ diff --git a/src/increase/types/real_time_payments_request_for_payment_create_params.py b/src/increase/types/real_time_payments_request_for_payment_create_params.py deleted file mode 100644 index f179faa09..000000000 --- a/src/increase/types/real_time_payments_request_for_payment_create_params.py +++ /dev/null @@ -1,62 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import date -from typing_extensions import Required, Annotated, TypedDict - -from .._utils import PropertyInfo - -__all__ = ["RealTimePaymentsRequestForPaymentCreateParams", "Debtor", "DebtorAddress"] - - -class RealTimePaymentsRequestForPaymentCreateParams(TypedDict, total=False): - amount: Required[int] - """The requested amount in USD cents. Must be positive.""" - - debtor: Required[Debtor] - """Details of the person being requested to pay.""" - - destination_account_number_id: Required[str] - """The identifier of the Account Number where the funds will land.""" - - expires_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] - """The expiration time for this request, in UTC. - - The requestee will not be able to pay after this date. - """ - - remittance_information: Required[str] - """Unstructured information that will show on the requestee's bank statement.""" - - source_account_number: Required[str] - """The account number the funds will be requested from.""" - - source_routing_number: Required[str] - """ - The requestee's American Bankers' Association (ABA) Routing Transit Number - (RTN). - """ - - -class DebtorAddress(TypedDict, total=False): - country: Required[str] - """The ISO 3166, Alpha-2 country code.""" - - city: str - """The town or city.""" - - post_code: str - """The postal code or zip.""" - - street_name: str - """The street name without the street number.""" - - -class Debtor(TypedDict, total=False): - address: Required[DebtorAddress] - """Address of the debtor.""" - - name: Required[str] - """The name of the debtor.""" diff --git a/src/increase/types/real_time_payments_transfer.py b/src/increase/types/real_time_payments_transfer.py index 2506a356f..ffc991288 100644 --- a/src/increase/types/real_time_payments_transfer.py +++ b/src/increase/types/real_time_payments_transfer.py @@ -1,15 +1,41 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["RealTimePaymentsTransfer", "Approval", "Cancellation", "Rejection", "Submission"] +__all__ = [ + "RealTimePaymentsTransfer", + "Acknowledgement", + "Approval", + "Cancellation", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "Rejection", + "Submission", +] + + +class Acknowledgement(BaseModel): + """ + If the transfer is acknowledged by the recipient bank, this will contain supplemental details. + """ + + acknowledged_at: datetime + """When the transfer was acknowledged.""" class Approval(BaseModel): + """ + If your account requires approvals for transfers and the transfer was approved, this will contain details of the approval. + """ + approved_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -24,6 +50,10 @@ class Approval(BaseModel): class Cancellation(BaseModel): + """ + If your account requires approvals for transfers and the transfer was not approved, this will contain details of the cancellation. + """ + canceled_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -37,7 +67,55 @@ class Cancellation(BaseModel): """ +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + class Rejection(BaseModel): + """ + If the transfer is rejected by Real-Time Payments or the destination financial institution, this will contain supplemental details. + """ + reject_reason_additional_information: Optional[str] = None """ Additional information about the rejection provided by the recipient bank when @@ -129,6 +207,10 @@ class Rejection(BaseModel): class Submission(BaseModel): + """ + After the transfer is submitted to Real-Time Payments, this will contain supplemental details. + """ + submitted_at: Optional[datetime] = None """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -140,12 +222,25 @@ class Submission(BaseModel): class RealTimePaymentsTransfer(BaseModel): + """ + Real-Time Payments transfers move funds, within seconds, between your Increase account and any other account on the Real-Time Payments network. + """ + id: str """The Real-Time Payments Transfer's identifier.""" account_id: str """The Account from which the transfer was sent.""" + account_number: str + """The destination account number.""" + + acknowledgement: Optional[Acknowledgement] = None + """ + If the transfer is acknowledged by the recipient bank, this will contain + supplemental details. + """ + amount: int """The transfer amount in USD cents.""" @@ -167,35 +262,27 @@ class RealTimePaymentsTransfer(BaseModel): the transfer was created. """ + created_by: Optional[CreatedBy] = None + """What object created the transfer, either via the API or the dashboard.""" + creditor_name: str - """The name of the transfer's recipient as provided by the sender.""" + """The name of the transfer's recipient. - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + This is set by the sender when creating the transfer. + """ + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transfer's currency. For real-time payments transfers this is always equal to `USD`. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ debtor_name: Optional[str] = None """The name of the transfer's sender. - If not provided, the account's entity name will be used. - """ - - destination_account_number: str - """The destination account number.""" - - destination_routing_number: str - """ - The destination American Bankers' Association (ABA) Routing Transit Number - (RTN). + If not provided, defaults to the name of the account's entity. """ external_account_id: Optional[str] = None @@ -223,8 +310,11 @@ class RealTimePaymentsTransfer(BaseModel): institution, this will contain supplemental details. """ - remittance_information: str - """Unstructured information that will show on the recipient's bank statement.""" + routing_number: str + """ + The destination American Bankers' Association (ABA) Routing Transit Number + (RTN). + """ source_account_number_id: str """The Account Number the recipient will see as having sent the transfer.""" @@ -233,25 +323,25 @@ class RealTimePaymentsTransfer(BaseModel): "pending_approval", "canceled", "pending_reviewing", + "requires_attention", + "rejected", "pending_submission", "submitted", "complete", - "rejected", - "requires_attention", ] """The lifecycle status of the transfer. - `pending_approval` - The transfer is pending approval. - `canceled` - The transfer has been canceled. - `pending_reviewing` - The transfer is pending review by Increase. + - `requires_attention` - The transfer requires attention from an Increase + operator. + - `rejected` - The transfer was rejected by the network or the recipient's bank. - `pending_submission` - The transfer is queued to be submitted to Real-Time Payments. - `submitted` - The transfer has been submitted and is pending a response from Real-Time Payments. - `complete` - The transfer has been sent successfully and is complete. - - `rejected` - The transfer was rejected by the network or the recipient's bank. - - `requires_attention` - The transfer requires attention from an Increase - operator. """ submission: Optional[Submission] = None @@ -270,9 +360,30 @@ class RealTimePaymentsTransfer(BaseModel): """ ultimate_creditor_name: Optional[str] = None - """The name of the party on whose behalf the creditor is receiving the payment.""" + """The name of the ultimate recipient of the transfer. - ultimate_debtor_name: Optional[str] = None + Set this if the creditor is an intermediary receiving the payment for someone + else. """ - The name of the the party on whose behalf the debtor is instructing the payment. + + ultimate_debtor_name: Optional[str] = None + """The name of the ultimate sender of the transfer. + + Set this if the funds are being sent on behalf of someone who is not the account + holder at Increase. """ + + unstructured_remittance_information: str + """Unstructured information that will show on the recipient's bank statement.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/real_time_payments_transfer_create_params.py b/src/increase/types/real_time_payments_transfer_create_params.py index a6171438b..ebf274002 100644 --- a/src/increase/types/real_time_payments_transfer_create_params.py +++ b/src/increase/types/real_time_payments_transfer_create_params.py @@ -17,41 +17,47 @@ class RealTimePaymentsTransferCreateParams(TypedDict, total=False): creditor_name: Required[str] """The name of the transfer's recipient.""" - remittance_information: Required[str] - """Unstructured information that will show on the recipient's bank statement.""" - source_account_number_id: Required[str] """The identifier of the Account Number from which to send the transfer.""" - debtor_name: str - """The name of the transfer's sender. - - If not provided, the account's entity name will be used. - """ + unstructured_remittance_information: Required[str] + """Unstructured information that will show on the recipient's bank statement.""" - destination_account_number: str + account_number: str """The destination account number.""" - destination_routing_number: str - """ - The destination American Bankers' Association (ABA) Routing Transit Number - (RTN). + debtor_name: str + """The name of the transfer's sender. + + If not provided, defaults to the name of the account's entity. """ external_account_id: str """The ID of an External Account to initiate a transfer to. - If this parameter is provided, `destination_account_number` and - `destination_routing_number` must be absent. + If this parameter is provided, `account_number` and `routing_number` must be + absent. """ require_approval: bool """Whether the transfer requires explicit approval via the dashboard or API.""" + routing_number: str + """ + The destination American Bankers' Association (ABA) Routing Transit Number + (RTN). + """ + ultimate_creditor_name: str - """The name of the party on whose behalf the creditor is receiving the payment.""" + """The name of the ultimate recipient of the transfer. - ultimate_debtor_name: str + Set this if the creditor is an intermediary receiving the payment for someone + else. """ - The name of the the party on whose behalf the debtor is instructing the payment. + + ultimate_debtor_name: str + """The name of the ultimate sender of the transfer. + + Set this if the funds are being sent on behalf of someone who is not the account + holder at Increase. """ diff --git a/src/increase/types/real_time_payments_transfer_list_params.py b/src/increase/types/real_time_payments_transfer_list_params.py index 086a5444f..c3f46e2e1 100644 --- a/src/increase/types/real_time_payments_transfer_list_params.py +++ b/src/increase/types/real_time_payments_transfer_list_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["RealTimePaymentsTransferListParams", "CreatedAt"] +__all__ = ["RealTimePaymentsTransferListParams", "CreatedAt", "Status"] class RealTimePaymentsTransferListParams(TypedDict, total=False): @@ -42,6 +42,8 @@ class RealTimePaymentsTransferListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ + status: Status + class CreatedAt(TypedDict, total=False): after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] @@ -67,3 +69,27 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[ + Literal[ + "pending_approval", + "canceled", + "pending_reviewing", + "requires_attention", + "rejected", + "pending_submission", + "submitted", + "complete", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/routing_number.py b/src/increase/types/routing_number_list_response.py similarity index 74% rename from src/increase/types/routing_number.py rename to src/increase/types/routing_number_list_response.py index f9bab1249..30cce17e4 100644 --- a/src/increase/types/routing_number.py +++ b/src/increase/types/routing_number_list_response.py @@ -4,10 +4,12 @@ from .._models import BaseModel -__all__ = ["RoutingNumber"] +__all__ = ["RoutingNumberListResponse"] -class RoutingNumber(BaseModel): +class RoutingNumberListResponse(BaseModel): + """Routing numbers are used to identify your bank in a financial transaction.""" + ach_transfers: Literal["supported", "not_supported"] """This routing number's support for ACH Transfers. @@ -15,6 +17,13 @@ class RoutingNumber(BaseModel): - `not_supported` - The routing number cannot receive this transfer type. """ + fednow_transfers: Literal["supported", "not_supported"] + """This routing number's support for FedNow Transfers. + + - `supported` - The routing number can receive this transfer type. + - `not_supported` - The routing number cannot receive this transfer type. + """ + name: str """The name of the financial institution belonging to a routing number.""" diff --git a/src/increase/types/simulations/__init__.py b/src/increase/types/simulations/__init__.py index ae776ab53..17ec3a35e 100644 --- a/src/increase/types/simulations/__init__.py +++ b/src/increase/types/simulations/__init__.py @@ -2,25 +2,45 @@ from __future__ import annotations -from .card_authorize_params import CardAuthorizeParams as CardAuthorizeParams +from .export_create_params import ExportCreateParams as ExportCreateParams from .program_create_params import ProgramCreateParams as ProgramCreateParams -from .card_settlement_params import CardSettlementParams as CardSettlementParams -from .document_create_params import DocumentCreateParams as DocumentCreateParams +from .card_token_create_params import CardTokenCreateParams as CardTokenCreateParams from .card_refund_create_params import CardRefundCreateParams as CardRefundCreateParams from .ach_transfer_return_params import ACHTransferReturnParams as ACHTransferReturnParams +from .ach_transfer_settle_params import ACHTransferSettleParams as ACHTransferSettleParams from .card_dispute_action_params import CardDisputeActionParams as CardDisputeActionParams -from .card_authorization_simulation import CardAuthorizationSimulation as CardAuthorizationSimulation +from .card_reversal_create_params import CardReversalCreateParams as CardReversalCreateParams +from .check_deposit_submit_params import CheckDepositSubmitParams as CheckDepositSubmitParams +from .physical_card_create_params import PhysicalCardCreateParams as PhysicalCardCreateParams +from .card_increment_create_params import CardIncrementCreateParams as CardIncrementCreateParams +from .card_settlement_create_params import CardSettlementCreateParams as CardSettlementCreateParams from .interest_payment_create_params import InterestPaymentCreateParams as InterestPaymentCreateParams from .account_statement_create_params import AccountStatementCreateParams as AccountStatementCreateParams -from .ach_transfer_create_inbound_params import ACHTransferCreateInboundParams as ACHTransferCreateInboundParams -from .inbound_funds_hold_release_response import InboundFundsHoldReleaseResponse as InboundFundsHoldReleaseResponse -from .wire_transfer_create_inbound_params import WireTransferCreateInboundParams as WireTransferCreateInboundParams -from .physical_card_shipment_advance_params import ( - PhysicalCardShipmentAdvanceParams as PhysicalCardShipmentAdvanceParams, +from .check_deposit_adjustment_params import CheckDepositAdjustmentParams as CheckDepositAdjustmentParams +from .inbound_mail_item_create_params import InboundMailItemCreateParams as InboundMailItemCreateParams +from .card_authorization_create_params import CardAuthorizationCreateParams as CardAuthorizationCreateParams +from .card_authentication_create_params import CardAuthenticationCreateParams as CardAuthenticationCreateParams +from .card_authorization_create_response import CardAuthorizationCreateResponse as CardAuthorizationCreateResponse +from .card_balance_inquiry_create_params import CardBalanceInquiryCreateParams as CardBalanceInquiryCreateParams +from .inbound_ach_transfer_create_params import InboundACHTransferCreateParams as InboundACHTransferCreateParams +from .inbound_check_deposit_create_params import InboundCheckDepositCreateParams as InboundCheckDepositCreateParams +from .inbound_wire_transfer_create_params import InboundWireTransferCreateParams as InboundWireTransferCreateParams +from .card_fuel_confirmation_create_params import CardFuelConfirmationCreateParams as CardFuelConfirmationCreateParams +from .inbound_fednow_transfer_create_params import ( + InboundFednowTransferCreateParams as InboundFednowTransferCreateParams, +) +from .physical_card_advance_shipment_params import ( + PhysicalCardAdvanceShipmentParams as PhysicalCardAdvanceShipmentParams, +) +from .inbound_check_deposit_adjustment_params import ( + InboundCheckDepositAdjustmentParams as InboundCheckDepositAdjustmentParams, ) from .digital_wallet_token_request_create_params import ( DigitalWalletTokenRequestCreateParams as DigitalWalletTokenRequestCreateParams, ) +from .card_authorization_expiration_create_params import ( + CardAuthorizationExpirationCreateParams as CardAuthorizationExpirationCreateParams, +) from .inbound_wire_drawdown_request_create_params import ( InboundWireDrawdownRequestCreateParams as InboundWireDrawdownRequestCreateParams, ) @@ -30,9 +50,12 @@ from .digital_wallet_token_request_create_response import ( DigitalWalletTokenRequestCreateResponse as DigitalWalletTokenRequestCreateResponse, ) -from .real_time_payments_transfer_create_inbound_params import ( - RealTimePaymentsTransferCreateInboundParams as RealTimePaymentsTransferCreateInboundParams, +from .card_authentication_challenge_attempts_params import ( + CardAuthenticationChallengeAttemptsParams as CardAuthenticationChallengeAttemptsParams, +) +from .ach_transfer_create_notification_of_change_params import ( + ACHTransferCreateNotificationOfChangeParams as ACHTransferCreateNotificationOfChangeParams, ) -from .inbound_real_time_payments_transfer_simulation_result import ( - InboundRealTimePaymentsTransferSimulationResult as InboundRealTimePaymentsTransferSimulationResult, +from .inbound_real_time_payments_transfer_create_params import ( + InboundRealTimePaymentsTransferCreateParams as InboundRealTimePaymentsTransferCreateParams, ) diff --git a/src/increase/types/simulations/ach_transfer_create_inbound_params.py b/src/increase/types/simulations/ach_transfer_create_inbound_params.py deleted file mode 100644 index 077cea994..000000000 --- a/src/increase/types/simulations/ach_transfer_create_inbound_params.py +++ /dev/null @@ -1,51 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing import Union -from datetime import datetime -from typing_extensions import Required, Annotated, TypedDict - -from ..._utils import PropertyInfo - -__all__ = ["ACHTransferCreateInboundParams"] - - -class ACHTransferCreateInboundParams(TypedDict, total=False): - account_number_id: Required[str] - """The identifier of the Account Number the inbound ACH Transfer is for.""" - - amount: Required[int] - """The transfer amount in cents. - - A positive amount originates a credit transfer pushing funds to the receiving - account. A negative amount originates a debit transfer pulling funds from the - receiving account. - """ - - company_descriptive_date: str - """The description of the date of the transfer.""" - - company_discretionary_data: str - """Data associated with the transfer set by the sender.""" - - company_entry_description: str - """The description of the transfer set by the sender.""" - - company_id: str - """The sender's company ID.""" - - company_name: str - """The name of the sender.""" - - receiver_id_number: str - """The ID of the receiver of the transfer.""" - - receiver_name: str - """The name of the receiver of the transfer.""" - - resolve_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] - """The time at which the transfer should be resolved. - - If not provided will resolve immediately. - """ diff --git a/src/increase/types/simulations/ach_transfer_create_notification_of_change_params.py b/src/increase/types/simulations/ach_transfer_create_notification_of_change_params.py new file mode 100644 index 000000000..13a1f88d9 --- /dev/null +++ b/src/increase/types/simulations/ach_transfer_create_notification_of_change_params.py @@ -0,0 +1,73 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ACHTransferCreateNotificationOfChangeParams"] + + +class ACHTransferCreateNotificationOfChangeParams(TypedDict, total=False): + change_code: Required[ + Literal[ + "incorrect_account_number", + "incorrect_routing_number", + "incorrect_routing_number_and_account_number", + "incorrect_transaction_code", + "incorrect_account_number_and_transaction_code", + "incorrect_routing_number_account_number_and_transaction_code", + "incorrect_receiving_depository_financial_institution_identification", + "incorrect_individual_identification_number", + "addenda_format_error", + "incorrect_standard_entry_class_code_for_outbound_international_payment", + "misrouted_notification_of_change", + "incorrect_trace_number", + "incorrect_company_identification_number", + "incorrect_identification_number", + "incorrectly_formatted_corrected_data", + "incorrect_discretionary_data", + "routing_number_not_from_original_entry_detail_record", + "depository_financial_institution_account_number_not_from_original_entry_detail_record", + "incorrect_transaction_code_by_originating_depository_financial_institution", + ] + ] + """The reason for the notification of change. + + - `incorrect_account_number` - The account number was incorrect. + - `incorrect_routing_number` - The routing number was incorrect. + - `incorrect_routing_number_and_account_number` - Both the routing number and + the account number were incorrect. + - `incorrect_transaction_code` - The transaction code was incorrect. Try + changing the `funding` parameter from checking to savings or vice-versa. + - `incorrect_account_number_and_transaction_code` - The account number and the + transaction code were incorrect. + - `incorrect_routing_number_account_number_and_transaction_code` - The routing + number, account number, and transaction code were incorrect. + - `incorrect_receiving_depository_financial_institution_identification` - The + receiving depository financial institution identification was incorrect. + - `incorrect_individual_identification_number` - The individual identification + number was incorrect. + - `addenda_format_error` - The addenda had an incorrect format. + - `incorrect_standard_entry_class_code_for_outbound_international_payment` - The + standard entry class code was incorrect for an outbound international payment. + - `misrouted_notification_of_change` - The notification of change was misrouted. + - `incorrect_trace_number` - The trace number was incorrect. + - `incorrect_company_identification_number` - The company identification number + was incorrect. + - `incorrect_identification_number` - The individual identification number or + identification number was incorrect. + - `incorrectly_formatted_corrected_data` - The corrected data was incorrectly + formatted. + - `incorrect_discretionary_data` - The discretionary data was incorrect. + - `routing_number_not_from_original_entry_detail_record` - The routing number + was not from the original entry detail record. + - `depository_financial_institution_account_number_not_from_original_entry_detail_record` - + The depository financial institution account number was not from the original + entry detail record. + - `incorrect_transaction_code_by_originating_depository_financial_institution` - + The transaction code was incorrect, initiated by the originating depository + financial institution. + """ + + corrected_data: Required[str] + """The corrected data for the notification of change (e.g., a new routing number).""" diff --git a/src/increase/types/simulations/ach_transfer_return_params.py b/src/increase/types/simulations/ach_transfer_return_params.py index 164364c6e..fc6bb2cef 100644 --- a/src/increase/types/simulations/ach_transfer_return_params.py +++ b/src/increase/types/simulations/ach_transfer_return_params.py @@ -85,24 +85,28 @@ class ACHTransferReturnParams(TypedDict, total=False): Defaults to `no_account`. - `insufficient_fund` - Code R01. Insufficient funds in the receiving account. - Sometimes abbreviated to NSF. + Sometimes abbreviated to "NSF." - `no_account` - Code R03. The account does not exist or the receiving bank was unable to locate it. - `account_closed` - Code R02. The account is closed at the receiving bank. - `invalid_account_number_structure` - Code R04. The account number is invalid at the receiving bank. - - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. The account - at the receiving bank was frozen per the Office of Foreign Assets Control. - - `credit_entry_refused_by_receiver` - Code R23. The receiving bank account - refused a credit transfer. + - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. This return + code has two separate meanings. (1) The receiving bank froze the account or + (2) the Office of Foreign Assets Control (OFAC) instructed the receiving bank + to return the entry. + - `credit_entry_refused_by_receiver` - Code R23. The receiving bank refused the + credit transfer. - `unauthorized_debit_to_consumer_account_using_corporate_sec_code` - Code R05. The receiving bank rejected because of an incorrect Standard Entry Class code. + Consumer accounts cannot be debited as `corporate_credit_or_debit` or + `corporate_trade_exchange`. - `corporate_customer_advised_not_authorized` - Code R29. The corporate customer at the receiving bank reversed the transfer. - `payment_stopped` - Code R08. The receiving bank stopped payment on this transfer. - - `non_transaction_account` - Code R20. The receiving bank account does not - perform transfers. + - `non_transaction_account` - Code R20. The account is not eligible for ACH, + such as a savings account with transaction limits. - `uncollected_funds` - Code R09. The receiving bank account does not have enough available balance for the transfer. - `routing_number_check_digit_error` - Code R28. The routing number is @@ -110,14 +114,13 @@ class ACHTransferReturnParams(TypedDict, total=False): - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - Code R10. The customer at the receiving bank reversed the transfer. - `amount_field_error` - Code R19. The amount field is incorrect or too large. - - `authorization_revoked_by_customer` - Code R07. The customer at the receiving - institution informed their bank that they have revoked authorization for a - previously authorized transfer. + - `authorization_revoked_by_customer` - Code R07. The customer revoked their + authorization for a previously authorized transfer. - `invalid_ach_routing_number` - Code R13. The routing number is invalid. - `file_record_edit_criteria` - Code R17. The receiving bank is unable to process a field in the transfer. - - `enr_invalid_individual_name` - Code R45. The individual name field was - invalid. + - `enr_invalid_individual_name` - Code R45. A rare return reason. The individual + name field was invalid. - `returned_per_odfi_request` - Code R06. The originating financial institution asked for this transfer to be returned. The receiving bank is complying with the request. @@ -212,8 +215,8 @@ class ACHTransferReturnParams(TypedDict, total=False): a malformed credit entry. - `return_of_improper_debit_entry` - Code R35. A rare return reason. Return of a malformed debit entry. - - `return_of_xck_entry` - Code R33. A rare return reason. Return of a Destroyed - Check ("XKC") entry. + - `return_of_xck_entry` - Code R33. A rare return reason. Return of a destroyed + check ("XCK") entry. - `source_document_presented_for_payment` - Code R37. A rare return reason. The source document related to this ACH, usually an ACH check conversion, was presented to the bank. diff --git a/src/increase/types/simulations/ach_transfer_settle_params.py b/src/increase/types/simulations/ach_transfer_settle_params.py new file mode 100644 index 000000000..c885df8fa --- /dev/null +++ b/src/increase/types/simulations/ach_transfer_settle_params.py @@ -0,0 +1,20 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["ACHTransferSettleParams"] + + +class ACHTransferSettleParams(TypedDict, total=False): + inbound_funds_hold_behavior: Literal["release_immediately", "release_on_default_schedule"] + """ + The behavior of the inbound funds hold that is created when the ACH Transfer is + settled. If no behavior is specified, the inbound funds hold will be released + immediately in order for the funds to be available for use. + + - `release_immediately` - Release the inbound funds hold immediately. + - `release_on_default_schedule` - Release the inbound funds hold on the default + schedule. + """ diff --git a/src/increase/types/simulations/card_authentication_challenge_attempts_params.py b/src/increase/types/simulations/card_authentication_challenge_attempts_params.py new file mode 100644 index 000000000..472611c19 --- /dev/null +++ b/src/increase/types/simulations/card_authentication_challenge_attempts_params.py @@ -0,0 +1,12 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CardAuthenticationChallengeAttemptsParams"] + + +class CardAuthenticationChallengeAttemptsParams(TypedDict, total=False): + one_time_code: Required[str] + """The one-time code to be validated.""" diff --git a/src/increase/types/simulations/card_authentication_create_params.py b/src/increase/types/simulations/card_authentication_create_params.py new file mode 100644 index 000000000..2f559f1cf --- /dev/null +++ b/src/increase/types/simulations/card_authentication_create_params.py @@ -0,0 +1,50 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CardAuthenticationCreateParams"] + + +class CardAuthenticationCreateParams(TypedDict, total=False): + card_id: Required[str] + """The identifier of the Card to be authorized.""" + + category: Literal["payment_authentication", "non_payment_authentication"] + """The category of the card authentication attempt. + + - `payment_authentication` - The authentication attempt is for a payment. + - `non_payment_authentication` - The authentication attempt is not for a + payment. + """ + + device_channel: Literal["app", "browser", "three_ds_requestor_initiated"] + """The device channel of the card authentication attempt. + + - `app` - The authentication attempt was made from an app. + - `browser` - The authentication attempt was made from a browser. + - `three_ds_requestor_initiated` - The authentication attempt was initiated by + the 3DS Requestor. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_country: str + """The country the merchant resides in.""" + + merchant_name: str + """The name of the merchant""" + + purchase_amount: int + """The purchase amount in cents.""" diff --git a/src/increase/types/simulations/card_authorization_create_params.py b/src/increase/types/simulations/card_authorization_create_params.py new file mode 100644 index 000000000..b65f4c06a --- /dev/null +++ b/src/increase/types/simulations/card_authorization_create_params.py @@ -0,0 +1,244 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = [ + "CardAuthorizationCreateParams", + "NetworkDetails", + "NetworkDetailsVisa", + "ProcessingCategory", + "ProcessingCategoryRefund", +] + + +class CardAuthorizationCreateParams(TypedDict, total=False): + amount: Required[int] + """The authorization amount in cents.""" + + authenticated_card_payment_id: str + """ + The identifier of a Card Payment with a `card_authentication` if you want to + simulate an authenticated authorization. + """ + + card_id: str + """The identifier of the Card to be authorized.""" + + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + """Forces a card decline with a specific reason. + + No real time decision will be sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + """ + + digital_wallet_token_id: str + """The identifier of the Digital Wallet Token to be authorized.""" + + event_subscription_id: str + """The identifier of the Event Subscription to use. + + If provided, will override the default real time event subscription. Because you + can only create one real time decision event subscription, you can use this + field to route events to any specified event subscription for testing purposes. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: str + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_state: str + """The state the merchant resides in.""" + + network_details: NetworkDetails + """Fields specific to a given card network.""" + + network_risk_score: int + """The risk score generated by the card network. + + For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where + 99 is the riskiest. + """ + + physical_card_id: str + """The identifier of the Physical Card to be authorized.""" + + processing_category: ProcessingCategory + """ + Fields specific to a specific type of authorization, such as Automatic Fuel + Dispensers, Refund Authorizations, or Cash Disbursements. + """ + + terminal_id: str + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + +class NetworkDetailsVisa(TypedDict, total=False): + """Fields specific to the Visa network.""" + + stand_in_processing_reason: Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + """The reason code for the stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + +class NetworkDetails(TypedDict, total=False): + """Fields specific to a given card network.""" + + visa: Required[NetworkDetailsVisa] + """Fields specific to the Visa network.""" + + +class ProcessingCategoryRefund(TypedDict, total=False): + """Details related to refund authorizations.""" + + original_card_payment_id: str + """The card payment to link this refund to.""" + + +class ProcessingCategory(TypedDict, total=False): + """ + Fields specific to a specific type of authorization, such as Automatic Fuel Dispensers, Refund Authorizations, or Cash Disbursements. + """ + + category: Required[ + Literal[ + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + ] + ] + """ + The processing category describes the intent behind the authorization, such as + whether it was used for bill payments or an automatic fuel dispenser. + + - `account_funding` - Account funding transactions are transactions used to + e.g., fund an account or transfer funds between accounts. + - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur + when a card is used at a gas pump, prior to the actual transaction amount + being known. They are followed by an advice message that updates the amount of + the pending transaction. + - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. + - `purchase` - A regular purchase. + - `quasi_cash` - Quasi-cash transactions represent purchases of items which may + be convertible to cash. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + """ + + refund: ProcessingCategoryRefund + """Details related to refund authorizations.""" diff --git a/src/increase/types/simulations/card_authorization_create_response.py b/src/increase/types/simulations/card_authorization_create_response.py new file mode 100644 index 000000000..b6cd03098 --- /dev/null +++ b/src/increase/types/simulations/card_authorization_create_response.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from typing_extensions import Literal + +from ..._models import BaseModel +from ..pending_transaction import PendingTransaction +from ..declined_transaction import DeclinedTransaction + +__all__ = ["CardAuthorizationCreateResponse"] + + +class CardAuthorizationCreateResponse(BaseModel): + """The results of a Card Authorization simulation.""" + + declined_transaction: Optional[DeclinedTransaction] = None + """ + If the authorization attempt fails, this will contain the resulting + [Declined Transaction](#declined-transactions) object. The Declined + Transaction's `source` will be of `category: card_decline`. + """ + + pending_transaction: Optional[PendingTransaction] = None + """ + If the authorization attempt succeeds, this will contain the resulting Pending + Transaction object. The Pending Transaction's `source` will be of + `category: card_authorization`. + """ + + type: Literal["inbound_card_authorization_simulation_result"] + """A constant representing the object's type. + + For this resource it will always be + `inbound_card_authorization_simulation_result`. + """ diff --git a/src/increase/types/simulation_card_authorization_expirations_params.py b/src/increase/types/simulations/card_authorization_expiration_create_params.py similarity index 66% rename from src/increase/types/simulation_card_authorization_expirations_params.py rename to src/increase/types/simulations/card_authorization_expiration_create_params.py index 00aa2e09f..1fda3504d 100644 --- a/src/increase/types/simulation_card_authorization_expirations_params.py +++ b/src/increase/types/simulations/card_authorization_expiration_create_params.py @@ -4,9 +4,9 @@ from typing_extensions import Required, TypedDict -__all__ = ["SimulationCardAuthorizationExpirationsParams"] +__all__ = ["CardAuthorizationExpirationCreateParams"] -class SimulationCardAuthorizationExpirationsParams(TypedDict, total=False): +class CardAuthorizationExpirationCreateParams(TypedDict, total=False): card_payment_id: Required[str] """The identifier of the Card Payment to expire.""" diff --git a/src/increase/types/simulations/card_authorization_simulation.py b/src/increase/types/simulations/card_authorization_simulation.py deleted file mode 100644 index 37f1bcfe6..000000000 --- a/src/increase/types/simulations/card_authorization_simulation.py +++ /dev/null @@ -1,1702 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = [ - "CardAuthorizationSimulation", - "DeclinedTransaction", - "DeclinedTransactionSource", - "DeclinedTransactionSourceACHDecline", - "DeclinedTransactionSourceCardDecline", - "DeclinedTransactionSourceCardDeclineNetworkDetails", - "DeclinedTransactionSourceCardDeclineNetworkDetailsVisa", - "DeclinedTransactionSourceCardDeclineNetworkIdentifiers", - "DeclinedTransactionSourceCardDeclineVerification", - "DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode", - "DeclinedTransactionSourceCardDeclineVerificationCardholderAddress", - "DeclinedTransactionSourceCheckDecline", - "DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline", - "DeclinedTransactionSourceInternationalACHDecline", - "DeclinedTransactionSourceWireDecline", - "PendingTransaction", - "PendingTransactionSource", - "PendingTransactionSourceAccountTransferInstruction", - "PendingTransactionSourceACHTransferInstruction", - "PendingTransactionSourceCardAuthorization", - "PendingTransactionSourceCardAuthorizationNetworkDetails", - "PendingTransactionSourceCardAuthorizationNetworkDetailsVisa", - "PendingTransactionSourceCardAuthorizationNetworkIdentifiers", - "PendingTransactionSourceCardAuthorizationVerification", - "PendingTransactionSourceCardAuthorizationVerificationCardVerificationCode", - "PendingTransactionSourceCardAuthorizationVerificationCardholderAddress", - "PendingTransactionSourceCheckDepositInstruction", - "PendingTransactionSourceCheckTransferInstruction", - "PendingTransactionSourceInboundFundsHold", - "PendingTransactionSourceRealTimePaymentsTransferInstruction", - "PendingTransactionSourceWireTransferInstruction", -] - - -class DeclinedTransactionSourceACHDecline(BaseModel): - id: str - """The ACH Decline's identifier.""" - - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - originator_company_descriptive_date: Optional[str] = None - """The descriptive date of the transfer.""" - - originator_company_discretionary_data: Optional[str] = None - """The additional information included with the transfer.""" - - originator_company_id: str - """The identifier of the company that initiated the transfer.""" - - originator_company_name: str - """The name of the company that initiated the transfer.""" - - reason: Literal[ - "ach_route_canceled", - "ach_route_disabled", - "breaches_limit", - "credit_entry_refused_by_receiver", - "duplicate_return", - "entity_not_active", - "group_locked", - "insufficient_funds", - "misrouted_return", - "return_of_erroneous_or_reversing_debit", - "no_ach_route", - "originator_request", - "transaction_not_allowed", - "user_initiated", - ] - """Why the ACH transfer was declined. - - - `ach_route_canceled` - The account number is canceled. - - `ach_route_disabled` - The account number is disabled. - - `breaches_limit` - The transaction would cause an Increase limit to be - exceeded. - - `credit_entry_refused_by_receiver` - A credit was refused. This is a - reasonable default reason for decline of credits. - - `duplicate_return` - A rare return reason. The return this message refers to - was a duplicate. - - `entity_not_active` - The account's entity is not active. - - `group_locked` - Your account is inactive. - - `insufficient_funds` - Your account contains insufficient funds. - - `misrouted_return` - A rare return reason. The return this message refers to - was misrouted. - - `return_of_erroneous_or_reversing_debit` - The originating financial - institution made a mistake and this return corrects it. - - `no_ach_route` - The account number that was debited does not exist. - - `originator_request` - The originating financial institution asked for this - transfer to be returned. - - `transaction_not_allowed` - The transaction is not allowed per Increase's - terms. - - `user_initiated` - The user initiated the decline. - """ - - receiver_id_number: Optional[str] = None - """The id of the receiver of the transfer.""" - - receiver_name: Optional[str] = None - """The name of the receiver of the transfer.""" - - trace_number: str - """The trace number of the transfer.""" - - type: Literal["ach_decline"] - """A constant representing the object's type. - - For this resource it will always be `ach_decline`. - """ - - -class DeclinedTransactionSourceCardDeclineNetworkDetailsVisa(BaseModel): - electronic_commerce_indicator: Optional[ - Literal[ - "mail_phone_order", - "recurring", - "installment", - "unknown_mail_phone_order", - "secure_electronic_commerce", - "non_authenticated_security_transaction_at_3ds_capable_merchant", - "non_authenticated_security_transaction", - "non_secure_transaction", - ] - ] = None - """ - For electronic commerce transactions, this identifies the level of security used - in obtaining the customer's payment credential. For mail or telephone order - transactions, identifies the type of mail or telephone order. - - - `mail_phone_order` - Single transaction of a mail/phone order: Use to indicate - that the transaction is a mail/phone order purchase, not a recurring - transaction or installment payment. For domestic transactions in the US - region, this value may also indicate one bill payment transaction in the - card-present or card-absent environments. - - `recurring` - Recurring transaction: Payment indicator used to indicate a - recurring transaction that originates from an acquirer in the US region. - - `installment` - Installment payment: Payment indicator used to indicate one - purchase of goods or services that is billed to the account in multiple - charges over a period of time agreed upon by the cardholder and merchant from - transactions that originate from an acquirer in the US region. - - `unknown_mail_phone_order` - Unknown classification: other mail order: Use to - indicate that the type of mail/telephone order is unknown. - - `secure_electronic_commerce` - Secure electronic commerce transaction: Use to - indicate that the electronic commerce transaction has been authenticated using - e.g., 3-D Secure - - `non_authenticated_security_transaction_at_3ds_capable_merchant` - - Non-authenticated security transaction at a 3-D Secure-capable merchant, and - merchant attempted to authenticate the cardholder using 3-D Secure: Use to - identify an electronic commerce transaction where the merchant attempted to - authenticate the cardholder using 3-D Secure, but was unable to complete the - authentication because the issuer or cardholder does not participate in the - 3-D Secure program. - - `non_authenticated_security_transaction` - Non-authenticated security - transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed - using 3-D Secure. - - `non_secure_transaction` - Non-secure transaction: Use to identify an - electronic commerce transaction that has no data protection. - """ - - point_of_service_entry_mode: Optional[ - Literal[ - "unknown", - "manual", - "magnetic_stripe_no_cvv", - "optical_code", - "integrated_circuit_card", - "contactless", - "credential_on_file", - "magnetic_stripe", - "contactless_magnetic_stripe", - "integrated_circuit_card_no_cvv", - ] - ] = None - """ - The method used to enter the cardholder's primary account number and card - expiration date. - - - `unknown` - Unknown - - `manual` - Manual key entry - - `magnetic_stripe_no_cvv` - Magnetic stripe read, without card verification - value - - `optical_code` - Optical code - - `integrated_circuit_card` - Contact chip card - - `contactless` - Contactless read of chip card - - `credential_on_file` - Transaction initiated using a credential that has - previously been stored on file - - `magnetic_stripe` - Magnetic stripe read - - `contactless_magnetic_stripe` - Contactless read of magnetic stripe data - - `integrated_circuit_card_no_cvv` - Contact chip card, without card - verification value - """ - - -class DeclinedTransactionSourceCardDeclineNetworkDetails(BaseModel): - category: Literal["visa"] - """The payment network used to process this card authorization. - - - `visa` - Visa - """ - - visa: Optional[DeclinedTransactionSourceCardDeclineNetworkDetailsVisa] = None - """Fields specific to the `visa` network.""" - - -class DeclinedTransactionSourceCardDeclineNetworkIdentifiers(BaseModel): - retrieval_reference_number: Optional[str] = None - """A life-cycle identifier used across e.g., an authorization and a reversal. - - Expected to be unique per acquirer within a window of time. For some card - networks the retrieval reference number includes the trace counter. - """ - - trace_number: Optional[str] = None - """A counter used to verify an individual authorization. - - Expected to be unique per acquirer within a window of time. - """ - - transaction_id: Optional[str] = None - """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. - """ - - -class DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode(BaseModel): - result: Literal["not_checked", "match", "no_match"] - """The result of verifying the Card Verification Code. - - - `not_checked` - No card verification code was provided in the authorization - request. - - `match` - The card verification code matched the one on file. - - `no_match` - The card verification code did not match the one on file. - """ - - -class DeclinedTransactionSourceCardDeclineVerificationCardholderAddress(BaseModel): - actual_line1: Optional[str] = None - """Line 1 of the address on file for the cardholder.""" - - actual_postal_code: Optional[str] = None - """The postal code of the address on file for the cardholder.""" - - provided_line1: Optional[str] = None - """ - The cardholder address line 1 provided for verification in the authorization - request. - """ - - provided_postal_code: Optional[str] = None - """The postal code provided for verification in the authorization request.""" - - result: Literal[ - "not_checked", - "postal_code_match_address_not_checked", - "postal_code_match_address_no_match", - "postal_code_no_match_address_match", - "match", - "no_match", - ] - """The address verification result returned to the card network. - - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. - - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. - - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. - - `match` - Postal code and street address match. - - `no_match` - Postal code and street address do not match. - """ - - -class DeclinedTransactionSourceCardDeclineVerification(BaseModel): - card_verification_code: DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode - """ - Fields related to verification of the Card Verification Code, a 3-digit code on - the back of the card. - """ - - cardholder_address: DeclinedTransactionSourceCardDeclineVerificationCardholderAddress - """ - Cardholder address provided in the authorization request and the address on file - we verified it against. - """ - - -class DeclinedTransactionSourceCardDecline(BaseModel): - id: str - """The Card Decline identifier.""" - - actioner: Literal["user", "increase", "network"] - """ - Whether this authorization was approved by Increase, the card network through - stand-in processing, or the user through a real-time decision. - - - `user` - This object was actioned by the user through a real-time decision. - - `increase` - This object was actioned by Increase without user intervention. - - `network` - This object was actioned by the network, through stand-in - processing. - """ - - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - card_payment_id: Optional[str] = None - """The ID of the Card Payment this transaction belongs to.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - account currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - digital_wallet_token_id: Optional[str] = None - """ - If the authorization was made via a Digital Wallet Token (such as an Apple Pay - purchase), the identifier of the token that was used. - """ - - merchant_acceptor_id: str - """ - The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - """ - - merchant_category_code: Optional[str] = None - """ - The Merchant Category Code (commonly abbreviated as MCC) of the merchant the - card is transacting with. - """ - - merchant_city: Optional[str] = None - """The city the merchant resides in.""" - - merchant_country: Optional[str] = None - """The country the merchant resides in.""" - - merchant_descriptor: str - """The merchant descriptor of the merchant the card is transacting with.""" - - merchant_state: Optional[str] = None - """The state the merchant resides in.""" - - network_details: DeclinedTransactionSourceCardDeclineNetworkDetails - """Fields specific to the `network`.""" - - network_identifiers: DeclinedTransactionSourceCardDeclineNetworkIdentifiers - """Network-specific identifiers for a specific request or transaction.""" - - network_risk_score: Optional[int] = None - """The risk score generated by the card network. - - For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. - """ - - physical_card_id: Optional[str] = None - """ - If the authorization was made in-person with a physical card, the Physical Card - that was used. - """ - - processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" - ] - """ - The processing category describes the intent behind the authorization, such as - whether it was used for bill payments or an automatic fuel dispenser. - - - `account_funding` - Account funding transactions are transactions used to - e.g., fund an account or transfer funds between accounts. - - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur - when a card is used at a gas pump, prior to the actual transaction amount - being known. They are followed by an advice message that updates the amount of - the pending transaction. - - `bill_payment` - A transaction used to pay a bill. - - `purchase` - A regular purchase. - - `quasi_cash` - Quasi-cash transactions represent purchases of items which may - be convertible to cash. - - `refund` - A refund card authorization, sometimes referred to as a credit - voucher authorization, where funds are credited to the cardholder. - """ - - real_time_decision_id: Optional[str] = None - """ - The identifier of the Real-Time Decision sent to approve or decline this - transaction. - """ - - reason: Literal[ - "card_not_active", - "physical_card_not_active", - "entity_not_active", - "group_locked", - "insufficient_funds", - "cvv2_mismatch", - "transaction_not_allowed", - "breaches_limit", - "webhook_declined", - "webhook_timed_out", - "declined_by_stand_in_processing", - "invalid_physical_card", - "missing_original_authorization", - "suspected_fraud", - ] - """Why the transaction was declined. - - - `card_not_active` - The Card was not active. - - `physical_card_not_active` - The Physical Card was not active. - - `entity_not_active` - The account's entity was not active. - - `group_locked` - The account was inactive. - - `insufficient_funds` - The Card's Account did not have a sufficient available - balance. - - `cvv2_mismatch` - The given CVV2 did not match the card's value. - - `transaction_not_allowed` - The attempted card transaction is not allowed per - Increase's terms. - - `breaches_limit` - The transaction was blocked by a Limit. - - `webhook_declined` - Your application declined the transaction via webhook. - - `webhook_timed_out` - Your application webhook did not respond without the - required timeout. - - `declined_by_stand_in_processing` - Declined by stand-in processing. - - `invalid_physical_card` - The card read had an invalid CVV, dCVV, or - authorization request cryptogram. - - `missing_original_authorization` - The original card authorization for this - incremental authorization does not exist. - - `suspected_fraud` - The transaction was suspected to be fraudulent. Please - reach out to support@increase.com for more information. - """ - - verification: DeclinedTransactionSourceCardDeclineVerification - """Fields related to verification of cardholder-provided values.""" - - -class DeclinedTransactionSourceCheckDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - auxiliary_on_us: Optional[str] = None - """ - A computer-readable number printed on the MICR line of business checks, usually - the check number. This is useful for positive pay checks, but can be unreliably - transmitted by the bank of first deposit. - """ - - back_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the back of the - declined check. - """ - - front_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the front of the - declined check. - """ - - reason: Literal[ - "ach_route_disabled", - "ach_route_canceled", - "breaches_limit", - "entity_not_active", - "group_locked", - "insufficient_funds", - "stop_payment_requested", - "duplicate_presentment", - "not_authorized", - "amount_mismatch", - "not_our_item", - "no_account_number_found", - "refer_to_image", - "unable_to_process", - ] - """Why the check was declined. - - - `ach_route_disabled` - The account number is disabled. - - `ach_route_canceled` - The account number is canceled. - - `breaches_limit` - The transaction would cause a limit to be exceeded. - - `entity_not_active` - The account's entity is not active. - - `group_locked` - Your account is inactive. - - `insufficient_funds` - Your account contains insufficient funds. - - `stop_payment_requested` - Stop payment requested for this check. - - `duplicate_presentment` - The check was a duplicate deposit. - - `not_authorized` - The check was not authorized. - - `amount_mismatch` - The amount the receiving bank is attempting to deposit - does not match the amount on the check. - - `not_our_item` - The check attempting to be deposited does not belong to - Increase. - - `no_account_number_found` - The account number on the check does not exist at - Increase. - - `refer_to_image` - The check is not readable. Please refer to the image. - - `unable_to_process` - The check cannot be processed. This is rare: please - contact support. - """ - - -class DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - creditor_name: str - """The name the sender of the transfer specified as the recipient of the transfer.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the declined - transfer's currency. This will always be "USD" for a Real-Time Payments - transfer. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - debtor_account_number: str - """The account number of the account that sent the transfer.""" - - debtor_name: str - """The name provided by the sender of the transfer.""" - - debtor_routing_number: str - """The routing number of the account that sent the transfer.""" - - reason: Literal[ - "account_number_canceled", - "account_number_disabled", - "account_restricted", - "group_locked", - "entity_not_active", - "real_time_payments_not_enabled", - ] - """Why the transfer was declined. - - - `account_number_canceled` - The account number is canceled. - - `account_number_disabled` - The account number is disabled. - - `account_restricted` - Your account is restricted. - - `group_locked` - Your account is inactive. - - `entity_not_active` - The account's entity is not active. - - `real_time_payments_not_enabled` - Your account is not enabled to receive - Real-Time Payments transfers. - """ - - remittance_information: Optional[str] = None - """Additional information included with the transfer.""" - - transaction_identification: str - """The Real-Time Payments network identification of the declined transfer.""" - - -class DeclinedTransactionSourceInternationalACHDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - destination_country_code: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the destination country. - """ - - destination_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - destination bank account. - """ - - foreign_exchange_indicator: Literal["fixed_to_variable", "variable_to_fixed", "fixed_to_fixed"] - """A description of how the foreign exchange rate was calculated. - - - `fixed_to_variable` - The originator chose an amount in their own currency. - The settled amount in USD was converted using the exchange rate. - - `variable_to_fixed` - The originator chose an amount to settle in USD. The - originator's amount was variable; known only after the foreign exchange - conversion. - - `fixed_to_fixed` - The amount was originated and settled as a fixed amount in - USD. There is no foreign exchange conversion. - """ - - foreign_exchange_reference: Optional[str] = None - """ - Depending on the `foreign_exchange_reference_indicator`, an exchange rate or a - reference to a well-known rate. - """ - - foreign_exchange_reference_indicator: Literal["foreign_exchange_rate", "foreign_exchange_reference_number", "blank"] - """ - An instruction of how to interpret the `foreign_exchange_reference` field for - this Transaction. - - - `foreign_exchange_rate` - The ACH file contains a foreign exchange rate. - - `foreign_exchange_reference_number` - The ACH file contains a reference to a - well-known foreign exchange rate. - - `blank` - There is no foreign exchange for this transfer, so the - `foreign_exchange_reference` field is blank. - """ - - foreign_payment_amount: int - """The amount in the minor unit of the foreign payment currency. - - For dollars, for example, this is cents. - """ - - foreign_trace_number: Optional[str] = None - """A reference number in the foreign banking infrastructure.""" - - international_transaction_type_code: Literal[ - "annuity", - "business_or_commercial", - "deposit", - "loan", - "miscellaneous", - "mortgage", - "pension", - "remittance", - "rent_or_lease", - "salary_or_payroll", - "tax", - "accounts_receivable", - "back_office_conversion", - "machine_transfer", - "point_of_purchase", - "point_of_sale", - "represented_check", - "shared_network_transaction", - "telphone_initiated", - "internet_initiated", - ] - """The type of transfer. Set by the originator. - - - `annuity` - Sent as `ANN` in the Nacha file. - - `business_or_commercial` - Sent as `BUS` in the Nacha file. - - `deposit` - Sent as `DEP` in the Nacha file. - - `loan` - Sent as `LOA` in the Nacha file. - - `miscellaneous` - Sent as `MIS` in the Nacha file. - - `mortgage` - Sent as `MOR` in the Nacha file. - - `pension` - Sent as `PEN` in the Nacha file. - - `remittance` - Sent as `REM` in the Nacha file. - - `rent_or_lease` - Sent as `RLS` in the Nacha file. - - `salary_or_payroll` - Sent as `SAL` in the Nacha file. - - `tax` - Sent as `TAX` in the Nacha file. - - `accounts_receivable` - Sent as `ARC` in the Nacha file. - - `back_office_conversion` - Sent as `BOC` in the Nacha file. - - `machine_transfer` - Sent as `MTE` in the Nacha file. - - `point_of_purchase` - Sent as `POP` in the Nacha file. - - `point_of_sale` - Sent as `POS` in the Nacha file. - - `represented_check` - Sent as `RCK` in the Nacha file. - - `shared_network_transaction` - Sent as `SHR` in the Nacha file. - - `telphone_initiated` - Sent as `TEL` in the Nacha file. - - `internet_initiated` - Sent as `WEB` in the Nacha file. - """ - - originating_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - originating bank account. - """ - - originating_depository_financial_institution_branch_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originating branch country. - """ - - originating_depository_financial_institution_id: str - """An identifier for the originating bank. - - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ - - originating_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `originating_depository_financial_institution_id` field for this Transaction. - - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - - originating_depository_financial_institution_name: str - """The name of the originating bank. - - Sometimes this will refer to an American bank and obscure the correspondent - foreign bank. - """ - - originator_city: str - """A portion of the originator address. This may be incomplete.""" - - originator_company_entry_description: str - """A description field set by the originator.""" - - originator_country: str - """A portion of the originator address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originator country. - """ - - originator_identification: str - """An identifier for the originating company. - - This is generally stable across multiple ACH transfers. - """ - - originator_name: str - """Either the name of the originator or an intermediary money transmitter.""" - - originator_postal_code: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_state_or_province: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_street_address: str - """A portion of the originator address. This may be incomplete.""" - - payment_related_information: Optional[str] = None - """A description field set by the originator.""" - - payment_related_information2: Optional[str] = None - """A description field set by the originator.""" - - receiver_city: str - """A portion of the receiver address. This may be incomplete.""" - - receiver_country: str - """A portion of the receiver address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiver country. - """ - - receiver_identification_number: Optional[str] = None - """An identification number the originator uses for the receiver.""" - - receiver_postal_code: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" - - receiver_state_or_province: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" - - receiver_street_address: str - """A portion of the receiver address. This may be incomplete.""" - - receiving_company_or_individual_name: str - """The name of the receiver of the transfer. This is not verified by Increase.""" - - receiving_depository_financial_institution_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiving bank country. - """ - - receiving_depository_financial_institution_id: str - """An identifier for the receiving bank. - - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ - - receiving_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `receiving_depository_financial_institution_id` field for this Transaction. - - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - - receiving_depository_financial_institution_name: str - """The name of the receiving bank, as set by the sending financial institution.""" - - trace_number: str - """ - A 15 digit number recorded in the Nacha file and available to both the - originating and receiving bank. Along with the amount, date, and originating - routing number, this can be used to identify the ACH transfer at either bank. - ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). - """ - - -class DeclinedTransactionSourceWireDecline(BaseModel): - inbound_wire_transfer_id: str - """The identifier of the Inbound Wire Transfer that was declined.""" - - reason: Literal[ - "account_number_canceled", - "account_number_disabled", - "entity_not_active", - "group_locked", - "no_account_number", - "transaction_not_allowed", - ] - """Why the wire transfer was declined. - - - `account_number_canceled` - The account number is canceled. - - `account_number_disabled` - The account number is disabled. - - `entity_not_active` - The account's entity is not active. - - `group_locked` - Your account is inactive. - - `no_account_number` - The beneficiary account number does not exist. - - `transaction_not_allowed` - The transaction is not allowed per Increase's - terms. - """ - - -class DeclinedTransactionSource(BaseModel): - ach_decline: Optional[DeclinedTransactionSourceACHDecline] = None - """An ACH Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `ach_decline`. - """ - - card_decline: Optional[DeclinedTransactionSourceCardDecline] = None - """A Card Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_decline`. - """ - - category: Literal[ - "ach_decline", - "card_decline", - "check_decline", - "inbound_real_time_payments_transfer_decline", - "international_ach_decline", - "wire_decline", - "other", - ] - """The type of the resource. - - We may add additional possible values for this enum over time; your application - should be able to handle such additions gracefully. - - - `ach_decline` - ACH Decline: details will be under the `ach_decline` object. - - `card_decline` - Card Decline: details will be under the `card_decline` - object. - - `check_decline` - Check Decline: details will be under the `check_decline` - object. - - `inbound_real_time_payments_transfer_decline` - Inbound Real-Time Payments - Transfer Decline: details will be under the - `inbound_real_time_payments_transfer_decline` object. - - `international_ach_decline` - International ACH Decline: details will be under - the `international_ach_decline` object. - - `wire_decline` - Wire Decline: details will be under the `wire_decline` - object. - - `other` - The Declined Transaction was made for an undocumented or deprecated - reason. - """ - - check_decline: Optional[DeclinedTransactionSourceCheckDecline] = None - """A Check Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_decline`. - """ - - inbound_real_time_payments_transfer_decline: Optional[ - DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline - ] = None - """An Inbound Real-Time Payments Transfer Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_real_time_payments_transfer_decline`. - """ - - international_ach_decline: Optional[DeclinedTransactionSourceInternationalACHDecline] = None - """An International ACH Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `international_ach_decline`. - """ - - wire_decline: Optional[DeclinedTransactionSourceWireDecline] = None - """A Wire Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `wire_decline`. - """ - - -class DeclinedTransaction(BaseModel): - id: str - """The Declined Transaction identifier.""" - - account_id: str - """The identifier for the Account the Declined Transaction belongs to.""" - - amount: int - """The Declined Transaction amount in the minor unit of its currency. - - For dollars, for example, this is cents. - """ - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the - Transaction occurred. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Declined - Transaction's currency. This will match the currency on the Declined - Transaction's Account. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - description: str - """This is the description the vendor provides.""" - - route_id: Optional[str] = None - """The identifier for the route this Declined Transaction came through. - - Routes are things like cards and ACH details. - """ - - route_type: Optional[Literal["account_number", "card"]] = None - """The type of the route this Declined Transaction came through. - - - `account_number` - An Account Number. - - `card` - A Card. - """ - - source: DeclinedTransactionSource - """ - This is an object giving more details on the network-level event that caused the - Declined Transaction. For example, for a card transaction this lists the - merchant's industry and location. Note that for backwards compatibility reasons, - additional undocumented keys may appear in this object. These should be treated - as deprecated and will be removed in the future. - """ - - type: Literal["declined_transaction"] - """A constant representing the object's type. - - For this resource it will always be `declined_transaction`. - """ - - -class PendingTransactionSourceAccountTransferInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - account currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - transfer_id: str - """The identifier of the Account Transfer that led to this Pending Transaction.""" - - -class PendingTransactionSourceACHTransferInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - transfer_id: str - """The identifier of the ACH Transfer that led to this Pending Transaction.""" - - -class PendingTransactionSourceCardAuthorizationNetworkDetailsVisa(BaseModel): - electronic_commerce_indicator: Optional[ - Literal[ - "mail_phone_order", - "recurring", - "installment", - "unknown_mail_phone_order", - "secure_electronic_commerce", - "non_authenticated_security_transaction_at_3ds_capable_merchant", - "non_authenticated_security_transaction", - "non_secure_transaction", - ] - ] = None - """ - For electronic commerce transactions, this identifies the level of security used - in obtaining the customer's payment credential. For mail or telephone order - transactions, identifies the type of mail or telephone order. - - - `mail_phone_order` - Single transaction of a mail/phone order: Use to indicate - that the transaction is a mail/phone order purchase, not a recurring - transaction or installment payment. For domestic transactions in the US - region, this value may also indicate one bill payment transaction in the - card-present or card-absent environments. - - `recurring` - Recurring transaction: Payment indicator used to indicate a - recurring transaction that originates from an acquirer in the US region. - - `installment` - Installment payment: Payment indicator used to indicate one - purchase of goods or services that is billed to the account in multiple - charges over a period of time agreed upon by the cardholder and merchant from - transactions that originate from an acquirer in the US region. - - `unknown_mail_phone_order` - Unknown classification: other mail order: Use to - indicate that the type of mail/telephone order is unknown. - - `secure_electronic_commerce` - Secure electronic commerce transaction: Use to - indicate that the electronic commerce transaction has been authenticated using - e.g., 3-D Secure - - `non_authenticated_security_transaction_at_3ds_capable_merchant` - - Non-authenticated security transaction at a 3-D Secure-capable merchant, and - merchant attempted to authenticate the cardholder using 3-D Secure: Use to - identify an electronic commerce transaction where the merchant attempted to - authenticate the cardholder using 3-D Secure, but was unable to complete the - authentication because the issuer or cardholder does not participate in the - 3-D Secure program. - - `non_authenticated_security_transaction` - Non-authenticated security - transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed - using 3-D Secure. - - `non_secure_transaction` - Non-secure transaction: Use to identify an - electronic commerce transaction that has no data protection. - """ - - point_of_service_entry_mode: Optional[ - Literal[ - "unknown", - "manual", - "magnetic_stripe_no_cvv", - "optical_code", - "integrated_circuit_card", - "contactless", - "credential_on_file", - "magnetic_stripe", - "contactless_magnetic_stripe", - "integrated_circuit_card_no_cvv", - ] - ] = None - """ - The method used to enter the cardholder's primary account number and card - expiration date. - - - `unknown` - Unknown - - `manual` - Manual key entry - - `magnetic_stripe_no_cvv` - Magnetic stripe read, without card verification - value - - `optical_code` - Optical code - - `integrated_circuit_card` - Contact chip card - - `contactless` - Contactless read of chip card - - `credential_on_file` - Transaction initiated using a credential that has - previously been stored on file - - `magnetic_stripe` - Magnetic stripe read - - `contactless_magnetic_stripe` - Contactless read of magnetic stripe data - - `integrated_circuit_card_no_cvv` - Contact chip card, without card - verification value - """ - - -class PendingTransactionSourceCardAuthorizationNetworkDetails(BaseModel): - category: Literal["visa"] - """The payment network used to process this card authorization. - - - `visa` - Visa - """ - - visa: Optional[PendingTransactionSourceCardAuthorizationNetworkDetailsVisa] = None - """Fields specific to the `visa` network.""" - - -class PendingTransactionSourceCardAuthorizationNetworkIdentifiers(BaseModel): - retrieval_reference_number: Optional[str] = None - """A life-cycle identifier used across e.g., an authorization and a reversal. - - Expected to be unique per acquirer within a window of time. For some card - networks the retrieval reference number includes the trace counter. - """ - - trace_number: Optional[str] = None - """A counter used to verify an individual authorization. - - Expected to be unique per acquirer within a window of time. - """ - - transaction_id: Optional[str] = None - """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. - """ - - -class PendingTransactionSourceCardAuthorizationVerificationCardVerificationCode(BaseModel): - result: Literal["not_checked", "match", "no_match"] - """The result of verifying the Card Verification Code. - - - `not_checked` - No card verification code was provided in the authorization - request. - - `match` - The card verification code matched the one on file. - - `no_match` - The card verification code did not match the one on file. - """ - - -class PendingTransactionSourceCardAuthorizationVerificationCardholderAddress(BaseModel): - actual_line1: Optional[str] = None - """Line 1 of the address on file for the cardholder.""" - - actual_postal_code: Optional[str] = None - """The postal code of the address on file for the cardholder.""" - - provided_line1: Optional[str] = None - """ - The cardholder address line 1 provided for verification in the authorization - request. - """ - - provided_postal_code: Optional[str] = None - """The postal code provided for verification in the authorization request.""" - - result: Literal[ - "not_checked", - "postal_code_match_address_not_checked", - "postal_code_match_address_no_match", - "postal_code_no_match_address_match", - "match", - "no_match", - ] - """The address verification result returned to the card network. - - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. - - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. - - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. - - `match` - Postal code and street address match. - - `no_match` - Postal code and street address do not match. - """ - - -class PendingTransactionSourceCardAuthorizationVerification(BaseModel): - card_verification_code: PendingTransactionSourceCardAuthorizationVerificationCardVerificationCode - """ - Fields related to verification of the Card Verification Code, a 3-digit code on - the back of the card. - """ - - cardholder_address: PendingTransactionSourceCardAuthorizationVerificationCardholderAddress - """ - Cardholder address provided in the authorization request and the address on file - we verified it against. - """ - - -class PendingTransactionSourceCardAuthorization(BaseModel): - id: str - """The Card Authorization identifier.""" - - actioner: Literal["user", "increase", "network"] - """ - Whether this authorization was approved by Increase, the card network through - stand-in processing, or the user through a real-time decision. - - - `user` - This object was actioned by the user through a real-time decision. - - `increase` - This object was actioned by Increase without user intervention. - - `network` - This object was actioned by the network, through stand-in - processing. - """ - - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - card_payment_id: Optional[str] = None - """The ID of the Card Payment this transaction belongs to.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - digital_wallet_token_id: Optional[str] = None - """ - If the authorization was made via a Digital Wallet Token (such as an Apple Pay - purchase), the identifier of the token that was used. - """ - - direction: Literal["settlement", "refund"] - """ - The direction descibes the direction the funds will move, either from the - cardholder to the merchant or from the merchant to the cardholder. - - - `settlement` - A regular card authorization where funds are debited from the - cardholder. - - `refund` - A refund card authorization, sometimes referred to as a credit - voucher authorization, where funds are credited to the cardholder. - """ - - expires_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) when this authorization - will expire and the pending transaction will be released. - """ - - merchant_acceptor_id: str - """ - The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - """ - - merchant_category_code: Optional[str] = None - """ - The Merchant Category Code (commonly abbreviated as MCC) of the merchant the - card is transacting with. - """ - - merchant_city: Optional[str] = None - """The city the merchant resides in.""" - - merchant_country: Optional[str] = None - """The country the merchant resides in.""" - - merchant_descriptor: str - """The merchant descriptor of the merchant the card is transacting with.""" - - network_details: PendingTransactionSourceCardAuthorizationNetworkDetails - """Fields specific to the `network`.""" - - network_identifiers: PendingTransactionSourceCardAuthorizationNetworkIdentifiers - """Network-specific identifiers for a specific request or transaction.""" - - network_risk_score: Optional[int] = None - """The risk score generated by the card network. - - For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. - """ - - pending_transaction_id: Optional[str] = None - """The identifier of the Pending Transaction associated with this Transaction.""" - - physical_card_id: Optional[str] = None - """ - If the authorization was made in-person with a physical card, the Physical Card - that was used. - """ - - processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" - ] - """ - The processing category describes the intent behind the authorization, such as - whether it was used for bill payments or an automatic fuel dispenser. - - - `account_funding` - Account funding transactions are transactions used to - e.g., fund an account or transfer funds between accounts. - - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur - when a card is used at a gas pump, prior to the actual transaction amount - being known. They are followed by an advice message that updates the amount of - the pending transaction. - - `bill_payment` - A transaction used to pay a bill. - - `purchase` - A regular purchase. - - `quasi_cash` - Quasi-cash transactions represent purchases of items which may - be convertible to cash. - - `refund` - A refund card authorization, sometimes referred to as a credit - voucher authorization, where funds are credited to the cardholder. - """ - - real_time_decision_id: Optional[str] = None - """ - The identifier of the Real-Time Decision sent to approve or decline this - transaction. - """ - - type: Literal["card_authorization"] - """A constant representing the object's type. - - For this resource it will always be `card_authorization`. - """ - - verification: PendingTransactionSourceCardAuthorizationVerification - """Fields related to verification of cardholder-provided values.""" - - -class PendingTransactionSourceCheckDepositInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - back_image_file_id: Optional[str] = None - """ - The identifier of the File containing the image of the back of the check that - was deposited. - """ - - check_deposit_id: Optional[str] = None - """The identifier of the Check Deposit.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - front_image_file_id: str - """ - The identifier of the File containing the image of the front of the check that - was deposited. - """ - - -class PendingTransactionSourceCheckTransferInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - transfer_id: str - """The identifier of the Check Transfer that led to this Pending Transaction.""" - - -class PendingTransactionSourceInboundFundsHold(BaseModel): - id: str - """The Inbound Funds Hold identifier.""" - - amount: int - """The held amount in the minor unit of the account's currency. - - For dollars, for example, this is cents. - """ - - automatically_releases_at: datetime - """When the hold will be released automatically. - - Certain conditions may cause it to be released before this time. - """ - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the hold - was created. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - held_transaction_id: Optional[str] = None - """The ID of the Transaction for which funds were held.""" - - pending_transaction_id: Optional[str] = None - """The ID of the Pending Transaction representing the held funds.""" - - released_at: Optional[datetime] = None - """When the hold was released (if it has been released).""" - - status: Literal["held", "complete"] - """The status of the hold. - - - `held` - Funds are still being held. - - `complete` - Funds have been released. - """ - - type: Literal["inbound_funds_hold"] - """A constant representing the object's type. - - For this resource it will always be `inbound_funds_hold`. - """ - - -class PendingTransactionSourceRealTimePaymentsTransferInstruction(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - transfer_id: str - """ - The identifier of the Real-Time Payments Transfer that led to this Pending - Transaction. - """ - - -class PendingTransactionSourceWireTransferInstruction(BaseModel): - account_number: str - """The account number for the destination account.""" - - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - message_to_recipient: str - """The message that will show on the recipient's bank statement.""" - - routing_number: str - """ - The American Bankers' Association (ABA) Routing Transit Number (RTN) for the - destination account. - """ - - transfer_id: str - """The identifier of the Wire Transfer that led to this Pending Transaction.""" - - -class PendingTransactionSource(BaseModel): - account_transfer_instruction: Optional[PendingTransactionSourceAccountTransferInstruction] = None - """An Account Transfer Instruction object. - - This field will be present in the JSON response if and only if `category` is - equal to `account_transfer_instruction`. - """ - - ach_transfer_instruction: Optional[PendingTransactionSourceACHTransferInstruction] = None - """An ACH Transfer Instruction object. - - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_instruction`. - """ - - card_authorization: Optional[PendingTransactionSourceCardAuthorization] = None - """A Card Authorization object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_authorization`. - """ - - category: Literal[ - "account_transfer_instruction", - "ach_transfer_instruction", - "card_authorization", - "check_deposit_instruction", - "check_transfer_instruction", - "inbound_funds_hold", - "real_time_payments_transfer_instruction", - "wire_transfer_instruction", - "other", - ] - """The type of the resource. - - We may add additional possible values for this enum over time; your application - should be able to handle such additions gracefully. - - - `account_transfer_instruction` - Account Transfer Instruction: details will be - under the `account_transfer_instruction` object. - - `ach_transfer_instruction` - ACH Transfer Instruction: details will be under - the `ach_transfer_instruction` object. - - `card_authorization` - Card Authorization: details will be under the - `card_authorization` object. - - `check_deposit_instruction` - Check Deposit Instruction: details will be under - the `check_deposit_instruction` object. - - `check_transfer_instruction` - Check Transfer Instruction: details will be - under the `check_transfer_instruction` object. - - `inbound_funds_hold` - Inbound Funds Hold: details will be under the - `inbound_funds_hold` object. - - `real_time_payments_transfer_instruction` - Real-Time Payments Transfer - Instruction: details will be under the - `real_time_payments_transfer_instruction` object. - - `wire_transfer_instruction` - Wire Transfer Instruction: details will be under - the `wire_transfer_instruction` object. - - `other` - The Pending Transaction was made for an undocumented or deprecated - reason. - """ - - check_deposit_instruction: Optional[PendingTransactionSourceCheckDepositInstruction] = None - """A Check Deposit Instruction object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_deposit_instruction`. - """ - - check_transfer_instruction: Optional[PendingTransactionSourceCheckTransferInstruction] = None - """A Check Transfer Instruction object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_transfer_instruction`. - """ - - inbound_funds_hold: Optional[PendingTransactionSourceInboundFundsHold] = None - """An Inbound Funds Hold object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_funds_hold`. - """ - - real_time_payments_transfer_instruction: Optional[ - PendingTransactionSourceRealTimePaymentsTransferInstruction - ] = None - """A Real-Time Payments Transfer Instruction object. - - This field will be present in the JSON response if and only if `category` is - equal to `real_time_payments_transfer_instruction`. - """ - - wire_transfer_instruction: Optional[PendingTransactionSourceWireTransferInstruction] = None - """A Wire Transfer Instruction object. - - This field will be present in the JSON response if and only if `category` is - equal to `wire_transfer_instruction`. - """ - - -class PendingTransaction(BaseModel): - id: str - """The Pending Transaction identifier.""" - - account_id: str - """The identifier for the account this Pending Transaction belongs to.""" - - amount: int - """The Pending Transaction amount in the minor unit of its currency. - - For dollars, for example, this is cents. - """ - - completed_at: Optional[datetime] = None - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the Pending - Transaction was completed. - """ - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the Pending - Transaction occurred. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Pending - Transaction's currency. This will match the currency on the Pending - Transaction's Account. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - description: str - """ - For a Pending Transaction related to a transfer, this is the description you - provide. For a Pending Transaction related to a payment, this is the description - the vendor provides. - """ - - route_id: Optional[str] = None - """The identifier for the route this Pending Transaction came through. - - Routes are things like cards and ACH details. - """ - - route_type: Optional[Literal["account_number", "card"]] = None - """The type of the route this Pending Transaction came through. - - - `account_number` - An Account Number. - - `card` - A Card. - """ - - source: PendingTransactionSource - """ - This is an object giving more details on the network-level event that caused the - Pending Transaction. For example, for a card transaction this lists the - merchant's industry and location. - """ - - status: Literal["pending", "complete"] - """ - Whether the Pending Transaction has been confirmed and has an associated - Transaction. - - - `pending` - The Pending Transaction is still awaiting confirmation. - - `complete` - The Pending Transaction is confirmed. An associated Transaction - exists for this object. The Pending Transaction will no longer count against - your balance and can generally be hidden from UIs, etc. - """ - - type: Literal["pending_transaction"] - """A constant representing the object's type. - - For this resource it will always be `pending_transaction`. - """ - - -class CardAuthorizationSimulation(BaseModel): - declined_transaction: Optional[DeclinedTransaction] = None - """ - If the authorization attempt fails, this will contain the resulting - [Declined Transaction](#declined-transactions) object. The Declined - Transaction's `source` will be of `category: card_decline`. - """ - - pending_transaction: Optional[PendingTransaction] = None - """ - If the authorization attempt succeeds, this will contain the resulting Pending - Transaction object. The Pending Transaction's `source` will be of - `category: card_authorization`. - """ - - type: Literal["inbound_card_authorization_simulation_result"] - """A constant representing the object's type. - - For this resource it will always be - `inbound_card_authorization_simulation_result`. - """ diff --git a/src/increase/types/simulations/card_authorize_params.py b/src/increase/types/simulations/card_authorize_params.py deleted file mode 100644 index ec64c91be..000000000 --- a/src/increase/types/simulations/card_authorize_params.py +++ /dev/null @@ -1,50 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["CardAuthorizeParams"] - - -class CardAuthorizeParams(TypedDict, total=False): - amount: Required[int] - """The authorization amount in cents.""" - - card_id: str - """The identifier of the Card to be authorized.""" - - digital_wallet_token_id: str - """The identifier of the Digital Wallet Token to be authorized.""" - - event_subscription_id: str - """The identifier of the Event Subscription to use. - - If provided, will override the default real time event subscription. Because you - can only create one real time decision event subscription, you can use this - field to route events to any specified event subscription for testing purposes. - """ - - merchant_acceptor_id: str - """ - The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - """ - - merchant_category_code: str - """ - The Merchant Category Code (commonly abbreviated as MCC) of the merchant the - card is transacting with. - """ - - merchant_city: str - """The city the merchant resides in.""" - - merchant_country: str - """The country the merchant resides in.""" - - merchant_descriptor: str - """The merchant descriptor of the merchant the card is transacting with.""" - - physical_card_id: str - """The identifier of the Physical Card to be authorized.""" diff --git a/src/increase/types/simulations/card_balance_inquiry_create_params.py b/src/increase/types/simulations/card_balance_inquiry_create_params.py new file mode 100644 index 000000000..7c58c264e --- /dev/null +++ b/src/increase/types/simulations/card_balance_inquiry_create_params.py @@ -0,0 +1,173 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CardBalanceInquiryCreateParams", "NetworkDetails", "NetworkDetailsVisa"] + + +class CardBalanceInquiryCreateParams(TypedDict, total=False): + balance: int + """The balance amount in cents. The account balance will be used if not provided.""" + + card_id: str + """The identifier of the Card to be authorized.""" + + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "invalid_cryptogram", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + """Forces a card decline with a specific reason. + + No real time decision will be sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV or dCVV. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + """ + + digital_wallet_token_id: str + """The identifier of the Digital Wallet Token to be authorized.""" + + event_subscription_id: str + """The identifier of the Event Subscription to use. + + If provided, will override the default real time event subscription. Because you + can only create one real time decision event subscription, you can use this + field to route events to any specified event subscription for testing purposes. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: str + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_state: str + """The state the merchant resides in.""" + + network_details: NetworkDetails + """Fields specific to a given card network.""" + + network_risk_score: int + """The risk score generated by the card network. + + For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where + 99 is the riskiest. + """ + + physical_card_id: str + """The identifier of the Physical Card to be authorized.""" + + terminal_id: str + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + +class NetworkDetailsVisa(TypedDict, total=False): + """Fields specific to the Visa network.""" + + stand_in_processing_reason: Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + """The reason code for the stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + +class NetworkDetails(TypedDict, total=False): + """Fields specific to a given card network.""" + + visa: Required[NetworkDetailsVisa] + """Fields specific to the Visa network.""" diff --git a/src/increase/types/simulations/card_dispute_action_params.py b/src/increase/types/simulations/card_dispute_action_params.py index e9b818ee7..3cd69b425 100644 --- a/src/increase/types/simulations/card_dispute_action_params.py +++ b/src/increase/types/simulations/card_dispute_action_params.py @@ -4,17 +4,235 @@ from typing_extensions import Literal, Required, TypedDict -__all__ = ["CardDisputeActionParams"] +__all__ = [ + "CardDisputeActionParams", + "Visa", + "VisaAcceptChargeback", + "VisaAcceptUserSubmission", + "VisaDeclineUserPrearbitration", + "VisaReceiveMerchantPrearbitration", + "VisaRepresent", + "VisaRequestFurtherInformation", + "VisaTimeOutChargeback", + "VisaTimeOutMerchantPrearbitration", + "VisaTimeOutRepresentment", + "VisaTimeOutUserPrearbitration", +] class CardDisputeActionParams(TypedDict, total=False): - status: Required[Literal["accepted", "rejected"]] - """The status to move the dispute to. + network: Required[Literal["visa"]] + """The network of the Card Dispute. - - `accepted` - The Card Dispute has been accepted and your funds have been - returned. - - `rejected` - The Card Dispute has been rejected. + Details specific to the network are required under the sub-object with the same + identifier as the network. + + - `visa` - Visa + """ + + visa: Visa + """The Visa-specific parameters for the taking action on the dispute. + + Required if and only if `network` is `visa`. + """ + + +class VisaAcceptChargeback(TypedDict, total=False): + """The parameters for accepting the chargeback. + + Required if and only if `action` is `accept_chargeback`. + """ + + pass + + +class VisaAcceptUserSubmission(TypedDict, total=False): + """The parameters for accepting the user submission. + + Required if and only if `action` is `accept_user_submission`. + """ + + pass + + +class VisaDeclineUserPrearbitration(TypedDict, total=False): + """The parameters for declining the prearbitration. + + Required if and only if `action` is `decline_user_prearbitration`. + """ + + pass + + +class VisaReceiveMerchantPrearbitration(TypedDict, total=False): + """The parameters for receiving the prearbitration. + + Required if and only if `action` is `receive_merchant_prearbitration`. """ - explanation: str - """Why the dispute was rejected. Not required for accepting disputes.""" + pass + + +class VisaRepresent(TypedDict, total=False): + """The parameters for re-presenting the dispute. + + Required if and only if `action` is `represent`. + """ + + pass + + +class VisaRequestFurtherInformation(TypedDict, total=False): + """The parameters for requesting further information from the user. + + Required if and only if `action` is `request_further_information`. + """ + + reason: Required[str] + """The reason for requesting further information from the user.""" + + +class VisaTimeOutChargeback(TypedDict, total=False): + """The parameters for timing out the chargeback. + + Required if and only if `action` is `time_out_chargeback`. + """ + + pass + + +class VisaTimeOutMerchantPrearbitration(TypedDict, total=False): + """The parameters for timing out the merchant prearbitration. + + Required if and only if `action` is `time_out_merchant_prearbitration`. + """ + + pass + + +class VisaTimeOutRepresentment(TypedDict, total=False): + """The parameters for timing out the re-presentment. + + Required if and only if `action` is `time_out_representment`. + """ + + pass + + +class VisaTimeOutUserPrearbitration(TypedDict, total=False): + """The parameters for timing out the user prearbitration. + + Required if and only if `action` is `time_out_user_prearbitration`. + """ + + pass + + +class Visa(TypedDict, total=False): + """The Visa-specific parameters for the taking action on the dispute. + + Required if and only if `network` is `visa`. + """ + + action: Required[ + Literal[ + "accept_chargeback", + "accept_user_submission", + "decline_user_prearbitration", + "receive_merchant_prearbitration", + "represent", + "request_further_information", + "time_out_chargeback", + "time_out_merchant_prearbitration", + "time_out_representment", + "time_out_user_prearbitration", + ] + ] + """The action to take. + + Details specific to the action are required under the sub-object with the same + identifier as the action. + + - `accept_chargeback` - Simulate the merchant accepting the chargeback. This + will move the dispute to a `won` state. + - `accept_user_submission` - Accept the user's submission and transmit it to the + network. This will move the dispute to a `pending_response` state. + - `decline_user_prearbitration` - Simulate the merchant declining the user's + pre-arbitration. This will move the dispute to a `lost` state. + - `receive_merchant_prearbitration` - Simulate the merchant issuing + pre-arbitration. This will move the dispute to a `user_submission_required` + state. + - `represent` - Simulate the merchant re-presenting the dispute. This will move + the dispute to a `user_submission_required` state. + - `request_further_information` - Simulate further information being requested + from the user. This will move the dispute to a `user_submission_required` + state. + - `time_out_chargeback` - Simulate the merchant timing out responding to the + chargeback. This will move the dispute to a `won` state. + - `time_out_merchant_prearbitration` - Simulate the user timing out responding + to a merchant pre-arbitration. This will move the dispute to a `lost` state. + - `time_out_representment` - Simulate the user timing out responding to a + merchant re-presentment. This will move the dispute to a `lost` state. + - `time_out_user_prearbitration` - Simulate the merchant timing out responding + to a user pre-arbitration. This will move the dispute to a `win` state. + """ + + accept_chargeback: VisaAcceptChargeback + """The parameters for accepting the chargeback. + + Required if and only if `action` is `accept_chargeback`. + """ + + accept_user_submission: VisaAcceptUserSubmission + """The parameters for accepting the user submission. + + Required if and only if `action` is `accept_user_submission`. + """ + + decline_user_prearbitration: VisaDeclineUserPrearbitration + """The parameters for declining the prearbitration. + + Required if and only if `action` is `decline_user_prearbitration`. + """ + + receive_merchant_prearbitration: VisaReceiveMerchantPrearbitration + """The parameters for receiving the prearbitration. + + Required if and only if `action` is `receive_merchant_prearbitration`. + """ + + represent: VisaRepresent + """The parameters for re-presenting the dispute. + + Required if and only if `action` is `represent`. + """ + + request_further_information: VisaRequestFurtherInformation + """The parameters for requesting further information from the user. + + Required if and only if `action` is `request_further_information`. + """ + + time_out_chargeback: VisaTimeOutChargeback + """The parameters for timing out the chargeback. + + Required if and only if `action` is `time_out_chargeback`. + """ + + time_out_merchant_prearbitration: VisaTimeOutMerchantPrearbitration + """The parameters for timing out the merchant prearbitration. + + Required if and only if `action` is `time_out_merchant_prearbitration`. + """ + + time_out_representment: VisaTimeOutRepresentment + """The parameters for timing out the re-presentment. + + Required if and only if `action` is `time_out_representment`. + """ + + time_out_user_prearbitration: VisaTimeOutUserPrearbitration + """The parameters for timing out the user prearbitration. + + Required if and only if `action` is `time_out_user_prearbitration`. + """ diff --git a/src/increase/types/simulation_card_fuel_confirmations_params.py b/src/increase/types/simulations/card_fuel_confirmation_create_params.py similarity index 78% rename from src/increase/types/simulation_card_fuel_confirmations_params.py rename to src/increase/types/simulations/card_fuel_confirmation_create_params.py index 90af445be..4ebfc413a 100644 --- a/src/increase/types/simulation_card_fuel_confirmations_params.py +++ b/src/increase/types/simulations/card_fuel_confirmation_create_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["SimulationCardFuelConfirmationsParams"] +__all__ = ["CardFuelConfirmationCreateParams"] -class SimulationCardFuelConfirmationsParams(TypedDict, total=False): +class CardFuelConfirmationCreateParams(TypedDict, total=False): amount: Required[int] """ The amount of the fuel_confirmation in minor units in the card authorization's diff --git a/src/increase/types/simulation_card_increments_params.py b/src/increase/types/simulations/card_increment_create_params.py similarity index 79% rename from src/increase/types/simulation_card_increments_params.py rename to src/increase/types/simulations/card_increment_create_params.py index 564c0631c..508c252e7 100644 --- a/src/increase/types/simulation_card_increments_params.py +++ b/src/increase/types/simulations/card_increment_create_params.py @@ -4,17 +4,17 @@ from typing_extensions import Required, TypedDict -__all__ = ["SimulationCardIncrementsParams"] +__all__ = ["CardIncrementCreateParams"] -class SimulationCardIncrementsParams(TypedDict, total=False): +class CardIncrementCreateParams(TypedDict, total=False): amount: Required[int] """ The amount of the increment in minor units in the card authorization's currency. """ card_payment_id: Required[str] - """The identifier of the Card Payment to create a increment on.""" + """The identifier of the Card Payment to create an increment on.""" event_subscription_id: str """The identifier of the Event Subscription to use. diff --git a/src/increase/types/simulations/card_refund_create_params.py b/src/increase/types/simulations/card_refund_create_params.py index fb072b9c0..c7fcd9878 100644 --- a/src/increase/types/simulations/card_refund_create_params.py +++ b/src/increase/types/simulations/card_refund_create_params.py @@ -2,13 +2,26 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import TypedDict __all__ = ["CardRefundCreateParams"] class CardRefundCreateParams(TypedDict, total=False): - transaction_id: Required[str] + amount: int + """The refund amount in cents. + + Pulled off the `pending_transaction` or the `transaction` if not provided. + """ + + pending_transaction_id: str + """The identifier of the Pending Transaction for the refund authorization. + + If this is provided, `transaction` must not be provided as a refund with a + refund authorized can not be linked to a regular transaction. + """ + + transaction_id: str """The identifier for the Transaction to refund. The Transaction's source must have a category of card_settlement. diff --git a/src/increase/types/simulation_card_reversals_params.py b/src/increase/types/simulations/card_reversal_create_params.py similarity index 80% rename from src/increase/types/simulation_card_reversals_params.py rename to src/increase/types/simulations/card_reversal_create_params.py index 3ee6bdc91..ad0b9c8d2 100644 --- a/src/increase/types/simulation_card_reversals_params.py +++ b/src/increase/types/simulations/card_reversal_create_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["SimulationCardReversalsParams"] +__all__ = ["CardReversalCreateParams"] -class SimulationCardReversalsParams(TypedDict, total=False): +class CardReversalCreateParams(TypedDict, total=False): card_payment_id: Required[str] """The identifier of the Card Payment to create a reversal on.""" diff --git a/src/increase/types/simulations/card_settlement_params.py b/src/increase/types/simulations/card_settlement_create_params.py similarity index 84% rename from src/increase/types/simulations/card_settlement_params.py rename to src/increase/types/simulations/card_settlement_create_params.py index 53aa972b8..f93244b00 100644 --- a/src/increase/types/simulations/card_settlement_params.py +++ b/src/increase/types/simulations/card_settlement_create_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["CardSettlementParams"] +__all__ = ["CardSettlementCreateParams"] -class CardSettlementParams(TypedDict, total=False): +class CardSettlementCreateParams(TypedDict, total=False): card_id: Required[str] """The identifier of the Card to create a settlement on.""" diff --git a/src/increase/types/simulations/card_token_create_params.py b/src/increase/types/simulations/card_token_create_params.py new file mode 100644 index 000000000..d9b752bcd --- /dev/null +++ b/src/increase/types/simulations/card_token_create_params.py @@ -0,0 +1,249 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["CardTokenCreateParams", "Capability", "Outcome", "OutcomeDecline"] + + +class CardTokenCreateParams(TypedDict, total=False): + capabilities: Iterable[Capability] + """The capabilities of the outbound card token.""" + + expiration: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """The expiration date of the card.""" + + last4: str + """The last 4 digits of the card number.""" + + outcome: Outcome + """The outcome to simulate for card push transfers using this token.""" + + prefix: str + """The prefix of the card number, usually the first 8 digits.""" + + primary_account_number_length: int + """The total length of the card number, including prefix and last4.""" + + +class Capability(TypedDict, total=False): + cross_border_push_transfers: Required[Literal["supported", "not_supported"]] + """The cross-border push transfers capability. + + - `supported` - The capability is supported. + - `not_supported` - The capability is not supported. + """ + + domestic_push_transfers: Required[Literal["supported", "not_supported"]] + """The domestic push transfers capability. + + - `supported` - The capability is supported. + - `not_supported` - The capability is not supported. + """ + + route: Required[Literal["visa", "mastercard"]] + """The route of the capability. + + - `visa` - Visa and Interlink + - `mastercard` - Mastercard and Maestro + """ + + +class OutcomeDecline(TypedDict, total=False): + """If the result is declined, the details of the decline.""" + + reason: Literal[ + "do_not_honor", + "activity_count_limit_exceeded", + "refer_to_card_issuer", + "refer_to_card_issuer_special_condition", + "invalid_merchant", + "pick_up_card", + "error", + "pick_up_card_special", + "invalid_transaction", + "invalid_amount", + "invalid_account_number", + "no_such_issuer", + "re_enter_transaction", + "no_credit_account", + "pick_up_card_lost", + "pick_up_card_stolen", + "closed_account", + "insufficient_funds", + "no_checking_account", + "no_savings_account", + "expired_card", + "transaction_not_permitted_to_cardholder", + "transaction_not_allowed_at_terminal", + "transaction_not_supported_or_blocked_by_issuer", + "suspected_fraud", + "activity_amount_limit_exceeded", + "restricted_card", + "security_violation", + "transaction_does_not_fulfill_anti_money_laundering_requirement", + "blocked_by_cardholder", + "blocked_first_use", + "credit_issuer_unavailable", + "negative_card_verification_value_results", + "issuer_unavailable", + "financial_institution_cannot_be_found", + "transaction_cannot_be_completed", + "duplicate_transaction", + "system_malfunction", + "additional_customer_authentication_required", + "surcharge_amount_not_permitted", + "decline_for_cvv2_failure", + "stop_payment_order", + "revocation_of_authorization_order", + "revocation_of_all_authorizations_order", + "unable_to_locate_record", + "file_is_temporarily_unavailable", + "incorrect_pin", + "allowable_number_of_pin_entry_tries_exceeded", + "unable_to_locate_previous_message", + "pin_error_found", + "cannot_verify_pin", + "verification_data_failed", + "surcharge_amount_not_supported_by_debit_network_issuer", + "cash_service_not_available", + "cashback_request_exceeds_issuer_limit", + "transaction_amount_exceeds_pre_authorized_approval_amount", + "transaction_does_not_qualify_for_visa_pin", + "offline_declined", + "unable_to_go_online", + "valid_account_but_amount_not_supported", + "invalid_use_of_merchant_category_code_correct_and_reattempt", + "card_authentication_failed", + ] + """The reason for the decline. + + - `do_not_honor` - The card issuer has declined the transaction without + providing a specific reason. + - `activity_count_limit_exceeded` - The number of transactions for the card has + exceeded the limit set by the issuer. + - `refer_to_card_issuer` - The card issuer requires the cardholder to contact + them for further information regarding the transaction. + - `refer_to_card_issuer_special_condition` - The card issuer requires the + cardholder to contact them due to a special condition related to the + transaction. + - `invalid_merchant` - The merchant is not valid for this transaction. + - `pick_up_card` - The card should be retained by the terminal. + - `error` - An error occurred during processing of the transaction. + - `pick_up_card_special` - The card should be retained by the terminal due to a + special condition. + - `invalid_transaction` - The transaction is invalid and cannot be processed. + - `invalid_amount` - The amount of the transaction is invalid. + - `invalid_account_number` - The account number provided is invalid. + - `no_such_issuer` - The issuer of the card could not be found. + - `re_enter_transaction` - The transaction should be re-entered for processing. + - `no_credit_account` - There is no credit account associated with the card. + - `pick_up_card_lost` - The card should be retained by the terminal because it + has been reported lost. + - `pick_up_card_stolen` - The card should be retained by the terminal because it + has been reported stolen. + - `closed_account` - The account associated with the card has been closed. + - `insufficient_funds` - There are insufficient funds in the account to complete + the transaction. + - `no_checking_account` - There is no checking account associated with the card. + - `no_savings_account` - There is no savings account associated with the card. + - `expired_card` - The card has expired and cannot be used for transactions. + - `transaction_not_permitted_to_cardholder` - The transaction is not permitted + for this cardholder. + - `transaction_not_allowed_at_terminal` - The transaction is not allowed at this + terminal. + - `transaction_not_supported_or_blocked_by_issuer` - The transaction is not + supported or has been blocked by the issuer. + - `suspected_fraud` - The transaction has been flagged as suspected fraud and + cannot be processed. + - `activity_amount_limit_exceeded` - The amount of activity on the card has + exceeded the limit set by the issuer. + - `restricted_card` - The card has restrictions that prevent it from being used + for this transaction. + - `security_violation` - A security violation has occurred, preventing the + transaction from being processed. + - `transaction_does_not_fulfill_anti_money_laundering_requirement` - The + transaction does not meet the anti-money laundering requirements set by the + issuer. + - `blocked_by_cardholder` - The transaction was blocked by the cardholder. + - `blocked_first_use` - The first use of the card has been blocked by the + issuer. + - `credit_issuer_unavailable` - The credit issuer is currently unavailable to + process the transaction. + - `negative_card_verification_value_results` - The card verification value (CVV) + results were negative, indicating a potential issue with the card. + - `issuer_unavailable` - The issuer of the card is currently unavailable to + process the transaction. + - `financial_institution_cannot_be_found` - The financial institution associated + with the card could not be found. + - `transaction_cannot_be_completed` - The transaction cannot be completed due to + an unspecified reason. + - `duplicate_transaction` - The transaction is a duplicate of a previous + transaction and cannot be processed again. + - `system_malfunction` - A system malfunction occurred, preventing the + transaction from being processed. + - `additional_customer_authentication_required` - Additional customer + authentication is required to complete the transaction. + - `surcharge_amount_not_permitted` - The surcharge amount applied to the + transaction is not permitted by the issuer. + - `decline_for_cvv2_failure` - The transaction was declined due to a failure in + verifying the CVV2 code. + - `stop_payment_order` - A stop payment order has been placed on this + transaction. + - `revocation_of_authorization_order` - An order has been placed to revoke + authorization for this transaction. + - `revocation_of_all_authorizations_order` - An order has been placed to revoke + all authorizations for this cardholder. + - `unable_to_locate_record` - The record associated with the transaction could + not be located. + - `file_is_temporarily_unavailable` - The file needed for the transaction is + temporarily unavailable. + - `incorrect_pin` - The PIN entered for the transaction is incorrect. + - `allowable_number_of_pin_entry_tries_exceeded` - The allowable number of PIN + entry tries has been exceeded. + - `unable_to_locate_previous_message` - The previous message associated with the + transaction could not be located. + - `pin_error_found` - An error was found with the PIN associated with the + transaction. + - `cannot_verify_pin` - The PIN associated with the transaction could not be + verified. + - `verification_data_failed` - The verification data associated with the + transaction has failed. + - `surcharge_amount_not_supported_by_debit_network_issuer` - The surcharge + amount is not supported by the debit network issuer. + - `cash_service_not_available` - Cash service is not available for this + transaction. + - `cashback_request_exceeds_issuer_limit` - The cashback request exceeds the + issuer limit. + - `transaction_amount_exceeds_pre_authorized_approval_amount` - The transaction + amount exceeds the pre-authorized approval amount. + - `transaction_does_not_qualify_for_visa_pin` - The transaction does not qualify + for Visa PIN processing. + - `offline_declined` - The transaction was declined offline. + - `unable_to_go_online` - The terminal was unable to go online to process the + transaction. + - `valid_account_but_amount_not_supported` - The account is valid but the + transaction amount is not supported. + - `invalid_use_of_merchant_category_code_correct_and_reattempt` - The merchant + category code was used incorrectly; correct it and reattempt the transaction. + - `card_authentication_failed` - The card authentication process has failed. + """ + + +class Outcome(TypedDict, total=False): + """The outcome to simulate for card push transfers using this token.""" + + result: Required[Literal["approve", "decline"]] + """Whether card push transfers or validations will be approved or declined. + + - `approve` - Any card push transfers or validations will be approved. + - `decline` - Any card push transfers or validations will be declined. + """ + + decline: OutcomeDecline + """If the result is declined, the details of the decline.""" diff --git a/src/increase/types/simulations/check_deposit_adjustment_params.py b/src/increase/types/simulations/check_deposit_adjustment_params.py new file mode 100644 index 000000000..7627917c0 --- /dev/null +++ b/src/increase/types/simulations/check_deposit_adjustment_params.py @@ -0,0 +1,35 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["CheckDepositAdjustmentParams"] + + +class CheckDepositAdjustmentParams(TypedDict, total=False): + amount: int + """ + The adjustment amount in the minor unit of the Check Deposit's currency (e.g., + cents). A negative amount means that the funds are being clawed back by the + other bank and is a debit to your account. Defaults to the negative of the Check + Deposit amount. + """ + + reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"] + """The reason for the adjustment. + + Defaults to `non_conforming_item`, which is often used for a low quality image + that the recipient wasn't able to handle. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. + """ diff --git a/src/increase/types/simulations/check_deposit_submit_params.py b/src/increase/types/simulations/check_deposit_submit_params.py new file mode 100644 index 000000000..82abf0a46 --- /dev/null +++ b/src/increase/types/simulations/check_deposit_submit_params.py @@ -0,0 +1,25 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["CheckDepositSubmitParams", "Scan"] + + +class CheckDepositSubmitParams(TypedDict, total=False): + scan: Scan + """If set, the simulation will use these values for the check's scanned MICR data.""" + + +class Scan(TypedDict, total=False): + """If set, the simulation will use these values for the check's scanned MICR data.""" + + account_number: Required[str] + """The account number to be returned in the check deposit's scan data.""" + + routing_number: Required[str] + """The routing number to be returned in the check deposit's scan data.""" + + auxiliary_on_us: str + """The auxiliary on-us data to be returned in the check deposit's scan data.""" diff --git a/src/increase/types/simulations/digital_wallet_token_request_create_response.py b/src/increase/types/simulations/digital_wallet_token_request_create_response.py index 29df122fe..bd2fa140c 100644 --- a/src/increase/types/simulations/digital_wallet_token_request_create_response.py +++ b/src/increase/types/simulations/digital_wallet_token_request_create_response.py @@ -9,6 +9,8 @@ class DigitalWalletTokenRequestCreateResponse(BaseModel): + """The results of a Digital Wallet Token simulation.""" + decline_reason: Optional[ Literal["card_not_active", "no_verification_method", "webhook_timed_out", "webhook_declined"] ] = None diff --git a/src/increase/types/simulations/document_create_params.py b/src/increase/types/simulations/document_create_params.py deleted file mode 100644 index 34b6b854e..000000000 --- a/src/increase/types/simulations/document_create_params.py +++ /dev/null @@ -1,12 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["DocumentCreateParams"] - - -class DocumentCreateParams(TypedDict, total=False): - account_id: Required[str] - """The identifier of the Account the tax document is for.""" diff --git a/src/increase/types/simulations/export_create_params.py b/src/increase/types/simulations/export_create_params.py new file mode 100644 index 000000000..9bb9acb43 --- /dev/null +++ b/src/increase/types/simulations/export_create_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["ExportCreateParams", "Form1099Int"] + + +class ExportCreateParams(TypedDict, total=False): + category: Required[Literal["form_1099_int"]] + """The type of Export to create. + + - `form_1099_int` - A PDF of an Internal Revenue Service Form 1099-INT. + """ + + form_1099_int: Form1099Int + """Options for the created export. + + Required if `category` is equal to `form_1099_int`. + """ + + +class Form1099Int(TypedDict, total=False): + """Options for the created export. + + Required if `category` is equal to `form_1099_int`. + """ + + account_id: Required[str] + """The identifier of the Account the tax document is for.""" diff --git a/src/increase/types/simulations/inbound_ach_transfer_create_params.py b/src/increase/types/simulations/inbound_ach_transfer_create_params.py new file mode 100644 index 000000000..616dfa2a7 --- /dev/null +++ b/src/increase/types/simulations/inbound_ach_transfer_create_params.py @@ -0,0 +1,118 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["InboundACHTransferCreateParams", "Addenda", "AddendaFreeform", "AddendaFreeformEntry"] + + +class InboundACHTransferCreateParams(TypedDict, total=False): + account_number_id: Required[str] + """The identifier of the Account Number the inbound ACH Transfer is for.""" + + amount: Required[int] + """The transfer amount in cents. + + A positive amount originates a credit transfer pushing funds to the receiving + account. A negative amount originates a debit transfer pulling funds from the + receiving account. + """ + + addenda: Addenda + """Additional information to include in the transfer.""" + + company_descriptive_date: str + """The description of the date of the transfer.""" + + company_discretionary_data: str + """Data associated with the transfer set by the sender.""" + + company_entry_description: str + """The description of the transfer set by the sender.""" + + company_id: str + """The sender's company ID.""" + + company_name: str + """The name of the sender.""" + + receiver_id_number: str + """The ID of the receiver of the transfer.""" + + receiver_name: str + """The name of the receiver of the transfer.""" + + resolve_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """The time at which the transfer should be resolved. + + If not provided will resolve immediately. + """ + + standard_entry_class_code: Literal[ + "corporate_credit_or_debit", + "corporate_trade_exchange", + "prearranged_payments_and_deposit", + "internet_initiated", + "point_of_sale", + "telephone_initiated", + "customer_initiated", + "accounts_receivable", + "machine_transfer", + "shared_network_transaction", + "represented_check", + "back_office_conversion", + "point_of_purchase", + "check_truncation", + "destroyed_check", + "international_ach_transaction", + ] + """The standard entry class code for the transfer. + + - `corporate_credit_or_debit` - Corporate Credit and Debit (CCD). + - `corporate_trade_exchange` - Corporate Trade Exchange (CTX). + - `prearranged_payments_and_deposit` - Prearranged Payments and Deposits (PPD). + - `internet_initiated` - Internet Initiated (WEB). + - `point_of_sale` - Point of Sale (POS). + - `telephone_initiated` - Telephone Initiated (TEL). + - `customer_initiated` - Customer Initiated (CIE). + - `accounts_receivable` - Accounts Receivable (ARC). + - `machine_transfer` - Machine Transfer (MTE). + - `shared_network_transaction` - Shared Network Transaction (SHR). + - `represented_check` - Represented Check (RCK). + - `back_office_conversion` - Back Office Conversion (BOC). + - `point_of_purchase` - Point of Purchase (POP). + - `check_truncation` - Check Truncation (TRC). + - `destroyed_check` - Destroyed Check (XCK). + - `international_ach_transaction` - International ACH Transaction (IAT). + """ + + +class AddendaFreeformEntry(TypedDict, total=False): + payment_related_information: Required[str] + """The payment related information passed in the addendum.""" + + +class AddendaFreeform(TypedDict, total=False): + """Unstructured `payment_related_information` passed through with the transfer.""" + + entries: Required[Iterable[AddendaFreeformEntry]] + """Each entry represents an addendum sent with the transfer.""" + + +class Addenda(TypedDict, total=False): + """Additional information to include in the transfer.""" + + category: Required[Literal["freeform"]] + """The type of addenda to simulate being sent with the transfer. + + - `freeform` - Unstructured `payment_related_information` passed through with + the transfer. + """ + + freeform: AddendaFreeform + """Unstructured `payment_related_information` passed through with the transfer.""" diff --git a/src/increase/types/simulations/inbound_check_deposit_adjustment_params.py b/src/increase/types/simulations/inbound_check_deposit_adjustment_params.py new file mode 100644 index 000000000..80357357e --- /dev/null +++ b/src/increase/types/simulations/inbound_check_deposit_adjustment_params.py @@ -0,0 +1,30 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, TypedDict + +__all__ = ["InboundCheckDepositAdjustmentParams"] + + +class InboundCheckDepositAdjustmentParams(TypedDict, total=False): + amount: int + """The adjustment amount in cents. + + Defaults to the amount of the Inbound Check Deposit. + """ + + reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"] + """The reason for the adjustment. Defaults to `wrong_payee_credit`. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. + """ diff --git a/src/increase/types/simulations/inbound_check_deposit_create_params.py b/src/increase/types/simulations/inbound_check_deposit_create_params.py new file mode 100644 index 000000000..16c4a4e8d --- /dev/null +++ b/src/increase/types/simulations/inbound_check_deposit_create_params.py @@ -0,0 +1,31 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["InboundCheckDepositCreateParams"] + + +class InboundCheckDepositCreateParams(TypedDict, total=False): + account_number_id: Required[str] + """The identifier of the Account Number the Inbound Check Deposit will be against.""" + + amount: Required[int] + """The check amount in cents.""" + + check_number: Required[str] + """The check number on the check to be deposited.""" + + payee_name_analysis: Literal["name_matches", "does_not_match", "not_evaluated"] + """ + Simulate the outcome of + [payee name checking](https://increase.com/documentation/positive-pay#payee-name-mismatches). + Defaults to `not_evaluated`. + + - `name_matches` - The details on the check match the recipient name of the + check transfer. + - `does_not_match` - The details on the check do not match the recipient name of + the check transfer. + - `not_evaluated` - The payee name analysis was not evaluated. + """ diff --git a/src/increase/types/simulations/inbound_fednow_transfer_create_params.py b/src/increase/types/simulations/inbound_fednow_transfer_create_params.py new file mode 100644 index 000000000..19bd4878d --- /dev/null +++ b/src/increase/types/simulations/inbound_fednow_transfer_create_params.py @@ -0,0 +1,27 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InboundFednowTransferCreateParams"] + + +class InboundFednowTransferCreateParams(TypedDict, total=False): + account_number_id: Required[str] + """The identifier of the Account Number the inbound FedNow Transfer is for.""" + + amount: Required[int] + """The transfer amount in USD cents. Must be positive.""" + + debtor_account_number: str + """The account number of the account that sent the transfer.""" + + debtor_name: str + """The name provided by the sender of the transfer.""" + + debtor_routing_number: str + """The routing number of the account that sent the transfer.""" + + unstructured_remittance_information: str + """Additional information included with the transfer.""" diff --git a/src/increase/types/simulations/inbound_funds_hold_release_response.py b/src/increase/types/simulations/inbound_funds_hold_release_response.py deleted file mode 100644 index ae8d93d3e..000000000 --- a/src/increase/types/simulations/inbound_funds_hold_release_response.py +++ /dev/null @@ -1,67 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import Optional -from datetime import datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = ["InboundFundsHoldReleaseResponse"] - - -class InboundFundsHoldReleaseResponse(BaseModel): - id: str - """The Inbound Funds Hold identifier.""" - - amount: int - """The held amount in the minor unit of the account's currency. - - For dollars, for example, this is cents. - """ - - automatically_releases_at: datetime - """When the hold will be released automatically. - - Certain conditions may cause it to be released before this time. - """ - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the hold - was created. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the hold's - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - held_transaction_id: Optional[str] = None - """The ID of the Transaction for which funds were held.""" - - pending_transaction_id: Optional[str] = None - """The ID of the Pending Transaction representing the held funds.""" - - released_at: Optional[datetime] = None - """When the hold was released (if it has been released).""" - - status: Literal["held", "complete"] - """The status of the hold. - - - `held` - Funds are still being held. - - `complete` - Funds have been released. - """ - - type: Literal["inbound_funds_hold"] - """A constant representing the object's type. - - For this resource it will always be `inbound_funds_hold`. - """ diff --git a/src/increase/types/simulations/inbound_mail_item_create_params.py b/src/increase/types/simulations/inbound_mail_item_create_params.py new file mode 100755 index 000000000..bbbc2ef15 --- /dev/null +++ b/src/increase/types/simulations/inbound_mail_item_create_params.py @@ -0,0 +1,21 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InboundMailItemCreateParams"] + + +class InboundMailItemCreateParams(TypedDict, total=False): + amount: Required[int] + """The amount of the check to be simulated, in cents.""" + + lockbox_id: Required[str] + """The identifier of the Lockbox to simulate inbound mail to.""" + + contents_file_id: str + """The file containing the PDF contents. + + If not present, a default check image file will be used. + """ diff --git a/src/increase/types/simulations/real_time_payments_transfer_create_inbound_params.py b/src/increase/types/simulations/inbound_real_time_payments_transfer_create_params.py similarity index 84% rename from src/increase/types/simulations/real_time_payments_transfer_create_inbound_params.py rename to src/increase/types/simulations/inbound_real_time_payments_transfer_create_params.py index f4dfec4a0..a8401d960 100644 --- a/src/increase/types/simulations/real_time_payments_transfer_create_inbound_params.py +++ b/src/increase/types/simulations/inbound_real_time_payments_transfer_create_params.py @@ -4,10 +4,10 @@ from typing_extensions import Required, TypedDict -__all__ = ["RealTimePaymentsTransferCreateInboundParams"] +__all__ = ["InboundRealTimePaymentsTransferCreateParams"] -class RealTimePaymentsTransferCreateInboundParams(TypedDict, total=False): +class InboundRealTimePaymentsTransferCreateParams(TypedDict, total=False): account_number_id: Required[str] """ The identifier of the Account Number the inbound Real-Time Payments Transfer is @@ -26,10 +26,10 @@ class RealTimePaymentsTransferCreateInboundParams(TypedDict, total=False): debtor_routing_number: str """The routing number of the account that sent the transfer.""" - remittance_information: str - """Additional information included with the transfer.""" - request_for_payment_id: str """ The identifier of a pending Request for Payment that this transfer will fulfill. """ + + unstructured_remittance_information: str + """Additional information included with the transfer.""" diff --git a/src/increase/types/simulations/inbound_real_time_payments_transfer_simulation_result.py b/src/increase/types/simulations/inbound_real_time_payments_transfer_simulation_result.py deleted file mode 100644 index f19b63f0e..000000000 --- a/src/increase/types/simulations/inbound_real_time_payments_transfer_simulation_result.py +++ /dev/null @@ -1,3799 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from typing import List, Optional -from datetime import date, datetime -from typing_extensions import Literal - -from ..._models import BaseModel - -__all__ = [ - "InboundRealTimePaymentsTransferSimulationResult", - "DeclinedTransaction", - "DeclinedTransactionSource", - "DeclinedTransactionSourceACHDecline", - "DeclinedTransactionSourceCardDecline", - "DeclinedTransactionSourceCardDeclineNetworkDetails", - "DeclinedTransactionSourceCardDeclineNetworkDetailsVisa", - "DeclinedTransactionSourceCardDeclineNetworkIdentifiers", - "DeclinedTransactionSourceCardDeclineVerification", - "DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode", - "DeclinedTransactionSourceCardDeclineVerificationCardholderAddress", - "DeclinedTransactionSourceCheckDecline", - "DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline", - "DeclinedTransactionSourceInternationalACHDecline", - "DeclinedTransactionSourceWireDecline", - "Transaction", - "TransactionSource", - "TransactionSourceAccountTransferIntention", - "TransactionSourceACHTransferIntention", - "TransactionSourceACHTransferRejection", - "TransactionSourceACHTransferReturn", - "TransactionSourceCardDisputeAcceptance", - "TransactionSourceCardRefund", - "TransactionSourceCardRefundNetworkIdentifiers", - "TransactionSourceCardRefundPurchaseDetails", - "TransactionSourceCardRefundPurchaseDetailsCarRental", - "TransactionSourceCardRefundPurchaseDetailsLodging", - "TransactionSourceCardRefundPurchaseDetailsTravel", - "TransactionSourceCardRefundPurchaseDetailsTravelAncillary", - "TransactionSourceCardRefundPurchaseDetailsTravelAncillaryService", - "TransactionSourceCardRefundPurchaseDetailsTravelTripLeg", - "TransactionSourceCardRevenuePayment", - "TransactionSourceCardSettlement", - "TransactionSourceCardSettlementNetworkIdentifiers", - "TransactionSourceCardSettlementPurchaseDetails", - "TransactionSourceCardSettlementPurchaseDetailsCarRental", - "TransactionSourceCardSettlementPurchaseDetailsLodging", - "TransactionSourceCardSettlementPurchaseDetailsTravel", - "TransactionSourceCardSettlementPurchaseDetailsTravelAncillary", - "TransactionSourceCardSettlementPurchaseDetailsTravelAncillaryService", - "TransactionSourceCardSettlementPurchaseDetailsTravelTripLeg", - "TransactionSourceCheckDepositAcceptance", - "TransactionSourceCheckDepositReturn", - "TransactionSourceCheckTransferDeposit", - "TransactionSourceCheckTransferIntention", - "TransactionSourceCheckTransferStopPaymentRequest", - "TransactionSourceFeePayment", - "TransactionSourceInboundACHTransfer", - "TransactionSourceInboundACHTransferAddenda", - "TransactionSourceInboundACHTransferAddendaFreeform", - "TransactionSourceInboundACHTransferAddendaFreeformEntry", - "TransactionSourceInboundCheck", - "TransactionSourceInboundInternationalACHTransfer", - "TransactionSourceInboundRealTimePaymentsTransferConfirmation", - "TransactionSourceInboundWireDrawdownPayment", - "TransactionSourceInboundWireDrawdownPaymentReversal", - "TransactionSourceInboundWireReversal", - "TransactionSourceInboundWireTransfer", - "TransactionSourceInterestPayment", - "TransactionSourceInternalSource", - "TransactionSourceRealTimePaymentsTransferAcknowledgement", - "TransactionSourceSampleFunds", - "TransactionSourceWireTransferIntention", - "TransactionSourceWireTransferRejection", -] - - -class DeclinedTransactionSourceACHDecline(BaseModel): - id: str - """The ACH Decline's identifier.""" - - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - originator_company_descriptive_date: Optional[str] = None - """The descriptive date of the transfer.""" - - originator_company_discretionary_data: Optional[str] = None - """The additional information included with the transfer.""" - - originator_company_id: str - """The identifier of the company that initiated the transfer.""" - - originator_company_name: str - """The name of the company that initiated the transfer.""" - - reason: Literal[ - "ach_route_canceled", - "ach_route_disabled", - "breaches_limit", - "credit_entry_refused_by_receiver", - "duplicate_return", - "entity_not_active", - "group_locked", - "insufficient_funds", - "misrouted_return", - "return_of_erroneous_or_reversing_debit", - "no_ach_route", - "originator_request", - "transaction_not_allowed", - "user_initiated", - ] - """Why the ACH transfer was declined. - - - `ach_route_canceled` - The account number is canceled. - - `ach_route_disabled` - The account number is disabled. - - `breaches_limit` - The transaction would cause an Increase limit to be - exceeded. - - `credit_entry_refused_by_receiver` - A credit was refused. This is a - reasonable default reason for decline of credits. - - `duplicate_return` - A rare return reason. The return this message refers to - was a duplicate. - - `entity_not_active` - The account's entity is not active. - - `group_locked` - Your account is inactive. - - `insufficient_funds` - Your account contains insufficient funds. - - `misrouted_return` - A rare return reason. The return this message refers to - was misrouted. - - `return_of_erroneous_or_reversing_debit` - The originating financial - institution made a mistake and this return corrects it. - - `no_ach_route` - The account number that was debited does not exist. - - `originator_request` - The originating financial institution asked for this - transfer to be returned. - - `transaction_not_allowed` - The transaction is not allowed per Increase's - terms. - - `user_initiated` - The user initiated the decline. - """ - - receiver_id_number: Optional[str] = None - """The id of the receiver of the transfer.""" - - receiver_name: Optional[str] = None - """The name of the receiver of the transfer.""" - - trace_number: str - """The trace number of the transfer.""" - - type: Literal["ach_decline"] - """A constant representing the object's type. - - For this resource it will always be `ach_decline`. - """ - - -class DeclinedTransactionSourceCardDeclineNetworkDetailsVisa(BaseModel): - electronic_commerce_indicator: Optional[ - Literal[ - "mail_phone_order", - "recurring", - "installment", - "unknown_mail_phone_order", - "secure_electronic_commerce", - "non_authenticated_security_transaction_at_3ds_capable_merchant", - "non_authenticated_security_transaction", - "non_secure_transaction", - ] - ] = None - """ - For electronic commerce transactions, this identifies the level of security used - in obtaining the customer's payment credential. For mail or telephone order - transactions, identifies the type of mail or telephone order. - - - `mail_phone_order` - Single transaction of a mail/phone order: Use to indicate - that the transaction is a mail/phone order purchase, not a recurring - transaction or installment payment. For domestic transactions in the US - region, this value may also indicate one bill payment transaction in the - card-present or card-absent environments. - - `recurring` - Recurring transaction: Payment indicator used to indicate a - recurring transaction that originates from an acquirer in the US region. - - `installment` - Installment payment: Payment indicator used to indicate one - purchase of goods or services that is billed to the account in multiple - charges over a period of time agreed upon by the cardholder and merchant from - transactions that originate from an acquirer in the US region. - - `unknown_mail_phone_order` - Unknown classification: other mail order: Use to - indicate that the type of mail/telephone order is unknown. - - `secure_electronic_commerce` - Secure electronic commerce transaction: Use to - indicate that the electronic commerce transaction has been authenticated using - e.g., 3-D Secure - - `non_authenticated_security_transaction_at_3ds_capable_merchant` - - Non-authenticated security transaction at a 3-D Secure-capable merchant, and - merchant attempted to authenticate the cardholder using 3-D Secure: Use to - identify an electronic commerce transaction where the merchant attempted to - authenticate the cardholder using 3-D Secure, but was unable to complete the - authentication because the issuer or cardholder does not participate in the - 3-D Secure program. - - `non_authenticated_security_transaction` - Non-authenticated security - transaction: Use to identify an electronic commerce transaction that uses data - encryption for security however , cardholder authentication is not performed - using 3-D Secure. - - `non_secure_transaction` - Non-secure transaction: Use to identify an - electronic commerce transaction that has no data protection. - """ - - point_of_service_entry_mode: Optional[ - Literal[ - "unknown", - "manual", - "magnetic_stripe_no_cvv", - "optical_code", - "integrated_circuit_card", - "contactless", - "credential_on_file", - "magnetic_stripe", - "contactless_magnetic_stripe", - "integrated_circuit_card_no_cvv", - ] - ] = None - """ - The method used to enter the cardholder's primary account number and card - expiration date. - - - `unknown` - Unknown - - `manual` - Manual key entry - - `magnetic_stripe_no_cvv` - Magnetic stripe read, without card verification - value - - `optical_code` - Optical code - - `integrated_circuit_card` - Contact chip card - - `contactless` - Contactless read of chip card - - `credential_on_file` - Transaction initiated using a credential that has - previously been stored on file - - `magnetic_stripe` - Magnetic stripe read - - `contactless_magnetic_stripe` - Contactless read of magnetic stripe data - - `integrated_circuit_card_no_cvv` - Contact chip card, without card - verification value - """ - - -class DeclinedTransactionSourceCardDeclineNetworkDetails(BaseModel): - category: Literal["visa"] - """The payment network used to process this card authorization. - - - `visa` - Visa - """ - - visa: Optional[DeclinedTransactionSourceCardDeclineNetworkDetailsVisa] = None - """Fields specific to the `visa` network.""" - - -class DeclinedTransactionSourceCardDeclineNetworkIdentifiers(BaseModel): - retrieval_reference_number: Optional[str] = None - """A life-cycle identifier used across e.g., an authorization and a reversal. - - Expected to be unique per acquirer within a window of time. For some card - networks the retrieval reference number includes the trace counter. - """ - - trace_number: Optional[str] = None - """A counter used to verify an individual authorization. - - Expected to be unique per acquirer within a window of time. - """ - - transaction_id: Optional[str] = None - """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. - """ - - -class DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode(BaseModel): - result: Literal["not_checked", "match", "no_match"] - """The result of verifying the Card Verification Code. - - - `not_checked` - No card verification code was provided in the authorization - request. - - `match` - The card verification code matched the one on file. - - `no_match` - The card verification code did not match the one on file. - """ - - -class DeclinedTransactionSourceCardDeclineVerificationCardholderAddress(BaseModel): - actual_line1: Optional[str] = None - """Line 1 of the address on file for the cardholder.""" - - actual_postal_code: Optional[str] = None - """The postal code of the address on file for the cardholder.""" - - provided_line1: Optional[str] = None - """ - The cardholder address line 1 provided for verification in the authorization - request. - """ - - provided_postal_code: Optional[str] = None - """The postal code provided for verification in the authorization request.""" - - result: Literal[ - "not_checked", - "postal_code_match_address_not_checked", - "postal_code_match_address_no_match", - "postal_code_no_match_address_match", - "match", - "no_match", - ] - """The address verification result returned to the card network. - - - `not_checked` - No adress was provided in the authorization request. - - `postal_code_match_address_not_checked` - Postal code matches, but the street - address was not verified. - - `postal_code_match_address_no_match` - Postal code matches, but the street - address does not match. - - `postal_code_no_match_address_match` - Postal code does not match, but the - street address matches. - - `match` - Postal code and street address match. - - `no_match` - Postal code and street address do not match. - """ - - -class DeclinedTransactionSourceCardDeclineVerification(BaseModel): - card_verification_code: DeclinedTransactionSourceCardDeclineVerificationCardVerificationCode - """ - Fields related to verification of the Card Verification Code, a 3-digit code on - the back of the card. - """ - - cardholder_address: DeclinedTransactionSourceCardDeclineVerificationCardholderAddress - """ - Cardholder address provided in the authorization request and the address on file - we verified it against. - """ - - -class DeclinedTransactionSourceCardDecline(BaseModel): - id: str - """The Card Decline identifier.""" - - actioner: Literal["user", "increase", "network"] - """ - Whether this authorization was approved by Increase, the card network through - stand-in processing, or the user through a real-time decision. - - - `user` - This object was actioned by the user through a real-time decision. - - `increase` - This object was actioned by Increase without user intervention. - - `network` - This object was actioned by the network, through stand-in - processing. - """ - - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - card_payment_id: Optional[str] = None - """The ID of the Card Payment this transaction belongs to.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - account currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - digital_wallet_token_id: Optional[str] = None - """ - If the authorization was made via a Digital Wallet Token (such as an Apple Pay - purchase), the identifier of the token that was used. - """ - - merchant_acceptor_id: str - """ - The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - """ - - merchant_category_code: Optional[str] = None - """ - The Merchant Category Code (commonly abbreviated as MCC) of the merchant the - card is transacting with. - """ - - merchant_city: Optional[str] = None - """The city the merchant resides in.""" - - merchant_country: Optional[str] = None - """The country the merchant resides in.""" - - merchant_descriptor: str - """The merchant descriptor of the merchant the card is transacting with.""" - - merchant_state: Optional[str] = None - """The state the merchant resides in.""" - - network_details: DeclinedTransactionSourceCardDeclineNetworkDetails - """Fields specific to the `network`.""" - - network_identifiers: DeclinedTransactionSourceCardDeclineNetworkIdentifiers - """Network-specific identifiers for a specific request or transaction.""" - - network_risk_score: Optional[int] = None - """The risk score generated by the card network. - - For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where - 99 is the riskiest. - """ - - physical_card_id: Optional[str] = None - """ - If the authorization was made in-person with a physical card, the Physical Card - that was used. - """ - - processing_category: Literal[ - "account_funding", "automatic_fuel_dispenser", "bill_payment", "purchase", "quasi_cash", "refund" - ] - """ - The processing category describes the intent behind the authorization, such as - whether it was used for bill payments or an automatic fuel dispenser. - - - `account_funding` - Account funding transactions are transactions used to - e.g., fund an account or transfer funds between accounts. - - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur - when a card is used at a gas pump, prior to the actual transaction amount - being known. They are followed by an advice message that updates the amount of - the pending transaction. - - `bill_payment` - A transaction used to pay a bill. - - `purchase` - A regular purchase. - - `quasi_cash` - Quasi-cash transactions represent purchases of items which may - be convertible to cash. - - `refund` - A refund card authorization, sometimes referred to as a credit - voucher authorization, where funds are credited to the cardholder. - """ - - real_time_decision_id: Optional[str] = None - """ - The identifier of the Real-Time Decision sent to approve or decline this - transaction. - """ - - reason: Literal[ - "card_not_active", - "physical_card_not_active", - "entity_not_active", - "group_locked", - "insufficient_funds", - "cvv2_mismatch", - "transaction_not_allowed", - "breaches_limit", - "webhook_declined", - "webhook_timed_out", - "declined_by_stand_in_processing", - "invalid_physical_card", - "missing_original_authorization", - "suspected_fraud", - ] - """Why the transaction was declined. - - - `card_not_active` - The Card was not active. - - `physical_card_not_active` - The Physical Card was not active. - - `entity_not_active` - The account's entity was not active. - - `group_locked` - The account was inactive. - - `insufficient_funds` - The Card's Account did not have a sufficient available - balance. - - `cvv2_mismatch` - The given CVV2 did not match the card's value. - - `transaction_not_allowed` - The attempted card transaction is not allowed per - Increase's terms. - - `breaches_limit` - The transaction was blocked by a Limit. - - `webhook_declined` - Your application declined the transaction via webhook. - - `webhook_timed_out` - Your application webhook did not respond without the - required timeout. - - `declined_by_stand_in_processing` - Declined by stand-in processing. - - `invalid_physical_card` - The card read had an invalid CVV, dCVV, or - authorization request cryptogram. - - `missing_original_authorization` - The original card authorization for this - incremental authorization does not exist. - - `suspected_fraud` - The transaction was suspected to be fraudulent. Please - reach out to support@increase.com for more information. - """ - - verification: DeclinedTransactionSourceCardDeclineVerification - """Fields related to verification of cardholder-provided values.""" - - -class DeclinedTransactionSourceCheckDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - auxiliary_on_us: Optional[str] = None - """ - A computer-readable number printed on the MICR line of business checks, usually - the check number. This is useful for positive pay checks, but can be unreliably - transmitted by the bank of first deposit. - """ - - back_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the back of the - declined check. - """ - - front_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the front of the - declined check. - """ - - reason: Literal[ - "ach_route_disabled", - "ach_route_canceled", - "breaches_limit", - "entity_not_active", - "group_locked", - "insufficient_funds", - "stop_payment_requested", - "duplicate_presentment", - "not_authorized", - "amount_mismatch", - "not_our_item", - "no_account_number_found", - "refer_to_image", - "unable_to_process", - ] - """Why the check was declined. - - - `ach_route_disabled` - The account number is disabled. - - `ach_route_canceled` - The account number is canceled. - - `breaches_limit` - The transaction would cause a limit to be exceeded. - - `entity_not_active` - The account's entity is not active. - - `group_locked` - Your account is inactive. - - `insufficient_funds` - Your account contains insufficient funds. - - `stop_payment_requested` - Stop payment requested for this check. - - `duplicate_presentment` - The check was a duplicate deposit. - - `not_authorized` - The check was not authorized. - - `amount_mismatch` - The amount the receiving bank is attempting to deposit - does not match the amount on the check. - - `not_our_item` - The check attempting to be deposited does not belong to - Increase. - - `no_account_number_found` - The account number on the check does not exist at - Increase. - - `refer_to_image` - The check is not readable. Please refer to the image. - - `unable_to_process` - The check cannot be processed. This is rare: please - contact support. - """ - - -class DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - creditor_name: str - """The name the sender of the transfer specified as the recipient of the transfer.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the declined - transfer's currency. This will always be "USD" for a Real-Time Payments - transfer. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - debtor_account_number: str - """The account number of the account that sent the transfer.""" - - debtor_name: str - """The name provided by the sender of the transfer.""" - - debtor_routing_number: str - """The routing number of the account that sent the transfer.""" - - reason: Literal[ - "account_number_canceled", - "account_number_disabled", - "account_restricted", - "group_locked", - "entity_not_active", - "real_time_payments_not_enabled", - ] - """Why the transfer was declined. - - - `account_number_canceled` - The account number is canceled. - - `account_number_disabled` - The account number is disabled. - - `account_restricted` - Your account is restricted. - - `group_locked` - Your account is inactive. - - `entity_not_active` - The account's entity is not active. - - `real_time_payments_not_enabled` - Your account is not enabled to receive - Real-Time Payments transfers. - """ - - remittance_information: Optional[str] = None - """Additional information included with the transfer.""" - - transaction_identification: str - """The Real-Time Payments network identification of the declined transfer.""" - - -class DeclinedTransactionSourceInternationalACHDecline(BaseModel): - amount: int - """The declined amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - destination_country_code: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the destination country. - """ - - destination_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - destination bank account. - """ - - foreign_exchange_indicator: Literal["fixed_to_variable", "variable_to_fixed", "fixed_to_fixed"] - """A description of how the foreign exchange rate was calculated. - - - `fixed_to_variable` - The originator chose an amount in their own currency. - The settled amount in USD was converted using the exchange rate. - - `variable_to_fixed` - The originator chose an amount to settle in USD. The - originator's amount was variable; known only after the foreign exchange - conversion. - - `fixed_to_fixed` - The amount was originated and settled as a fixed amount in - USD. There is no foreign exchange conversion. - """ - - foreign_exchange_reference: Optional[str] = None - """ - Depending on the `foreign_exchange_reference_indicator`, an exchange rate or a - reference to a well-known rate. - """ - - foreign_exchange_reference_indicator: Literal["foreign_exchange_rate", "foreign_exchange_reference_number", "blank"] - """ - An instruction of how to interpret the `foreign_exchange_reference` field for - this Transaction. - - - `foreign_exchange_rate` - The ACH file contains a foreign exchange rate. - - `foreign_exchange_reference_number` - The ACH file contains a reference to a - well-known foreign exchange rate. - - `blank` - There is no foreign exchange for this transfer, so the - `foreign_exchange_reference` field is blank. - """ - - foreign_payment_amount: int - """The amount in the minor unit of the foreign payment currency. - - For dollars, for example, this is cents. - """ - - foreign_trace_number: Optional[str] = None - """A reference number in the foreign banking infrastructure.""" - - international_transaction_type_code: Literal[ - "annuity", - "business_or_commercial", - "deposit", - "loan", - "miscellaneous", - "mortgage", - "pension", - "remittance", - "rent_or_lease", - "salary_or_payroll", - "tax", - "accounts_receivable", - "back_office_conversion", - "machine_transfer", - "point_of_purchase", - "point_of_sale", - "represented_check", - "shared_network_transaction", - "telphone_initiated", - "internet_initiated", - ] - """The type of transfer. Set by the originator. - - - `annuity` - Sent as `ANN` in the Nacha file. - - `business_or_commercial` - Sent as `BUS` in the Nacha file. - - `deposit` - Sent as `DEP` in the Nacha file. - - `loan` - Sent as `LOA` in the Nacha file. - - `miscellaneous` - Sent as `MIS` in the Nacha file. - - `mortgage` - Sent as `MOR` in the Nacha file. - - `pension` - Sent as `PEN` in the Nacha file. - - `remittance` - Sent as `REM` in the Nacha file. - - `rent_or_lease` - Sent as `RLS` in the Nacha file. - - `salary_or_payroll` - Sent as `SAL` in the Nacha file. - - `tax` - Sent as `TAX` in the Nacha file. - - `accounts_receivable` - Sent as `ARC` in the Nacha file. - - `back_office_conversion` - Sent as `BOC` in the Nacha file. - - `machine_transfer` - Sent as `MTE` in the Nacha file. - - `point_of_purchase` - Sent as `POP` in the Nacha file. - - `point_of_sale` - Sent as `POS` in the Nacha file. - - `represented_check` - Sent as `RCK` in the Nacha file. - - `shared_network_transaction` - Sent as `SHR` in the Nacha file. - - `telphone_initiated` - Sent as `TEL` in the Nacha file. - - `internet_initiated` - Sent as `WEB` in the Nacha file. - """ - - originating_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - originating bank account. - """ - - originating_depository_financial_institution_branch_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originating branch country. - """ - - originating_depository_financial_institution_id: str - """An identifier for the originating bank. - - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ - - originating_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `originating_depository_financial_institution_id` field for this Transaction. - - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - - originating_depository_financial_institution_name: str - """The name of the originating bank. - - Sometimes this will refer to an American bank and obscure the correspondent - foreign bank. - """ - - originator_city: str - """A portion of the originator address. This may be incomplete.""" - - originator_company_entry_description: str - """A description field set by the originator.""" - - originator_country: str - """A portion of the originator address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originator country. - """ - - originator_identification: str - """An identifier for the originating company. - - This is generally stable across multiple ACH transfers. - """ - - originator_name: str - """Either the name of the originator or an intermediary money transmitter.""" - - originator_postal_code: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_state_or_province: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_street_address: str - """A portion of the originator address. This may be incomplete.""" - - payment_related_information: Optional[str] = None - """A description field set by the originator.""" - - payment_related_information2: Optional[str] = None - """A description field set by the originator.""" - - receiver_city: str - """A portion of the receiver address. This may be incomplete.""" - - receiver_country: str - """A portion of the receiver address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiver country. - """ - - receiver_identification_number: Optional[str] = None - """An identification number the originator uses for the receiver.""" - - receiver_postal_code: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" - - receiver_state_or_province: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" - - receiver_street_address: str - """A portion of the receiver address. This may be incomplete.""" - - receiving_company_or_individual_name: str - """The name of the receiver of the transfer. This is not verified by Increase.""" - - receiving_depository_financial_institution_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiving bank country. - """ - - receiving_depository_financial_institution_id: str - """An identifier for the receiving bank. - - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ - - receiving_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `receiving_depository_financial_institution_id` field for this Transaction. - - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - - receiving_depository_financial_institution_name: str - """The name of the receiving bank, as set by the sending financial institution.""" - - trace_number: str - """ - A 15 digit number recorded in the Nacha file and available to both the - originating and receiving bank. Along with the amount, date, and originating - routing number, this can be used to identify the ACH transfer at either bank. - ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). - """ - - -class DeclinedTransactionSourceWireDecline(BaseModel): - inbound_wire_transfer_id: str - """The identifier of the Inbound Wire Transfer that was declined.""" - - reason: Literal[ - "account_number_canceled", - "account_number_disabled", - "entity_not_active", - "group_locked", - "no_account_number", - "transaction_not_allowed", - ] - """Why the wire transfer was declined. - - - `account_number_canceled` - The account number is canceled. - - `account_number_disabled` - The account number is disabled. - - `entity_not_active` - The account's entity is not active. - - `group_locked` - Your account is inactive. - - `no_account_number` - The beneficiary account number does not exist. - - `transaction_not_allowed` - The transaction is not allowed per Increase's - terms. - """ - - -class DeclinedTransactionSource(BaseModel): - ach_decline: Optional[DeclinedTransactionSourceACHDecline] = None - """An ACH Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `ach_decline`. - """ - - card_decline: Optional[DeclinedTransactionSourceCardDecline] = None - """A Card Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_decline`. - """ - - category: Literal[ - "ach_decline", - "card_decline", - "check_decline", - "inbound_real_time_payments_transfer_decline", - "international_ach_decline", - "wire_decline", - "other", - ] - """The type of the resource. - - We may add additional possible values for this enum over time; your application - should be able to handle such additions gracefully. - - - `ach_decline` - ACH Decline: details will be under the `ach_decline` object. - - `card_decline` - Card Decline: details will be under the `card_decline` - object. - - `check_decline` - Check Decline: details will be under the `check_decline` - object. - - `inbound_real_time_payments_transfer_decline` - Inbound Real-Time Payments - Transfer Decline: details will be under the - `inbound_real_time_payments_transfer_decline` object. - - `international_ach_decline` - International ACH Decline: details will be under - the `international_ach_decline` object. - - `wire_decline` - Wire Decline: details will be under the `wire_decline` - object. - - `other` - The Declined Transaction was made for an undocumented or deprecated - reason. - """ - - check_decline: Optional[DeclinedTransactionSourceCheckDecline] = None - """A Check Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_decline`. - """ - - inbound_real_time_payments_transfer_decline: Optional[ - DeclinedTransactionSourceInboundRealTimePaymentsTransferDecline - ] = None - """An Inbound Real-Time Payments Transfer Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_real_time_payments_transfer_decline`. - """ - - international_ach_decline: Optional[DeclinedTransactionSourceInternationalACHDecline] = None - """An International ACH Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `international_ach_decline`. - """ - - wire_decline: Optional[DeclinedTransactionSourceWireDecline] = None - """A Wire Decline object. - - This field will be present in the JSON response if and only if `category` is - equal to `wire_decline`. - """ - - -class DeclinedTransaction(BaseModel): - id: str - """The Declined Transaction identifier.""" - - account_id: str - """The identifier for the Account the Declined Transaction belongs to.""" - - amount: int - """The Declined Transaction amount in the minor unit of its currency. - - For dollars, for example, this is cents. - """ - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the - Transaction occurred. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Declined - Transaction's currency. This will match the currency on the Declined - Transaction's Account. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - description: str - """This is the description the vendor provides.""" - - route_id: Optional[str] = None - """The identifier for the route this Declined Transaction came through. - - Routes are things like cards and ACH details. - """ - - route_type: Optional[Literal["account_number", "card"]] = None - """The type of the route this Declined Transaction came through. - - - `account_number` - An Account Number. - - `card` - A Card. - """ - - source: DeclinedTransactionSource - """ - This is an object giving more details on the network-level event that caused the - Declined Transaction. For example, for a card transaction this lists the - merchant's industry and location. Note that for backwards compatibility reasons, - additional undocumented keys may appear in this object. These should be treated - as deprecated and will be removed in the future. - """ - - type: Literal["declined_transaction"] - """A constant representing the object's type. - - For this resource it will always be `declined_transaction`. - """ - - -class TransactionSourceAccountTransferIntention(BaseModel): - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination - account currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - description: str - """The description you chose to give the transfer.""" - - destination_account_id: str - """The identifier of the Account to where the Account Transfer was sent.""" - - source_account_id: str - """The identifier of the Account from where the Account Transfer was sent.""" - - transfer_id: str - """The identifier of the Account Transfer that led to this Pending Transaction.""" - - -class TransactionSourceACHTransferIntention(BaseModel): - account_number: str - """The account number for the destination account.""" - - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - routing_number: str - """ - The American Bankers' Association (ABA) Routing Transit Number (RTN) for the - destination account. - """ - - statement_descriptor: str - """A description set when the ACH Transfer was created.""" - - transfer_id: str - """The identifier of the ACH Transfer that led to this Transaction.""" - - -class TransactionSourceACHTransferRejection(BaseModel): - transfer_id: str - """The identifier of the ACH Transfer that led to this Transaction.""" - - -class TransactionSourceACHTransferReturn(BaseModel): - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the transfer was created. - """ - - raw_return_reason_code: str - """The three character ACH return code, in the range R01 to R85.""" - - return_reason_code: Literal[ - "insufficient_fund", - "no_account", - "account_closed", - "invalid_account_number_structure", - "account_frozen_entry_returned_per_ofac_instruction", - "credit_entry_refused_by_receiver", - "unauthorized_debit_to_consumer_account_using_corporate_sec_code", - "corporate_customer_advised_not_authorized", - "payment_stopped", - "non_transaction_account", - "uncollected_funds", - "routing_number_check_digit_error", - "customer_advised_unauthorized_improper_ineligible_or_incomplete", - "amount_field_error", - "authorization_revoked_by_customer", - "invalid_ach_routing_number", - "file_record_edit_criteria", - "enr_invalid_individual_name", - "returned_per_odfi_request", - "limited_participation_dfi", - "incorrectly_coded_outbound_international_payment", - "account_sold_to_another_dfi", - "addenda_error", - "beneficiary_or_account_holder_deceased", - "customer_advised_not_within_authorization_terms", - "corrected_return", - "duplicate_entry", - "duplicate_return", - "enr_duplicate_enrollment", - "enr_invalid_dfi_account_number", - "enr_invalid_individual_id_number", - "enr_invalid_representative_payee_indicator", - "enr_invalid_transaction_code", - "enr_return_of_enr_entry", - "enr_routing_number_check_digit_error", - "entry_not_processed_by_gateway", - "field_error", - "foreign_receiving_dfi_unable_to_settle", - "iat_entry_coding_error", - "improper_effective_entry_date", - "improper_source_document_source_document_presented", - "invalid_company_id", - "invalid_foreign_receiving_dfi_identification", - "invalid_individual_id_number", - "item_and_rck_entry_presented_for_payment", - "item_related_to_rck_entry_is_ineligible", - "mandatory_field_error", - "misrouted_dishonored_return", - "misrouted_return", - "no_errors_found", - "non_acceptance_of_r62_dishonored_return", - "non_participant_in_iat_program", - "permissible_return_entry", - "permissible_return_entry_not_accepted", - "rdfi_non_settlement", - "rdfi_participant_in_check_truncation_program", - "representative_payee_deceased_or_unable_to_continue_in_that_capacity", - "return_not_a_duplicate", - "return_of_erroneous_or_reversing_debit", - "return_of_improper_credit_entry", - "return_of_improper_debit_entry", - "return_of_xck_entry", - "source_document_presented_for_payment", - "state_law_affecting_rck_acceptance", - "stop_payment_on_item_related_to_rck_entry", - "stop_payment_on_source_document", - "timely_original_return", - "trace_number_error", - "untimely_dishonored_return", - "untimely_return", - ] - """Why the ACH Transfer was returned. - - This reason code is sent by the receiving bank back to Increase. - - - `insufficient_fund` - Code R01. Insufficient funds in the receiving account. - Sometimes abbreviated to NSF. - - `no_account` - Code R03. The account does not exist or the receiving bank was - unable to locate it. - - `account_closed` - Code R02. The account is closed at the receiving bank. - - `invalid_account_number_structure` - Code R04. The account number is invalid - at the receiving bank. - - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. The account - at the receiving bank was frozen per the Office of Foreign Assets Control. - - `credit_entry_refused_by_receiver` - Code R23. The receiving bank account - refused a credit transfer. - - `unauthorized_debit_to_consumer_account_using_corporate_sec_code` - Code R05. - The receiving bank rejected because of an incorrect Standard Entry Class code. - - `corporate_customer_advised_not_authorized` - Code R29. The corporate customer - at the receiving bank reversed the transfer. - - `payment_stopped` - Code R08. The receiving bank stopped payment on this - transfer. - - `non_transaction_account` - Code R20. The receiving bank account does not - perform transfers. - - `uncollected_funds` - Code R09. The receiving bank account does not have - enough available balance for the transfer. - - `routing_number_check_digit_error` - Code R28. The routing number is - incorrect. - - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - Code R10. - The customer at the receiving bank reversed the transfer. - - `amount_field_error` - Code R19. The amount field is incorrect or too large. - - `authorization_revoked_by_customer` - Code R07. The customer at the receiving - institution informed their bank that they have revoked authorization for a - previously authorized transfer. - - `invalid_ach_routing_number` - Code R13. The routing number is invalid. - - `file_record_edit_criteria` - Code R17. The receiving bank is unable to - process a field in the transfer. - - `enr_invalid_individual_name` - Code R45. The individual name field was - invalid. - - `returned_per_odfi_request` - Code R06. The originating financial institution - asked for this transfer to be returned. The receiving bank is complying with - the request. - - `limited_participation_dfi` - Code R34. The receiving bank's regulatory - supervisor has limited their participation in the ACH network. - - `incorrectly_coded_outbound_international_payment` - Code R85. The outbound - international ACH transfer was incorrect. - - `account_sold_to_another_dfi` - Code R12. A rare return reason. The account - was sold to another bank. - - `addenda_error` - Code R25. The addenda record is incorrect or missing. - - `beneficiary_or_account_holder_deceased` - Code R15. A rare return reason. The - account holder is deceased. - - `customer_advised_not_within_authorization_terms` - Code R11. A rare return - reason. The customer authorized some payment to the sender, but this payment - was not in error. - - `corrected_return` - Code R74. A rare return reason. Sent in response to a - return that was returned with code `field_error`. The latest return should - include the corrected field(s). - - `duplicate_entry` - Code R24. A rare return reason. The receiving bank - received an exact duplicate entry with the same trace number and amount. - - `duplicate_return` - Code R67. A rare return reason. The return this message - refers to was a duplicate. - - `enr_duplicate_enrollment` - Code R47. A rare return reason. Only used for US - Government agency non-monetary automatic enrollment messages. - - `enr_invalid_dfi_account_number` - Code R43. A rare return reason. Only used - for US Government agency non-monetary automatic enrollment messages. - - `enr_invalid_individual_id_number` - Code R44. A rare return reason. Only used - for US Government agency non-monetary automatic enrollment messages. - - `enr_invalid_representative_payee_indicator` - Code R46. A rare return reason. - Only used for US Government agency non-monetary automatic enrollment messages. - - `enr_invalid_transaction_code` - Code R41. A rare return reason. Only used for - US Government agency non-monetary automatic enrollment messages. - - `enr_return_of_enr_entry` - Code R40. A rare return reason. Only used for US - Government agency non-monetary automatic enrollment messages. - - `enr_routing_number_check_digit_error` - Code R42. A rare return reason. Only - used for US Government agency non-monetary automatic enrollment messages. - - `entry_not_processed_by_gateway` - Code R84. A rare return reason. The - International ACH Transfer cannot be processed by the gateway. - - `field_error` - Code R69. A rare return reason. One or more of the fields in - the ACH were malformed. - - `foreign_receiving_dfi_unable_to_settle` - Code R83. A rare return reason. The - Foreign receiving bank was unable to settle this ACH transfer. - - `iat_entry_coding_error` - Code R80. A rare return reason. The International - ACH Transfer is malformed. - - `improper_effective_entry_date` - Code R18. A rare return reason. The ACH has - an improper effective entry date field. - - `improper_source_document_source_document_presented` - Code R39. A rare return - reason. The source document related to this ACH, usually an ACH check - conversion, was presented to the bank. - - `invalid_company_id` - Code R21. A rare return reason. The Company ID field of - the ACH was invalid. - - `invalid_foreign_receiving_dfi_identification` - Code R82. A rare return - reason. The foreign receiving bank identifier for an International ACH - Transfer was invalid. - - `invalid_individual_id_number` - Code R22. A rare return reason. The - Individual ID number field of the ACH was invalid. - - `item_and_rck_entry_presented_for_payment` - Code R53. A rare return reason. - Both the Represented Check ("RCK") entry and the original check were presented - to the bank. - - `item_related_to_rck_entry_is_ineligible` - Code R51. A rare return reason. - The Represented Check ("RCK") entry is ineligible. - - `mandatory_field_error` - Code R26. A rare return reason. The ACH is missing a - required field. - - `misrouted_dishonored_return` - Code R71. A rare return reason. The receiving - bank does not recognize the routing number in a dishonored return entry. - - `misrouted_return` - Code R61. A rare return reason. The receiving bank does - not recognize the routing number in a return entry. - - `no_errors_found` - Code R76. A rare return reason. Sent in response to a - return, the bank does not find the errors alleged by the returning bank. - - `non_acceptance_of_r62_dishonored_return` - Code R77. A rare return reason. - The receiving bank does not accept the return of the erroneous debit. The - funds are not available at the receiving bank. - - `non_participant_in_iat_program` - Code R81. A rare return reason. The - receiving bank does not accept International ACH Transfers. - - `permissible_return_entry` - Code R31. A rare return reason. A return that has - been agreed to be accepted by the receiving bank, despite falling outside of - the usual return timeframe. - - `permissible_return_entry_not_accepted` - Code R70. A rare return reason. The - receiving bank had not approved this return. - - `rdfi_non_settlement` - Code R32. A rare return reason. The receiving bank - could not settle this transaction. - - `rdfi_participant_in_check_truncation_program` - Code R30. A rare return - reason. The receiving bank does not accept Check Truncation ACH transfers. - - `representative_payee_deceased_or_unable_to_continue_in_that_capacity` - Code - R14. A rare return reason. The payee is deceased. - - `return_not_a_duplicate` - Code R75. A rare return reason. The originating - bank disputes that an earlier `duplicate_entry` return was actually a - duplicate. - - `return_of_erroneous_or_reversing_debit` - Code R62. A rare return reason. The - originating financial institution made a mistake and this return corrects it. - - `return_of_improper_credit_entry` - Code R36. A rare return reason. Return of - a malformed credit entry. - - `return_of_improper_debit_entry` - Code R35. A rare return reason. Return of a - malformed debit entry. - - `return_of_xck_entry` - Code R33. A rare return reason. Return of a Destroyed - Check ("XKC") entry. - - `source_document_presented_for_payment` - Code R37. A rare return reason. The - source document related to this ACH, usually an ACH check conversion, was - presented to the bank. - - `state_law_affecting_rck_acceptance` - Code R50. A rare return reason. State - law prevents the bank from accepting the Represented Check ("RCK") entry. - - `stop_payment_on_item_related_to_rck_entry` - Code R52. A rare return reason. - A stop payment was issued on a Represented Check ("RCK") entry. - - `stop_payment_on_source_document` - Code R38. A rare return reason. The source - attached to the ACH, usually an ACH check conversion, includes a stop payment. - - `timely_original_return` - Code R73. A rare return reason. The bank receiving - an `untimely_return` believes it was on time. - - `trace_number_error` - Code R27. A rare return reason. An ACH return's trace - number does not match an originated ACH. - - `untimely_dishonored_return` - Code R72. A rare return reason. The dishonored - return was sent too late. - - `untimely_return` - Code R68. A rare return reason. The return was sent too - late. - """ - - transaction_id: str - """The identifier of the Transaction associated with this return.""" - - transfer_id: str - """The identifier of the ACH Transfer associated with this return.""" - - -class TransactionSourceCardDisputeAcceptance(BaseModel): - accepted_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the Card Dispute was accepted. - """ - - card_dispute_id: str - """The identifier of the Card Dispute that was accepted.""" - - transaction_id: str - """ - The identifier of the Transaction that was created to return the disputed funds - to your account. - """ - - -class TransactionSourceCardRefundNetworkIdentifiers(BaseModel): - acquirer_business_id: str - """ - A network assigned business ID that identifies the acquirer that processed this - transaction. - """ - - acquirer_reference_number: str - """A globally unique identifier for this settlement.""" - - transaction_id: Optional[str] = None - """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. - """ - - -class TransactionSourceCardRefundPurchaseDetailsCarRental(BaseModel): - car_class_code: Optional[str] = None - """Code indicating the vehicle's class.""" - - checkout_date: Optional[date] = None - """ - Date the customer picked up the car or, in the case of a no-show or pre-pay - transaction, the scheduled pick up date. - """ - - daily_rental_rate_amount: Optional[int] = None - """Daily rate being charged for the vehicle.""" - - daily_rental_rate_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily rental - rate. - """ - - days_rented: Optional[int] = None - """Number of days the vehicle was rented.""" - - extra_charges: Optional[ - Literal["no_extra_charge", "gas", "extra_mileage", "late_return", "one_way_service_fee", "parking_violation"] - ] = None - """Additional charges (gas, late fee, etc.) being billed. - - - `no_extra_charge` - No extra charge - - `gas` - Gas - - `extra_mileage` - Extra mileage - - `late_return` - Late return - - `one_way_service_fee` - One way service fee - - `parking_violation` - Parking violation - """ - - fuel_charges_amount: Optional[int] = None - """Fuel charges for the vehicle.""" - - fuel_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel charges - assessed. - """ - - insurance_charges_amount: Optional[int] = None - """Any insurance being charged for the vehicle.""" - - insurance_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance - charges assessed. - """ - - no_show_indicator: Optional[Literal["not_applicable", "no_show_for_specialized_vehicle"]] = None - """ - An indicator that the cardholder is being billed for a reserved vehicle that was - not actually rented (that is, a "no-show" charge). - - - `not_applicable` - Not applicable - - `no_show_for_specialized_vehicle` - No show for specialized vehicle - """ - - one_way_drop_off_charges_amount: Optional[int] = None - """ - Charges for returning the vehicle at a different location than where it was - picked up. - """ - - one_way_drop_off_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way - drop-off charges assessed. - """ - - renter_name: Optional[str] = None - """Name of the person renting the vehicle.""" - - weekly_rental_rate_amount: Optional[int] = None - """Weekly rate being charged for the vehicle.""" - - weekly_rental_rate_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly - rental rate. - """ - - -class TransactionSourceCardRefundPurchaseDetailsLodging(BaseModel): - check_in_date: Optional[date] = None - """Date the customer checked in.""" - - daily_room_rate_amount: Optional[int] = None - """Daily rate being charged for the room.""" - - daily_room_rate_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily room - rate. - """ - - extra_charges: Optional[ - Literal["no_extra_charge", "restaurant", "gift_shop", "mini_bar", "telephone", "other", "laundry"] - ] = None - """Additional charges (phone, late check-out, etc.) being billed. - - - `no_extra_charge` - No extra charge - - `restaurant` - Restaurant - - `gift_shop` - Gift shop - - `mini_bar` - Mini bar - - `telephone` - Telephone - - `other` - Other - - `laundry` - Laundry - """ - - folio_cash_advances_amount: Optional[int] = None - """Folio cash advances for the room.""" - - folio_cash_advances_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio cash - advances. - """ - - food_beverage_charges_amount: Optional[int] = None - """Food and beverage charges for the room.""" - - food_beverage_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and - beverage charges. - """ - - no_show_indicator: Optional[Literal["not_applicable", "no_show"]] = None - """ - Indicator that the cardholder is being billed for a reserved room that was not - actually used. - - - `not_applicable` - Not applicable - - `no_show` - No show - """ - - prepaid_expenses_amount: Optional[int] = None - """Prepaid expenses being charged for the room.""" - - prepaid_expenses_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid - expenses. - """ - - room_nights: Optional[int] = None - """Number of nights the room was rented.""" - - total_room_tax_amount: Optional[int] = None - """Total room tax being charged.""" - - total_room_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total room - tax. - """ - - total_tax_amount: Optional[int] = None - """Total tax being charged for the room.""" - - total_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax - assessed. - """ - - -class TransactionSourceCardRefundPurchaseDetailsTravelAncillaryService(BaseModel): - category: Optional[ - Literal[ - "none", - "bundled_service", - "baggage_fee", - "change_fee", - "cargo", - "carbon_offset", - "frequent_flyer", - "gift_card", - "ground_transport", - "in_flight_entertainment", - "lounge", - "medical", - "meal_beverage", - "other", - "passenger_assist_fee", - "pets", - "seat_fees", - "standby", - "service_fee", - "store", - "travel_service", - "unaccompanied_travel", - "upgrades", - "wifi", - ] - ] = None - """Category of the ancillary service. - - - `none` - None - - `bundled_service` - Bundled service - - `baggage_fee` - Baggage fee - - `change_fee` - Change fee - - `cargo` - Cargo - - `carbon_offset` - Carbon offset - - `frequent_flyer` - Frequent flyer - - `gift_card` - Gift card - - `ground_transport` - Ground transport - - `in_flight_entertainment` - In-flight entertainment - - `lounge` - Lounge - - `medical` - Medical - - `meal_beverage` - Meal beverage - - `other` - Other - - `passenger_assist_fee` - Passenger assist fee - - `pets` - Pets - - `seat_fees` - Seat fees - - `standby` - Standby - - `service_fee` - Service fee - - `store` - Store - - `travel_service` - Travel service - - `unaccompanied_travel` - Unaccompanied travel - - `upgrades` - Upgrades - - `wifi` - Wi-fi - """ - - sub_category: Optional[str] = None - """Sub-category of the ancillary service, free-form.""" - - -class TransactionSourceCardRefundPurchaseDetailsTravelAncillary(BaseModel): - connected_ticket_document_number: Optional[str] = None - """ - If this purchase has a connection or relationship to another purchase, such as a - baggage fee for a passenger transport ticket, this field should contain the - ticket document number for the other purchase. - """ - - credit_reason_indicator: Optional[ - Literal[ - "no_credit", - "passenger_transport_ancillary_purchase_cancellation", - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation", - "other", - ] - ] = None - """Indicates the reason for a credit to the cardholder. - - - `no_credit` - No credit - - `passenger_transport_ancillary_purchase_cancellation` - Passenger transport - ancillary purchase cancellation - - `airline_ticket_and_passenger_transport_ancillary_purchase_cancellation` - - Airline ticket and passenger transport ancillary purchase cancellation - - `other` - Other - """ - - passenger_name_or_description: Optional[str] = None - """Name of the passenger or description of the ancillary purchase.""" - - services: List[TransactionSourceCardRefundPurchaseDetailsTravelAncillaryService] - """Additional travel charges, such as baggage fees.""" - - ticket_document_number: Optional[str] = None - """Ticket document number.""" - - -class TransactionSourceCardRefundPurchaseDetailsTravelTripLeg(BaseModel): - carrier_code: Optional[str] = None - """Carrier code (e.g., United Airlines, Jet Blue, etc.).""" - - destination_city_airport_code: Optional[str] = None - """Code for the destination city or airport.""" - - fare_basis_code: Optional[str] = None - """Fare basis code.""" - - flight_number: Optional[str] = None - """Flight number.""" - - service_class: Optional[str] = None - """Service class (e.g., first class, business class, etc.).""" - - stop_over_code: Optional[Literal["none", "stop_over_allowed", "stop_over_not_allowed"]] = None - """Indicates whether a stopover is allowed on this ticket. - - - `none` - None - - `stop_over_allowed` - Stop over allowed - - `stop_over_not_allowed` - Stop over not allowed - """ - - -class TransactionSourceCardRefundPurchaseDetailsTravel(BaseModel): - ancillary: Optional[TransactionSourceCardRefundPurchaseDetailsTravelAncillary] = None - """Ancillary purchases in addition to the airfare.""" - - computerized_reservation_system: Optional[str] = None - """Indicates the computerized reservation system used to book the ticket.""" - - credit_reason_indicator: Optional[ - Literal[ - "no_credit", - "passenger_transport_ancillary_purchase_cancellation", - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation", - "airline_ticket_cancellation", - "other", - "partial_refund_of_airline_ticket", - ] - ] = None - """Indicates the reason for a credit to the cardholder. - - - `no_credit` - No credit - - `passenger_transport_ancillary_purchase_cancellation` - Passenger transport - ancillary purchase cancellation - - `airline_ticket_and_passenger_transport_ancillary_purchase_cancellation` - - Airline ticket and passenger transport ancillary purchase cancellation - - `airline_ticket_cancellation` - Airline ticket cancellation - - `other` - Other - - `partial_refund_of_airline_ticket` - Partial refund of airline ticket - """ - - departure_date: Optional[date] = None - """Date of departure.""" - - origination_city_airport_code: Optional[str] = None - """Code for the originating city or airport.""" - - passenger_name: Optional[str] = None - """Name of the passenger.""" - - restricted_ticket_indicator: Optional[Literal["no_restrictions", "restricted_non_refundable_ticket"]] = None - """Indicates whether this ticket is non-refundable. - - - `no_restrictions` - No restrictions - - `restricted_non_refundable_ticket` - Restricted non-refundable ticket - """ - - ticket_change_indicator: Optional[Literal["none", "change_to_existing_ticket", "new_ticket"]] = None - """Indicates why a ticket was changed. - - - `none` - None - - `change_to_existing_ticket` - Change to existing ticket - - `new_ticket` - New ticket - """ - - ticket_number: Optional[str] = None - """Ticket number.""" - - travel_agency_code: Optional[str] = None - """Code for the travel agency if the ticket was issued by a travel agency.""" - - travel_agency_name: Optional[str] = None - """Name of the travel agency if the ticket was issued by a travel agency.""" - - trip_legs: Optional[List[TransactionSourceCardRefundPurchaseDetailsTravelTripLeg]] = None - """Fields specific to each leg of the journey.""" - - -class TransactionSourceCardRefundPurchaseDetails(BaseModel): - car_rental: Optional[TransactionSourceCardRefundPurchaseDetailsCarRental] = None - """Fields specific to car rentals.""" - - customer_reference_identifier: Optional[str] = None - """An identifier from the merchant for the customer or consumer.""" - - local_tax_amount: Optional[int] = None - """The state or provincial tax amount in minor units.""" - - local_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - assessed. - """ - - lodging: Optional[TransactionSourceCardRefundPurchaseDetailsLodging] = None - """Fields specific to lodging.""" - - national_tax_amount: Optional[int] = None - """The national tax amount in minor units.""" - - national_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - assessed. - """ - - purchase_identifier: Optional[str] = None - """An identifier from the merchant for the purchase to the issuer and cardholder.""" - - purchase_identifier_format: Optional[ - Literal["free_text", "order_number", "rental_agreement_number", "hotel_folio_number", "invoice_number"] - ] = None - """The format of the purchase identifier. - - - `free_text` - Free text - - `order_number` - Order number - - `rental_agreement_number` - Rental agreement number - - `hotel_folio_number` - Hotel folio number - - `invoice_number` - Invoice number - """ - - travel: Optional[TransactionSourceCardRefundPurchaseDetailsTravel] = None - """Fields specific to travel.""" - - -class TransactionSourceCardRefund(BaseModel): - id: str - """The Card Refund identifier.""" - - amount: int - """The pending amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - card_payment_id: Optional[str] = None - """The ID of the Card Payment this transaction belongs to.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - merchant_acceptor_id: Optional[str] = None - """ - The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - """ - - merchant_category_code: str - """The 4-digit MCC describing the merchant's business.""" - - merchant_city: Optional[str] = None - """The city the merchant resides in.""" - - merchant_country: str - """The country the merchant resides in.""" - - merchant_name: Optional[str] = None - """The name of the merchant.""" - - merchant_state: Optional[str] = None - """The state the merchant resides in.""" - - network_identifiers: TransactionSourceCardRefundNetworkIdentifiers - """Network-specific identifiers for this refund.""" - - purchase_details: Optional[TransactionSourceCardRefundPurchaseDetails] = None - """ - Additional details about the card purchase, such as tax and industry-specific - fields. - """ - - transaction_id: str - """The identifier of the Transaction associated with this Transaction.""" - - type: Literal["card_refund"] - """A constant representing the object's type. - - For this resource it will always be `card_refund`. - """ - - -class TransactionSourceCardRevenuePayment(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - period_end: datetime - """The end of the period for which this transaction paid interest.""" - - period_start: datetime - """The start of the period for which this transaction paid interest.""" - - transacted_on_account_id: Optional[str] = None - """The account the card belonged to.""" - - -class TransactionSourceCardSettlementNetworkIdentifiers(BaseModel): - acquirer_business_id: str - """ - A network assigned business ID that identifies the acquirer that processed this - transaction. - """ - - acquirer_reference_number: str - """A globally unique identifier for this settlement.""" - - transaction_id: Optional[str] = None - """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. - """ - - -class TransactionSourceCardSettlementPurchaseDetailsCarRental(BaseModel): - car_class_code: Optional[str] = None - """Code indicating the vehicle's class.""" - - checkout_date: Optional[date] = None - """ - Date the customer picked up the car or, in the case of a no-show or pre-pay - transaction, the scheduled pick up date. - """ - - daily_rental_rate_amount: Optional[int] = None - """Daily rate being charged for the vehicle.""" - - daily_rental_rate_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily rental - rate. - """ - - days_rented: Optional[int] = None - """Number of days the vehicle was rented.""" - - extra_charges: Optional[ - Literal["no_extra_charge", "gas", "extra_mileage", "late_return", "one_way_service_fee", "parking_violation"] - ] = None - """Additional charges (gas, late fee, etc.) being billed. - - - `no_extra_charge` - No extra charge - - `gas` - Gas - - `extra_mileage` - Extra mileage - - `late_return` - Late return - - `one_way_service_fee` - One way service fee - - `parking_violation` - Parking violation - """ - - fuel_charges_amount: Optional[int] = None - """Fuel charges for the vehicle.""" - - fuel_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel charges - assessed. - """ - - insurance_charges_amount: Optional[int] = None - """Any insurance being charged for the vehicle.""" - - insurance_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance - charges assessed. - """ - - no_show_indicator: Optional[Literal["not_applicable", "no_show_for_specialized_vehicle"]] = None - """ - An indicator that the cardholder is being billed for a reserved vehicle that was - not actually rented (that is, a "no-show" charge). - - - `not_applicable` - Not applicable - - `no_show_for_specialized_vehicle` - No show for specialized vehicle - """ - - one_way_drop_off_charges_amount: Optional[int] = None - """ - Charges for returning the vehicle at a different location than where it was - picked up. - """ - - one_way_drop_off_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way - drop-off charges assessed. - """ - - renter_name: Optional[str] = None - """Name of the person renting the vehicle.""" - - weekly_rental_rate_amount: Optional[int] = None - """Weekly rate being charged for the vehicle.""" - - weekly_rental_rate_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly - rental rate. - """ - - -class TransactionSourceCardSettlementPurchaseDetailsLodging(BaseModel): - check_in_date: Optional[date] = None - """Date the customer checked in.""" - - daily_room_rate_amount: Optional[int] = None - """Daily rate being charged for the room.""" - - daily_room_rate_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily room - rate. - """ - - extra_charges: Optional[ - Literal["no_extra_charge", "restaurant", "gift_shop", "mini_bar", "telephone", "other", "laundry"] - ] = None - """Additional charges (phone, late check-out, etc.) being billed. - - - `no_extra_charge` - No extra charge - - `restaurant` - Restaurant - - `gift_shop` - Gift shop - - `mini_bar` - Mini bar - - `telephone` - Telephone - - `other` - Other - - `laundry` - Laundry - """ - - folio_cash_advances_amount: Optional[int] = None - """Folio cash advances for the room.""" - - folio_cash_advances_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio cash - advances. - """ - - food_beverage_charges_amount: Optional[int] = None - """Food and beverage charges for the room.""" - - food_beverage_charges_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and - beverage charges. - """ - - no_show_indicator: Optional[Literal["not_applicable", "no_show"]] = None - """ - Indicator that the cardholder is being billed for a reserved room that was not - actually used. - - - `not_applicable` - Not applicable - - `no_show` - No show - """ - - prepaid_expenses_amount: Optional[int] = None - """Prepaid expenses being charged for the room.""" - - prepaid_expenses_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid - expenses. - """ - - room_nights: Optional[int] = None - """Number of nights the room was rented.""" - - total_room_tax_amount: Optional[int] = None - """Total room tax being charged.""" - - total_room_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total room - tax. - """ - - total_tax_amount: Optional[int] = None - """Total tax being charged for the room.""" - - total_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax - assessed. - """ - - -class TransactionSourceCardSettlementPurchaseDetailsTravelAncillaryService(BaseModel): - category: Optional[ - Literal[ - "none", - "bundled_service", - "baggage_fee", - "change_fee", - "cargo", - "carbon_offset", - "frequent_flyer", - "gift_card", - "ground_transport", - "in_flight_entertainment", - "lounge", - "medical", - "meal_beverage", - "other", - "passenger_assist_fee", - "pets", - "seat_fees", - "standby", - "service_fee", - "store", - "travel_service", - "unaccompanied_travel", - "upgrades", - "wifi", - ] - ] = None - """Category of the ancillary service. - - - `none` - None - - `bundled_service` - Bundled service - - `baggage_fee` - Baggage fee - - `change_fee` - Change fee - - `cargo` - Cargo - - `carbon_offset` - Carbon offset - - `frequent_flyer` - Frequent flyer - - `gift_card` - Gift card - - `ground_transport` - Ground transport - - `in_flight_entertainment` - In-flight entertainment - - `lounge` - Lounge - - `medical` - Medical - - `meal_beverage` - Meal beverage - - `other` - Other - - `passenger_assist_fee` - Passenger assist fee - - `pets` - Pets - - `seat_fees` - Seat fees - - `standby` - Standby - - `service_fee` - Service fee - - `store` - Store - - `travel_service` - Travel service - - `unaccompanied_travel` - Unaccompanied travel - - `upgrades` - Upgrades - - `wifi` - Wi-fi - """ - - sub_category: Optional[str] = None - """Sub-category of the ancillary service, free-form.""" - - -class TransactionSourceCardSettlementPurchaseDetailsTravelAncillary(BaseModel): - connected_ticket_document_number: Optional[str] = None - """ - If this purchase has a connection or relationship to another purchase, such as a - baggage fee for a passenger transport ticket, this field should contain the - ticket document number for the other purchase. - """ - - credit_reason_indicator: Optional[ - Literal[ - "no_credit", - "passenger_transport_ancillary_purchase_cancellation", - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation", - "other", - ] - ] = None - """Indicates the reason for a credit to the cardholder. - - - `no_credit` - No credit - - `passenger_transport_ancillary_purchase_cancellation` - Passenger transport - ancillary purchase cancellation - - `airline_ticket_and_passenger_transport_ancillary_purchase_cancellation` - - Airline ticket and passenger transport ancillary purchase cancellation - - `other` - Other - """ - - passenger_name_or_description: Optional[str] = None - """Name of the passenger or description of the ancillary purchase.""" - - services: List[TransactionSourceCardSettlementPurchaseDetailsTravelAncillaryService] - """Additional travel charges, such as baggage fees.""" - - ticket_document_number: Optional[str] = None - """Ticket document number.""" - - -class TransactionSourceCardSettlementPurchaseDetailsTravelTripLeg(BaseModel): - carrier_code: Optional[str] = None - """Carrier code (e.g., United Airlines, Jet Blue, etc.).""" - - destination_city_airport_code: Optional[str] = None - """Code for the destination city or airport.""" - - fare_basis_code: Optional[str] = None - """Fare basis code.""" - - flight_number: Optional[str] = None - """Flight number.""" - - service_class: Optional[str] = None - """Service class (e.g., first class, business class, etc.).""" - - stop_over_code: Optional[Literal["none", "stop_over_allowed", "stop_over_not_allowed"]] = None - """Indicates whether a stopover is allowed on this ticket. - - - `none` - None - - `stop_over_allowed` - Stop over allowed - - `stop_over_not_allowed` - Stop over not allowed - """ - - -class TransactionSourceCardSettlementPurchaseDetailsTravel(BaseModel): - ancillary: Optional[TransactionSourceCardSettlementPurchaseDetailsTravelAncillary] = None - """Ancillary purchases in addition to the airfare.""" - - computerized_reservation_system: Optional[str] = None - """Indicates the computerized reservation system used to book the ticket.""" - - credit_reason_indicator: Optional[ - Literal[ - "no_credit", - "passenger_transport_ancillary_purchase_cancellation", - "airline_ticket_and_passenger_transport_ancillary_purchase_cancellation", - "airline_ticket_cancellation", - "other", - "partial_refund_of_airline_ticket", - ] - ] = None - """Indicates the reason for a credit to the cardholder. - - - `no_credit` - No credit - - `passenger_transport_ancillary_purchase_cancellation` - Passenger transport - ancillary purchase cancellation - - `airline_ticket_and_passenger_transport_ancillary_purchase_cancellation` - - Airline ticket and passenger transport ancillary purchase cancellation - - `airline_ticket_cancellation` - Airline ticket cancellation - - `other` - Other - - `partial_refund_of_airline_ticket` - Partial refund of airline ticket - """ - - departure_date: Optional[date] = None - """Date of departure.""" - - origination_city_airport_code: Optional[str] = None - """Code for the originating city or airport.""" - - passenger_name: Optional[str] = None - """Name of the passenger.""" - - restricted_ticket_indicator: Optional[Literal["no_restrictions", "restricted_non_refundable_ticket"]] = None - """Indicates whether this ticket is non-refundable. - - - `no_restrictions` - No restrictions - - `restricted_non_refundable_ticket` - Restricted non-refundable ticket - """ - - ticket_change_indicator: Optional[Literal["none", "change_to_existing_ticket", "new_ticket"]] = None - """Indicates why a ticket was changed. - - - `none` - None - - `change_to_existing_ticket` - Change to existing ticket - - `new_ticket` - New ticket - """ - - ticket_number: Optional[str] = None - """Ticket number.""" - - travel_agency_code: Optional[str] = None - """Code for the travel agency if the ticket was issued by a travel agency.""" - - travel_agency_name: Optional[str] = None - """Name of the travel agency if the ticket was issued by a travel agency.""" - - trip_legs: Optional[List[TransactionSourceCardSettlementPurchaseDetailsTravelTripLeg]] = None - """Fields specific to each leg of the journey.""" - - -class TransactionSourceCardSettlementPurchaseDetails(BaseModel): - car_rental: Optional[TransactionSourceCardSettlementPurchaseDetailsCarRental] = None - """Fields specific to car rentals.""" - - customer_reference_identifier: Optional[str] = None - """An identifier from the merchant for the customer or consumer.""" - - local_tax_amount: Optional[int] = None - """The state or provincial tax amount in minor units.""" - - local_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - assessed. - """ - - lodging: Optional[TransactionSourceCardSettlementPurchaseDetailsLodging] = None - """Fields specific to lodging.""" - - national_tax_amount: Optional[int] = None - """The national tax amount in minor units.""" - - national_tax_currency: Optional[str] = None - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the local tax - assessed. - """ - - purchase_identifier: Optional[str] = None - """An identifier from the merchant for the purchase to the issuer and cardholder.""" - - purchase_identifier_format: Optional[ - Literal["free_text", "order_number", "rental_agreement_number", "hotel_folio_number", "invoice_number"] - ] = None - """The format of the purchase identifier. - - - `free_text` - Free text - - `order_number` - Order number - - `rental_agreement_number` - Rental agreement number - - `hotel_folio_number` - Hotel folio number - - `invoice_number` - Invoice number - """ - - travel: Optional[TransactionSourceCardSettlementPurchaseDetailsTravel] = None - """Fields specific to travel.""" - - -class TransactionSourceCardSettlement(BaseModel): - id: str - """The Card Settlement identifier.""" - - amount: int - """The amount in the minor unit of the transaction's settlement currency. - - For dollars, for example, this is cents. - """ - - card_authorization: Optional[str] = None - """ - The Card Authorization that was created prior to this Card Settlement, if one - exists. - """ - - card_payment_id: Optional[str] = None - """The ID of the Card Payment this transaction belongs to.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's settlement currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - merchant_acceptor_id: Optional[str] = None - """ - The merchant identifier (commonly abbreviated as MID) of the merchant the card - is transacting with. - """ - - merchant_category_code: str - """The 4-digit MCC describing the merchant's business.""" - - merchant_city: Optional[str] = None - """The city the merchant resides in.""" - - merchant_country: str - """The country the merchant resides in.""" - - merchant_name: Optional[str] = None - """The name of the merchant.""" - - merchant_state: Optional[str] = None - """The state the merchant resides in.""" - - network_identifiers: TransactionSourceCardSettlementNetworkIdentifiers - """Network-specific identifiers for this refund.""" - - pending_transaction_id: Optional[str] = None - """The identifier of the Pending Transaction associated with this Transaction.""" - - presentment_amount: int - """The amount in the minor unit of the transaction's presentment currency.""" - - presentment_currency: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's presentment currency. - """ - - purchase_details: Optional[TransactionSourceCardSettlementPurchaseDetails] = None - """ - Additional details about the card purchase, such as tax and industry-specific - fields. - """ - - transaction_id: str - """The identifier of the Transaction associated with this Transaction.""" - - type: Literal["card_settlement"] - """A constant representing the object's type. - - For this resource it will always be `card_settlement`. - """ - - -class TransactionSourceCheckDepositAcceptance(BaseModel): - account_number: str - """The account number printed on the check.""" - - amount: int - """The amount to be deposited in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - auxiliary_on_us: Optional[str] = None - """An additional line of metadata printed on the check. - - This typically includes the check number for business checks. - """ - - check_deposit_id: str - """The ID of the Check Deposit that was accepted.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - routing_number: str - """The routing number printed on the check.""" - - serial_number: Optional[str] = None - """The check serial number, if present, for consumer checks. - - For business checks, the serial number is usually in the `auxiliary_on_us` - field. - """ - - -class TransactionSourceCheckDepositReturn(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - check_deposit_id: str - """The identifier of the Check Deposit that was returned.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - return_reason: Literal[ - "ach_conversion_not_supported", - "closed_account", - "duplicate_submission", - "insufficient_funds", - "no_account", - "not_authorized", - "stale_dated", - "stop_payment", - "unknown_reason", - "unmatched_details", - "unreadable_image", - "endorsement_irregular", - "altered_or_fictitious_item", - "frozen_or_blocked_account", - "post_dated", - "endorsement_missing", - "signature_missing", - "stop_payment_suspect", - "unusable_image", - "image_fails_security_check", - "cannot_determine_amount", - "signature_irregular", - "non_cash_item", - "unable_to_process", - "item_exceeds_dollar_limit", - "branch_or_account_sold", - ] - """ - Why this check was returned by the bank holding the account it was drawn - against. - - - `ach_conversion_not_supported` - The check doesn't allow ACH conversion. - - `closed_account` - The account is closed. - - `duplicate_submission` - The check has already been deposited. - - `insufficient_funds` - Insufficient funds - - `no_account` - No account was found matching the check details. - - `not_authorized` - The check was not authorized. - - `stale_dated` - The check is too old. - - `stop_payment` - The payment has been stopped by the account holder. - - `unknown_reason` - The reason for the return is unknown. - - `unmatched_details` - The image doesn't match the details submitted. - - `unreadable_image` - The image could not be read. - - `endorsement_irregular` - The check endorsement was irregular. - - `altered_or_fictitious_item` - The check present was either altered or fake. - - `frozen_or_blocked_account` - The account this check is drawn on is frozen. - - `post_dated` - The check is post dated. - - `endorsement_missing` - The endorsement was missing. - - `signature_missing` - The check signature was missing. - - `stop_payment_suspect` - The bank suspects a stop payment will be placed. - - `unusable_image` - The bank cannot read the image. - - `image_fails_security_check` - The check image fails the bank's security - check. - - `cannot_determine_amount` - The bank cannot determine the amount. - - `signature_irregular` - The signature is inconsistent with prior signatures. - - `non_cash_item` - The check is a non-cash item and cannot be drawn against the - account. - - `unable_to_process` - The bank is unable to process this check. - - `item_exceeds_dollar_limit` - The check exceeds the bank or customer's limit. - - `branch_or_account_sold` - The bank sold this account and no longer services - this customer. - """ - - returned_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the check deposit was returned. - """ - - transaction_id: str - """ - The identifier of the transaction that reversed the original check deposit - transaction. - """ - - -class TransactionSourceCheckTransferDeposit(BaseModel): - back_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the back of the - deposited check. - """ - - bank_of_first_deposit_routing_number: Optional[str] = None - """ - The American Bankers' Association (ABA) Routing Transit Number (RTN) for the - bank depositing this check. In some rare cases, this is not transmitted via - Check21 and the value will be null. - """ - - deposited_at: datetime - """When the check was deposited.""" - - front_image_file_id: Optional[str] = None - """ - The identifier of the API File object containing an image of the front of the - deposited check. - """ - - transaction_id: Optional[str] = None - """The identifier of the Transaction object created when the check was deposited.""" - - transfer_id: str - """The identifier of the Check Transfer object that was deposited.""" - - type: Literal["check_transfer_deposit"] - """A constant representing the object's type. - - For this resource it will always be `check_transfer_deposit`. - """ - - -class TransactionSourceCheckTransferIntention(BaseModel): - address_city: Optional[str] = None - """The city of the check's destination.""" - - address_line1: Optional[str] = None - """The street address of the check's destination.""" - - address_line2: Optional[str] = None - """The second line of the address of the check's destination.""" - - address_state: Optional[str] = None - """The state of the check's destination.""" - - address_zip: Optional[str] = None - """The postal code of the check's destination.""" - - amount: int - """The transfer amount in USD cents.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - recipient_name: Optional[str] = None - """The name that will be printed on the check.""" - - transfer_id: str - """The identifier of the Check Transfer with which this is associated.""" - - -class TransactionSourceCheckTransferStopPaymentRequest(BaseModel): - reason: Literal["mail_delivery_failed", "rejected_by_increase", "not_authorized", "unknown"] - """The reason why this transfer was stopped. - - - `mail_delivery_failed` - The check could not be delivered. - - `rejected_by_increase` - The check was canceled by an Increase operator who - will provide details out-of-band. - - `not_authorized` - The check was not authorized. - - `unknown` - The check was stopped for another reason. - """ - - requested_at: datetime - """The time the stop-payment was requested.""" - - transfer_id: str - """The ID of the check transfer that was stopped.""" - - type: Literal["check_transfer_stop_payment_request"] - """A constant representing the object's type. - - For this resource it will always be `check_transfer_stop_payment_request`. - """ - - -class TransactionSourceFeePayment(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - fee_period_start: date - """The start of this payment's fee period, usually the first day of a month.""" - - -class TransactionSourceInboundACHTransferAddendaFreeformEntry(BaseModel): - payment_related_information: str - """The payment related information passed in the addendum.""" - - -class TransactionSourceInboundACHTransferAddendaFreeform(BaseModel): - entries: List[TransactionSourceInboundACHTransferAddendaFreeformEntry] - """Each entry represents an addendum received from the originator.""" - - -class TransactionSourceInboundACHTransferAddenda(BaseModel): - category: Literal["freeform"] - """The type of addendum. - - - `freeform` - Unstructured addendum. - """ - - freeform: Optional[TransactionSourceInboundACHTransferAddendaFreeform] = None - """Unstructured `payment_related_information` passed through by the originator.""" - - -class TransactionSourceInboundACHTransfer(BaseModel): - addenda: Optional[TransactionSourceInboundACHTransferAddenda] = None - """Additional information sent from the originator.""" - - amount: int - """The amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - originator_company_descriptive_date: Optional[str] = None - """The description of the date of the transfer, usually in the format `YYMMDD`.""" - - originator_company_discretionary_data: Optional[str] = None - """Data set by the originator.""" - - originator_company_entry_description: str - """An informational description of the transfer.""" - - originator_company_id: str - """An identifier for the originating company. - - This is generally, but not always, a stable identifier across multiple - transfers. - """ - - originator_company_name: str - """A name set by the originator to identify themselves.""" - - receiver_id_number: Optional[str] = None - """The originator's identifier for the transfer receipient.""" - - receiver_name: Optional[str] = None - """The name of the transfer recipient. - - This value is informational and not verified by Increase. - """ - - trace_number: str - """ - A 15 digit number recorded in the Nacha file and available to both the - originating and receiving bank. Along with the amount, date, and originating - routing number, this can be used to identify the ACH transfer at either bank. - ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). - """ - - transfer_id: str - """The inbound ach transfer's identifier.""" - - -class TransactionSourceInboundCheck(BaseModel): - amount: int - """The amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - bank_of_first_deposit_routing_number: Optional[str] = None - """ - The American Bankers' Association (ABA) Routing Transit Number (RTN) for the - bank depositing this check. In some rare cases, this is not transmitted via - Check21 and the value will be null. - """ - - check_front_image_file_id: Optional[str] = None - """The front image of the check. This is a black and white TIFF image file.""" - - check_number: Optional[str] = None - """The number of the check. - - This field is set by the depositing bank and can be unreliable. - """ - - check_rear_image_file_id: Optional[str] = None - """The rear image of the check. This is a black and white TIFF image file.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - -class TransactionSourceInboundInternationalACHTransfer(BaseModel): - amount: int - """The amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - destination_country_code: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the destination country. - """ - - destination_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - destination bank account. - """ - - foreign_exchange_indicator: Literal["fixed_to_variable", "variable_to_fixed", "fixed_to_fixed"] - """A description of how the foreign exchange rate was calculated. - - - `fixed_to_variable` - The originator chose an amount in their own currency. - The settled amount in USD was converted using the exchange rate. - - `variable_to_fixed` - The originator chose an amount to settle in USD. The - originator's amount was variable; known only after the foreign exchange - conversion. - - `fixed_to_fixed` - The amount was originated and settled as a fixed amount in - USD. There is no foreign exchange conversion. - """ - - foreign_exchange_reference: Optional[str] = None - """ - Depending on the `foreign_exchange_reference_indicator`, an exchange rate or a - reference to a well-known rate. - """ - - foreign_exchange_reference_indicator: Literal["foreign_exchange_rate", "foreign_exchange_reference_number", "blank"] - """ - An instruction of how to interpret the `foreign_exchange_reference` field for - this Transaction. - - - `foreign_exchange_rate` - The ACH file contains a foreign exchange rate. - - `foreign_exchange_reference_number` - The ACH file contains a reference to a - well-known foreign exchange rate. - - `blank` - There is no foreign exchange for this transfer, so the - `foreign_exchange_reference` field is blank. - """ - - foreign_payment_amount: int - """The amount in the minor unit of the foreign payment currency. - - For dollars, for example, this is cents. - """ - - foreign_trace_number: Optional[str] = None - """A reference number in the foreign banking infrastructure.""" - - international_transaction_type_code: Literal[ - "annuity", - "business_or_commercial", - "deposit", - "loan", - "miscellaneous", - "mortgage", - "pension", - "remittance", - "rent_or_lease", - "salary_or_payroll", - "tax", - "accounts_receivable", - "back_office_conversion", - "machine_transfer", - "point_of_purchase", - "point_of_sale", - "represented_check", - "shared_network_transaction", - "telphone_initiated", - "internet_initiated", - ] - """The type of transfer. Set by the originator. - - - `annuity` - Sent as `ANN` in the Nacha file. - - `business_or_commercial` - Sent as `BUS` in the Nacha file. - - `deposit` - Sent as `DEP` in the Nacha file. - - `loan` - Sent as `LOA` in the Nacha file. - - `miscellaneous` - Sent as `MIS` in the Nacha file. - - `mortgage` - Sent as `MOR` in the Nacha file. - - `pension` - Sent as `PEN` in the Nacha file. - - `remittance` - Sent as `REM` in the Nacha file. - - `rent_or_lease` - Sent as `RLS` in the Nacha file. - - `salary_or_payroll` - Sent as `SAL` in the Nacha file. - - `tax` - Sent as `TAX` in the Nacha file. - - `accounts_receivable` - Sent as `ARC` in the Nacha file. - - `back_office_conversion` - Sent as `BOC` in the Nacha file. - - `machine_transfer` - Sent as `MTE` in the Nacha file. - - `point_of_purchase` - Sent as `POP` in the Nacha file. - - `point_of_sale` - Sent as `POS` in the Nacha file. - - `represented_check` - Sent as `RCK` in the Nacha file. - - `shared_network_transaction` - Sent as `SHR` in the Nacha file. - - `telphone_initiated` - Sent as `TEL` in the Nacha file. - - `internet_initiated` - Sent as `WEB` in the Nacha file. - """ - - originating_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - originating bank account. - """ - - originating_depository_financial_institution_branch_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originating branch country. - """ - - originating_depository_financial_institution_id: str - """An identifier for the originating bank. - - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ - - originating_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `originating_depository_financial_institution_id` field for this Transaction. - - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - - originating_depository_financial_institution_name: str - """The name of the originating bank. - - Sometimes this will refer to an American bank and obscure the correspondent - foreign bank. - """ - - originator_city: str - """A portion of the originator address. This may be incomplete.""" - - originator_company_entry_description: str - """A description field set by the originator.""" - - originator_country: str - """A portion of the originator address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originator country. - """ - - originator_identification: str - """An identifier for the originating company. - - This is generally stable across multiple ACH transfers. - """ - - originator_name: str - """Either the name of the originator or an intermediary money transmitter.""" - - originator_postal_code: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_state_or_province: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_street_address: str - """A portion of the originator address. This may be incomplete.""" - - payment_related_information: Optional[str] = None - """A description field set by the originator.""" - - payment_related_information2: Optional[str] = None - """A description field set by the originator.""" - - receiver_city: str - """A portion of the receiver address. This may be incomplete.""" - - receiver_country: str - """A portion of the receiver address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiver country. - """ - - receiver_identification_number: Optional[str] = None - """An identification number the originator uses for the receiver.""" - - receiver_postal_code: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" - - receiver_state_or_province: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" - - receiver_street_address: str - """A portion of the receiver address. This may be incomplete.""" - - receiving_company_or_individual_name: str - """The name of the receiver of the transfer. This is not verified by Increase.""" - - receiving_depository_financial_institution_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiving bank country. - """ - - receiving_depository_financial_institution_id: str - """An identifier for the receiving bank. - - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ - - receiving_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `receiving_depository_financial_institution_id` field for this Transaction. - - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - - receiving_depository_financial_institution_name: str - """The name of the receiving bank, as set by the sending financial institution.""" - - trace_number: str - """ - A 15 digit number recorded in the Nacha file and available to both the - originating and receiving bank. Along with the amount, date, and originating - routing number, this can be used to identify the ACH transfer at either bank. - ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). - """ - - -class TransactionSourceInboundRealTimePaymentsTransferConfirmation(BaseModel): - amount: int - """The amount in the minor unit of the transfer's currency. - - For dollars, for example, this is cents. - """ - - creditor_name: str - """The name the sender of the transfer specified as the recipient of the transfer.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the transfer's - currency. This will always be "USD" for a Real-Time Payments transfer. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - debtor_account_number: str - """The account number of the account that sent the transfer.""" - - debtor_name: str - """The name provided by the sender of the transfer.""" - - debtor_routing_number: str - """The routing number of the account that sent the transfer.""" - - remittance_information: Optional[str] = None - """Additional information included with the transfer.""" - - transaction_identification: str - """The Real-Time Payments network identification of the transfer.""" - - -class TransactionSourceInboundWireDrawdownPayment(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - beneficiary_address_line1: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_address_line2: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_address_line3: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_name: Optional[str] = None - """A name set by the sender.""" - - beneficiary_reference: Optional[str] = None - """A free-form reference string set by the sender, to help identify the transfer.""" - - description: str - """An Increase-constructed description of the transfer.""" - - input_message_accountability_data: Optional[str] = None - """ - A unique identifier available to the originating and receiving banks, commonly - abbreviated as IMAD. It is created when the wire is submitted to the Fedwire - service and is helpful when debugging wires with the receiving bank. - """ - - originator_address_line1: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line2: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line3: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_name: Optional[str] = None - """The originator of the wire, set by the sending bank.""" - - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ - - originator_to_beneficiary_information: Optional[str] = None - """An Increase-created concatenation of the Originator-to-Beneficiary lines.""" - - originator_to_beneficiary_information_line1: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line2: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line3: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line4: Optional[str] = None - """A free-form message set by the wire originator.""" - - -class TransactionSourceInboundWireDrawdownPaymentReversal(BaseModel): - amount: int - """The amount that was reversed.""" - - description: str - """The description on the reversal message from Fedwire.""" - - input_cycle_date: date - """The Fedwire cycle date for the wire reversal.""" - - input_message_accountability_data: str - """The Fedwire transaction identifier.""" - - input_sequence_number: str - """The Fedwire sequence number.""" - - input_source: str - """The Fedwire input source identifier.""" - - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ - - previous_message_input_cycle_date: date - """The Fedwire cycle date for the wire transfer that was reversed.""" - - previous_message_input_message_accountability_data: str - """The Fedwire transaction identifier for the wire transfer that was reversed.""" - - previous_message_input_sequence_number: str - """The Fedwire sequence number for the wire transfer that was reversed.""" - - previous_message_input_source: str - """The Fedwire input source identifier for the wire transfer that was reversed.""" - - -class TransactionSourceInboundWireReversal(BaseModel): - amount: int - """The amount that was reversed in USD cents.""" - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which - the reversal was created. - """ - - description: str - """ - The description on the reversal message from Fedwire, set by the reversing bank. - """ - - financial_institution_to_financial_institution_information: Optional[str] = None - """Additional financial institution information included in the wire reversal.""" - - input_cycle_date: date - """The Fedwire cycle date for the wire reversal. - - The "Fedwire day" begins at 9:00 PM Eastern Time on the evening before the - `cycle date`. - """ - - input_message_accountability_data: str - """The Fedwire transaction identifier.""" - - input_sequence_number: str - """The Fedwire sequence number.""" - - input_source: str - """The Fedwire input source identifier.""" - - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ - - previous_message_input_cycle_date: date - """ - The Fedwire cycle date for the wire transfer that is being reversed by this - message. - """ - - previous_message_input_message_accountability_data: str - """The Fedwire transaction identifier for the wire transfer that was reversed.""" - - previous_message_input_sequence_number: str - """The Fedwire sequence number for the wire transfer that was reversed.""" - - previous_message_input_source: str - """The Fedwire input source identifier for the wire transfer that was reversed.""" - - receiver_financial_institution_information: Optional[str] = None - """ - Information included in the wire reversal for the receiving financial - institution. - """ - - transaction_id: str - """The ID for the Transaction associated with the transfer reversal.""" - - wire_transfer_id: str - """The ID for the Wire Transfer that is being reversed.""" - - -class TransactionSourceInboundWireTransfer(BaseModel): - amount: int - """The amount in USD cents.""" - - beneficiary_address_line1: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_address_line2: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_address_line3: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_name: Optional[str] = None - """A name set by the sender.""" - - beneficiary_reference: Optional[str] = None - """A free-form reference string set by the sender, to help identify the transfer.""" - - description: str - """An Increase-constructed description of the transfer.""" - - input_message_accountability_data: Optional[str] = None - """ - A unique identifier available to the originating and receiving banks, commonly - abbreviated as IMAD. It is created when the wire is submitted to the Fedwire - service and is helpful when debugging wires with the originating bank. - """ - - originator_address_line1: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line2: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line3: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_name: Optional[str] = None - """The originator of the wire, set by the sending bank.""" - - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ - - originator_to_beneficiary_information: Optional[str] = None - """An Increase-created concatenation of the Originator-to-Beneficiary lines.""" - - originator_to_beneficiary_information_line1: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line2: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line3: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line4: Optional[str] = None - """A free-form message set by the wire originator.""" - - transfer_id: str - """The ID of the Inbound Wire Transfer object that resulted in this Transaction.""" - - -class TransactionSourceInterestPayment(BaseModel): - accrued_on_account_id: Optional[str] = None - """The account on which the interest was accrued.""" - - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - period_end: datetime - """The end of the period for which this transaction paid interest.""" - - period_start: datetime - """The start of the period for which this transaction paid interest.""" - - -class TransactionSourceInternalSource(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction - currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - reason: Literal[ - "account_closure", - "bank_migration", - "cashback", - "check_adjustment", - "collection_payment", - "collection_receivable", - "empyreal_adjustment", - "error", - "error_correction", - "fees", - "interest", - "negative_balance_forgiveness", - "sample_funds", - "sample_funds_return", - ] - """An Internal Source is a transaction between you and Increase. - - This describes the reason for the transaction. - - - `account_closure` - Account closure - - `bank_migration` - Bank migration - - `cashback` - Cashback - - `check_adjustment` - Check adjustment - - `collection_payment` - Collection payment - - `collection_receivable` - Collection receivable - - `empyreal_adjustment` - Empyreal adjustment - - `error` - Error - - `error_correction` - Error correction - - `fees` - Fees - - `interest` - Interest - - `negative_balance_forgiveness` - Negative balance forgiveness - - `sample_funds` - Sample funds - - `sample_funds_return` - Sample funds return - """ - - -class TransactionSourceRealTimePaymentsTransferAcknowledgement(BaseModel): - amount: int - """The transfer amount in USD cents.""" - - destination_account_number: str - """The destination account number.""" - - destination_routing_number: str - """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" - - remittance_information: str - """Unstructured information that will show on the recipient's bank statement.""" - - transfer_id: str - """The identifier of the Real-Time Payments Transfer that led to this Transaction.""" - - -class TransactionSourceSampleFunds(BaseModel): - originator: str - """Where the sample funds came from.""" - - -class TransactionSourceWireTransferIntention(BaseModel): - account_number: str - """The destination account number.""" - - amount: int - """The transfer amount in USD cents.""" - - message_to_recipient: str - """The message that will show on the recipient's bank statement.""" - - routing_number: str - """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" - - transfer_id: str - """The identifier of the Wire Transfer that led to this Transaction.""" - - -class TransactionSourceWireTransferRejection(BaseModel): - transfer_id: str - """The identifier of the Wire Transfer that led to this Transaction.""" - - -class TransactionSource(BaseModel): - account_transfer_intention: Optional[TransactionSourceAccountTransferIntention] = None - """An Account Transfer Intention object. - - This field will be present in the JSON response if and only if `category` is - equal to `account_transfer_intention`. - """ - - ach_transfer_intention: Optional[TransactionSourceACHTransferIntention] = None - """An ACH Transfer Intention object. - - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_intention`. - """ - - ach_transfer_rejection: Optional[TransactionSourceACHTransferRejection] = None - """An ACH Transfer Rejection object. - - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_rejection`. - """ - - ach_transfer_return: Optional[TransactionSourceACHTransferReturn] = None - """An ACH Transfer Return object. - - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_return`. - """ - - card_dispute_acceptance: Optional[TransactionSourceCardDisputeAcceptance] = None - """A Card Dispute Acceptance object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_dispute_acceptance`. - """ - - card_refund: Optional[TransactionSourceCardRefund] = None - """A Card Refund object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_refund`. - """ - - card_revenue_payment: Optional[TransactionSourceCardRevenuePayment] = None - """A Card Revenue Payment object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_revenue_payment`. - """ - - card_settlement: Optional[TransactionSourceCardSettlement] = None - """A Card Settlement object. - - This field will be present in the JSON response if and only if `category` is - equal to `card_settlement`. - """ - - category: Literal[ - "account_transfer_intention", - "ach_transfer_intention", - "ach_transfer_rejection", - "ach_transfer_return", - "card_dispute_acceptance", - "card_refund", - "card_settlement", - "card_revenue_payment", - "check_deposit_acceptance", - "check_deposit_return", - "check_transfer_deposit", - "check_transfer_intention", - "check_transfer_stop_payment_request", - "fee_payment", - "inbound_ach_transfer", - "inbound_ach_transfer_return_intention", - "inbound_check", - "inbound_international_ach_transfer", - "inbound_real_time_payments_transfer_confirmation", - "inbound_wire_drawdown_payment_reversal", - "inbound_wire_drawdown_payment", - "inbound_wire_reversal", - "inbound_wire_transfer", - "inbound_wire_transfer_reversal", - "interest_payment", - "internal_source", - "real_time_payments_transfer_acknowledgement", - "sample_funds", - "wire_transfer_intention", - "wire_transfer_rejection", - "other", - ] - """The type of the resource. - - We may add additional possible values for this enum over time; your application - should be able to handle such additions gracefully. - - - `account_transfer_intention` - Account Transfer Intention: details will be - under the `account_transfer_intention` object. - - `ach_transfer_intention` - ACH Transfer Intention: details will be under the - `ach_transfer_intention` object. - - `ach_transfer_rejection` - ACH Transfer Rejection: details will be under the - `ach_transfer_rejection` object. - - `ach_transfer_return` - ACH Transfer Return: details will be under the - `ach_transfer_return` object. - - `card_dispute_acceptance` - Card Dispute Acceptance: details will be under the - `card_dispute_acceptance` object. - - `card_refund` - Card Refund: details will be under the `card_refund` object. - - `card_settlement` - Card Settlement: details will be under the - `card_settlement` object. - - `card_revenue_payment` - Card Revenue Payment: details will be under the - `card_revenue_payment` object. - - `check_deposit_acceptance` - Check Deposit Acceptance: details will be under - the `check_deposit_acceptance` object. - - `check_deposit_return` - Check Deposit Return: details will be under the - `check_deposit_return` object. - - `check_transfer_deposit` - Check Transfer Deposit: details will be under the - `check_transfer_deposit` object. - - `check_transfer_intention` - Check Transfer Intention: details will be under - the `check_transfer_intention` object. - - `check_transfer_stop_payment_request` - Check Transfer Stop Payment Request: - details will be under the `check_transfer_stop_payment_request` object. - - `fee_payment` - Fee Payment: details will be under the `fee_payment` object. - - `inbound_ach_transfer` - Inbound ACH Transfer Intention: details will be under - the `inbound_ach_transfer` object. - - `inbound_ach_transfer_return_intention` - Inbound ACH Transfer Return - Intention: details will be under the `inbound_ach_transfer_return_intention` - object. - - `inbound_check` - Inbound Check: details will be under the `inbound_check` - object. - - `inbound_international_ach_transfer` - Inbound International ACH Transfer: - details will be under the `inbound_international_ach_transfer` object. - - `inbound_real_time_payments_transfer_confirmation` - Inbound Real-Time - Payments Transfer Confirmation: details will be under the - `inbound_real_time_payments_transfer_confirmation` object. - - `inbound_wire_drawdown_payment_reversal` - Inbound Wire Drawdown Payment - Reversal: details will be under the `inbound_wire_drawdown_payment_reversal` - object. - - `inbound_wire_drawdown_payment` - Inbound Wire Drawdown Payment: details will - be under the `inbound_wire_drawdown_payment` object. - - `inbound_wire_reversal` - Inbound Wire Reversal: details will be under the - `inbound_wire_reversal` object. - - `inbound_wire_transfer` - Inbound Wire Transfer Intention: details will be - under the `inbound_wire_transfer` object. - - `inbound_wire_transfer_reversal` - Inbound Wire Transfer Reversal Intention: - details will be under the `inbound_wire_transfer_reversal` object. - - `interest_payment` - Interest Payment: details will be under the - `interest_payment` object. - - `internal_source` - Internal Source: details will be under the - `internal_source` object. - - `real_time_payments_transfer_acknowledgement` - Real-Time Payments Transfer - Acknowledgement: details will be under the - `real_time_payments_transfer_acknowledgement` object. - - `sample_funds` - Sample Funds: details will be under the `sample_funds` - object. - - `wire_transfer_intention` - Wire Transfer Intention: details will be under the - `wire_transfer_intention` object. - - `wire_transfer_rejection` - Wire Transfer Rejection: details will be under the - `wire_transfer_rejection` object. - - `other` - The Transaction was made for an undocumented or deprecated reason. - """ - - check_deposit_acceptance: Optional[TransactionSourceCheckDepositAcceptance] = None - """A Check Deposit Acceptance object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_deposit_acceptance`. - """ - - check_deposit_return: Optional[TransactionSourceCheckDepositReturn] = None - """A Check Deposit Return object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_deposit_return`. - """ - - check_transfer_deposit: Optional[TransactionSourceCheckTransferDeposit] = None - """A Check Transfer Deposit object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_transfer_deposit`. - """ - - check_transfer_intention: Optional[TransactionSourceCheckTransferIntention] = None - """A Check Transfer Intention object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_transfer_intention`. - """ - - check_transfer_stop_payment_request: Optional[TransactionSourceCheckTransferStopPaymentRequest] = None - """A Check Transfer Stop Payment Request object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_transfer_stop_payment_request`. - """ - - fee_payment: Optional[TransactionSourceFeePayment] = None - """A Fee Payment object. - - This field will be present in the JSON response if and only if `category` is - equal to `fee_payment`. - """ - - inbound_ach_transfer: Optional[TransactionSourceInboundACHTransfer] = None - """An Inbound ACH Transfer Intention object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_ach_transfer`. - """ - - inbound_check: Optional[TransactionSourceInboundCheck] = None - """An Inbound Check object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_check`. - """ - - inbound_international_ach_transfer: Optional[TransactionSourceInboundInternationalACHTransfer] = None - """An Inbound International ACH Transfer object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_international_ach_transfer`. - """ - - inbound_real_time_payments_transfer_confirmation: Optional[ - TransactionSourceInboundRealTimePaymentsTransferConfirmation - ] = None - """An Inbound Real-Time Payments Transfer Confirmation object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_real_time_payments_transfer_confirmation`. - """ - - inbound_wire_drawdown_payment: Optional[TransactionSourceInboundWireDrawdownPayment] = None - """An Inbound Wire Drawdown Payment object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_drawdown_payment`. - """ - - inbound_wire_drawdown_payment_reversal: Optional[TransactionSourceInboundWireDrawdownPaymentReversal] = None - """An Inbound Wire Drawdown Payment Reversal object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_drawdown_payment_reversal`. - """ - - inbound_wire_reversal: Optional[TransactionSourceInboundWireReversal] = None - """An Inbound Wire Reversal object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_reversal`. - """ - - inbound_wire_transfer: Optional[TransactionSourceInboundWireTransfer] = None - """An Inbound Wire Transfer Intention object. - - This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_transfer`. - """ - - interest_payment: Optional[TransactionSourceInterestPayment] = None - """An Interest Payment object. - - This field will be present in the JSON response if and only if `category` is - equal to `interest_payment`. - """ - - internal_source: Optional[TransactionSourceInternalSource] = None - """An Internal Source object. - - This field will be present in the JSON response if and only if `category` is - equal to `internal_source`. - """ - - real_time_payments_transfer_acknowledgement: Optional[ - TransactionSourceRealTimePaymentsTransferAcknowledgement - ] = None - """A Real-Time Payments Transfer Acknowledgement object. - - This field will be present in the JSON response if and only if `category` is - equal to `real_time_payments_transfer_acknowledgement`. - """ - - sample_funds: Optional[TransactionSourceSampleFunds] = None - """A Sample Funds object. - - This field will be present in the JSON response if and only if `category` is - equal to `sample_funds`. - """ - - wire_transfer_intention: Optional[TransactionSourceWireTransferIntention] = None - """A Wire Transfer Intention object. - - This field will be present in the JSON response if and only if `category` is - equal to `wire_transfer_intention`. - """ - - wire_transfer_rejection: Optional[TransactionSourceWireTransferRejection] = None - """A Wire Transfer Rejection object. - - This field will be present in the JSON response if and only if `category` is - equal to `wire_transfer_rejection`. - """ - - -class Transaction(BaseModel): - id: str - """The Transaction identifier.""" - - account_id: str - """The identifier for the Account the Transaction belongs to.""" - - amount: int - """The Transaction amount in the minor unit of its currency. - - For dollars, for example, this is cents. - """ - - created_at: datetime - """ - The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date on which the - Transaction occurred. - """ - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - Transaction's currency. This will match the currency on the Transaction's - Account. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - description: str - """An informational message describing this transaction. - - Use the fields in `source` to get more detailed information. This field appears - as the line-item on the statement. - """ - - route_id: Optional[str] = None - """The identifier for the route this Transaction came through. - - Routes are things like cards and ACH details. - """ - - route_type: Optional[Literal["account_number", "card"]] = None - """The type of the route this Transaction came through. - - - `account_number` - An Account Number. - - `card` - A Card. - """ - - source: TransactionSource - """ - This is an object giving more details on the network-level event that caused the - Transaction. Note that for backwards compatibility reasons, additional - undocumented keys may appear in this object. These should be treated as - deprecated and will be removed in the future. - """ - - type: Literal["transaction"] - """A constant representing the object's type. - - For this resource it will always be `transaction`. - """ - - -class InboundRealTimePaymentsTransferSimulationResult(BaseModel): - declined_transaction: Optional[DeclinedTransaction] = None - """ - If the Real-Time Payments Transfer attempt fails, this will contain the - resulting [Declined Transaction](#declined-transactions) object. The Declined - Transaction's `source` will be of - `category: inbound_real_time_payments_transfer_decline`. - """ - - transaction: Optional[Transaction] = None - """ - If the Real-Time Payments Transfer attempt succeeds, this will contain the - resulting [Transaction](#transactions) object. The Transaction's `source` will - be of `category: inbound_real_time_payments_transfer_confirmation`. - """ - - type: Literal["inbound_real_time_payments_transfer_simulation_result"] - """A constant representing the object's type. - - For this resource it will always be - `inbound_real_time_payments_transfer_simulation_result`. - """ diff --git a/src/increase/types/simulations/inbound_wire_drawdown_request_create_params.py b/src/increase/types/simulations/inbound_wire_drawdown_request_create_params.py index 5aac92594..224b6766f 100644 --- a/src/increase/types/simulations/inbound_wire_drawdown_request_create_params.py +++ b/src/increase/types/simulations/inbound_wire_drawdown_request_create_params.py @@ -11,11 +11,11 @@ class InboundWireDrawdownRequestCreateParams(TypedDict, total=False): amount: Required[int] """The amount being requested in cents.""" - beneficiary_account_number: Required[str] - """The drawdown request's beneficiary's account number.""" + creditor_account_number: Required[str] + """The creditor's account number.""" - beneficiary_routing_number: Required[str] - """The drawdown request's beneficiary's routing number.""" + creditor_routing_number: Required[str] + """The creditor's routing number.""" currency: Required[str] """ @@ -23,65 +23,69 @@ class InboundWireDrawdownRequestCreateParams(TypedDict, total=False): requested. Will always be "USD". """ - message_to_recipient: Required[str] - """A message from the drawdown request's originator.""" - - originator_account_number: Required[str] - """The drawdown request's originator's account number.""" - - originator_routing_number: Required[str] - """The drawdown request's originator's routing number.""" - recipient_account_number_id: Required[str] """ The Account Number to which the recipient of this request is being requested to send funds from. """ - beneficiary_address_line1: str - """Line 1 of the drawdown request's beneficiary's address.""" - - beneficiary_address_line2: str - """Line 2 of the drawdown request's beneficiary's address.""" - - beneficiary_address_line3: str - """Line 3 of the drawdown request's beneficiary's address.""" - - beneficiary_name: str - """The drawdown request's beneficiary's name.""" + creditor_address_line1: str + """ + A free-form address field set by the sender representing the first line of the + creditor's address. + """ - originator_address_line1: str - """Line 1 of the drawdown request's originator's address.""" + creditor_address_line2: str + """ + A free-form address field set by the sender representing the second line of the + creditor's address. + """ - originator_address_line2: str - """Line 2 of the drawdown request's originator's address.""" + creditor_address_line3: str + """ + A free-form address field set by the sender representing the third line of the + creditor's address. + """ - originator_address_line3: str - """Line 3 of the drawdown request's originator's address.""" + creditor_name: str + """A free-form name field set by the sender representing the creditor's name.""" - originator_name: str - """The drawdown request's originator's name.""" + debtor_account_number: str + """The debtor's account number.""" - originator_to_beneficiary_information_line1: str + debtor_address_line1: str """ - Line 1 of the information conveyed from the originator of the message to the - beneficiary. + A free-form address field set by the sender representing the first line of the + debtor's address. """ - originator_to_beneficiary_information_line2: str + debtor_address_line2: str """ - Line 2 of the information conveyed from the originator of the message to the - beneficiary. + A free-form address field set by the sender representing the second line of the + debtor's address. """ - originator_to_beneficiary_information_line3: str - """ - Line 3 of the information conveyed from the originator of the message to the - beneficiary. - """ + debtor_address_line3: str + """A free-form address field set by the sender.""" + + debtor_name: str + """A free-form name field set by the sender representing the debtor's name.""" - originator_to_beneficiary_information_line4: str + debtor_routing_number: str + """The debtor's routing number.""" + + end_to_end_identification: str + """A free-form reference string set by the sender, to help identify the transfer.""" + + instruction_identification: str + """The sending bank's identifier for the wire transfer.""" + + unique_end_to_end_transaction_reference: str """ - Line 4 of the information conveyed from the originator of the message to the - beneficiary. + The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + of the transfer. """ + + unstructured_remittance_information: str + """A free-form message set by the sender.""" diff --git a/src/increase/types/simulations/inbound_wire_transfer_create_params.py b/src/increase/types/simulations/inbound_wire_transfer_create_params.py new file mode 100644 index 000000000..997861e09 --- /dev/null +++ b/src/increase/types/simulations/inbound_wire_transfer_create_params.py @@ -0,0 +1,99 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Required, TypedDict + +__all__ = ["InboundWireTransferCreateParams"] + + +class InboundWireTransferCreateParams(TypedDict, total=False): + account_number_id: Required[str] + """The identifier of the Account Number the inbound Wire Transfer is for.""" + + amount: Required[int] + """The transfer amount in cents. Must be positive.""" + + creditor_address_line1: str + """The sending bank will set creditor_address_line1 in production. + + You can simulate any value here. + """ + + creditor_address_line2: str + """The sending bank will set creditor_address_line2 in production. + + You can simulate any value here. + """ + + creditor_address_line3: str + """The sending bank will set creditor_address_line3 in production. + + You can simulate any value here. + """ + + creditor_name: str + """The sending bank will set creditor_name in production. + + You can simulate any value here. + """ + + debtor_address_line1: str + """The sending bank will set debtor_address_line1 in production. + + You can simulate any value here. + """ + + debtor_address_line2: str + """The sending bank will set debtor_address_line2 in production. + + You can simulate any value here. + """ + + debtor_address_line3: str + """The sending bank will set debtor_address_line3 in production. + + You can simulate any value here. + """ + + debtor_name: str + """The sending bank will set debtor_name in production. + + You can simulate any value here. + """ + + end_to_end_identification: str + """The sending bank will set end_to_end_identification in production. + + You can simulate any value here. + """ + + instructing_agent_routing_number: str + """The sending bank will set instructing_agent_routing_number in production. + + You can simulate any value here. + """ + + instruction_identification: str + """The sending bank will set instruction_identification in production. + + You can simulate any value here. + """ + + unique_end_to_end_transaction_reference: str + """The sending bank will set unique_end_to_end_transaction_reference in production. + + You can simulate any value here. + """ + + unstructured_remittance_information: str + """The sending bank will set unstructured_remittance_information in production. + + You can simulate any value here. + """ + + wire_drawdown_request_id: str + """ + The identifier of a Wire Drawdown Request the inbound Wire Transfer is + fulfilling. + """ diff --git a/src/increase/types/simulations/interest_payment_create_params.py b/src/increase/types/simulations/interest_payment_create_params.py index a180e1eae..6659005dd 100644 --- a/src/increase/types/simulations/interest_payment_create_params.py +++ b/src/increase/types/simulations/interest_payment_create_params.py @@ -13,11 +13,17 @@ class InterestPaymentCreateParams(TypedDict, total=False): account_id: Required[str] - """The identifier of the Account Number the Interest Payment is for.""" + """The identifier of the Account the Interest Payment should be paid to is for.""" amount: Required[int] """The interest amount in cents. Must be positive.""" + accrued_on_account_id: str + """The identifier of the Account the Interest accrued on. + + Defaults to `account_id`. + """ + period_end: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] """The end of the interest period. If not provided, defaults to the current time.""" diff --git a/src/increase/types/simulations/physical_card_shipment_advance_params.py b/src/increase/types/simulations/physical_card_advance_shipment_params.py similarity index 72% rename from src/increase/types/simulations/physical_card_shipment_advance_params.py rename to src/increase/types/simulations/physical_card_advance_shipment_params.py index 58e44d41c..25c75bb80 100644 --- a/src/increase/types/simulations/physical_card_shipment_advance_params.py +++ b/src/increase/types/simulations/physical_card_advance_shipment_params.py @@ -4,12 +4,14 @@ from typing_extensions import Literal, Required, TypedDict -__all__ = ["PhysicalCardShipmentAdvanceParams"] +__all__ = ["PhysicalCardAdvanceShipmentParams"] -class PhysicalCardShipmentAdvanceParams(TypedDict, total=False): +class PhysicalCardAdvanceShipmentParams(TypedDict, total=False): shipment_status: Required[ - Literal["pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned"] + Literal[ + "pending", "canceled", "submitted", "acknowledged", "rejected", "shipped", "returned", "requires_attention" + ] ] """The shipment status to move the Physical Card to. @@ -24,4 +26,6 @@ class PhysicalCardShipmentAdvanceParams(TypedDict, total=False): - `shipped` - The physical card has been shipped. - `returned` - The physical card shipment was returned to the sender and destroyed by the production facility. + - `requires_attention` - The physical card shipment requires attention from + Increase before progressing. """ diff --git a/src/increase/types/simulations/physical_card_create_params.py b/src/increase/types/simulations/physical_card_create_params.py new file mode 100644 index 000000000..d61a0d028 --- /dev/null +++ b/src/increase/types/simulations/physical_card_create_params.py @@ -0,0 +1,43 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union +from datetime import datetime +from typing_extensions import Literal, Required, Annotated, TypedDict + +from ..._utils import PropertyInfo + +__all__ = ["PhysicalCardCreateParams"] + + +class PhysicalCardCreateParams(TypedDict, total=False): + category: Required[ + Literal["in_transit", "processed_for_delivery", "delivered", "delivery_issue", "returned_to_sender"] + ] + """The type of tracking event. + + - `in_transit` - The physical card is in transit. + - `processed_for_delivery` - The physical card has been processed for delivery. + - `delivered` - The physical card has been delivered. + - `delivery_issue` - There is an issue preventing delivery. The delivery will be + attempted again if possible. If the issue cannot be resolved, the physical + card will be returned to sender. + - `returned_to_sender` - Delivery failed and the physical card was returned to + sender. + """ + + carrier_estimated_delivery_at: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time when the + carrier expects the card to be delivered. + """ + + city: str + """The city where the event took place.""" + + postal_code: str + """The postal code where the event took place.""" + + state: str + """The state where the event took place.""" diff --git a/src/increase/types/simulations/program_create_params.py b/src/increase/types/simulations/program_create_params.py index d040579d2..0985e9ca9 100644 --- a/src/increase/types/simulations/program_create_params.py +++ b/src/increase/types/simulations/program_create_params.py @@ -2,7 +2,7 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict __all__ = ["ProgramCreateParams"] @@ -10,3 +10,18 @@ class ProgramCreateParams(TypedDict, total=False): name: Required[str] """The name of the program being added.""" + + bank: Literal["core_bank", "first_internet_bank", "grasshopper_bank", "twin_city_bank"] + """The bank for the program's accounts, defaults to First Internet Bank. + + - `core_bank` - Core Bank + - `first_internet_bank` - First Internet Bank of Indiana + - `grasshopper_bank` - Grasshopper Bank + - `twin_city_bank` - Twin City Bank + """ + + lending_maximum_extendable_credit: int + """The maximum extendable credit of the program being added.""" + + reserve_account_id: str + """The identifier of the Account the Program should be added to is for.""" diff --git a/src/increase/types/simulations/real_time_payments_transfer_complete_params.py b/src/increase/types/simulations/real_time_payments_transfer_complete_params.py index 1bbadeeb6..f96f2fd3b 100644 --- a/src/increase/types/simulations/real_time_payments_transfer_complete_params.py +++ b/src/increase/types/simulations/real_time_payments_transfer_complete_params.py @@ -13,6 +13,8 @@ class RealTimePaymentsTransferCompleteParams(TypedDict, total=False): class Rejection(TypedDict, total=False): + """If set, the simulation will reject the transfer.""" + reject_reason_code: Required[ Literal[ "account_closed", diff --git a/src/increase/types/simulations/wire_transfer_create_inbound_params.py b/src/increase/types/simulations/wire_transfer_create_inbound_params.py deleted file mode 100644 index 7357261b3..000000000 --- a/src/increase/types/simulations/wire_transfer_create_inbound_params.py +++ /dev/null @@ -1,99 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -from typing_extensions import Required, TypedDict - -__all__ = ["WireTransferCreateInboundParams"] - - -class WireTransferCreateInboundParams(TypedDict, total=False): - account_number_id: Required[str] - """The identifier of the Account Number the inbound Wire Transfer is for.""" - - amount: Required[int] - """The transfer amount in cents. Must be positive.""" - - beneficiary_address_line1: str - """The sending bank will set beneficiary_address_line1 in production. - - You can simulate any value here. - """ - - beneficiary_address_line2: str - """The sending bank will set beneficiary_address_line2 in production. - - You can simulate any value here. - """ - - beneficiary_address_line3: str - """The sending bank will set beneficiary_address_line3 in production. - - You can simulate any value here. - """ - - beneficiary_name: str - """The sending bank will set beneficiary_name in production. - - You can simulate any value here. - """ - - beneficiary_reference: str - """The sending bank will set beneficiary_reference in production. - - You can simulate any value here. - """ - - originator_address_line1: str - """The sending bank will set originator_address_line1 in production. - - You can simulate any value here. - """ - - originator_address_line2: str - """The sending bank will set originator_address_line2 in production. - - You can simulate any value here. - """ - - originator_address_line3: str - """The sending bank will set originator_address_line3 in production. - - You can simulate any value here. - """ - - originator_name: str - """The sending bank will set originator_name in production. - - You can simulate any value here. - """ - - originator_routing_number: str - """The sending bank will set originator_routing_number in production. - - You can simulate any value here. - """ - - originator_to_beneficiary_information_line1: str - """ - The sending bank will set originator_to_beneficiary_information_line1 in - production. You can simulate any value here. - """ - - originator_to_beneficiary_information_line2: str - """ - The sending bank will set originator_to_beneficiary_information_line2 in - production. You can simulate any value here. - """ - - originator_to_beneficiary_information_line3: str - """ - The sending bank will set originator_to_beneficiary_information_line3 in - production. You can simulate any value here. - """ - - originator_to_beneficiary_information_line4: str - """ - The sending bank will set originator_to_beneficiary_information_line4 in - production. You can simulate any value here. - """ diff --git a/src/increase/types/entities/supplemental_document_create_params.py b/src/increase/types/supplemental_document_create_params.py similarity index 76% rename from src/increase/types/entities/supplemental_document_create_params.py rename to src/increase/types/supplemental_document_create_params.py index 74939db4e..50169258d 100644 --- a/src/increase/types/entities/supplemental_document_create_params.py +++ b/src/increase/types/supplemental_document_create_params.py @@ -8,5 +8,8 @@ class SupplementalDocumentCreateParams(TypedDict, total=False): + entity_id: Required[str] + """The identifier of the Entity to associate with the supplemental document.""" + file_id: Required[str] """The identifier of the File containing the document.""" diff --git a/src/increase/types/entities/supplemental_document_list_params.py b/src/increase/types/supplemental_document_list_params.py similarity index 100% rename from src/increase/types/entities/supplemental_document_list_params.py rename to src/increase/types/supplemental_document_list_params.py diff --git a/src/increase/types/swift_transfer.py b/src/increase/types/swift_transfer.py new file mode 100644 index 000000000..5344a4452 --- /dev/null +++ b/src/increase/types/swift_transfer.py @@ -0,0 +1,232 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import Optional +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = [ + "SwiftTransfer", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "CreditorAddress", + "DebtorAddress", +] + + +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + +class CreditorAddress(BaseModel): + """The creditor's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: str + """The first line of the address.""" + + line2: Optional[str] = None + """The second line of the address.""" + + postal_code: Optional[str] = None + """The ZIP or postal code of the address.""" + + state: Optional[str] = None + """The state, province, or region of the address. Required in certain countries.""" + + +class DebtorAddress(BaseModel): + """The debtor's address.""" + + city: Optional[str] = None + """The city, district, town, or village of the address.""" + + country: str + """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: str + """The first line of the address.""" + + line2: Optional[str] = None + """The second line of the address.""" + + postal_code: Optional[str] = None + """The ZIP or postal code of the address.""" + + state: Optional[str] = None + """The state, province, or region of the address. Required in certain countries.""" + + +class SwiftTransfer(BaseModel): + """Swift Transfers send funds internationally.""" + + id: str + """The Swift transfer's identifier.""" + + account_id: str + """The Account to which the transfer belongs.""" + + account_number: str + """The creditor's account number.""" + + amount: int + """The transfer amount in USD cents.""" + + bank_identification_code: str + """The bank identification code (BIC) of the creditor.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the transfer was created. + """ + + created_by: CreatedBy + """What object created the transfer, either via the API or the dashboard.""" + + creditor_address: CreditorAddress + """The creditor's address.""" + + creditor_name: str + """The creditor's name.""" + + debtor_address: DebtorAddress + """The debtor's address.""" + + debtor_name: str + """The debtor's name.""" + + idempotency_key: Optional[str] = None + """The idempotency key you chose for this object. + + This value is unique across Increase and is used to ensure that a request is + only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + instructed_amount: int + """ + The amount that was instructed to be transferred in minor units of the + `instructed_currency`. + """ + + instructed_currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the + instructed amount. + + - `USD` - United States Dollar + """ + + pending_transaction_id: Optional[str] = None + """The ID for the pending transaction representing the transfer.""" + + routing_number: Optional[str] = None + """The creditor's bank account routing or transit number. + + Required in certain countries. + """ + + source_account_number_id: str + """The Account Number included in the transfer as the debtor's account number.""" + + status: Literal[ + "pending_approval", + "canceled", + "pending_reviewing", + "requires_attention", + "pending_initiating", + "initiated", + "rejected", + "returned", + ] + """The lifecycle status of the transfer. + + - `pending_approval` - The transfer is pending approval. + - `canceled` - The transfer has been canceled. + - `pending_reviewing` - The transfer is pending review by Increase. + - `requires_attention` - The transfer requires attention from an Increase + operator. + - `pending_initiating` - The transfer is pending initiation. + - `initiated` - The transfer has been initiated. + - `rejected` - The transfer has been rejected by Increase. + - `returned` - The transfer has been returned. + """ + + transaction_id: Optional[str] = None + """The ID for the transaction funding the transfer. + + This will be populated after the transfer is initiated. + """ + + type: Literal["swift_transfer"] + """A constant representing the object's type. + + For this resource it will always be `swift_transfer`. + """ + + unique_end_to_end_transaction_reference: str + """ + The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + for the transfer. + """ + + unstructured_remittance_information: str + """The unstructured remittance information that was included with the transfer.""" diff --git a/src/increase/types/swift_transfer_create_params.py b/src/increase/types/swift_transfer_create_params.py new file mode 100644 index 000000000..2a37c670d --- /dev/null +++ b/src/increase/types/swift_transfer_create_params.py @@ -0,0 +1,113 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["SwiftTransferCreateParams", "CreditorAddress", "DebtorAddress"] + + +class SwiftTransferCreateParams(TypedDict, total=False): + account_id: Required[str] + """The identifier for the account that will send the transfer.""" + + account_number: Required[str] + """The creditor's account number.""" + + bank_identification_code: Required[str] + """The bank identification code (BIC) of the creditor. + + If it ends with the three-character branch code, this must be 11 characters + long. Otherwise this must be 8 characters and the branch code will be assumed to + be `XXX`. + """ + + creditor_address: Required[CreditorAddress] + """The creditor's address.""" + + creditor_name: Required[str] + """The creditor's name.""" + + debtor_address: Required[DebtorAddress] + """The debtor's address.""" + + debtor_name: Required[str] + """The debtor's name.""" + + instructed_amount: Required[int] + """The amount, in minor units of `instructed_currency`, to send to the creditor.""" + + instructed_currency: Required[Literal["USD"]] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code of the + instructed amount. + + - `USD` - United States Dollar + """ + + source_account_number_id: Required[str] + """The Account Number to include in the transfer as the debtor's account number.""" + + unstructured_remittance_information: Required[str] + """Unstructured remittance information to include in the transfer.""" + + require_approval: bool + """Whether the transfer requires explicit approval via the dashboard or API.""" + + routing_number: str + """The creditor's bank account routing or transit number. + + Required in certain countries. + """ + + +class CreditorAddress(TypedDict, total=False): + """The creditor's address.""" + + city: Required[str] + """The city, district, town, or village of the address.""" + + country: Required[str] + """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + postal_code: str + """The ZIP or postal code of the address. Required in certain countries.""" + + state: str + """The state, province, or region of the address. Required in certain countries.""" + + +class DebtorAddress(TypedDict, total=False): + """The debtor's address.""" + + city: Required[str] + """The city, district, town, or village of the address.""" + + country: Required[str] + """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + postal_code: str + """The ZIP or postal code of the address. Required in certain countries.""" + + state: str + """The state, province, or region of the address. Required in certain countries.""" diff --git a/src/increase/types/swift_transfer_list_params.py b/src/increase/types/swift_transfer_list_params.py new file mode 100644 index 000000000..15f14bd69 --- /dev/null +++ b/src/increase/types/swift_transfer_list_params.py @@ -0,0 +1,87 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import List, Union +from datetime import datetime +from typing_extensions import Literal, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["SwiftTransferListParams", "CreatedAt", "Status"] + + +class SwiftTransferListParams(TypedDict, total=False): + account_id: str + """Filter Swift Transfers to those that originated from the specified Account.""" + + created_at: CreatedAt + + cursor: str + """Return the page of entries after this one.""" + + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + + limit: int + """Limit the size of the list that is returned. + + The default (and maximum) is 100 objects. + """ + + status: Status + + +class CreatedAt(TypedDict, total=False): + after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) + timestamp. + """ + + on_or_after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or after this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + on_or_before: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] + """ + Return results on or before this + [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. + """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[ + Literal[ + "pending_approval", + "canceled", + "pending_reviewing", + "requires_attention", + "pending_initiating", + "initiated", + "rejected", + "returned", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/transaction.py b/src/increase/types/transaction.py index 378ac1c80..b371d94ed 100644 --- a/src/increase/types/transaction.py +++ b/src/increase/types/transaction.py @@ -1,20 +1,52 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import List, Optional +from typing import TYPE_CHECKING, Dict, List, Optional from datetime import date, datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel __all__ = [ "Transaction", "Source", + "SourceAccountRevenuePayment", "SourceAccountTransferIntention", "SourceACHTransferIntention", "SourceACHTransferRejection", "SourceACHTransferReturn", + "SourceBlockchainOfframpTransferSettlement", + "SourceBlockchainOnrampTransferIntention", "SourceCardDisputeAcceptance", + "SourceCardDisputeFinancial", + "SourceCardDisputeFinancialVisa", + "SourceCardDisputeLoss", + "SourceCardFinancial", + "SourceCardFinancialAdditionalAmounts", + "SourceCardFinancialAdditionalAmountsClinic", + "SourceCardFinancialAdditionalAmountsDental", + "SourceCardFinancialAdditionalAmountsOriginal", + "SourceCardFinancialAdditionalAmountsPrescription", + "SourceCardFinancialAdditionalAmountsSurcharge", + "SourceCardFinancialAdditionalAmountsTotalCumulative", + "SourceCardFinancialAdditionalAmountsTotalHealthcare", + "SourceCardFinancialAdditionalAmountsTransit", + "SourceCardFinancialAdditionalAmountsUnknown", + "SourceCardFinancialAdditionalAmountsVision", + "SourceCardFinancialNetworkDetails", + "SourceCardFinancialNetworkDetailsPulse", + "SourceCardFinancialNetworkDetailsVisa", + "SourceCardFinancialNetworkIdentifiers", + "SourceCardFinancialSchemeFee", + "SourceCardFinancialVerification", + "SourceCardFinancialVerificationCardVerificationCode", + "SourceCardFinancialVerificationCardholderAddress", + "SourceCardFinancialVerificationCardholderName", + "SourceCardPushTransferAcceptance", "SourceCardRefund", + "SourceCardRefundCashback", + "SourceCardRefundInterchange", "SourceCardRefundNetworkIdentifiers", "SourceCardRefundPurchaseDetails", "SourceCardRefundPurchaseDetailsCarRental", @@ -23,8 +55,11 @@ "SourceCardRefundPurchaseDetailsTravelAncillary", "SourceCardRefundPurchaseDetailsTravelAncillaryService", "SourceCardRefundPurchaseDetailsTravelTripLeg", + "SourceCardRefundSchemeFee", "SourceCardRevenuePayment", "SourceCardSettlement", + "SourceCardSettlementCashback", + "SourceCardSettlementInterchange", "SourceCardSettlementNetworkIdentifiers", "SourceCardSettlementPurchaseDetails", "SourceCardSettlementPurchaseDetailsCarRental", @@ -33,49 +68,82 @@ "SourceCardSettlementPurchaseDetailsTravelAncillary", "SourceCardSettlementPurchaseDetailsTravelAncillaryService", "SourceCardSettlementPurchaseDetailsTravelTripLeg", + "SourceCardSettlementSchemeFee", + "SourceCardSettlementSurcharge", + "SourceCashbackPayment", "SourceCheckDepositAcceptance", "SourceCheckDepositReturn", "SourceCheckTransferDeposit", - "SourceCheckTransferIntention", - "SourceCheckTransferStopPaymentRequest", + "SourceFednowTransferAcknowledgement", "SourceFeePayment", "SourceInboundACHTransfer", "SourceInboundACHTransferAddenda", "SourceInboundACHTransferAddendaFreeform", "SourceInboundACHTransferAddendaFreeformEntry", - "SourceInboundCheck", - "SourceInboundInternationalACHTransfer", + "SourceInboundACHTransferReturnIntention", + "SourceInboundCheckAdjustment", + "SourceInboundCheckDepositReturnIntention", + "SourceInboundFednowTransferConfirmation", "SourceInboundRealTimePaymentsTransferConfirmation", - "SourceInboundWireDrawdownPayment", - "SourceInboundWireDrawdownPaymentReversal", "SourceInboundWireReversal", "SourceInboundWireTransfer", + "SourceInboundWireTransferReversal", "SourceInterestPayment", "SourceInternalSource", + "SourceOther", "SourceRealTimePaymentsTransferAcknowledgement", "SourceSampleFunds", + "SourceSwiftTransferIntention", + "SourceSwiftTransferReturn", "SourceWireTransferIntention", - "SourceWireTransferRejection", ] +class SourceAccountRevenuePayment(BaseModel): + """An Account Revenue Payment object. + + This field will be present in the JSON response if and only if `category` is equal to `account_revenue_payment`. An Account Revenue Payment represents a payment made to an account from the bank. Account revenue is a type of non-interest income. + """ + + accrued_on_account_id: str + """The account on which the account revenue was accrued.""" + + period_end: datetime + """The end of the period for which this transaction paid account revenue.""" + + period_start: datetime + """The start of the period for which this transaction paid account revenue.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + class SourceAccountTransferIntention(BaseModel): + """An Account Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is equal to `account_transfer_intention`. Two Account Transfer Intentions are created from each Account Transfer. One decrements the source account, and the other increments the destination account. + """ + amount: int """The pending amount in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the destination account currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -91,8 +159,25 @@ class SourceAccountTransferIntention(BaseModel): transfer_id: str """The identifier of the Account Transfer that led to this Pending Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceACHTransferIntention(BaseModel): + """An ACH Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_intention`. An ACH Transfer Intention is created from an ACH Transfer. It reflects the intention to move money into or out of an Increase account via the ACH network. + """ + account_number: str """The account number for the destination account.""" @@ -114,13 +199,47 @@ class SourceACHTransferIntention(BaseModel): transfer_id: str """The identifier of the ACH Transfer that led to this Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceACHTransferRejection(BaseModel): + """An ACH Transfer Rejection object. + + This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_rejection`. An ACH Transfer Rejection is created when an ACH Transfer is rejected by Increase. It offsets the ACH Transfer Intention. These rejections are rare. + """ + transfer_id: str """The identifier of the ACH Transfer that led to this Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceACHTransferReturn(BaseModel): + """An ACH Transfer Return object. + + This field will be present in the JSON response if and only if `category` is equal to `ach_transfer_return`. An ACH Transfer Return is created when an ACH Transfer is returned by the receiving bank. It offsets the ACH Transfer Intention. ACH Transfer Returns usually occur within the first two business days after the transfer is initiated, but can occur much later. + """ + created_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which @@ -207,24 +326,28 @@ class SourceACHTransferReturn(BaseModel): This reason code is sent by the receiving bank back to Increase. - `insufficient_fund` - Code R01. Insufficient funds in the receiving account. - Sometimes abbreviated to NSF. + Sometimes abbreviated to "NSF." - `no_account` - Code R03. The account does not exist or the receiving bank was unable to locate it. - `account_closed` - Code R02. The account is closed at the receiving bank. - `invalid_account_number_structure` - Code R04. The account number is invalid at the receiving bank. - - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. The account - at the receiving bank was frozen per the Office of Foreign Assets Control. - - `credit_entry_refused_by_receiver` - Code R23. The receiving bank account - refused a credit transfer. + - `account_frozen_entry_returned_per_ofac_instruction` - Code R16. This return + code has two separate meanings. (1) The receiving bank froze the account or + (2) the Office of Foreign Assets Control (OFAC) instructed the receiving bank + to return the entry. + - `credit_entry_refused_by_receiver` - Code R23. The receiving bank refused the + credit transfer. - `unauthorized_debit_to_consumer_account_using_corporate_sec_code` - Code R05. The receiving bank rejected because of an incorrect Standard Entry Class code. + Consumer accounts cannot be debited as `corporate_credit_or_debit` or + `corporate_trade_exchange`. - `corporate_customer_advised_not_authorized` - Code R29. The corporate customer at the receiving bank reversed the transfer. - `payment_stopped` - Code R08. The receiving bank stopped payment on this transfer. - - `non_transaction_account` - Code R20. The receiving bank account does not - perform transfers. + - `non_transaction_account` - Code R20. The account is not eligible for ACH, + such as a savings account with transaction limits. - `uncollected_funds` - Code R09. The receiving bank account does not have enough available balance for the transfer. - `routing_number_check_digit_error` - Code R28. The routing number is @@ -232,14 +355,13 @@ class SourceACHTransferReturn(BaseModel): - `customer_advised_unauthorized_improper_ineligible_or_incomplete` - Code R10. The customer at the receiving bank reversed the transfer. - `amount_field_error` - Code R19. The amount field is incorrect or too large. - - `authorization_revoked_by_customer` - Code R07. The customer at the receiving - institution informed their bank that they have revoked authorization for a - previously authorized transfer. + - `authorization_revoked_by_customer` - Code R07. The customer revoked their + authorization for a previously authorized transfer. - `invalid_ach_routing_number` - Code R13. The routing number is invalid. - `file_record_edit_criteria` - Code R17. The receiving bank is unable to process a field in the transfer. - - `enr_invalid_individual_name` - Code R45. The individual name field was - invalid. + - `enr_invalid_individual_name` - Code R45. A rare return reason. The individual + name field was invalid. - `returned_per_odfi_request` - Code R06. The originating financial institution asked for this transfer to be returned. The receiving bank is complying with the request. @@ -334,8 +456,8 @@ class SourceACHTransferReturn(BaseModel): a malformed credit entry. - `return_of_improper_debit_entry` - Code R35. A rare return reason. Return of a malformed debit entry. - - `return_of_xck_entry` - Code R33. A rare return reason. Return of a Destroyed - Check ("XKC") entry. + - `return_of_xck_entry` - Code R33. A rare return reason. Return of a destroyed + check ("XCK") entry. - `source_document_presented_for_payment` - Code R37. A rare return reason. The source document related to this ACH, usually an ACH check conversion, was presented to the bank. @@ -355,235 +477,1366 @@ class SourceACHTransferReturn(BaseModel): late. """ + trace_number: str + """A 15 digit number that was generated by the bank that initiated the return. + + The trace number of the return is different than that of the original transfer. + ACH trace numbers are not unique, but along with the amount and date this number + can be used to identify the ACH return at the bank that initiated it. + """ + transaction_id: str """The identifier of the Transaction associated with this return.""" transfer_id: str """The identifier of the ACH Transfer associated with this return.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceBlockchainOfframpTransferSettlement(BaseModel): + """A Blockchain Off-Ramp Transfer Settlement object. + + This field will be present in the JSON response if and only if `category` is equal to `blockchain_offramp_transfer_settlement`. + """ + + source_blockchain_address_id: str + """The identifier of the Blockchain Address the funds were received at.""" + + transfer_id: str + """ + The identifier of the Blockchain Off-Ramp Transfer that led to this Transaction. + """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceBlockchainOnrampTransferIntention(BaseModel): + """A Blockchain On-Ramp Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is equal to `blockchain_onramp_transfer_intention`. + """ + + destination_blockchain_address: str + """The blockchain address the funds were sent to.""" + + transfer_id: str + """The identifier of the Blockchain On-Ramp Transfer that led to this Transaction.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceCardDisputeAcceptance(BaseModel): + """A Legacy Card Dispute Acceptance object. + + This field will be present in the JSON response if and only if `category` is equal to `card_dispute_acceptance`. Contains the details of a successful Card Dispute. + """ + accepted_at: datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Card Dispute was accepted. """ - card_dispute_id: str - """The identifier of the Card Dispute that was accepted.""" - transaction_id: str """ The identifier of the Transaction that was created to return the disputed funds to your account. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class SourceCardRefundNetworkIdentifiers(BaseModel): - acquirer_business_id: str + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCardDisputeFinancialVisa(BaseModel): """ - A network assigned business ID that identifies the acquirer that processed this - transaction. + Information for events related to card dispute for card payments processed over Visa's network. This field will be present in the JSON response if and only if `network` is equal to `visa`. """ - acquirer_reference_number: str - """A globally unique identifier for this settlement.""" + event_type: Literal[ + "chargeback_submitted", + "merchant_prearbitration_decline_submitted", + "merchant_prearbitration_received", + "represented", + "user_prearbitration_decline_received", + "user_prearbitration_submitted", + "user_withdrawal_submitted", + ] + """The type of card dispute financial event. - transaction_id: Optional[str] = None - """ - A globally unique transaction identifier provided by the card network, used - across multiple life-cycle requests. + - `chargeback_submitted` - The user's chargeback was submitted. + - `merchant_prearbitration_decline_submitted` - The user declined the merchant's + pre-arbitration submission. + - `merchant_prearbitration_received` - The merchant's pre-arbitration submission + was received. + - `represented` - The transaction was re-presented by the merchant. + - `user_prearbitration_decline_received` - The user's pre-arbitration was + declined by the merchant. + - `user_prearbitration_submitted` - The user's pre-arbitration was submitted. + - `user_withdrawal_submitted` - The user withdrew from the dispute. """ -class SourceCardRefundPurchaseDetailsCarRental(BaseModel): - car_class_code: Optional[str] = None - """Code indicating the vehicle's class.""" +class SourceCardDisputeFinancial(BaseModel): + """A Card Dispute Financial object. - checkout_date: Optional[date] = None + This field will be present in the JSON response if and only if `category` is equal to `card_dispute_financial`. Financial event related to a Card Dispute. """ - Date the customer picked up the car or, in the case of a no-show or pre-pay - transaction, the scheduled pick up date. + + amount: int + """The amount of the financial event.""" + + network: Literal["visa", "pulse"] + """The network that the Card Dispute is associated with. + + - `visa` - Visa: details will be under the `visa` object. + - `pulse` - Pulse: details will be under the `pulse` object. """ - daily_rental_rate_amount: Optional[int] = None - """Daily rate being charged for the vehicle.""" + transaction_id: str + """ + The identifier of the Transaction that was created to credit or debit the + disputed funds to or from your account. + """ - daily_rental_rate_currency: Optional[str] = None + visa: Optional[SourceCardDisputeFinancialVisa] = None """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily rental - rate. + Information for events related to card dispute for card payments processed over + Visa's network. This field will be present in the JSON response if and only if + `network` is equal to `visa`. """ - days_rented: Optional[int] = None - """Number of days the vehicle was rented.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - extra_charges: Optional[ - Literal["no_extra_charge", "gas", "extra_mileage", "late_return", "one_way_service_fee", "parking_violation"] - ] = None - """Additional charges (gas, late fee, etc.) being billed. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - - `no_extra_charge` - No extra charge - - `gas` - Gas - - `extra_mileage` - Extra mileage - - `late_return` - Late return - - `one_way_service_fee` - One way service fee - - `parking_violation` - Parking violation + +class SourceCardDisputeLoss(BaseModel): + """A Legacy Card Dispute Loss object. + + This field will be present in the JSON response if and only if `category` is equal to `card_dispute_loss`. Contains the details of a lost Card Dispute. """ - fuel_charges_amount: Optional[int] = None - """Fuel charges for the vehicle.""" + explanation: str + """Why the Card Dispute was lost.""" - fuel_charges_currency: Optional[str] = None + lost_at: datetime """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel charges - assessed. + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Card Dispute was lost. """ - insurance_charges_amount: Optional[int] = None - """Any insurance being charged for the vehicle.""" - - insurance_charges_currency: Optional[str] = None + transaction_id: str """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance - charges assessed. + The identifier of the Transaction that was created to debit the disputed funds + from your account. """ - no_show_indicator: Optional[Literal["not_applicable", "no_show_for_specialized_vehicle"]] = None + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCardFinancialAdditionalAmountsClinic(BaseModel): + """The part of this transaction amount that was for clinic-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - An indicator that the cardholder is being billed for a reserved vehicle that was - not actually rented (that is, a "no-show" charge). - - `not_applicable` - Not applicable - - `no_show_for_specialized_vehicle` - No show for specialized vehicle + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - one_way_drop_off_charges_amount: Optional[int] = None + +class SourceCardFinancialAdditionalAmountsDental(BaseModel): + """The part of this transaction amount that was for dental-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - Charges for returning the vehicle at a different location than where it was - picked up. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - one_way_drop_off_charges_currency: Optional[str] = None + +class SourceCardFinancialAdditionalAmountsOriginal(BaseModel): + """The original pre-authorized amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way - drop-off charges assessed. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - renter_name: Optional[str] = None - """Name of the person renting the vehicle.""" - weekly_rental_rate_amount: Optional[int] = None - """Weekly rate being charged for the vehicle.""" +class SourceCardFinancialAdditionalAmountsPrescription(BaseModel): + """The part of this transaction amount that was for healthcare prescriptions.""" - weekly_rental_rate_currency: Optional[str] = None + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly - rental rate. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ -class SourceCardRefundPurchaseDetailsLodging(BaseModel): - check_in_date: Optional[date] = None - """Date the customer checked in.""" +class SourceCardFinancialAdditionalAmountsSurcharge(BaseModel): + """The surcharge amount charged for this transaction by the merchant.""" - daily_room_rate_amount: Optional[int] = None - """Daily rate being charged for the room.""" + amount: int + """The amount in minor units of the `currency` field. - daily_room_rate_currency: Optional[str] = None + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily room - rate. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - extra_charges: Optional[ - Literal["no_extra_charge", "restaurant", "gift_shop", "mini_bar", "telephone", "other", "laundry"] - ] = None - """Additional charges (phone, late check-out, etc.) being billed. - - `no_extra_charge` - No extra charge - - `restaurant` - Restaurant - - `gift_shop` - Gift shop - - `mini_bar` - Mini bar - - `telephone` - Telephone - - `other` - Other - - `laundry` - Laundry +class SourceCardFinancialAdditionalAmountsTotalCumulative(BaseModel): + """ + The total amount of a series of incremental authorizations, optionally provided. """ - folio_cash_advances_amount: Optional[int] = None - """Folio cash advances for the room.""" + amount: int + """The amount in minor units of the `currency` field. - folio_cash_advances_currency: Optional[str] = None + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio cash - advances. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - food_beverage_charges_amount: Optional[int] = None - """Food and beverage charges for the room.""" - food_beverage_charges_currency: Optional[str] = None +class SourceCardFinancialAdditionalAmountsTotalHealthcare(BaseModel): + """The total amount of healthcare-related additional amounts.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and - beverage charges. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - no_show_indicator: Optional[Literal["not_applicable", "no_show"]] = None + +class SourceCardFinancialAdditionalAmountsTransit(BaseModel): + """The part of this transaction amount that was for transit-related services.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - Indicator that the cardholder is being billed for a reserved room that was not - actually used. - - `not_applicable` - Not applicable - - `no_show` - No show + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - prepaid_expenses_amount: Optional[int] = None - """Prepaid expenses being charged for the room.""" - prepaid_expenses_currency: Optional[str] = None +class SourceCardFinancialAdditionalAmountsUnknown(BaseModel): + """An unknown additional amount.""" + + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid - expenses. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - room_nights: Optional[int] = None - """Number of nights the room was rented.""" - total_room_tax_amount: Optional[int] = None - """Total room tax being charged.""" +class SourceCardFinancialAdditionalAmountsVision(BaseModel): + """The part of this transaction amount that was for vision-related services.""" - total_room_tax_currency: Optional[str] = None + amount: int + """The amount in minor units of the `currency` field. + + The amount is positive if it is added to the amount (such as an ATM surcharge + fee) and negative if it is subtracted from the amount (such as a discount). """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total room - tax. + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the additional + amount's currency. """ - total_tax_amount: Optional[int] = None - """Total tax being charged for the room.""" - total_tax_currency: Optional[str] = None +class SourceCardFinancialAdditionalAmounts(BaseModel): """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax - assessed. + Additional amounts associated with the card authorization, such as ATM surcharges fees. These are usually a subset of the `amount` field and are used to provide more detailed information about the transaction. """ + clinic: Optional[SourceCardFinancialAdditionalAmountsClinic] = None + """The part of this transaction amount that was for clinic-related services.""" -class SourceCardRefundPurchaseDetailsTravelAncillaryService(BaseModel): - category: Optional[ - Literal[ - "none", - "bundled_service", - "baggage_fee", - "change_fee", - "cargo", - "carbon_offset", - "frequent_flyer", - "gift_card", - "ground_transport", - "in_flight_entertainment", - "lounge", - "medical", - "meal_beverage", + dental: Optional[SourceCardFinancialAdditionalAmountsDental] = None + """The part of this transaction amount that was for dental-related services.""" + + original: Optional[SourceCardFinancialAdditionalAmountsOriginal] = None + """The original pre-authorized amount.""" + + prescription: Optional[SourceCardFinancialAdditionalAmountsPrescription] = None + """The part of this transaction amount that was for healthcare prescriptions.""" + + surcharge: Optional[SourceCardFinancialAdditionalAmountsSurcharge] = None + """The surcharge amount charged for this transaction by the merchant.""" + + total_cumulative: Optional[SourceCardFinancialAdditionalAmountsTotalCumulative] = None + """ + The total amount of a series of incremental authorizations, optionally provided. + """ + + total_healthcare: Optional[SourceCardFinancialAdditionalAmountsTotalHealthcare] = None + """The total amount of healthcare-related additional amounts.""" + + transit: Optional[SourceCardFinancialAdditionalAmountsTransit] = None + """The part of this transaction amount that was for transit-related services.""" + + unknown: Optional[SourceCardFinancialAdditionalAmountsUnknown] = None + """An unknown additional amount.""" + + vision: Optional[SourceCardFinancialAdditionalAmountsVision] = None + """The part of this transaction amount that was for vision-related services.""" + + +class SourceCardFinancialNetworkDetailsPulse(BaseModel): + """Fields specific to the `pulse` network.""" + + pass + + +class SourceCardFinancialNetworkDetailsVisa(BaseModel): + """Fields specific to the `visa` network.""" + + electronic_commerce_indicator: Optional[ + Literal[ + "mail_phone_order", + "recurring", + "installment", + "unknown_mail_phone_order", + "secure_electronic_commerce", + "non_authenticated_security_transaction_at_3ds_capable_merchant", + "non_authenticated_security_transaction", + "non_secure_transaction", + ] + ] = None + """ + For electronic commerce transactions, this identifies the level of security used + in obtaining the customer's payment credential. For mail or telephone order + transactions, identifies the type of mail or telephone order. + + - `mail_phone_order` - Single transaction of a mail/phone order: Use to indicate + that the transaction is a mail/phone order purchase, not a recurring + transaction or installment payment. For domestic transactions in the US + region, this value may also indicate one bill payment transaction in the + card-present or card-absent environments. + - `recurring` - Recurring transaction: Payment indicator used to indicate a + recurring transaction that originates from an acquirer in the US region. + - `installment` - Installment payment: Payment indicator used to indicate one + purchase of goods or services that is billed to the account in multiple + charges over a period of time agreed upon by the cardholder and merchant from + transactions that originate from an acquirer in the US region. + - `unknown_mail_phone_order` - Unknown classification: other mail order: Use to + indicate that the type of mail/telephone order is unknown. + - `secure_electronic_commerce` - Secure electronic commerce transaction: Use to + indicate that the electronic commerce transaction has been authenticated using + e.g., 3-D Secure + - `non_authenticated_security_transaction_at_3ds_capable_merchant` - + Non-authenticated security transaction at a 3-D Secure-capable merchant, and + merchant attempted to authenticate the cardholder using 3-D Secure: Use to + identify an electronic commerce transaction where the merchant attempted to + authenticate the cardholder using 3-D Secure, but was unable to complete the + authentication because the issuer or cardholder does not participate in the + 3-D Secure program. + - `non_authenticated_security_transaction` - Non-authenticated security + transaction: Use to identify an electronic commerce transaction that uses data + encryption for security however, cardholder authentication is not performed + using 3-D Secure. + - `non_secure_transaction` - Non-secure transaction: Use to identify an + electronic commerce transaction that has no data protection. + """ + + point_of_service_entry_mode: Optional[ + Literal[ + "unknown", + "manual", + "magnetic_stripe_no_cvv", + "optical_code", + "integrated_circuit_card", + "contactless", + "credential_on_file", + "magnetic_stripe", + "contactless_magnetic_stripe", + "integrated_circuit_card_no_cvv", + ] + ] = None + """ + The method used to enter the cardholder's primary account number and card + expiration date. + + - `unknown` - Unknown + - `manual` - Manual key entry + - `magnetic_stripe_no_cvv` - Magnetic stripe read, without card verification + value + - `optical_code` - Optical code + - `integrated_circuit_card` - Contact chip card + - `contactless` - Contactless read of chip card + - `credential_on_file` - Transaction initiated using a credential that has + previously been stored on file + - `magnetic_stripe` - Magnetic stripe read + - `contactless_magnetic_stripe` - Contactless read of magnetic stripe data + - `integrated_circuit_card_no_cvv` - Contact chip card, without card + verification value + """ + + stand_in_processing_reason: Optional[ + Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cryptogram", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + ] = None + """Only present when `actioner: network`. + + Describes why a card authorization was approved or declined by Visa through + stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV or dCVV. + - `invalid_cryptogram` - The card's authorization request cryptogram was + invalid. The cryptogram can be from a physical card or a Digital Wallet Token + purchase. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + terminal_entry_capability: Optional[ + Literal[ + "unknown", + "terminal_not_used", + "magnetic_stripe", + "barcode", + "optical_character_recognition", + "chip_or_contactless", + "contactless_only", + "no_capability", + ] + ] = None + """The capability of the terminal being used to read the card. + + Shows whether a terminal can e.g., accept chip cards or if it only supports + magnetic stripe reads. This reflects the highest capability of the terminal — + for example, a terminal that supports both chip and magnetic stripe will be + identified as chip-capable. + + - `unknown` - Unknown + - `terminal_not_used` - No terminal was used for this transaction. + - `magnetic_stripe` - The terminal can only read magnetic stripes and does not + have chip or contactless reading capability. + - `barcode` - The terminal can only read barcodes. + - `optical_character_recognition` - The terminal can only read cards via Optical + Character Recognition. + - `chip_or_contactless` - The terminal supports contact chip cards and can also + read the magnetic stripe. If contact chip is supported, this value is used + regardless of whether contactless is also supported. + - `contactless_only` - The terminal supports contactless reads but does not + support contact chip. Only used when the terminal lacks contact chip + capability. + - `no_capability` - The terminal has no card reading capability. + """ + + +class SourceCardFinancialNetworkDetails(BaseModel): + """Fields specific to the `network`.""" + + category: Literal["visa", "pulse"] + """The payment network used to process this card authorization. + + - `visa` - Visa + - `pulse` - Pulse + """ + + pulse: Optional[SourceCardFinancialNetworkDetailsPulse] = None + """Fields specific to the `pulse` network.""" + + visa: Optional[SourceCardFinancialNetworkDetailsVisa] = None + """Fields specific to the `visa` network.""" + + +class SourceCardFinancialNetworkIdentifiers(BaseModel): + """Network-specific identifiers for a specific request or transaction.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + + retrieval_reference_number: Optional[str] = None + """A life-cycle identifier used across e.g., an authorization and a reversal. + + Expected to be unique per acquirer within a window of time. For some card + networks the retrieval reference number includes the trace counter. + """ + + trace_number: Optional[str] = None + """A counter used to verify an individual authorization. + + Expected to be unique per acquirer within a window of time. + """ + + transaction_id: Optional[str] = None + """ + A globally unique transaction identifier provided by the card network, used + across multiple life-cycle requests. + """ + + +class SourceCardFinancialSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + +class SourceCardFinancialVerificationCardVerificationCode(BaseModel): + """ + Fields related to verification of the Card Verification Code, a 3-digit code on the back of the card. + """ + + result: Literal["not_checked", "match", "no_match"] + """The result of verifying the Card Verification Code. + + - `not_checked` - No card verification code was provided in the authorization + request. + - `match` - The card verification code matched the one on file. + - `no_match` - The card verification code did not match the one on file. + """ + + +class SourceCardFinancialVerificationCardholderAddress(BaseModel): + """ + Cardholder address provided in the authorization request and the address on file we verified it against. + """ + + actual_line1: Optional[str] = None + """Line 1 of the address on file for the cardholder.""" + + actual_postal_code: Optional[str] = None + """The postal code of the address on file for the cardholder.""" + + provided_line1: Optional[str] = None + """ + The cardholder address line 1 provided for verification in the authorization + request. + """ + + provided_postal_code: Optional[str] = None + """The postal code provided for verification in the authorization request.""" + + result: Literal[ + "not_checked", + "postal_code_match_address_no_match", + "postal_code_no_match_address_match", + "match", + "no_match", + "postal_code_match_address_not_checked", + ] + """The address verification result returned to the card network. + + - `not_checked` - No address information was provided in the authorization + request. + - `postal_code_match_address_no_match` - Postal code matches, but the street + address does not match or was not provided. + - `postal_code_no_match_address_match` - Postal code does not match, but the + street address matches or was not provided. + - `match` - Postal code and street address match. + - `no_match` - Postal code and street address do not match. + - `postal_code_match_address_not_checked` - Postal code matches, but the street + address was not verified. (deprecated) + """ + + +class SourceCardFinancialVerificationCardholderName(BaseModel): + """Cardholder name provided in the authorization request.""" + + provided_first_name: Optional[str] = None + """The first name provided for verification in the authorization request.""" + + provided_last_name: Optional[str] = None + """The last name provided for verification in the authorization request.""" + + provided_middle_name: Optional[str] = None + """The middle name provided for verification in the authorization request.""" + + +class SourceCardFinancialVerification(BaseModel): + """Fields related to verification of cardholder-provided values.""" + + card_verification_code: SourceCardFinancialVerificationCardVerificationCode + """ + Fields related to verification of the Card Verification Code, a 3-digit code on + the back of the card. + """ + + cardholder_address: SourceCardFinancialVerificationCardholderAddress + """ + Cardholder address provided in the authorization request and the address on file + we verified it against. + """ + + cardholder_name: Optional[SourceCardFinancialVerificationCardholderName] = None + """Cardholder name provided in the authorization request.""" + + +class SourceCardFinancial(BaseModel): + """A Card Financial object. + + This field will be present in the JSON response if and only if `category` is equal to `card_financial`. Card Financials are temporary holds placed on a customer's funds with the intent to later clear a transaction. + """ + + id: str + """The Card Financial identifier.""" + + actioner: Literal["user", "increase", "network"] + """ + Whether this financial was approved by Increase, the card network through + stand-in processing, or the user through a real-time decision. + + - `user` - This object was actioned by the user through a real-time decision. + - `increase` - This object was actioned by Increase without user intervention. + - `network` - This object was actioned by the network, through stand-in + processing. + """ + + additional_amounts: SourceCardFinancialAdditionalAmounts + """ + Additional amounts associated with the card authorization, such as ATM + surcharges fees. These are usually a subset of the `amount` field and are used + to provide more detailed information about the transaction. + """ + + amount: int + """The pending amount in the minor unit of the transaction's currency. + + For dollars, for example, this is cents. + """ + + card_payment_id: str + """The ID of the Card Payment this transaction belongs to.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's currency. + + - `USD` - US Dollar (USD) + """ + + digital_wallet_token_id: Optional[str] = None + """ + If the authorization was made via a Digital Wallet Token (such as an Apple Pay + purchase), the identifier of the token that was used. + """ + + direction: Literal["settlement", "refund"] + """ + The direction describes the direction the funds will move, either from the + cardholder to the merchant or from the merchant to the cardholder. + + - `settlement` - A regular card authorization where funds are debited from the + cardholder. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: Optional[str] = None + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_postal_code: Optional[str] = None + """The merchant's postal code. + + For US merchants this is either a 5-digit or 9-digit ZIP code, where the first 5 + and last 4 are separated by a dash. + """ + + merchant_state: Optional[str] = None + """The state the merchant resides in.""" + + network_details: SourceCardFinancialNetworkDetails + """Fields specific to the `network`.""" + + network_identifiers: SourceCardFinancialNetworkIdentifiers + """Network-specific identifiers for a specific request or transaction.""" + + network_risk_score: Optional[int] = None + """The risk score generated by the card network. + + For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where + 99 is the riskiest. For Pulse the score is from 0 to 999, where 999 is the + riskiest. + """ + + physical_card_id: Optional[str] = None + """ + If the authorization was made in-person with a physical card, the Physical Card + that was used. + """ + + presentment_amount: int + """The pending amount in the minor unit of the transaction's presentment currency.""" + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + + processing_category: Literal[ + "account_funding", + "automatic_fuel_dispenser", + "bill_payment", + "original_credit", + "purchase", + "quasi_cash", + "refund", + "cash_disbursement", + "balance_inquiry", + "unknown", + ] + """ + The processing category describes the intent behind the financial, such as + whether it was used for bill payments or an automatic fuel dispenser. + + - `account_funding` - Account funding transactions are transactions used to + e.g., fund an account or transfer funds between accounts. + - `automatic_fuel_dispenser` - Automatic fuel dispenser authorizations occur + when a card is used at a gas pump, prior to the actual transaction amount + being known. They are followed by an advice message that updates the amount of + the pending transaction. + - `bill_payment` - A transaction used to pay a bill. + - `original_credit` - Original credit transactions are used to send money to a + cardholder. + - `purchase` - A regular purchase. + - `quasi_cash` - Quasi-cash transactions represent purchases of items which may + be convertible to cash. + - `refund` - A refund card authorization, sometimes referred to as a credit + voucher authorization, where funds are credited to the cardholder. + - `cash_disbursement` - Cash disbursement transactions are used to withdraw cash + from an ATM or a point of sale. + - `balance_inquiry` - A balance inquiry transaction is used to check the balance + of an account associated with a card. + - `unknown` - The processing category is unknown. + """ + + real_time_decision_id: Optional[str] = None + """ + The identifier of the Real-Time Decision sent to approve or decline this + transaction. + """ + + scheme_fees: List[SourceCardFinancialSchemeFee] + """The scheme fees associated with this card financial.""" + + terminal_id: Optional[str] = None + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + transaction_id: str + """The identifier of the Transaction associated with this Transaction.""" + + type: Literal["card_financial"] + """A constant representing the object's type. + + For this resource it will always be `card_financial`. + """ + + verification: SourceCardFinancialVerification + """Fields related to verification of cardholder-provided values.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCardPushTransferAcceptance(BaseModel): + """A Card Push Transfer Acceptance object. + + This field will be present in the JSON response if and only if `category` is equal to `card_push_transfer_acceptance`. A Card Push Transfer Acceptance is created when an Outbound Card Push Transfer sent from Increase is accepted by the receiving bank. + """ + + settlement_amount: int + """The transfer amount in USD cents.""" + + transfer_id: str + """The identifier of the Card Push Transfer that led to this Transaction.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCardRefundCashback(BaseModel): + """Cashback debited for this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + amount: str + """The cashback amount given as a string containing a decimal number. + + The amount is a positive number if it will be credited to you (e.g., + settlements) and a negative number if it will be debited (e.g., refunds). + """ + + currency: Literal["USD"] + """The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + + - `USD` - US Dollar (USD) + """ + + +class SourceCardRefundInterchange(BaseModel): + """Interchange assessed as a part of this transaction.""" + + amount: str + """ + The interchange amount given as a string containing a decimal number in major + units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + credited to Increase (e.g., settlements) and a negative number if it is debited + (e.g., refunds). + """ + + code: Optional[str] = None + """The card network specific interchange code.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + reimbursement. + + - `USD` - US Dollar (USD) + """ + + +class SourceCardRefundNetworkIdentifiers(BaseModel): + """Network-specific identifiers for this refund.""" + + acquirer_business_id: str + """ + A network assigned business ID that identifies the acquirer that processed this + transaction. + """ + + acquirer_reference_number: str + """A globally unique identifier for this settlement.""" + + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + + transaction_id: Optional[str] = None + """ + A globally unique transaction identifier provided by the card network, used + across multiple life-cycle requests. + """ + + +class SourceCardRefundPurchaseDetailsCarRental(BaseModel): + """Fields specific to car rentals.""" + + car_class_code: Optional[str] = None + """Code indicating the vehicle's class.""" + + checkout_date: Optional[date] = None + """ + Date the customer picked up the car or, in the case of a no-show or pre-pay + transaction, the scheduled pick up date. + """ + + daily_rental_rate_amount: Optional[int] = None + """Daily rate being charged for the vehicle.""" + + daily_rental_rate_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily rental + rate. + """ + + days_rented: Optional[int] = None + """Number of days the vehicle was rented.""" + + extra_charges: Optional[ + Literal["no_extra_charge", "gas", "extra_mileage", "late_return", "one_way_service_fee", "parking_violation"] + ] = None + """Additional charges (gas, late fee, etc.) being billed. + + - `no_extra_charge` - No extra charge + - `gas` - Gas + - `extra_mileage` - Extra mileage + - `late_return` - Late return + - `one_way_service_fee` - One way service fee + - `parking_violation` - Parking violation + """ + + fuel_charges_amount: Optional[int] = None + """Fuel charges for the vehicle.""" + + fuel_charges_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fuel charges + assessed. + """ + + insurance_charges_amount: Optional[int] = None + """Any insurance being charged for the vehicle.""" + + insurance_charges_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the insurance + charges assessed. + """ + + no_show_indicator: Optional[Literal["not_applicable", "no_show_for_specialized_vehicle"]] = None + """ + An indicator that the cardholder is being billed for a reserved vehicle that was + not actually rented (that is, a "no-show" charge). + + - `not_applicable` - Not applicable + - `no_show_for_specialized_vehicle` - No show for specialized vehicle + """ + + one_way_drop_off_charges_amount: Optional[int] = None + """ + Charges for returning the vehicle at a different location than where it was + picked up. + """ + + one_way_drop_off_charges_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the one-way + drop-off charges assessed. + """ + + renter_name: Optional[str] = None + """Name of the person renting the vehicle.""" + + weekly_rental_rate_amount: Optional[int] = None + """Weekly rate being charged for the vehicle.""" + + weekly_rental_rate_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the weekly + rental rate. + """ + + +class SourceCardRefundPurchaseDetailsLodging(BaseModel): + """Fields specific to lodging.""" + + check_in_date: Optional[date] = None + """Date the customer checked in.""" + + daily_room_rate_amount: Optional[int] = None + """Daily rate being charged for the room.""" + + daily_room_rate_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the daily room + rate. + """ + + extra_charges: Optional[ + Literal["no_extra_charge", "restaurant", "gift_shop", "mini_bar", "telephone", "other", "laundry"] + ] = None + """Additional charges (phone, late check-out, etc.) being billed. + + - `no_extra_charge` - No extra charge + - `restaurant` - Restaurant + - `gift_shop` - Gift shop + - `mini_bar` - Mini bar + - `telephone` - Telephone + - `other` - Other + - `laundry` - Laundry + """ + + folio_cash_advances_amount: Optional[int] = None + """Folio cash advances for the room.""" + + folio_cash_advances_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the folio cash + advances. + """ + + food_beverage_charges_amount: Optional[int] = None + """Food and beverage charges for the room.""" + + food_beverage_charges_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the food and + beverage charges. + """ + + no_show_indicator: Optional[Literal["not_applicable", "no_show"]] = None + """ + Indicator that the cardholder is being billed for a reserved room that was not + actually used. + + - `not_applicable` - Not applicable + - `no_show` - No show + """ + + prepaid_expenses_amount: Optional[int] = None + """Prepaid expenses being charged for the room.""" + + prepaid_expenses_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the prepaid + expenses. + """ + + room_nights: Optional[int] = None + """Number of nights the room was rented.""" + + total_room_tax_amount: Optional[int] = None + """Total room tax being charged.""" + + total_room_tax_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total room + tax. + """ + + total_tax_amount: Optional[int] = None + """Total tax being charged for the room.""" + + total_tax_currency: Optional[str] = None + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the total tax + assessed. + """ + + +class SourceCardRefundPurchaseDetailsTravelAncillaryService(BaseModel): + category: Optional[ + Literal[ + "none", + "bundled_service", + "baggage_fee", + "change_fee", + "cargo", + "carbon_offset", + "frequent_flyer", + "gift_card", + "ground_transport", + "in_flight_entertainment", + "lounge", + "medical", + "meal_beverage", "other", "passenger_assist_fee", "pets", @@ -630,6 +1883,8 @@ class SourceCardRefundPurchaseDetailsTravelAncillaryService(BaseModel): class SourceCardRefundPurchaseDetailsTravelAncillary(BaseModel): + """Ancillary purchases in addition to the airfare.""" + connected_ticket_document_number: Optional[str] = None """ If this purchase has a connection or relationship to another purchase, such as a @@ -691,6 +1946,8 @@ class SourceCardRefundPurchaseDetailsTravelTripLeg(BaseModel): class SourceCardRefundPurchaseDetailsTravel(BaseModel): + """Fields specific to travel.""" + ancillary: Optional[SourceCardRefundPurchaseDetailsTravelAncillary] = None """Ancillary purchases in addition to the airfare.""" @@ -757,6 +2014,10 @@ class SourceCardRefundPurchaseDetailsTravel(BaseModel): class SourceCardRefundPurchaseDetails(BaseModel): + """ + Additional details about the card purchase, such as tax and industry-specific fields. + """ + car_rental: Optional[SourceCardRefundPurchaseDetailsCarRental] = None """Fields specific to car rentals.""" @@ -803,33 +2064,194 @@ class SourceCardRefundPurchaseDetails(BaseModel): """Fields specific to travel.""" +class SourceCardRefundSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + class SourceCardRefund(BaseModel): + """A Card Refund object. + + This field will be present in the JSON response if and only if `category` is equal to `card_refund`. Card Refunds move money back to the cardholder. While they are usually connected to a Card Settlement, an acquirer can also refund money directly to a card without relation to a transaction. + """ + id: str """The Card Refund identifier.""" amount: int - """The pending amount in the minor unit of the transaction's currency. + """The amount in the minor unit of the transaction's settlement currency. For dollars, for example, this is cents. """ - card_payment_id: Optional[str] = None + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + cashback: Optional[SourceCardRefundCashback] = None + """Cashback debited for this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. + transaction's settlement currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - merchant_acceptor_id: Optional[str] = None + interchange: Optional[SourceCardRefundInterchange] = None + """Interchange assessed as a part of this transaction.""" + + merchant_acceptor_id: str """ The merchant identifier (commonly abbreviated as MID) of the merchant the card is transacting with. @@ -838,27 +2260,42 @@ class SourceCardRefund(BaseModel): merchant_category_code: str """The 4-digit MCC describing the merchant's business.""" - merchant_city: Optional[str] = None + merchant_city: str """The city the merchant resides in.""" merchant_country: str """The country the merchant resides in.""" - merchant_name: Optional[str] = None + merchant_name: str """The name of the merchant.""" + merchant_postal_code: Optional[str] = None + """The merchant's postal code. For US merchants this is always a 5-digit ZIP code.""" + merchant_state: Optional[str] = None """The state the merchant resides in.""" network_identifiers: SourceCardRefundNetworkIdentifiers """Network-specific identifiers for this refund.""" + presentment_amount: int + """The amount in the minor unit of the transaction's presentment currency.""" + + presentment_currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the + transaction's presentment currency. + """ + purchase_details: Optional[SourceCardRefundPurchaseDetails] = None """ Additional details about the card purchase, such as tax and industry-specific fields. """ + scheme_fees: List[SourceCardRefundSchemeFee] + """The scheme fees associated with this card refund.""" + transaction_id: str """The identifier of the Transaction associated with this Transaction.""" @@ -868,24 +2305,36 @@ class SourceCardRefund(BaseModel): For this resource it will always be `card_refund`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceCardRevenuePayment(BaseModel): + """A Card Revenue Payment object. + + This field will be present in the JSON response if and only if `category` is equal to `card_revenue_payment`. Card Revenue Payments reflect earnings from fees on card transactions. + """ + amount: int """The amount in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -898,8 +2347,65 @@ class SourceCardRevenuePayment(BaseModel): transacted_on_account_id: Optional[str] = None """The account the card belonged to.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCardSettlementCashback(BaseModel): + """Cashback earned on this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + amount: str + """The cashback amount given as a string containing a decimal number. + + The amount is a positive number if it will be credited to you (e.g., + settlements) and a negative number if it will be debited (e.g., refunds). + """ + + currency: Literal["USD"] + """The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the cashback. + + - `USD` - US Dollar (USD) + """ + + +class SourceCardSettlementInterchange(BaseModel): + """Interchange assessed as a part of this transaction.""" + + amount: str + """ + The interchange amount given as a string containing a decimal number in major + units (so e.g., "3.14" for $3.14). The amount is a positive number if it is + credited to Increase (e.g., settlements) and a negative number if it is debited + (e.g., refunds). + """ + + code: Optional[str] = None + """The card network specific interchange code.""" + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the interchange + reimbursement. + + - `USD` - US Dollar (USD) + """ + class SourceCardSettlementNetworkIdentifiers(BaseModel): + """Network-specific identifiers for this refund.""" + acquirer_business_id: str """ A network assigned business ID that identifies the acquirer that processed this @@ -909,6 +2415,12 @@ class SourceCardSettlementNetworkIdentifiers(BaseModel): acquirer_reference_number: str """A globally unique identifier for this settlement.""" + authorization_identification_response: Optional[str] = None + """ + The randomly generated 6-character Authorization Identification Response code + sent back to the acquirer in an approved response. + """ + transaction_id: Optional[str] = None """ A globally unique transaction identifier provided by the card network, used @@ -917,6 +2429,8 @@ class SourceCardSettlementNetworkIdentifiers(BaseModel): class SourceCardSettlementPurchaseDetailsCarRental(BaseModel): + """Fields specific to car rentals.""" + car_class_code: Optional[str] = None """Code indicating the vehicle's class.""" @@ -1004,6 +2518,8 @@ class SourceCardSettlementPurchaseDetailsCarRental(BaseModel): class SourceCardSettlementPurchaseDetailsLodging(BaseModel): + """Fields specific to lodging.""" + check_in_date: Optional[date] = None """Date the customer checked in.""" @@ -1150,6 +2666,8 @@ class SourceCardSettlementPurchaseDetailsTravelAncillaryService(BaseModel): class SourceCardSettlementPurchaseDetailsTravelAncillary(BaseModel): + """Ancillary purchases in addition to the airfare.""" + connected_ticket_document_number: Optional[str] = None """ If this purchase has a connection or relationship to another purchase, such as a @@ -1211,6 +2729,8 @@ class SourceCardSettlementPurchaseDetailsTravelTripLeg(BaseModel): class SourceCardSettlementPurchaseDetailsTravel(BaseModel): + """Fields specific to travel.""" + ancillary: Optional[SourceCardSettlementPurchaseDetailsTravelAncillary] = None """Ancillary purchases in addition to the airfare.""" @@ -1277,6 +2797,10 @@ class SourceCardSettlementPurchaseDetailsTravel(BaseModel): class SourceCardSettlementPurchaseDetails(BaseModel): + """ + Additional details about the card purchase, such as tax and industry-specific fields. + """ + car_rental: Optional[SourceCardSettlementPurchaseDetailsCarRental] = None """Fields specific to car rentals.""" @@ -1318,12 +2842,187 @@ class SourceCardSettlementPurchaseDetails(BaseModel): - `hotel_folio_number` - Hotel folio number - `invoice_number` - Invoice number """ - - travel: Optional[SourceCardSettlementPurchaseDetailsTravel] = None - """Fields specific to travel.""" + + travel: Optional[SourceCardSettlementPurchaseDetailsTravel] = None + """Fields specific to travel.""" + + +class SourceCardSettlementSchemeFee(BaseModel): + amount: str + """The fee amount given as a string containing a decimal number.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) time at which the fee was + created. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the fee + reimbursement. + + - `USD` - US Dollar (USD) + """ + + fee_type: Literal[ + "visa_international_service_assessment_single_currency", + "visa_international_service_assessment_cross_currency", + "visa_authorization_domestic_point_of_sale", + "visa_authorization_international_point_of_sale", + "visa_authorization_canada_point_of_sale", + "visa_authorization_reversal_point_of_sale", + "visa_authorization_reversal_international_point_of_sale", + "visa_authorization_address_verification_service", + "visa_advanced_authorization", + "visa_message_transmission", + "visa_account_verification_domestic", + "visa_account_verification_international", + "visa_account_verification_canada", + "visa_corporate_acceptance_fee", + "visa_consumer_debit_acceptance_fee", + "visa_business_debit_acceptance_fee", + "visa_purchasing_acceptance_fee", + "visa_purchase_domestic", + "visa_purchase_international", + "visa_credit_purchase_token", + "visa_debit_purchase_token", + "visa_clearing_transmission", + "visa_direct_authorization", + "visa_direct_transaction_domestic", + "visa_service_commercial_credit", + "visa_advertising_service_commercial_credit", + "visa_community_growth_acceleration_program", + "visa_processing_guarantee_commercial_credit", + "pulse_switch_fee", + ] + """The type of fee being assessed. + + - `visa_international_service_assessment_single_currency` - International + Service Assessment (ISA) single-currency is a fee assessed by the card network + for cross-border transactions presented and settled in the same currency. + - `visa_international_service_assessment_cross_currency` - International Service + Assessment (ISA) cross-currency is a fee assessed by the card network for + cross-border transactions presented and settled in different currencies. + - `visa_authorization_domestic_point_of_sale` - Activity and charges for Visa + Settlement System processing for POS (Point-Of-Sale) authorization + transactions. Authorization is the process of approving or declining the + transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_international_point_of_sale` - Activity and charges for + Visa Settlement System processing for POS (Point-Of-Sale) International + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. The fee is assessed to the Issuer. + - `visa_authorization_canada_point_of_sale` - Activity and charges for Visa + Settlement System processing for Canada Region POS (Point-of-Sale) + authorization transactions. Authorization is the process of approving or + declining the transaction amount specified. + - `visa_authorization_reversal_point_of_sale` - Activity only for Visa + Settlement System authorization processing of POS (Point-Of-Sale) reversal + transactions. Authorization reversal represents a VSS message that undoes the + complete or partial actions of a previous authorization request. + - `visa_authorization_reversal_international_point_of_sale` - Activity only for + Visa Settlement System authorization processing of POS (Point-Of-Sale) + International reversal transactions. Authorization reversal represents a VSS + message that undoes the complete or partial actions of a previous + authorization request. + - `visa_authorization_address_verification_service` - A per Address Verification + Service (AVS) result fee. Applies to all usable AVS result codes. + - `visa_advanced_authorization` - Advanced Authorization is a fraud detection + tool that monitors and risk evaluates 100 percent of US VisaNet authorizations + in real-time. Activity related to Purchase (includes Signature Authenticated + Visa and PIN Authenticated Visa Debit (PAVD) transactions). + - `visa_message_transmission` - Issuer Transactions Visa represents a charge + based on total actual monthly processing (Visa transactions only) through a + VisaNet Access Point (VAP). Charges are assessed to the processor for each + VisaNet Access Point. + - `visa_account_verification_domestic` - Activity, per inquiry, related to the + domestic Issuer for Account Number Verification. + - `visa_account_verification_international` - Activity, per inquiry, related to + the international Issuer for Account Number Verification. + - `visa_account_verification_canada` - Activity, per inquiry, related to the + US-Canada Issuer for Account Number Verification. + - `visa_corporate_acceptance_fee` - The Corporate Acceptance Fee is charged to + issuers and is based on the monthly sales volume on Commercial and Government + Debit, Prepaid, Credit, Charge, or Deferred Debit card transactions. + - `visa_consumer_debit_acceptance_fee` - The Consumer Debit Acceptance Fee is + charged to issuers and is based on the monthly sales volume of Consumer Debit + or Prepaid card transactions. The cashback portion of a Debit and Prepaid card + transaction is excluded from the sales volume calculation. + - `visa_business_debit_acceptance_fee` - The Business Acceptance Fee is charged + to issuers and is based on the monthly sales volume on Business Debit, + Prepaid, Credit, Charge, or Deferred Debit card transactions. The cashback + portion is included in the sales volume calculation with the exception of a + Debit and Prepaid card transactions. + - `visa_purchasing_acceptance_fee` - The Purchasing Card Acceptance Fee is + charged to issuers and is based on the monthly sales volume on Commercial and + Government Debit, Prepaid, Credit, Charge, or Deferred Debit card + transactions. + - `visa_purchase_domestic` - Activity and fees for the processing of a sales + draft original for a purchase transaction. + - `visa_purchase_international` - Activity and fees for the processing of an + international sales draft original for a purchase transaction. + - `visa_credit_purchase_token` - Apple Pay Credit Product Token Purchase + Original Transactions. This fee is billed by Visa on behalf of Apple Inc. for + Apple Pay transactions. + - `visa_debit_purchase_token` - Apple Pay Debit Product Token Purchase Original + Transactions. This fee is billed by Visa on behalf of Apple Inc. for Apple Pay + transactions. + - `visa_clearing_transmission` - A per transaction fee assessed for Base II + financial draft - Issuer. + - `visa_direct_authorization` - Issuer charge for Non-Financial OCT/AFT + Authorization 0100 and Declined Financial OCT/AFT 0200 transactions. + - `visa_direct_transaction_domestic` - Data processing charge for Visa Direct + OCTs for all business application identifiers (BAIs) other than money + transfer-bank initiated (BI). BASE II transactions. + - `visa_service_commercial_credit` - Issuer card service fee for Commercial + Credit cards. + - `visa_advertising_service_commercial_credit` - Issuer Advertising Service Fee + for Commercial Credit cards. + - `visa_community_growth_acceleration_program` - Issuer Community Growth + Acceleration Program Fee. + - `visa_processing_guarantee_commercial_credit` - Issuer Processing Guarantee + for Commercial Credit cards. + - `pulse_switch_fee` - Pulse Switch Fee is a fee charged by the Pulse network + for processing transactions on its network. + """ + + fixed_component: Optional[str] = None + """ + The fixed component of the fee, if applicable, given in major units of the fee + amount. + """ + + variable_rate: Optional[str] = None + """ + The variable rate component of the fee, if applicable, given as a decimal (e.g., + 0.015 for 1.5%). + """ + + +class SourceCardSettlementSurcharge(BaseModel): + """Surcharge amount details, if applicable. + + The amount is positive if the surcharge is added to the overall transaction amount (surcharge), and negative if the surcharge is deducted from the overall transaction amount (discount). + """ + + amount: int + """ + The surcharge amount in the minor unit of the transaction's settlement currency. + """ + + presentment_amount: int + """ + The surcharge amount in the minor unit of the transaction's presentment + currency. + """ class SourceCardSettlement(BaseModel): + """A Card Settlement object. + + This field will be present in the JSON response if and only if `category` is equal to `card_settlement`. Card Settlements are card transactions that have cleared and settled. While a settlement is usually preceded by an authorization, an acquirer can also directly clear a transaction without first authorizing it. + """ + id: str """The Card Settlement identifier.""" @@ -1339,23 +3038,27 @@ class SourceCardSettlement(BaseModel): exists. """ - card_payment_id: Optional[str] = None + card_payment_id: str """The ID of the Card Payment this transaction belongs to.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + cashback: Optional[SourceCardSettlementCashback] = None + """Cashback earned on this transaction, if eligible. + + Cashback is paid out in aggregate, monthly. + """ + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's settlement currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ - merchant_acceptor_id: Optional[str] = None + interchange: Optional[SourceCardSettlementInterchange] = None + """Interchange assessed as a part of this transaction.""" + + merchant_acceptor_id: str """ The merchant identifier (commonly abbreviated as MID) of the merchant the card is transacting with. @@ -1364,18 +3067,28 @@ class SourceCardSettlement(BaseModel): merchant_category_code: str """The 4-digit MCC describing the merchant's business.""" - merchant_city: Optional[str] = None + merchant_city: str """The city the merchant resides in.""" merchant_country: str """The country the merchant resides in.""" - merchant_name: Optional[str] = None + merchant_name: str """The name of the merchant.""" + merchant_postal_code: Optional[str] = None + """The merchant's postal code. For US merchants this is always a 5-digit ZIP code.""" + merchant_state: Optional[str] = None """The state the merchant resides in.""" + network: Literal["visa", "pulse"] + """The card network on which this transaction was processed. + + - `visa` - Visa + - `pulse` - Pulse + """ + network_identifiers: SourceCardSettlementNetworkIdentifiers """Network-specific identifiers for this refund.""" @@ -1397,6 +3110,17 @@ class SourceCardSettlement(BaseModel): fields. """ + scheme_fees: List[SourceCardSettlementSchemeFee] + """The scheme fees associated with this card settlement.""" + + surcharge: Optional[SourceCardSettlementSurcharge] = None + """Surcharge amount details, if applicable. + + The amount is positive if the surcharge is added to the overall transaction + amount (surcharge), and negative if the surcharge is deducted from the overall + transaction amount (discount). + """ + transaction_id: str """The identifier of the Transaction associated with this Transaction.""" @@ -1406,10 +3130,72 @@ class SourceCardSettlement(BaseModel): For this resource it will always be `card_settlement`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceCashbackPayment(BaseModel): + """A Cashback Payment object. + + This field will be present in the JSON response if and only if `category` is equal to `cashback_payment`. A Cashback Payment represents the cashback paid to a cardholder for a given period. Cashback is usually paid monthly for the prior month's transactions. + """ + + accrued_on_card_id: Optional[str] = None + """The card on which the cashback was accrued.""" + + amount: int + """The amount in the minor unit of the transaction's currency. + + For dollars, for example, this is cents. + """ + + currency: Literal["USD"] + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction + currency. + + - `USD` - US Dollar (USD) + """ + + period_end: datetime + """The end of the period for which this transaction paid cashback.""" + + period_start: datetime + """The start of the period for which this transaction paid cashback.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceCheckDepositAcceptance(BaseModel): + """A Check Deposit Acceptance object. + + This field will be present in the JSON response if and only if `category` is equal to `check_deposit_acceptance`. A Check Deposit Acceptance is created when a Check Deposit is processed and its details confirmed. Check Deposits may be returned by the receiving bank, which will appear as a Check Deposit Return. + """ + account_number: str - """The account number printed on the check.""" + """The account number printed on the check. + + This is an account at the bank that issued the check. + """ amount: int """The amount to be deposited in the minor unit of the transaction's currency. @@ -1426,21 +3212,19 @@ class SourceCheckDepositAcceptance(BaseModel): check_deposit_id: str """The ID of the Check Deposit that was accepted.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ routing_number: str - """The routing number printed on the check.""" + """The routing number printed on the check. + + This is a routing number for the bank that issued the check. + """ serial_number: Optional[str] = None """The check serial number, if present, for consumer checks. @@ -1449,27 +3233,36 @@ class SourceCheckDepositAcceptance(BaseModel): field. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceCheckDepositReturn(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. + """A Check Deposit Return object. - For dollars, for example, this is cents. + This field will be present in the JSON response if and only if `category` is equal to `check_deposit_return`. A Check Deposit Return is created when a Check Deposit is returned by the bank holding the account it was drawn against. Check Deposits may be returned for a variety of reasons, including insufficient funds or a mismatched account number. Usually, checks are returned within the first 7 days after the deposit is made. """ + amount: int + """The returned amount in USD cents.""" + check_deposit_id: str """The identifier of the Check Deposit that was returned.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction's currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -1506,34 +3299,46 @@ class SourceCheckDepositReturn(BaseModel): against. - `ach_conversion_not_supported` - The check doesn't allow ACH conversion. - - `closed_account` - The account is closed. - - `duplicate_submission` - The check has already been deposited. - - `insufficient_funds` - Insufficient funds - - `no_account` - No account was found matching the check details. - - `not_authorized` - The check was not authorized. - - `stale_dated` - The check is too old. - - `stop_payment` - The payment has been stopped by the account holder. + - `closed_account` - The account is closed. (Check21 return code `D`) + - `duplicate_submission` - The check has already been deposited. (Check21 return + code `Y`) + - `insufficient_funds` - Insufficient funds (Check21 return code `A`) + - `no_account` - No account was found matching the check details. (Check21 + return code `E`) + - `not_authorized` - The check was not authorized. (Check21 return code `Q`) + - `stale_dated` - The check is too old. (Check21 return code `G`) + - `stop_payment` - The payment has been stopped by the account holder. (Check21 + return code `C`) - `unknown_reason` - The reason for the return is unknown. - `unmatched_details` - The image doesn't match the details submitted. - - `unreadable_image` - The image could not be read. - - `endorsement_irregular` - The check endorsement was irregular. + - `unreadable_image` - The image could not be read. (Check21 return code `U`) + - `endorsement_irregular` - The check endorsement was irregular. (Check21 return + code `J`) - `altered_or_fictitious_item` - The check present was either altered or fake. + (Check21 return code `N`) - `frozen_or_blocked_account` - The account this check is drawn on is frozen. - - `post_dated` - The check is post dated. - - `endorsement_missing` - The endorsement was missing. - - `signature_missing` - The check signature was missing. + (Check21 return code `F`) + - `post_dated` - The check is post dated. (Check21 return code `H`) + - `endorsement_missing` - The endorsement was missing. (Check21 return code `I`) + - `signature_missing` - The check signature was missing. (Check21 return code + `K`) - `stop_payment_suspect` - The bank suspects a stop payment will be placed. - - `unusable_image` - The bank cannot read the image. + (Check21 return code `T`) + - `unusable_image` - The bank cannot read the image. (Check21 return code `U`) - `image_fails_security_check` - The check image fails the bank's security - check. - - `cannot_determine_amount` - The bank cannot determine the amount. + check. (Check21 return code `V`) + - `cannot_determine_amount` - The bank cannot determine the amount. (Check21 + return code `W`) - `signature_irregular` - The signature is inconsistent with prior signatures. + (Check21 return code `L`) - `non_cash_item` - The check is a non-cash item and cannot be drawn against the - account. - - `unable_to_process` - The bank is unable to process this check. + account. (Check21 return code `M`) + - `unable_to_process` - The bank is unable to process this check. (Check21 + return code `O`) - `item_exceeds_dollar_limit` - The check exceeds the bank or customer's limit. + (Check21 return code `P`) - `branch_or_account_sold` - The bank sold this account and no longer services - this customer. + this customer. (Check21 return code `R`) """ returned_at: datetime @@ -1548,8 +3353,25 @@ class SourceCheckDepositReturn(BaseModel): transaction. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceCheckTransferDeposit(BaseModel): + """A Check Transfer Deposit object. + + This field will be present in the JSON response if and only if `category` is equal to `check_transfer_deposit`. An Inbound Check is a check drawn on an Increase account that has been deposited by an external bank account. These types of checks are not pre-registered. + """ + back_image_file_id: Optional[str] = None """ The identifier of the API File object containing an image of the back of the @@ -1572,10 +3394,16 @@ class SourceCheckTransferDeposit(BaseModel): deposited check. """ + inbound_check_deposit_id: Optional[str] = None + """ + The identifier of the Inbound Check Deposit object associated with this + transaction. + """ + transaction_id: Optional[str] = None """The identifier of the Transaction object created when the check was deposited.""" - transfer_id: str + transfer_id: Optional[str] = None """The identifier of the Check Transfer object that was deposited.""" type: Literal["check_transfer_deposit"] @@ -1584,93 +3412,79 @@ class SourceCheckTransferDeposit(BaseModel): For this resource it will always be `check_transfer_deposit`. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class SourceCheckTransferIntention(BaseModel): - address_city: Optional[str] = None - """The city of the check's destination.""" - - address_line1: Optional[str] = None - """The street address of the check's destination.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - address_line2: Optional[str] = None - """The second line of the address of the check's destination.""" - - address_state: Optional[str] = None - """The state of the check's destination.""" - - address_zip: Optional[str] = None - """The postal code of the check's destination.""" - - amount: int - """The transfer amount in USD cents.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the check's - currency. +class SourceFednowTransferAcknowledgement(BaseModel): + """A FedNow Transfer Acknowledgement object. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) + This field will be present in the JSON response if and only if `category` is equal to `fednow_transfer_acknowledgement`. A FedNow Transfer Acknowledgement is created when a FedNow Transfer sent from Increase is acknowledged by the receiving bank. """ - recipient_name: Optional[str] = None - """The name that will be printed on the check.""" - transfer_id: str - """The identifier of the Check Transfer with which this is associated.""" - + """The identifier of the FedNow Transfer that led to this Transaction.""" -class SourceCheckTransferStopPaymentRequest(BaseModel): - reason: Literal["mail_delivery_failed", "rejected_by_increase", "not_authorized", "unknown"] - """The reason why this transfer was stopped. - - - `mail_delivery_failed` - The check could not be delivered. - - `rejected_by_increase` - The check was canceled by an Increase operator who - will provide details out-of-band. - - `not_authorized` - The check was not authorized. - - `unknown` - The check was stopped for another reason. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - requested_at: datetime - """The time the stop-payment was requested.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - transfer_id: str - """The ID of the check transfer that was stopped.""" - type: Literal["check_transfer_stop_payment_request"] - """A constant representing the object's type. +class SourceFeePayment(BaseModel): + """A Fee Payment object. - For this resource it will always be `check_transfer_stop_payment_request`. + This field will be present in the JSON response if and only if `category` is equal to `fee_payment`. A Fee Payment represents a payment made to Increase. """ - -class SourceFeePayment(BaseModel): amount: int """The amount in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ fee_period_start: date """The start of this payment's fee period, usually the first day of a month.""" + program_id: Optional[str] = None + """The Program for which this fee was incurred.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceInboundACHTransferAddendaFreeformEntry(BaseModel): payment_related_information: str @@ -1678,11 +3492,15 @@ class SourceInboundACHTransferAddendaFreeformEntry(BaseModel): class SourceInboundACHTransferAddendaFreeform(BaseModel): + """Unstructured `payment_related_information` passed through by the originator.""" + entries: List[SourceInboundACHTransferAddendaFreeformEntry] """Each entry represents an addendum received from the originator.""" class SourceInboundACHTransferAddenda(BaseModel): + """Additional information sent from the originator.""" + category: Literal["freeform"] """The type of addendum. @@ -1694,14 +3512,16 @@ class SourceInboundACHTransferAddenda(BaseModel): class SourceInboundACHTransfer(BaseModel): + """An Inbound ACH Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is equal to `inbound_ach_transfer`. An Inbound ACH Transfer Intention is created when an ACH transfer is initiated at another bank and received by Increase. + """ + addenda: Optional[SourceInboundACHTransferAddenda] = None """Additional information sent from the originator.""" amount: int - """The amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ + """The transfer amount in USD cents.""" originator_company_descriptive_date: Optional[str] = None """The description of the date of the transfer, usually in the format `YYMMDD`.""" @@ -1723,7 +3543,7 @@ class SourceInboundACHTransfer(BaseModel): """A name set by the originator to identify themselves.""" receiver_id_number: Optional[str] = None - """The originator's identifier for the transfer receipient.""" + """The originator's identifier for the transfer recipient.""" receiver_name: Optional[str] = None """The name of the transfer recipient. @@ -1737,300 +3557,140 @@ class SourceInboundACHTransfer(BaseModel): originating and receiving bank. Along with the amount, date, and originating routing number, this can be used to identify the ACH transfer at either bank. ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). + [used to correlate returns](https://increase.com/documentation/ach-returns#ach-returns). """ transfer_id: str - """The inbound ach transfer's identifier.""" - - -class SourceInboundCheck(BaseModel): - amount: int - """The amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - bank_of_first_deposit_routing_number: Optional[str] = None - """ - The American Bankers' Association (ABA) Routing Transit Number (RTN) for the - bank depositing this check. In some rare cases, this is not transmitted via - Check21 and the value will be null. - """ - - check_front_image_file_id: Optional[str] = None - """The front image of the check. This is a black and white TIFF image file.""" - - check_number: Optional[str] = None - """The number of the check. - - This field is set by the depositing bank and can be unreliable. - """ - - check_rear_image_file_id: Optional[str] = None - """The rear image of the check. This is a black and white TIFF image file.""" - - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the - transaction's currency. - - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - - `USD` - US Dollar (USD) - """ - - -class SourceInboundInternationalACHTransfer(BaseModel): - amount: int - """The amount in the minor unit of the destination account currency. - - For dollars, for example, this is cents. - """ - - destination_country_code: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the destination country. - """ - - destination_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - destination bank account. - """ - - foreign_exchange_indicator: Literal["fixed_to_variable", "variable_to_fixed", "fixed_to_fixed"] - """A description of how the foreign exchange rate was calculated. - - - `fixed_to_variable` - The originator chose an amount in their own currency. - The settled amount in USD was converted using the exchange rate. - - `variable_to_fixed` - The originator chose an amount to settle in USD. The - originator's amount was variable; known only after the foreign exchange - conversion. - - `fixed_to_fixed` - The amount was originated and settled as a fixed amount in - USD. There is no foreign exchange conversion. - """ - - foreign_exchange_reference: Optional[str] = None - """ - Depending on the `foreign_exchange_reference_indicator`, an exchange rate or a - reference to a well-known rate. - """ + """The Inbound ACH Transfer's identifier.""" - foreign_exchange_reference_indicator: Literal["foreign_exchange_rate", "foreign_exchange_reference_number", "blank"] - """ - An instruction of how to interpret the `foreign_exchange_reference` field for - this Transaction. - - - `foreign_exchange_rate` - The ACH file contains a foreign exchange rate. - - `foreign_exchange_reference_number` - The ACH file contains a reference to a - well-known foreign exchange rate. - - `blank` - There is no foreign exchange for this transfer, so the - `foreign_exchange_reference` field is blank. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - foreign_payment_amount: int - """The amount in the minor unit of the foreign payment currency. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - For dollars, for example, this is cents. - """ - foreign_trace_number: Optional[str] = None - """A reference number in the foreign banking infrastructure.""" - - international_transaction_type_code: Literal[ - "annuity", - "business_or_commercial", - "deposit", - "loan", - "miscellaneous", - "mortgage", - "pension", - "remittance", - "rent_or_lease", - "salary_or_payroll", - "tax", - "accounts_receivable", - "back_office_conversion", - "machine_transfer", - "point_of_purchase", - "point_of_sale", - "represented_check", - "shared_network_transaction", - "telphone_initiated", - "internet_initiated", - ] - """The type of transfer. Set by the originator. +class SourceInboundACHTransferReturnIntention(BaseModel): + """An Inbound ACH Transfer Return Intention object. - - `annuity` - Sent as `ANN` in the Nacha file. - - `business_or_commercial` - Sent as `BUS` in the Nacha file. - - `deposit` - Sent as `DEP` in the Nacha file. - - `loan` - Sent as `LOA` in the Nacha file. - - `miscellaneous` - Sent as `MIS` in the Nacha file. - - `mortgage` - Sent as `MOR` in the Nacha file. - - `pension` - Sent as `PEN` in the Nacha file. - - `remittance` - Sent as `REM` in the Nacha file. - - `rent_or_lease` - Sent as `RLS` in the Nacha file. - - `salary_or_payroll` - Sent as `SAL` in the Nacha file. - - `tax` - Sent as `TAX` in the Nacha file. - - `accounts_receivable` - Sent as `ARC` in the Nacha file. - - `back_office_conversion` - Sent as `BOC` in the Nacha file. - - `machine_transfer` - Sent as `MTE` in the Nacha file. - - `point_of_purchase` - Sent as `POP` in the Nacha file. - - `point_of_sale` - Sent as `POS` in the Nacha file. - - `represented_check` - Sent as `RCK` in the Nacha file. - - `shared_network_transaction` - Sent as `SHR` in the Nacha file. - - `telphone_initiated` - Sent as `TEL` in the Nacha file. - - `internet_initiated` - Sent as `WEB` in the Nacha file. + This field will be present in the JSON response if and only if `category` is equal to `inbound_ach_transfer_return_intention`. An Inbound ACH Transfer Return Intention is created when an ACH transfer is initiated at another bank and returned by Increase. """ - originating_currency_code: str - """ - The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code for the - originating bank account. - """ + inbound_ach_transfer_id: str + """The ID of the Inbound ACH Transfer that is being returned.""" - originating_depository_financial_institution_branch_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originating branch country. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - originating_depository_financial_institution_id: str - """An identifier for the originating bank. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ - originating_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `originating_depository_financial_institution_id` field for this Transaction. +class SourceInboundCheckAdjustment(BaseModel): + """An Inbound Check Adjustment object. - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. + This field will be present in the JSON response if and only if `category` is equal to `inbound_check_adjustment`. An Inbound Check Adjustment is created when Increase receives an adjustment for a check or return deposited through Check21. """ - originating_depository_financial_institution_name: str - """The name of the originating bank. + adjusted_transaction_id: str + """The ID of the transaction that was adjusted.""" - Sometimes this will refer to an American bank and obscure the correspondent - foreign bank. + amount: int + """The amount of the check adjustment.""" + + reason: Literal["late_return", "wrong_payee_credit", "adjusted_amount", "non_conforming_item", "paid"] + """The reason for the adjustment. + + - `late_return` - The return was initiated too late and the receiving + institution has responded with a Late Return Claim. + - `wrong_payee_credit` - The check was deposited to the wrong payee and the + depositing institution has reimbursed the funds with a Wrong Payee Credit. + - `adjusted_amount` - The check was deposited with a different amount than what + was written on the check. + - `non_conforming_item` - The recipient was not able to process the check. This + usually happens for e.g., low quality images. + - `paid` - The check has already been deposited elsewhere and so this is a + duplicate. """ - originator_city: str - """A portion of the originator address. This may be incomplete.""" - - originator_company_entry_description: str - """A description field set by the originator.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - originator_country: str - """A portion of the originator address. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the originator country. - """ - originator_identification: str - """An identifier for the originating company. +class SourceInboundCheckDepositReturnIntention(BaseModel): + """An Inbound Check Deposit Return Intention object. - This is generally stable across multiple ACH transfers. + This field will be present in the JSON response if and only if `category` is equal to `inbound_check_deposit_return_intention`. An Inbound Check Deposit Return Intention is created when Increase receives an Inbound Check and the User requests that it be returned. """ - originator_name: str - """Either the name of the originator or an intermediary money transmitter.""" - - originator_postal_code: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_state_or_province: Optional[str] = None - """A portion of the originator address. This may be incomplete.""" - - originator_street_address: str - """A portion of the originator address. This may be incomplete.""" - - payment_related_information: Optional[str] = None - """A description field set by the originator.""" - - payment_related_information2: Optional[str] = None - """A description field set by the originator.""" + inbound_check_deposit_id: str + """The ID of the Inbound Check Deposit that is being returned.""" - receiver_city: str - """A portion of the receiver address. This may be incomplete.""" - - receiver_country: str - """A portion of the receiver address. - - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiver country. - """ - - receiver_identification_number: Optional[str] = None - """An identification number the originator uses for the receiver.""" + transfer_id: Optional[str] = None + """The identifier of the Check Transfer object that was deposited.""" - receiver_postal_code: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - receiver_state_or_province: Optional[str] = None - """A portion of the receiver address. This may be incomplete.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - receiver_street_address: str - """A portion of the receiver address. This may be incomplete.""" - receiving_company_or_individual_name: str - """The name of the receiver of the transfer. This is not verified by Increase.""" +class SourceInboundFednowTransferConfirmation(BaseModel): + """An Inbound FedNow Transfer Confirmation object. - receiving_depository_financial_institution_country: str - """ - The [ISO 3166](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2), Alpha-2 - country code of the receiving bank country. + This field will be present in the JSON response if and only if `category` is equal to `inbound_fednow_transfer_confirmation`. An Inbound FedNow Transfer Confirmation is created when a FedNow transfer is initiated at another bank and received by Increase. """ - receiving_depository_financial_institution_id: str - """An identifier for the receiving bank. + transfer_id: str + """The identifier of the FedNow Transfer that led to this Transaction.""" - One of an International Bank Account Number (IBAN) bank identifier, SWIFT Bank - Identification Code (BIC), or a domestic identifier like a US Routing Number. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - receiving_depository_financial_institution_id_qualifier: Literal[ - "national_clearing_system_number", "bic_code", "iban" - ] - """ - An instruction of how to interpret the - `receiving_depository_financial_institution_id` field for this Transaction. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - - `national_clearing_system_number` - A domestic clearing system number. In the - US, for example, this is the American Banking Association (ABA) routing - number. - - `bic_code` - The SWIFT Bank Identifier Code (BIC) of the bank. - - `iban` - An International Bank Account Number. - """ - receiving_depository_financial_institution_name: str - """The name of the receiving bank, as set by the sending financial institution.""" +class SourceInboundRealTimePaymentsTransferConfirmation(BaseModel): + """An Inbound Real-Time Payments Transfer Confirmation object. - trace_number: str - """ - A 15 digit number recorded in the Nacha file and available to both the - originating and receiving bank. Along with the amount, date, and originating - routing number, this can be used to identify the ACH transfer at either bank. - ACH trace numbers are not unique, but are - [used to correlate returns](https://increase.com/documentation/ach#returns). + This field will be present in the JSON response if and only if `category` is equal to `inbound_real_time_payments_transfer_confirmation`. An Inbound Real-Time Payments Transfer Confirmation is created when a Real-Time Payments transfer is initiated at another bank and received by Increase. """ - -class SourceInboundRealTimePaymentsTransferConfirmation(BaseModel): amount: int """The amount in the minor unit of the transfer's currency. @@ -2040,16 +3700,11 @@ class SourceInboundRealTimePaymentsTransferConfirmation(BaseModel): creditor_name: str """The name the sender of the transfer specified as the recipient of the transfer.""" - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code of the transfer's currency. This will always be "USD" for a Real-Time Payments transfer. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -2062,118 +3717,34 @@ class SourceInboundRealTimePaymentsTransferConfirmation(BaseModel): debtor_routing_number: str """The routing number of the account that sent the transfer.""" - remittance_information: Optional[str] = None - """Additional information included with the transfer.""" - - transaction_identification: str - """The Real-Time Payments network identification of the transfer.""" - - -class SourceInboundWireDrawdownPayment(BaseModel): - amount: int - """The amount in the minor unit of the transaction's currency. - - For dollars, for example, this is cents. - """ - - beneficiary_address_line1: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_address_line2: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_address_line3: Optional[str] = None - """A free-form address field set by the sender.""" - - beneficiary_name: Optional[str] = None - """A name set by the sender.""" - - beneficiary_reference: Optional[str] = None - """A free-form reference string set by the sender, to help identify the transfer.""" - - description: str - """An Increase-constructed description of the transfer.""" - - input_message_accountability_data: Optional[str] = None - """ - A unique identifier available to the originating and receiving banks, commonly - abbreviated as IMAD. It is created when the wire is submitted to the Fedwire - service and is helpful when debugging wires with the receiving bank. - """ - - originator_address_line1: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line2: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line3: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_name: Optional[str] = None - """The originator of the wire, set by the sending bank.""" - - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ - - originator_to_beneficiary_information: Optional[str] = None - """An Increase-created concatenation of the Originator-to-Beneficiary lines.""" - - originator_to_beneficiary_information_line1: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line2: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line3: Optional[str] = None - """A free-form message set by the wire originator.""" - - originator_to_beneficiary_information_line4: Optional[str] = None - """A free-form message set by the wire originator.""" - - -class SourceInboundWireDrawdownPaymentReversal(BaseModel): - amount: int - """The amount that was reversed.""" - - description: str - """The description on the reversal message from Fedwire.""" - - input_cycle_date: date - """The Fedwire cycle date for the wire reversal.""" - - input_message_accountability_data: str - """The Fedwire transaction identifier.""" - - input_sequence_number: str - """The Fedwire sequence number.""" - - input_source: str - """The Fedwire input source identifier.""" - - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ + transaction_identification: str + """The Real-Time Payments network identification of the transfer.""" - previous_message_input_cycle_date: date - """The Fedwire cycle date for the wire transfer that was reversed.""" + transfer_id: str + """The identifier of the Real-Time Payments Transfer that led to this Transaction.""" - previous_message_input_message_accountability_data: str - """The Fedwire transaction identifier for the wire transfer that was reversed.""" + unstructured_remittance_information: Optional[str] = None + """Additional information included with the transfer.""" - previous_message_input_sequence_number: str - """The Fedwire sequence number for the wire transfer that was reversed.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - previous_message_input_source: str - """The Fedwire input source identifier for the wire transfer that was reversed.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] class SourceInboundWireReversal(BaseModel): + """An Inbound Wire Reversal object. + + This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_reversal`. An Inbound Wire Reversal represents a reversal of a wire transfer that was initiated via Increase. The other bank is sending the money back. This most often happens when the original destination account details were incorrect. + """ + amount: int """The amount that was reversed in USD cents.""" @@ -2183,14 +3754,14 @@ class SourceInboundWireReversal(BaseModel): the reversal was created. """ + debtor_routing_number: Optional[str] = None + """The debtor's routing number.""" + description: str """ The description on the reversal message from Fedwire, set by the reversing bank. """ - financial_institution_to_financial_institution_information: Optional[str] = None - """Additional financial institution information included in the wire reversal.""" - input_cycle_date: date """The Fedwire cycle date for the wire reversal. @@ -2207,62 +3778,80 @@ class SourceInboundWireReversal(BaseModel): input_source: str """The Fedwire input source identifier.""" - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ - - previous_message_input_cycle_date: date - """ - The Fedwire cycle date for the wire transfer that is being reversed by this - message. - """ + instruction_identification: Optional[str] = None + """The sending bank's identifier for the reversal.""" - previous_message_input_message_accountability_data: str - """The Fedwire transaction identifier for the wire transfer that was reversed.""" + return_reason_additional_information: Optional[str] = None + """Additional information about the reason for the reversal.""" - previous_message_input_sequence_number: str - """The Fedwire sequence number for the wire transfer that was reversed.""" + return_reason_code: Optional[str] = None + """A code provided by the sending bank giving a reason for the reversal. - previous_message_input_source: str - """The Fedwire input source identifier for the wire transfer that was reversed.""" - - receiver_financial_institution_information: Optional[str] = None - """ - Information included in the wire reversal for the receiving financial - institution. + The common return reason codes are + [documented here](/documentation/wire-reversals#reversal-reason-codes). """ + return_reason_code_description: Optional[str] = None + """An Increase-generated description of the `return_reason_code`.""" + transaction_id: str """The ID for the Transaction associated with the transfer reversal.""" wire_transfer_id: str """The ID for the Wire Transfer that is being reversed.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceInboundWireTransfer(BaseModel): + """An Inbound Wire Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_transfer`. An Inbound Wire Transfer Intention is created when a wire transfer is initiated at another bank and received by Increase. + """ + amount: int """The amount in USD cents.""" - beneficiary_address_line1: Optional[str] = None + creditor_address_line1: Optional[str] = None """A free-form address field set by the sender.""" - beneficiary_address_line2: Optional[str] = None + creditor_address_line2: Optional[str] = None """A free-form address field set by the sender.""" - beneficiary_address_line3: Optional[str] = None + creditor_address_line3: Optional[str] = None """A free-form address field set by the sender.""" - beneficiary_name: Optional[str] = None + creditor_name: Optional[str] = None """A name set by the sender.""" - beneficiary_reference: Optional[str] = None - """A free-form reference string set by the sender, to help identify the transfer.""" + debtor_address_line1: Optional[str] = None + """A free-form address field set by the sender.""" + + debtor_address_line2: Optional[str] = None + """A free-form address field set by the sender.""" + + debtor_address_line3: Optional[str] = None + """A free-form address field set by the sender.""" + + debtor_name: Optional[str] = None + """A name set by the sender.""" description: str """An Increase-constructed description of the transfer.""" + end_to_end_identification: Optional[str] = None + """A free-form reference string set by the sender, to help identify the transfer.""" + input_message_accountability_data: Optional[str] = None """ A unique identifier available to the originating and receiving banks, commonly @@ -2270,45 +3859,70 @@ class SourceInboundWireTransfer(BaseModel): service and is helpful when debugging wires with the originating bank. """ - originator_address_line1: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" - - originator_address_line2: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" + instructing_agent_routing_number: Optional[str] = None + """ + The American Banking Association (ABA) routing number of the bank that sent the + wire. + """ - originator_address_line3: Optional[str] = None - """The address of the wire originator, set by the sending bank.""" + instruction_identification: Optional[str] = None + """The sending bank's identifier for the wire transfer.""" - originator_name: Optional[str] = None - """The originator of the wire, set by the sending bank.""" + transfer_id: str + """The ID of the Inbound Wire Transfer object that resulted in this Transaction.""" - originator_routing_number: Optional[str] = None + unique_end_to_end_transaction_reference: Optional[str] = None """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. + The Unique End-to-end Transaction Reference + ([UETR](https://www.swift.com/payments/what-unique-end-end-transaction-reference-uetr)) + of the transfer. """ - originator_to_beneficiary_information: Optional[str] = None - """An Increase-created concatenation of the Originator-to-Beneficiary lines.""" + unstructured_remittance_information: Optional[str] = None + """A free-form message set by the sender.""" - originator_to_beneficiary_information_line1: Optional[str] = None - """A free-form message set by the wire originator.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - originator_to_beneficiary_information_line2: Optional[str] = None - """A free-form message set by the wire originator.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - originator_to_beneficiary_information_line3: Optional[str] = None - """A free-form message set by the wire originator.""" - originator_to_beneficiary_information_line4: Optional[str] = None - """A free-form message set by the wire originator.""" +class SourceInboundWireTransferReversal(BaseModel): + """An Inbound Wire Transfer Reversal Intention object. - transfer_id: str - """The ID of the Inbound Wire Transfer object that resulted in this Transaction.""" + This field will be present in the JSON response if and only if `category` is equal to `inbound_wire_transfer_reversal`. An Inbound Wire Transfer Reversal Intention is created when Increase has received a wire and the User requests that it be reversed. + """ + + inbound_wire_transfer_id: str + """The ID of the Inbound Wire Transfer that is being reversed.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] class SourceInterestPayment(BaseModel): - accrued_on_account_id: Optional[str] = None + """An Interest Payment object. + + This field will be present in the JSON response if and only if `category` is equal to `interest_payment`. An Interest Payment represents a payment of interest on an account. Interest is usually paid monthly. + """ + + accrued_on_account_id: str """The account on which the interest was accrued.""" amount: int @@ -2317,16 +3931,11 @@ class SourceInterestPayment(BaseModel): For dollars, for example, this is cents. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -2336,38 +3945,54 @@ class SourceInterestPayment(BaseModel): period_start: datetime """The start of the period for which this transaction paid interest.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceInternalSource(BaseModel): + """An Internal Source object. + + This field will be present in the JSON response if and only if `category` is equal to `internal_source`. A transaction between the user and Increase. See the `reason` attribute for more information. + """ + amount: int """The amount in the minor unit of the transaction's currency. For dollars, for example, this is cents. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transaction currency. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ reason: Literal[ "account_closure", + "account_revenue_payment_distribution", + "bank_drawn_check", + "bank_drawn_check_credit", "bank_migration", - "cashback", "check_adjustment", "collection_payment", "collection_receivable", + "dishonored_ach_return", "empyreal_adjustment", "error", "error_correction", "fees", + "general_ledger_transfer", "interest", "negative_balance_forgiveness", "sample_funds", @@ -2378,121 +4003,183 @@ class SourceInternalSource(BaseModel): This describes the reason for the transaction. - `account_closure` - Account closure + - `account_revenue_payment_distribution` - Account revenue payment distribution + - `bank_drawn_check` - Bank-drawn check + - `bank_drawn_check_credit` - Bank-drawn check credit - `bank_migration` - Bank migration - - `cashback` - Cashback - `check_adjustment` - Check adjustment - `collection_payment` - Collection payment - `collection_receivable` - Collection receivable + - `dishonored_ach_return` - Dishonored ACH return - `empyreal_adjustment` - Empyreal adjustment - `error` - Error - `error_correction` - Error correction - `fees` - Fees + - `general_ledger_transfer` - General ledger transfer - `interest` - Interest - `negative_balance_forgiveness` - Negative balance forgiveness - `sample_funds` - Sample funds - `sample_funds_return` - Sample funds return """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + + +class SourceOther(BaseModel): + """ + If the category of this Transaction source is equal to `other`, this field will contain an empty object, otherwise it will contain null. + """ + + pass + class SourceRealTimePaymentsTransferAcknowledgement(BaseModel): - amount: int - """The transfer amount in USD cents.""" + """A Real-Time Payments Transfer Acknowledgement object. - destination_account_number: str + This field will be present in the JSON response if and only if `category` is equal to `real_time_payments_transfer_acknowledgement`. A Real-Time Payments Transfer Acknowledgement is created when a Real-Time Payments Transfer sent from Increase is acknowledged by the receiving bank. + """ + + account_number: str """The destination account number.""" - destination_routing_number: str - """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" + amount: int + """The transfer amount in USD cents.""" - remittance_information: str - """Unstructured information that will show on the recipient's bank statement.""" + routing_number: str + """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" transfer_id: str """The identifier of the Real-Time Payments Transfer that led to this Transaction.""" + unstructured_remittance_information: str + """Unstructured information that will show on the recipient's bank statement.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class SourceSampleFunds(BaseModel): + """A Sample Funds object. + + This field will be present in the JSON response if and only if `category` is equal to `sample_funds`. Sample funds for testing purposes. + """ + originator: str """Where the sample funds came from.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class SourceWireTransferIntention(BaseModel): - account_number: str - """The destination account number.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - amount: int - """The transfer amount in USD cents.""" - message_to_recipient: str - """The message that will show on the recipient's bank statement.""" +class SourceSwiftTransferIntention(BaseModel): + """A Swift Transfer Intention object. - routing_number: str - """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" + This field will be present in the JSON response if and only if `category` is equal to `swift_transfer_intention`. A Swift Transfer initiated via Increase. + """ transfer_id: str - """The identifier of the Wire Transfer that led to this Transaction.""" + """The identifier of the Swift Transfer that led to this Transaction.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] -class SourceWireTransferRejection(BaseModel): - transfer_id: str - """The identifier of the Wire Transfer that led to this Transaction.""" + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] -class Source(BaseModel): - account_transfer_intention: Optional[SourceAccountTransferIntention] = None - """An Account Transfer Intention object. +class SourceSwiftTransferReturn(BaseModel): + """A Swift Transfer Return object. - This field will be present in the JSON response if and only if `category` is - equal to `account_transfer_intention`. + This field will be present in the JSON response if and only if `category` is equal to `swift_transfer_return`. A Swift Transfer Return is created when a Swift Transfer is returned by the receiving bank. """ - ach_transfer_intention: Optional[SourceACHTransferIntention] = None - """An ACH Transfer Intention object. + transfer_id: str + """The identifier of the Swift Transfer that led to this Transaction.""" - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_intention`. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - ach_transfer_rejection: Optional[SourceACHTransferRejection] = None - """An ACH Transfer Rejection object. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_rejection`. - """ - ach_transfer_return: Optional[SourceACHTransferReturn] = None - """An ACH Transfer Return object. +class SourceWireTransferIntention(BaseModel): + """A Wire Transfer Intention object. - This field will be present in the JSON response if and only if `category` is - equal to `ach_transfer_return`. + This field will be present in the JSON response if and only if `category` is equal to `wire_transfer_intention`. A Wire Transfer initiated via Increase and sent to a different bank. """ - card_dispute_acceptance: Optional[SourceCardDisputeAcceptance] = None - """A Card Dispute Acceptance object. + account_number: str + """The destination account number.""" - This field will be present in the JSON response if and only if `category` is - equal to `card_dispute_acceptance`. - """ + amount: int + """The transfer amount in USD cents.""" - card_refund: Optional[SourceCardRefund] = None - """A Card Refund object. + message_to_recipient: str + """The message that will show on the recipient's bank statement.""" - This field will be present in the JSON response if and only if `category` is - equal to `card_refund`. - """ + routing_number: str + """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" - card_revenue_payment: Optional[SourceCardRevenuePayment] = None - """A Card Revenue Payment object. + transfer_id: str + """The identifier of the Wire Transfer that led to this Transaction.""" - This field will be present in the JSON response if and only if `category` is - equal to `card_revenue_payment`. - """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] - card_settlement: Optional[SourceCardSettlement] = None - """A Card Settlement object. + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] - This field will be present in the JSON response if and only if `category` is - equal to `card_settlement`. + +class Source(BaseModel): + """ + This is an object giving more details on the network-level event that caused the Transaction. Note that for backwards compatibility reasons, additional undocumented keys may appear in this object. These should be treated as deprecated and will be removed in the future. """ category: Literal[ @@ -2500,23 +4187,25 @@ class Source(BaseModel): "ach_transfer_intention", "ach_transfer_rejection", "ach_transfer_return", + "cashback_payment", "card_dispute_acceptance", + "card_dispute_financial", + "card_dispute_loss", "card_refund", "card_settlement", + "card_financial", "card_revenue_payment", "check_deposit_acceptance", "check_deposit_return", + "fednow_transfer_acknowledgement", "check_transfer_deposit", - "check_transfer_intention", - "check_transfer_stop_payment_request", "fee_payment", "inbound_ach_transfer", "inbound_ach_transfer_return_intention", - "inbound_check", - "inbound_international_ach_transfer", + "inbound_check_deposit_return_intention", + "inbound_check_adjustment", + "inbound_fednow_transfer_confirmation", "inbound_real_time_payments_transfer_confirmation", - "inbound_wire_drawdown_payment_reversal", - "inbound_wire_drawdown_payment", "inbound_wire_reversal", "inbound_wire_transfer", "inbound_wire_transfer_reversal", @@ -2525,7 +4214,12 @@ class Source(BaseModel): "real_time_payments_transfer_acknowledgement", "sample_funds", "wire_transfer_intention", - "wire_transfer_rejection", + "swift_transfer_intention", + "swift_transfer_return", + "card_push_transfer_acceptance", + "account_revenue_payment", + "blockchain_onramp_transfer_intention", + "blockchain_offramp_transfer_settlement", "other", ] """The type of the resource. @@ -2541,41 +4235,45 @@ class Source(BaseModel): `ach_transfer_rejection` object. - `ach_transfer_return` - ACH Transfer Return: details will be under the `ach_transfer_return` object. - - `card_dispute_acceptance` - Card Dispute Acceptance: details will be under the - `card_dispute_acceptance` object. + - `cashback_payment` - Cashback Payment: details will be under the + `cashback_payment` object. + - `card_dispute_acceptance` - Legacy Card Dispute Acceptance: details will be + under the `card_dispute_acceptance` object. + - `card_dispute_financial` - Card Dispute Financial: details will be under the + `card_dispute_financial` object. + - `card_dispute_loss` - Legacy Card Dispute Loss: details will be under the + `card_dispute_loss` object. - `card_refund` - Card Refund: details will be under the `card_refund` object. - `card_settlement` - Card Settlement: details will be under the `card_settlement` object. + - `card_financial` - Card Financial: details will be under the `card_financial` + object. - `card_revenue_payment` - Card Revenue Payment: details will be under the `card_revenue_payment` object. - `check_deposit_acceptance` - Check Deposit Acceptance: details will be under the `check_deposit_acceptance` object. - `check_deposit_return` - Check Deposit Return: details will be under the `check_deposit_return` object. + - `fednow_transfer_acknowledgement` - FedNow Transfer Acknowledgement: details + will be under the `fednow_transfer_acknowledgement` object. - `check_transfer_deposit` - Check Transfer Deposit: details will be under the `check_transfer_deposit` object. - - `check_transfer_intention` - Check Transfer Intention: details will be under - the `check_transfer_intention` object. - - `check_transfer_stop_payment_request` - Check Transfer Stop Payment Request: - details will be under the `check_transfer_stop_payment_request` object. - `fee_payment` - Fee Payment: details will be under the `fee_payment` object. - `inbound_ach_transfer` - Inbound ACH Transfer Intention: details will be under the `inbound_ach_transfer` object. - `inbound_ach_transfer_return_intention` - Inbound ACH Transfer Return Intention: details will be under the `inbound_ach_transfer_return_intention` object. - - `inbound_check` - Inbound Check: details will be under the `inbound_check` + - `inbound_check_deposit_return_intention` - Inbound Check Deposit Return + Intention: details will be under the `inbound_check_deposit_return_intention` object. - - `inbound_international_ach_transfer` - Inbound International ACH Transfer: - details will be under the `inbound_international_ach_transfer` object. + - `inbound_check_adjustment` - Inbound Check Adjustment: details will be under + the `inbound_check_adjustment` object. + - `inbound_fednow_transfer_confirmation` - Inbound FedNow Transfer Confirmation: + details will be under the `inbound_fednow_transfer_confirmation` object. - `inbound_real_time_payments_transfer_confirmation` - Inbound Real-Time Payments Transfer Confirmation: details will be under the `inbound_real_time_payments_transfer_confirmation` object. - - `inbound_wire_drawdown_payment_reversal` - Inbound Wire Drawdown Payment - Reversal: details will be under the `inbound_wire_drawdown_payment_reversal` - object. - - `inbound_wire_drawdown_payment` - Inbound Wire Drawdown Payment: details will - be under the `inbound_wire_drawdown_payment` object. - `inbound_wire_reversal` - Inbound Wire Reversal: details will be under the `inbound_wire_reversal` object. - `inbound_wire_transfer` - Inbound Wire Transfer Intention: details will be @@ -2593,153 +4291,360 @@ class Source(BaseModel): object. - `wire_transfer_intention` - Wire Transfer Intention: details will be under the `wire_transfer_intention` object. - - `wire_transfer_rejection` - Wire Transfer Rejection: details will be under the - `wire_transfer_rejection` object. + - `swift_transfer_intention` - Swift Transfer Intention: details will be under + the `swift_transfer_intention` object. + - `swift_transfer_return` - Swift Transfer Return: details will be under the + `swift_transfer_return` object. + - `card_push_transfer_acceptance` - Card Push Transfer Acceptance: details will + be under the `card_push_transfer_acceptance` object. + - `account_revenue_payment` - Account Revenue Payment: details will be under the + `account_revenue_payment` object. + - `blockchain_onramp_transfer_intention` - Blockchain On-Ramp Transfer + Intention: details will be under the `blockchain_onramp_transfer_intention` + object. + - `blockchain_offramp_transfer_settlement` - Blockchain Off-Ramp Transfer + Settlement: details will be under the `blockchain_offramp_transfer_settlement` + object. - `other` - The Transaction was made for an undocumented or deprecated reason. """ + account_revenue_payment: Optional[SourceAccountRevenuePayment] = None + """An Account Revenue Payment object. + + This field will be present in the JSON response if and only if `category` is + equal to `account_revenue_payment`. An Account Revenue Payment represents a + payment made to an account from the bank. Account revenue is a type of + non-interest income. + """ + + account_transfer_intention: Optional[SourceAccountTransferIntention] = None + """An Account Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is + equal to `account_transfer_intention`. Two Account Transfer Intentions are + created from each Account Transfer. One decrements the source account, and the + other increments the destination account. + """ + + ach_transfer_intention: Optional[SourceACHTransferIntention] = None + """An ACH Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is + equal to `ach_transfer_intention`. An ACH Transfer Intention is created from an + ACH Transfer. It reflects the intention to move money into or out of an Increase + account via the ACH network. + """ + + ach_transfer_rejection: Optional[SourceACHTransferRejection] = None + """An ACH Transfer Rejection object. + + This field will be present in the JSON response if and only if `category` is + equal to `ach_transfer_rejection`. An ACH Transfer Rejection is created when an + ACH Transfer is rejected by Increase. It offsets the ACH Transfer Intention. + These rejections are rare. + """ + + ach_transfer_return: Optional[SourceACHTransferReturn] = None + """An ACH Transfer Return object. + + This field will be present in the JSON response if and only if `category` is + equal to `ach_transfer_return`. An ACH Transfer Return is created when an ACH + Transfer is returned by the receiving bank. It offsets the ACH Transfer + Intention. ACH Transfer Returns usually occur within the first two business days + after the transfer is initiated, but can occur much later. + """ + + blockchain_offramp_transfer_settlement: Optional[SourceBlockchainOfframpTransferSettlement] = None + """A Blockchain Off-Ramp Transfer Settlement object. + + This field will be present in the JSON response if and only if `category` is + equal to `blockchain_offramp_transfer_settlement`. + """ + + blockchain_onramp_transfer_intention: Optional[SourceBlockchainOnrampTransferIntention] = None + """A Blockchain On-Ramp Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is + equal to `blockchain_onramp_transfer_intention`. + """ + + card_dispute_acceptance: Optional[SourceCardDisputeAcceptance] = None + """A Legacy Card Dispute Acceptance object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_dispute_acceptance`. Contains the details of a successful Card + Dispute. + """ + + card_dispute_financial: Optional[SourceCardDisputeFinancial] = None + """A Card Dispute Financial object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_dispute_financial`. Financial event related to a Card Dispute. + """ + + card_dispute_loss: Optional[SourceCardDisputeLoss] = None + """A Legacy Card Dispute Loss object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_dispute_loss`. Contains the details of a lost Card Dispute. + """ + + card_financial: Optional[SourceCardFinancial] = None + """A Card Financial object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_financial`. Card Financials are temporary holds placed on a + customer's funds with the intent to later clear a transaction. + """ + + card_push_transfer_acceptance: Optional[SourceCardPushTransferAcceptance] = None + """A Card Push Transfer Acceptance object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_push_transfer_acceptance`. A Card Push Transfer Acceptance is + created when an Outbound Card Push Transfer sent from Increase is accepted by + the receiving bank. + """ + + card_refund: Optional[SourceCardRefund] = None + """A Card Refund object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_refund`. Card Refunds move money back to the cardholder. While + they are usually connected to a Card Settlement, an acquirer can also refund + money directly to a card without relation to a transaction. + """ + + card_revenue_payment: Optional[SourceCardRevenuePayment] = None + """A Card Revenue Payment object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_revenue_payment`. Card Revenue Payments reflect earnings from + fees on card transactions. + """ + + card_settlement: Optional[SourceCardSettlement] = None + """A Card Settlement object. + + This field will be present in the JSON response if and only if `category` is + equal to `card_settlement`. Card Settlements are card transactions that have + cleared and settled. While a settlement is usually preceded by an authorization, + an acquirer can also directly clear a transaction without first authorizing it. + """ + + cashback_payment: Optional[SourceCashbackPayment] = None + """A Cashback Payment object. + + This field will be present in the JSON response if and only if `category` is + equal to `cashback_payment`. A Cashback Payment represents the cashback paid to + a cardholder for a given period. Cashback is usually paid monthly for the prior + month's transactions. + """ + check_deposit_acceptance: Optional[SourceCheckDepositAcceptance] = None """A Check Deposit Acceptance object. This field will be present in the JSON response if and only if `category` is - equal to `check_deposit_acceptance`. + equal to `check_deposit_acceptance`. A Check Deposit Acceptance is created when + a Check Deposit is processed and its details confirmed. Check Deposits may be + returned by the receiving bank, which will appear as a Check Deposit Return. """ check_deposit_return: Optional[SourceCheckDepositReturn] = None """A Check Deposit Return object. This field will be present in the JSON response if and only if `category` is - equal to `check_deposit_return`. + equal to `check_deposit_return`. A Check Deposit Return is created when a Check + Deposit is returned by the bank holding the account it was drawn against. Check + Deposits may be returned for a variety of reasons, including insufficient funds + or a mismatched account number. Usually, checks are returned within the first 7 + days after the deposit is made. """ check_transfer_deposit: Optional[SourceCheckTransferDeposit] = None """A Check Transfer Deposit object. This field will be present in the JSON response if and only if `category` is - equal to `check_transfer_deposit`. - """ - - check_transfer_intention: Optional[SourceCheckTransferIntention] = None - """A Check Transfer Intention object. - - This field will be present in the JSON response if and only if `category` is - equal to `check_transfer_intention`. + equal to `check_transfer_deposit`. An Inbound Check is a check drawn on an + Increase account that has been deposited by an external bank account. These + types of checks are not pre-registered. """ - check_transfer_stop_payment_request: Optional[SourceCheckTransferStopPaymentRequest] = None - """A Check Transfer Stop Payment Request object. + fednow_transfer_acknowledgement: Optional[SourceFednowTransferAcknowledgement] = None + """A FedNow Transfer Acknowledgement object. This field will be present in the JSON response if and only if `category` is - equal to `check_transfer_stop_payment_request`. + equal to `fednow_transfer_acknowledgement`. A FedNow Transfer Acknowledgement is + created when a FedNow Transfer sent from Increase is acknowledged by the + receiving bank. """ fee_payment: Optional[SourceFeePayment] = None """A Fee Payment object. This field will be present in the JSON response if and only if `category` is - equal to `fee_payment`. + equal to `fee_payment`. A Fee Payment represents a payment made to Increase. """ inbound_ach_transfer: Optional[SourceInboundACHTransfer] = None """An Inbound ACH Transfer Intention object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_ach_transfer`. + equal to `inbound_ach_transfer`. An Inbound ACH Transfer Intention is created + when an ACH transfer is initiated at another bank and received by Increase. """ - inbound_check: Optional[SourceInboundCheck] = None - """An Inbound Check object. + inbound_ach_transfer_return_intention: Optional[SourceInboundACHTransferReturnIntention] = None + """An Inbound ACH Transfer Return Intention object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_check`. + equal to `inbound_ach_transfer_return_intention`. An Inbound ACH Transfer Return + Intention is created when an ACH transfer is initiated at another bank and + returned by Increase. """ - inbound_international_ach_transfer: Optional[SourceInboundInternationalACHTransfer] = None - """An Inbound International ACH Transfer object. + inbound_check_adjustment: Optional[SourceInboundCheckAdjustment] = None + """An Inbound Check Adjustment object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_international_ach_transfer`. + equal to `inbound_check_adjustment`. An Inbound Check Adjustment is created when + Increase receives an adjustment for a check or return deposited through Check21. """ - inbound_real_time_payments_transfer_confirmation: Optional[SourceInboundRealTimePaymentsTransferConfirmation] = None - """An Inbound Real-Time Payments Transfer Confirmation object. + inbound_check_deposit_return_intention: Optional[SourceInboundCheckDepositReturnIntention] = None + """An Inbound Check Deposit Return Intention object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_real_time_payments_transfer_confirmation`. + equal to `inbound_check_deposit_return_intention`. An Inbound Check Deposit + Return Intention is created when Increase receives an Inbound Check and the User + requests that it be returned. """ - inbound_wire_drawdown_payment: Optional[SourceInboundWireDrawdownPayment] = None - """An Inbound Wire Drawdown Payment object. + inbound_fednow_transfer_confirmation: Optional[SourceInboundFednowTransferConfirmation] = None + """An Inbound FedNow Transfer Confirmation object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_drawdown_payment`. + equal to `inbound_fednow_transfer_confirmation`. An Inbound FedNow Transfer + Confirmation is created when a FedNow transfer is initiated at another bank and + received by Increase. """ - inbound_wire_drawdown_payment_reversal: Optional[SourceInboundWireDrawdownPaymentReversal] = None - """An Inbound Wire Drawdown Payment Reversal object. + inbound_real_time_payments_transfer_confirmation: Optional[SourceInboundRealTimePaymentsTransferConfirmation] = None + """An Inbound Real-Time Payments Transfer Confirmation object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_drawdown_payment_reversal`. + equal to `inbound_real_time_payments_transfer_confirmation`. An Inbound + Real-Time Payments Transfer Confirmation is created when a Real-Time Payments + transfer is initiated at another bank and received by Increase. """ inbound_wire_reversal: Optional[SourceInboundWireReversal] = None """An Inbound Wire Reversal object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_reversal`. + equal to `inbound_wire_reversal`. An Inbound Wire Reversal represents a reversal + of a wire transfer that was initiated via Increase. The other bank is sending + the money back. This most often happens when the original destination account + details were incorrect. """ inbound_wire_transfer: Optional[SourceInboundWireTransfer] = None """An Inbound Wire Transfer Intention object. This field will be present in the JSON response if and only if `category` is - equal to `inbound_wire_transfer`. + equal to `inbound_wire_transfer`. An Inbound Wire Transfer Intention is created + when a wire transfer is initiated at another bank and received by Increase. + """ + + inbound_wire_transfer_reversal: Optional[SourceInboundWireTransferReversal] = None + """An Inbound Wire Transfer Reversal Intention object. + + This field will be present in the JSON response if and only if `category` is + equal to `inbound_wire_transfer_reversal`. An Inbound Wire Transfer Reversal + Intention is created when Increase has received a wire and the User requests + that it be reversed. """ interest_payment: Optional[SourceInterestPayment] = None """An Interest Payment object. This field will be present in the JSON response if and only if `category` is - equal to `interest_payment`. + equal to `interest_payment`. An Interest Payment represents a payment of + interest on an account. Interest is usually paid monthly. """ internal_source: Optional[SourceInternalSource] = None """An Internal Source object. This field will be present in the JSON response if and only if `category` is - equal to `internal_source`. + equal to `internal_source`. A transaction between the user and Increase. See the + `reason` attribute for more information. + """ + + other: Optional[SourceOther] = None + """ + If the category of this Transaction source is equal to `other`, this field will + contain an empty object, otherwise it will contain null. """ real_time_payments_transfer_acknowledgement: Optional[SourceRealTimePaymentsTransferAcknowledgement] = None """A Real-Time Payments Transfer Acknowledgement object. This field will be present in the JSON response if and only if `category` is - equal to `real_time_payments_transfer_acknowledgement`. + equal to `real_time_payments_transfer_acknowledgement`. A Real-Time Payments + Transfer Acknowledgement is created when a Real-Time Payments Transfer sent from + Increase is acknowledged by the receiving bank. """ sample_funds: Optional[SourceSampleFunds] = None """A Sample Funds object. This field will be present in the JSON response if and only if `category` is - equal to `sample_funds`. + equal to `sample_funds`. Sample funds for testing purposes. """ - wire_transfer_intention: Optional[SourceWireTransferIntention] = None - """A Wire Transfer Intention object. + swift_transfer_intention: Optional[SourceSwiftTransferIntention] = None + """A Swift Transfer Intention object. + + This field will be present in the JSON response if and only if `category` is + equal to `swift_transfer_intention`. A Swift Transfer initiated via Increase. + """ + + swift_transfer_return: Optional[SourceSwiftTransferReturn] = None + """A Swift Transfer Return object. This field will be present in the JSON response if and only if `category` is - equal to `wire_transfer_intention`. + equal to `swift_transfer_return`. A Swift Transfer Return is created when a + Swift Transfer is returned by the receiving bank. """ - wire_transfer_rejection: Optional[SourceWireTransferRejection] = None - """A Wire Transfer Rejection object. + wire_transfer_intention: Optional[SourceWireTransferIntention] = None + """A Wire Transfer Intention object. This field will be present in the JSON response if and only if `category` is - equal to `wire_transfer_rejection`. + equal to `wire_transfer_intention`. A Wire Transfer initiated via Increase and + sent to a different bank. """ + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class Transaction(BaseModel): + """ + Transactions are the immutable additions and removals of money from your bank account. They're the equivalent of line items on your bank statement. To learn more, see [Transactions and Transfers](/documentation/transactions-transfers). + """ + id: str """The Transaction identifier.""" @@ -2758,17 +4663,12 @@ class Transaction(BaseModel): Transaction occurred. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the Transaction's currency. This will match the currency on the Transaction's Account. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ @@ -2785,11 +4685,12 @@ class Transaction(BaseModel): Routes are things like cards and ACH details. """ - route_type: Optional[Literal["account_number", "card"]] = None + route_type: Optional[Literal["account_number", "card", "lockbox"]] = None """The type of the route this Transaction came through. - `account_number` - An Account Number. - `card` - A Card. + - `lockbox` - A Lockbox. """ source: Source @@ -2805,3 +4706,15 @@ class Transaction(BaseModel): For this resource it will always be `transaction`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/transaction_list_params.py b/src/increase/types/transaction_list_params.py index 9c4cf7b0b..25c686b9e 100644 --- a/src/increase/types/transaction_list_params.py +++ b/src/increase/types/transaction_list_params.py @@ -44,23 +44,25 @@ class TransactionListParams(TypedDict, total=False): "ach_transfer_intention", "ach_transfer_rejection", "ach_transfer_return", + "cashback_payment", "card_dispute_acceptance", + "card_dispute_financial", + "card_dispute_loss", "card_refund", "card_settlement", + "card_financial", "card_revenue_payment", "check_deposit_acceptance", "check_deposit_return", + "fednow_transfer_acknowledgement", "check_transfer_deposit", - "check_transfer_intention", - "check_transfer_stop_payment_request", "fee_payment", "inbound_ach_transfer", "inbound_ach_transfer_return_intention", - "inbound_check", - "inbound_international_ach_transfer", + "inbound_check_deposit_return_intention", + "inbound_check_adjustment", + "inbound_fednow_transfer_confirmation", "inbound_real_time_payments_transfer_confirmation", - "inbound_wire_drawdown_payment_reversal", - "inbound_wire_drawdown_payment", "inbound_wire_reversal", "inbound_wire_transfer", "inbound_wire_transfer_reversal", @@ -69,7 +71,12 @@ class TransactionListParams(TypedDict, total=False): "real_time_payments_transfer_acknowledgement", "sample_funds", "wire_transfer_intention", - "wire_transfer_rejection", + "swift_transfer_intention", + "swift_transfer_return", + "card_push_transfer_acceptance", + "account_revenue_payment", + "blockchain_onramp_transfer_intention", + "blockchain_offramp_transfer_settlement", "other", ] ], diff --git a/src/increase/types/unwrap_webhook_event.py b/src/increase/types/unwrap_webhook_event.py new file mode 100644 index 000000000..536c8303f --- /dev/null +++ b/src/increase/types/unwrap_webhook_event.py @@ -0,0 +1,319 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from datetime import datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = ["UnwrapWebhookEvent"] + + +class UnwrapWebhookEvent(BaseModel): + """Events are records of things that happened to objects at Increase. + + Events are accessible via the List Events endpoint and can be delivered to your application via webhooks. For more information, see our [webhooks guide](https://increase.com/documentation/webhooks). + """ + + id: str + """The Event identifier.""" + + associated_object_id: str + """The identifier of the object that generated this Event.""" + + associated_object_type: str + """The type of the object that generated this Event.""" + + category: Literal[ + "account.created", + "account.updated", + "account_number.created", + "account_number.updated", + "account_statement.created", + "account_transfer.created", + "account_transfer.updated", + "ach_prenotification.created", + "ach_prenotification.updated", + "ach_transfer.created", + "ach_transfer.updated", + "blockchain_address.created", + "blockchain_address.updated", + "blockchain_offramp_transfer.created", + "blockchain_offramp_transfer.updated", + "blockchain_onramp_transfer.created", + "blockchain_onramp_transfer.updated", + "bookkeeping_account.created", + "bookkeeping_account.updated", + "bookkeeping_entry_set.updated", + "card.created", + "card.updated", + "card_payment.created", + "card_payment.updated", + "card_profile.created", + "card_profile.updated", + "card_dispute.created", + "card_dispute.updated", + "check_deposit.created", + "check_deposit.updated", + "check_transfer.created", + "check_transfer.updated", + "declined_transaction.created", + "digital_card_profile.created", + "digital_card_profile.updated", + "digital_wallet_token.created", + "digital_wallet_token.updated", + "document.created", + "entity.created", + "entity.updated", + "event_subscription.created", + "event_subscription.updated", + "export.created", + "export.updated", + "external_account.created", + "external_account.updated", + "fednow_transfer.created", + "fednow_transfer.updated", + "file.created", + "group.updated", + "group.heartbeat", + "inbound_ach_transfer.created", + "inbound_ach_transfer.updated", + "inbound_ach_transfer_return.created", + "inbound_ach_transfer_return.updated", + "inbound_check_deposit.created", + "inbound_check_deposit.updated", + "inbound_fednow_transfer.created", + "inbound_fednow_transfer.updated", + "inbound_mail_item.created", + "inbound_mail_item.updated", + "inbound_real_time_payments_transfer.created", + "inbound_real_time_payments_transfer.updated", + "inbound_wire_drawdown_request.created", + "inbound_wire_transfer.created", + "inbound_wire_transfer.updated", + "intrafi_account_enrollment.created", + "intrafi_account_enrollment.updated", + "intrafi_exclusion.created", + "intrafi_exclusion.updated", + "legacy_card_dispute.created", + "legacy_card_dispute.updated", + "lockbox.created", + "lockbox.updated", + "oauth_connection.created", + "oauth_connection.deactivated", + "card_push_transfer.created", + "card_push_transfer.updated", + "card_validation.created", + "card_validation.updated", + "pending_transaction.created", + "pending_transaction.updated", + "physical_card.created", + "physical_card.updated", + "physical_card_profile.created", + "physical_card_profile.updated", + "physical_check.created", + "physical_check.updated", + "program.created", + "program.updated", + "proof_of_authorization_request.created", + "proof_of_authorization_request.updated", + "real_time_decision.card_authorization_requested", + "real_time_decision.card_balance_inquiry_requested", + "real_time_decision.digital_wallet_token_requested", + "real_time_decision.digital_wallet_authentication_requested", + "real_time_decision.card_authentication_requested", + "real_time_decision.card_authentication_challenge_requested", + "real_time_payments_transfer.created", + "real_time_payments_transfer.updated", + "real_time_payments_request_for_payment.created", + "real_time_payments_request_for_payment.updated", + "swift_transfer.created", + "swift_transfer.updated", + "transaction.created", + "wire_drawdown_request.created", + "wire_drawdown_request.updated", + "wire_transfer.created", + "wire_transfer.updated", + ] + """The category of the Event. + + We may add additional possible values for this enum over time; your application + should be able to handle such additions gracefully. + + - `account.created` - Occurs whenever an Account is created. + - `account.updated` - Occurs whenever an Account is updated. + - `account_number.created` - Occurs whenever an Account Number is created. + - `account_number.updated` - Occurs whenever an Account Number is updated. + - `account_statement.created` - Occurs whenever an Account Statement is created. + - `account_transfer.created` - Occurs whenever an Account Transfer is created. + - `account_transfer.updated` - Occurs whenever an Account Transfer is updated. + - `ach_prenotification.created` - Occurs whenever an ACH Prenotification is + created. + - `ach_prenotification.updated` - Occurs whenever an ACH Prenotification is + updated. + - `ach_transfer.created` - Occurs whenever an ACH Transfer is created. + - `ach_transfer.updated` - Occurs whenever an ACH Transfer is updated. + - `blockchain_address.created` - Occurs whenever a Blockchain Address is + created. + - `blockchain_address.updated` - Occurs whenever a Blockchain Address is + updated. + - `blockchain_offramp_transfer.created` - Occurs whenever a Blockchain Off-Ramp + Transfer is created. + - `blockchain_offramp_transfer.updated` - Occurs whenever a Blockchain Off-Ramp + Transfer is updated. + - `blockchain_onramp_transfer.created` - Occurs whenever a Blockchain On-Ramp + Transfer is created. + - `blockchain_onramp_transfer.updated` - Occurs whenever a Blockchain On-Ramp + Transfer is updated. + - `bookkeeping_account.created` - Occurs whenever a Bookkeeping Account is + created. + - `bookkeeping_account.updated` - Occurs whenever a Bookkeeping Account is + updated. + - `bookkeeping_entry_set.updated` - Occurs whenever a Bookkeeping Entry Set is + created. + - `card.created` - Occurs whenever a Card is created. + - `card.updated` - Occurs whenever a Card is updated. + - `card_payment.created` - Occurs whenever a Card Payment is created. + - `card_payment.updated` - Occurs whenever a Card Payment is updated. + - `card_profile.created` - Occurs whenever a Card Profile is created. + - `card_profile.updated` - Occurs whenever a Card Profile is updated. + - `card_dispute.created` - Occurs whenever a Card Dispute is created. + - `card_dispute.updated` - Occurs whenever a Card Dispute is updated. + - `check_deposit.created` - Occurs whenever a Check Deposit is created. + - `check_deposit.updated` - Occurs whenever a Check Deposit is updated. + - `check_transfer.created` - Occurs whenever a Check Transfer is created. + - `check_transfer.updated` - Occurs whenever a Check Transfer is updated. + - `declined_transaction.created` - Occurs whenever a Declined Transaction is + created. + - `digital_card_profile.created` - Occurs whenever a Digital Card Profile is + created. + - `digital_card_profile.updated` - Occurs whenever a Digital Card Profile is + updated. + - `digital_wallet_token.created` - Occurs whenever a Digital Wallet Token is + created. + - `digital_wallet_token.updated` - Occurs whenever a Digital Wallet Token is + updated. + - `document.created` - Occurs whenever a Document is created. + - `entity.created` - Occurs whenever an Entity is created. + - `entity.updated` - Occurs whenever an Entity is updated. + - `event_subscription.created` - Occurs whenever an Event Subscription is + created. + - `event_subscription.updated` - Occurs whenever an Event Subscription is + updated. + - `export.created` - Occurs whenever an Export is created. + - `export.updated` - Occurs whenever an Export is updated. + - `external_account.created` - Occurs whenever an External Account is created. + - `external_account.updated` - Occurs whenever an External Account is updated. + - `fednow_transfer.created` - Occurs whenever a FedNow Transfer is created. + - `fednow_transfer.updated` - Occurs whenever a FedNow Transfer is updated. + - `file.created` - Occurs whenever a File is created. + - `group.updated` - Occurs whenever a Group is updated. + - `group.heartbeat` - Increase may send webhooks with this category to see if a + webhook endpoint is working properly. + - `inbound_ach_transfer.created` - Occurs whenever an Inbound ACH Transfer is + created. + - `inbound_ach_transfer.updated` - Occurs whenever an Inbound ACH Transfer is + updated. + - `inbound_ach_transfer_return.created` - Occurs whenever an Inbound ACH + Transfer Return is created. + - `inbound_ach_transfer_return.updated` - Occurs whenever an Inbound ACH + Transfer Return is updated. + - `inbound_check_deposit.created` - Occurs whenever an Inbound Check Deposit is + created. + - `inbound_check_deposit.updated` - Occurs whenever an Inbound Check Deposit is + updated. + - `inbound_fednow_transfer.created` - Occurs whenever an Inbound FedNow Transfer + is created. + - `inbound_fednow_transfer.updated` - Occurs whenever an Inbound FedNow Transfer + is updated. + - `inbound_mail_item.created` - Occurs whenever an Inbound Mail Item is created. + - `inbound_mail_item.updated` - Occurs whenever an Inbound Mail Item is updated. + - `inbound_real_time_payments_transfer.created` - Occurs whenever an Inbound + Real-Time Payments Transfer is created. + - `inbound_real_time_payments_transfer.updated` - Occurs whenever an Inbound + Real-Time Payments Transfer is updated. + - `inbound_wire_drawdown_request.created` - Occurs whenever an Inbound Wire + Drawdown Request is created. + - `inbound_wire_transfer.created` - Occurs whenever an Inbound Wire Transfer is + created. + - `inbound_wire_transfer.updated` - Occurs whenever an Inbound Wire Transfer is + updated. + - `intrafi_account_enrollment.created` - Occurs whenever an IntraFi Account + Enrollment is created. + - `intrafi_account_enrollment.updated` - Occurs whenever an IntraFi Account + Enrollment is updated. + - `intrafi_exclusion.created` - Occurs whenever an IntraFi Exclusion is created. + - `intrafi_exclusion.updated` - Occurs whenever an IntraFi Exclusion is updated. + - `legacy_card_dispute.created` - Occurs whenever a Legacy Card Dispute is + created. + - `legacy_card_dispute.updated` - Occurs whenever a Legacy Card Dispute is + updated. + - `lockbox.created` - Occurs whenever a Lockbox is created. + - `lockbox.updated` - Occurs whenever a Lockbox is updated. + - `oauth_connection.created` - Occurs whenever an OAuth Connection is created. + - `oauth_connection.deactivated` - Occurs whenever an OAuth Connection is + deactivated. + - `card_push_transfer.created` - Occurs whenever a Card Push Transfer is + created. + - `card_push_transfer.updated` - Occurs whenever a Card Push Transfer is + updated. + - `card_validation.created` - Occurs whenever a Card Validation is created. + - `card_validation.updated` - Occurs whenever a Card Validation is updated. + - `pending_transaction.created` - Occurs whenever a Pending Transaction is + created. + - `pending_transaction.updated` - Occurs whenever a Pending Transaction is + updated. + - `physical_card.created` - Occurs whenever a Physical Card is created. + - `physical_card.updated` - Occurs whenever a Physical Card is updated. + - `physical_card_profile.created` - Occurs whenever a Physical Card Profile is + created. + - `physical_card_profile.updated` - Occurs whenever a Physical Card Profile is + updated. + - `physical_check.created` - Occurs whenever a Physical Check is created. + - `physical_check.updated` - Occurs whenever a Physical Check is updated. + - `program.created` - Occurs whenever a Program is created. + - `program.updated` - Occurs whenever a Program is updated. + - `proof_of_authorization_request.created` - Occurs whenever a Proof of + Authorization Request is created. + - `proof_of_authorization_request.updated` - Occurs whenever a Proof of + Authorization Request is updated. + - `real_time_decision.card_authorization_requested` - Occurs whenever a + Real-Time Decision is created in response to a card authorization. + - `real_time_decision.card_balance_inquiry_requested` - Occurs whenever a + Real-Time Decision is created in response to a card balance inquiry. + - `real_time_decision.digital_wallet_token_requested` - Occurs whenever a + Real-Time Decision is created in response to a digital wallet provisioning + attempt. + - `real_time_decision.digital_wallet_authentication_requested` - Occurs whenever + a Real-Time Decision is created in response to a digital wallet requiring + two-factor authentication. + - `real_time_decision.card_authentication_requested` - Occurs whenever a + Real-Time Decision is created in response to 3DS authentication. + - `real_time_decision.card_authentication_challenge_requested` - Occurs whenever + a Real-Time Decision is created in response to 3DS authentication challenges. + - `real_time_payments_transfer.created` - Occurs whenever a Real-Time Payments + Transfer is created. + - `real_time_payments_transfer.updated` - Occurs whenever a Real-Time Payments + Transfer is updated. + - `real_time_payments_request_for_payment.created` - Occurs whenever a Real-Time + Payments Request for Payment is created. + - `real_time_payments_request_for_payment.updated` - Occurs whenever a Real-Time + Payments Request for Payment is updated. + - `swift_transfer.created` - Occurs whenever a Swift Transfer is created. + - `swift_transfer.updated` - Occurs whenever a Swift Transfer is updated. + - `transaction.created` - Occurs whenever a Transaction is created. + - `wire_drawdown_request.created` - Occurs whenever a Wire Drawdown Request is + created. + - `wire_drawdown_request.updated` - Occurs whenever a Wire Drawdown Request is + updated. + - `wire_transfer.created` - Occurs whenever a Wire Transfer is created. + - `wire_transfer.updated` - Occurs whenever a Wire Transfer is updated. + """ + + created_at: datetime + """The time the Event was created.""" + + type: Literal["event"] + """A constant representing the object's type. + + For this resource it will always be `event`. + """ diff --git a/src/increase/types/wire_drawdown_request.py b/src/increase/types/wire_drawdown_request.py index 387c804c2..2084c934c 100644 --- a/src/increase/types/wire_drawdown_request.py +++ b/src/increase/types/wire_drawdown_request.py @@ -1,14 +1,73 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional +from typing import TYPE_CHECKING, Dict, Optional +from datetime import datetime from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["WireDrawdownRequest", "Submission"] +__all__ = ["WireDrawdownRequest", "CreditorAddress", "DebtorAddress", "Submission"] + + +class CreditorAddress(BaseModel): + """The creditor's address.""" + + city: str + """The city, district, town, or village of the address.""" + + country: str + """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: str + """The first line of the address.""" + + line2: Optional[str] = None + """The second line of the address.""" + + postal_code: Optional[str] = None + """The ZIP code of the address.""" + + state: Optional[str] = None + """The address state.""" + + +class DebtorAddress(BaseModel): + """The debtor's address.""" + + city: str + """The city, district, town, or village of the address.""" + + country: str + """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: str + """The first line of the address.""" + + line2: Optional[str] = None + """The second line of the address.""" + + postal_code: Optional[str] = None + """The ZIP code of the address.""" + + state: Optional[str] = None + """The address state.""" class Submission(BaseModel): + """ + After the drawdown request is submitted to Fedwire, this will contain supplemental details. + """ + input_message_accountability_data: str """ The input message accountability data (IMAD) uniquely identifying the submission @@ -17,25 +76,57 @@ class Submission(BaseModel): class WireDrawdownRequest(BaseModel): + """Wire drawdown requests enable you to request that someone else send you a wire. + + Because there is nuance to making sure your counterparty's bank processes these correctly, we ask that you reach out to [support@increase.com](mailto:support@increase.com) to enable this feature so we can help you plan your integration. For more information, see our [Wire Drawdown Requests documentation](/documentation/wire-drawdown-requests). + """ + id: str """The Wire drawdown request identifier.""" account_number_id: str """ - The Account Number to which the recipient of this request is being requested to - send funds. + The Account Number to which the debtor—the recipient of this request—is being + requested to send funds. """ amount: int """The amount being requested in cents.""" + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the wire drawdown request was created. + """ + + creditor_address: CreditorAddress + """The creditor's address.""" + + creditor_name: str + """The creditor's name.""" + currency: str """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the amount being requested. Will always be "USD". """ - fulfillment_transaction_id: Optional[str] = None + debtor_account_number: str + """The debtor's account number.""" + + debtor_address: DebtorAddress + """The debtor's address.""" + + debtor_external_account_id: Optional[str] = None + """The debtor's external account identifier.""" + + debtor_name: str + """The debtor's name.""" + + debtor_routing_number: str + """The debtor's routing number.""" + + fulfillment_inbound_wire_transfer_id: Optional[str] = None """ If the recipient fulfills the drawdown request by sending funds, then this will be the identifier of the corresponding Transaction. @@ -49,47 +140,14 @@ class WireDrawdownRequest(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ - message_to_recipient: str - """The message the recipient will see as part of the drawdown request.""" - - originator_address_line1: Optional[str] = None - """The originator's address line 1.""" - - originator_address_line2: Optional[str] = None - """The originator's address line 2.""" - - originator_address_line3: Optional[str] = None - """The originator's address line 3.""" - - originator_name: Optional[str] = None - """The originator's name.""" - - recipient_account_number: str - """The drawdown request's recipient's account number.""" - - recipient_address_line1: Optional[str] = None - """Line 1 of the drawdown request's recipient's address.""" - - recipient_address_line2: Optional[str] = None - """Line 2 of the drawdown request's recipient's address.""" - - recipient_address_line3: Optional[str] = None - """Line 3 of the drawdown request's recipient's address.""" - - recipient_name: Optional[str] = None - """The drawdown request's recipient's name.""" - - recipient_routing_number: str - """The drawdown request's recipient's routing number.""" - - status: Literal["pending_submission", "pending_response", "fulfilled", "refused"] + status: Literal["pending_submission", "fulfilled", "pending_response", "refused"] """The lifecycle status of the drawdown request. - `pending_submission` - The drawdown request is queued to be submitted to Fedwire. + - `fulfilled` - The drawdown request has been fulfilled by the recipient. - `pending_response` - The drawdown request has been sent and the recipient should respond in some way. - - `fulfilled` - The drawdown request has been fulfilled by the recipient. - `refused` - The drawdown request has been refused by the recipient. """ @@ -104,3 +162,18 @@ class WireDrawdownRequest(BaseModel): For this resource it will always be `wire_drawdown_request`. """ + + unstructured_remittance_information: str + """Remittance information the debtor will see as part of the drawdown request.""" + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/wire_drawdown_request_create_params.py b/src/increase/types/wire_drawdown_request_create_params.py index 027a22a50..41a38f0c5 100644 --- a/src/increase/types/wire_drawdown_request_create_params.py +++ b/src/increase/types/wire_drawdown_request_create_params.py @@ -2,63 +2,111 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict +from typing_extensions import Literal, Required, TypedDict -__all__ = ["WireDrawdownRequestCreateParams"] +__all__ = ["WireDrawdownRequestCreateParams", "CreditorAddress", "DebtorAddress"] class WireDrawdownRequestCreateParams(TypedDict, total=False): account_number_id: Required[str] - """The Account Number to which the recipient should send funds.""" + """The Account Number to which the debtor should send funds.""" amount: Required[int] - """The amount requested from the recipient, in cents.""" + """The amount requested from the debtor, in USD cents.""" - message_to_recipient: Required[str] - """A message the recipient will see as part of the request.""" + creditor_address: Required[CreditorAddress] + """The creditor's address.""" - recipient_account_number: Required[str] - """The drawdown request's recipient's account number.""" + creditor_name: Required[str] + """The creditor's name.""" - recipient_name: Required[str] - """The drawdown request's recipient's name.""" + debtor_address: Required[DebtorAddress] + """The debtor's address.""" - recipient_routing_number: Required[str] - """The drawdown request's recipient's routing number.""" + debtor_name: Required[str] + """The debtor's name.""" - originator_address_line1: str - """The drawdown request originator's address line 1. + unstructured_remittance_information: Required[str] + """Remittance information the debtor will see as part of the request.""" - This is only necessary if you're requesting a payment to a commingled account. - Otherwise, we'll use the associated entity's details. + charge_bearer: Literal["shared", "debtor", "creditor", "service_level"] + """Determines who bears the cost of the drawdown request. + + Defaults to `shared` if not specified. + + - `shared` - Charges are shared between the debtor and creditor. + - `debtor` - Charges are borne by the debtor. + - `creditor` - Charges are borne by the creditor. + - `service_level` - Charges are determined by the service level. """ - originator_address_line2: str - """The drawdown request originator's address line 2. + debtor_account_number: str + """The debtor's account number.""" + + debtor_external_account_id: str + """The ID of an External Account to initiate a transfer to. - This is only necessary if you're requesting a payment to a commingled account. - Otherwise, we'll use the associated entity's details. + If this parameter is provided, `debtor_account_number` and + `debtor_routing_number` must be absent. """ - originator_address_line3: str - """The drawdown request originator's address line 3. + debtor_routing_number: str + """The debtor's routing number.""" + + end_to_end_identification: str + """ + A free-form reference string set by the sender mirrored back in the subsequent + wire transfer. + """ + + +class CreditorAddress(TypedDict, total=False): + """The creditor's address.""" + + city: Required[str] + """The city, district, town, or village of the address.""" - This is only necessary if you're requesting a payment to a commingled account. - Otherwise, we'll use the associated entity's details. + country: Required[str] """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" + + line2: str + """The second line of the address. This might be the floor or room number.""" + + postal_code: str + """The ZIP code of the address.""" + + state: str + """The address state.""" - originator_name: str - """The drawdown request originator's name. - This is only necessary if you're requesting a payment to a commingled account. - Otherwise, we'll use the associated entity's details. +class DebtorAddress(TypedDict, total=False): + """The debtor's address.""" + + city: Required[str] + """The city, district, town, or village of the address.""" + + country: Required[str] """ + The two-letter + [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) code for + the country of the address. + """ + + line1: Required[str] + """The first line of the address. This is usually the street number and street.""" - recipient_address_line1: str - """Line 1 of the drawdown request's recipient's address.""" + line2: str + """The second line of the address. This might be the floor or room number.""" - recipient_address_line2: str - """Line 2 of the drawdown request's recipient's address.""" + postal_code: str + """The ZIP code of the address.""" - recipient_address_line3: str - """Line 3 of the drawdown request's recipient's address.""" + state: str + """The address state.""" diff --git a/src/increase/types/wire_drawdown_request_list_params.py b/src/increase/types/wire_drawdown_request_list_params.py index 0552d1801..e14c2cf79 100644 --- a/src/increase/types/wire_drawdown_request_list_params.py +++ b/src/increase/types/wire_drawdown_request_list_params.py @@ -2,17 +2,41 @@ from __future__ import annotations -from typing_extensions import TypedDict +from typing import List +from typing_extensions import Literal, TypedDict -__all__ = ["WireDrawdownRequestListParams"] +__all__ = ["WireDrawdownRequestListParams", "Status"] class WireDrawdownRequestListParams(TypedDict, total=False): cursor: str """Return the page of entries after this one.""" + idempotency_key: str + """ + Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + """ + limit: int """Limit the size of the list that is returned. The default (and maximum) is 100 objects. """ + + status: Status + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[Literal["pending_submission", "fulfilled", "pending_response", "refused"]], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/wire_transfer.py b/src/increase/types/wire_transfer.py index a8b2eff12..7f13befab 100644 --- a/src/increase/types/wire_transfer.py +++ b/src/increase/types/wire_transfer.py @@ -1,16 +1,41 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. -from typing import Optional -from datetime import date, datetime +import datetime +from typing import TYPE_CHECKING, Dict, Optional from typing_extensions import Literal +from pydantic import Field as FieldInfo + from .._models import BaseModel -__all__ = ["WireTransfer", "Approval", "Cancellation", "Reversal", "Submission"] +__all__ = [ + "WireTransfer", + "Approval", + "Cancellation", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "Creditor", + "CreditorAddress", + "CreditorAddressUnstructured", + "Debtor", + "DebtorAddress", + "DebtorAddressUnstructured", + "Remittance", + "RemittanceTax", + "RemittanceUnstructured", + "Reversal", + "Submission", +] class Approval(BaseModel): - approved_at: datetime + """ + If your account requires approvals for transfers and the transfer was approved, this will contain details of the approval. + """ + + approved_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the transfer was approved. @@ -24,7 +49,11 @@ class Approval(BaseModel): class Cancellation(BaseModel): - canceled_at: datetime + """ + If your account requires approvals for transfers and the transfer was not approved, this will contain details of the cancellation. + """ + + canceled_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the Transfer was canceled. @@ -37,25 +66,188 @@ class Cancellation(BaseModel): """ +class CreatedByAPIKey(BaseModel): + """If present, details about the API key that created the transfer.""" + + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + """If present, details about the OAuth Application that created the transfer.""" + + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + """If present, details about the User that created the transfer.""" + + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + """What object created the transfer, either via the API or the dashboard.""" + + category: Literal["api_key", "oauth_application", "user"] + """The type of object that created this transfer. + + - `api_key` - An API key. Details will be under the `api_key` object. + - `oauth_application` - An OAuth application you connected to Increase. Details + will be under the `oauth_application` object. + - `user` - A User in the Increase dashboard. Details will be under the `user` + object. + """ + + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + oauth_application: Optional[CreatedByOAuthApplication] = None + """If present, details about the OAuth Application that created the transfer.""" + + user: Optional[CreatedByUser] = None + """If present, details about the User that created the transfer.""" + + +class CreditorAddressUnstructured(BaseModel): + """Unstructured address lines.""" + + line1: Optional[str] = None + """The first line.""" + + line2: Optional[str] = None + """The second line.""" + + line3: Optional[str] = None + """The third line.""" + + +class CreditorAddress(BaseModel): + """The person or business's address.""" + + unstructured: Optional[CreditorAddressUnstructured] = None + """Unstructured address lines.""" + + +class Creditor(BaseModel): + """The person or business that is receiving the funds from the transfer.""" + + address: Optional[CreditorAddress] = None + """The person or business's address.""" + + name: Optional[str] = None + """The person or business's name.""" + + +class DebtorAddressUnstructured(BaseModel): + """Unstructured address lines.""" + + line1: Optional[str] = None + """The first line.""" + + line2: Optional[str] = None + """The second line.""" + + line3: Optional[str] = None + """The third line.""" + + +class DebtorAddress(BaseModel): + """The person or business's address.""" + + unstructured: Optional[DebtorAddressUnstructured] = None + """Unstructured address lines.""" + + +class Debtor(BaseModel): + """The person or business whose funds are being transferred.""" + + address: Optional[DebtorAddress] = None + """The person or business's address.""" + + name: Optional[str] = None + """The person or business's name.""" + + +class RemittanceTax(BaseModel): + """Internal Revenue Service (IRS) tax repayment information. + + Required if `category` is equal to `tax`. + """ + + date: datetime.date + """The month and year the tax payment is for, in YYYY-MM-DD format. + + The day is ignored. + """ + + identification_number: str + """ + The 9-digit Tax Identification Number (TIN) or Employer Identification Number + (EIN). + """ + + type_code: str + """The 5-character tax type code.""" + + +class RemittanceUnstructured(BaseModel): + """Unstructured remittance information. + + Required if `category` is equal to `unstructured`. + """ + + message: str + """The message to the beneficiary.""" + + +class Remittance(BaseModel): + """Remittance information sent with the wire transfer.""" + + category: Literal["unstructured", "tax"] + """The type of remittance information being passed. + + - `unstructured` - The wire transfer contains unstructured remittance + information. + - `tax` - The wire transfer is for tax payment purposes to the Internal Revenue + Service (IRS). + """ + + tax: Optional[RemittanceTax] = None + """Internal Revenue Service (IRS) tax repayment information. + + Required if `category` is equal to `tax`. + """ + + unstructured: Optional[RemittanceUnstructured] = None + """Unstructured remittance information. + + Required if `category` is equal to `unstructured`. + """ + + class Reversal(BaseModel): + """If your transfer is reversed, this will contain details of the reversal.""" + amount: int """The amount that was reversed in USD cents.""" - created_at: datetime + created_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the reversal was created. """ + debtor_routing_number: Optional[str] = None + """The debtor's routing number.""" + description: str """ The description on the reversal message from Fedwire, set by the reversing bank. """ - financial_institution_to_financial_institution_information: Optional[str] = None - """Additional financial institution information included in the wire reversal.""" - - input_cycle_date: date + input_cycle_date: datetime.date """The Fedwire cycle date for the wire reversal. The "Fedwire day" begins at 9:00 PM Eastern Time on the evening before the @@ -71,49 +263,58 @@ class Reversal(BaseModel): input_source: str """The Fedwire input source identifier.""" - originator_routing_number: Optional[str] = None - """ - The American Banking Association (ABA) routing number of the bank originating - the transfer. - """ - - previous_message_input_cycle_date: date - """ - The Fedwire cycle date for the wire transfer that is being reversed by this - message. - """ + instruction_identification: Optional[str] = None + """The sending bank's identifier for the reversal.""" - previous_message_input_message_accountability_data: str - """The Fedwire transaction identifier for the wire transfer that was reversed.""" + return_reason_additional_information: Optional[str] = None + """Additional information about the reason for the reversal.""" - previous_message_input_sequence_number: str - """The Fedwire sequence number for the wire transfer that was reversed.""" + return_reason_code: Optional[str] = None + """A code provided by the sending bank giving a reason for the reversal. - previous_message_input_source: str - """The Fedwire input source identifier for the wire transfer that was reversed.""" - - receiver_financial_institution_information: Optional[str] = None - """ - Information included in the wire reversal for the receiving financial - institution. + The common return reason codes are + [documented here](/documentation/wire-reversals#reversal-reason-codes). """ + return_reason_code_description: Optional[str] = None + """An Increase-generated description of the `return_reason_code`.""" + transaction_id: str """The ID for the Transaction associated with the transfer reversal.""" wire_transfer_id: str """The ID for the Wire Transfer that is being reversed.""" + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] + class Submission(BaseModel): + """ + After the transfer is submitted to Fedwire, this will contain supplemental details. + """ + input_message_accountability_data: str """The accountability data for the submission.""" - submitted_at: datetime + submitted_at: datetime.datetime """When this wire transfer was submitted to Fedwire.""" class WireTransfer(BaseModel): + """ + Wire transfers move funds between your Increase account and any other account accessible by Fedwire. + """ + id: str """The wire transfer's identifier.""" @@ -132,43 +333,35 @@ class WireTransfer(BaseModel): this will contain details of the approval. """ - beneficiary_address_line1: Optional[str] = None - """The beneficiary's address line 1.""" - - beneficiary_address_line2: Optional[str] = None - """The beneficiary's address line 2.""" - - beneficiary_address_line3: Optional[str] = None - """The beneficiary's address line 3.""" - - beneficiary_name: Optional[str] = None - """The beneficiary's name.""" - cancellation: Optional[Cancellation] = None """ If your account requires approvals for transfers and the transfer was not approved, this will contain details of the cancellation. """ - created_at: datetime + created_at: datetime.datetime """ The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which the transfer was created. """ - currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + created_by: Optional[CreatedBy] = None + """What object created the transfer, either via the API or the dashboard.""" + + creditor: Optional[Creditor] = None + """The person or business that is receiving the funds from the transfer.""" + + currency: Literal["USD"] """ The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the transfer's currency. For wire transfers this is always equal to `usd`. - - `CAD` - Canadian Dollar (CAD) - - `CHF` - Swiss Franc (CHF) - - `EUR` - Euro (EUR) - - `GBP` - British Pound (GBP) - - `JPY` - Japanese Yen (JPY) - `USD` - US Dollar (USD) """ + debtor: Optional[Debtor] = None + """The person or business whose funds are being transferred.""" + external_account_id: Optional[str] = None """The identifier of the External Account the transfer was made to, if any.""" @@ -180,24 +373,15 @@ class WireTransfer(BaseModel): [idempotency](https://increase.com/documentation/idempotency-keys). """ - message_to_recipient: Optional[str] = None - """The message that will show on the recipient's bank statement.""" + inbound_wire_drawdown_request_id: Optional[str] = None + """ + The ID of an Inbound Wire Drawdown Request in response to which this transfer + was sent. + """ network: Literal["wire"] """The transfer's network.""" - originator_address_line1: Optional[str] = None - """The originator's address line 1.""" - - originator_address_line2: Optional[str] = None - """The originator's address line 2.""" - - originator_address_line3: Optional[str] = None - """The originator's address line 3.""" - - originator_name: Optional[str] = None - """The originator's name.""" - pending_transaction_id: Optional[str] = None """The ID for the pending transaction representing the transfer. @@ -206,33 +390,42 @@ class WireTransfer(BaseModel): by someone else in your organization. """ + remittance: Optional[Remittance] = None + """Remittance information sent with the wire transfer.""" + reversal: Optional[Reversal] = None """If your transfer is reversed, this will contain details of the reversal.""" routing_number: str """The American Bankers' Association (ABA) Routing Transit Number (RTN).""" + source_account_number_id: Optional[str] = None + """The Account Number that was passed to the wire's recipient.""" + status: Literal[ + "pending_approval", "canceled", - "requires_attention", "pending_reviewing", - "pending_approval", "rejected", + "requires_attention", + "pending_creating", "reversed", + "submitted", "complete", - "pending_creating", ] """The lifecycle status of the transfer. + - `pending_approval` - The transfer is pending approval. - `canceled` - The transfer has been canceled. + - `pending_reviewing` - The transfer is pending review by Increase. + - `rejected` - The transfer has been rejected by Increase. - `requires_attention` - The transfer requires attention from an Increase operator. - - `pending_reviewing` - The transfer is pending review by Increase. - - `pending_approval` - The transfer is pending approval. - - `rejected` - The transfer has been rejected. - - `reversed` - The transfer has been reversed. - - `complete` - The transfer is complete. - `pending_creating` - The transfer is pending creation. + - `reversed` - The transfer has been reversed. + - `submitted` - The transfer has been submitted to Fedwire. + - `complete` - The transfer has been acknowledged by Fedwire and can be + considered complete. """ submission: Optional[Submission] = None @@ -249,3 +442,15 @@ class WireTransfer(BaseModel): For this resource it will always be `wire_transfer`. """ + + if TYPE_CHECKING: + # Some versions of Pydantic <2.8.0 have a bug and don’t allow assigning a + # value to this field, so for compatibility we avoid doing it at runtime. + __pydantic_extra__: Dict[str, object] = FieldInfo(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + # Stub to indicate that arbitrary properties are accepted. + # To access properties that are not valid identifiers you can use `getattr`, e.g. + # `getattr(obj, '$type')` + def __getattr__(self, attr: str) -> object: ... + else: + __pydantic_extra__: Dict[str, object] diff --git a/src/increase/types/wire_transfer_create_params.py b/src/increase/types/wire_transfer_create_params.py index d70f7bc76..84bdd3abc 100644 --- a/src/increase/types/wire_transfer_create_params.py +++ b/src/increase/types/wire_transfer_create_params.py @@ -2,9 +2,24 @@ from __future__ import annotations -from typing_extensions import Required, TypedDict - -__all__ = ["WireTransferCreateParams"] +import datetime +from typing import Union +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = [ + "WireTransferCreateParams", + "Creditor", + "CreditorAddress", + "CreditorAddressUnstructured", + "Remittance", + "RemittanceTax", + "RemittanceUnstructured", + "Debtor", + "DebtorAddress", + "DebtorAddressUnstructured", +] class WireTransferCreateParams(TypedDict, total=False): @@ -12,25 +27,23 @@ class WireTransferCreateParams(TypedDict, total=False): """The identifier for the account that will send the transfer.""" amount: Required[int] - """The transfer amount in cents.""" + """The transfer amount in USD cents.""" - beneficiary_name: Required[str] - """The beneficiary's name.""" + creditor: Required[Creditor] + """The person or business that is receiving the funds from the transfer.""" - message_to_recipient: Required[str] - """The message that will show on the recipient's bank statement.""" + remittance: Required[Remittance] + """Additional remittance information related to the wire transfer.""" account_number: str """The account number for the destination account.""" - beneficiary_address_line1: str - """The beneficiary's address line 1.""" - - beneficiary_address_line2: str - """The beneficiary's address line 2.""" + debtor: Debtor + """The person or business whose funds are being transferred. - beneficiary_address_line3: str - """The beneficiary's address line 3.""" + This is only necessary if you're transferring from a commingled account. + Otherwise, we'll use the associated entity's details. + """ external_account_id: str """The ID of an External Account to initiate a transfer to. @@ -39,39 +52,140 @@ class WireTransferCreateParams(TypedDict, total=False): absent. """ - originator_address_line1: str - """The originator's address line 1. + inbound_wire_drawdown_request_id: str + """ + The ID of an Inbound Wire Drawdown Request in response to which this transfer is + being sent. + """ - This is only necessary if you're transferring from a commingled account. - Otherwise, we'll use the associated entity's details. + require_approval: bool + """Whether the transfer requires explicit approval via the dashboard or API.""" + + routing_number: str + """ + The American Bankers' Association (ABA) Routing Transit Number (RTN) for the + destination account. """ - originator_address_line2: str - """The originator's address line 2. + source_account_number_id: str + """The ID of an Account Number that will be passed to the wire's recipient""" - This is only necessary if you're transferring from a commingled account. - Otherwise, we'll use the associated entity's details. + +class CreditorAddressUnstructured(TypedDict, total=False): + """Unstructured address lines.""" + + line1: Required[str] + """The address line 1.""" + + line2: str + """The address line 2.""" + + line3: str + """The address line 3.""" + + +class CreditorAddress(TypedDict, total=False): + """The person or business's address.""" + + unstructured: Required[CreditorAddressUnstructured] + """Unstructured address lines.""" + + +class Creditor(TypedDict, total=False): + """The person or business that is receiving the funds from the transfer.""" + + name: Required[str] + """The person or business's name.""" + + address: CreditorAddress + """The person or business's address.""" + + +class RemittanceTax(TypedDict, total=False): + """Internal Revenue Service (IRS) tax repayment information. + + Required if `category` is equal to `tax`. """ - originator_address_line3: str - """The originator's address line 3. + date: Required[Annotated[Union[str, datetime.date], PropertyInfo(format="iso8601")]] + """The month and year the tax payment is for, in YYYY-MM-DD format. - This is only necessary if you're transferring from a commingled account. - Otherwise, we'll use the associated entity's details. + The day is ignored. """ - originator_name: str - """The originator's name. + identification_number: Required[str] + """ + The 9-digit Tax Identification Number (TIN) or Employer Identification Number + (EIN). + """ - This is only necessary if you're transferring from a commingled account. - Otherwise, we'll use the associated entity's details. + type_code: Required[str] + """The 5-character tax type code.""" + + +class RemittanceUnstructured(TypedDict, total=False): + """Unstructured remittance information. + + Required if `category` is equal to `unstructured`. """ - require_approval: bool - """Whether the transfer requires explicit approval via the dashboard or API.""" + message: Required[str] + """The information.""" - routing_number: str + +class Remittance(TypedDict, total=False): + """Additional remittance information related to the wire transfer.""" + + category: Required[Literal["unstructured", "tax"]] + """The type of remittance information being passed. + + - `unstructured` - The wire transfer contains unstructured remittance + information. + - `tax` - The wire transfer is for tax payment purposes to the Internal Revenue + Service (IRS). """ - The American Bankers' Association (ABA) Routing Transit Number (RTN) for the - destination account. + + tax: RemittanceTax + """Internal Revenue Service (IRS) tax repayment information. + + Required if `category` is equal to `tax`. """ + + unstructured: RemittanceUnstructured + """Unstructured remittance information. + + Required if `category` is equal to `unstructured`. + """ + + +class DebtorAddressUnstructured(TypedDict, total=False): + """Unstructured address lines.""" + + line1: Required[str] + """The address line 1.""" + + line2: str + """The address line 2.""" + + line3: str + """The address line 3.""" + + +class DebtorAddress(TypedDict, total=False): + """The person or business's address.""" + + unstructured: Required[DebtorAddressUnstructured] + """Unstructured address lines.""" + + +class Debtor(TypedDict, total=False): + """The person or business whose funds are being transferred. + + This is only necessary if you're transferring from a commingled account. Otherwise, we'll use the associated entity's details. + """ + + name: Required[str] + """The person or business's name.""" + + address: DebtorAddress + """The person or business's address.""" diff --git a/src/increase/types/wire_transfer_list_params.py b/src/increase/types/wire_transfer_list_params.py index ae2166da1..ed7cfdca9 100644 --- a/src/increase/types/wire_transfer_list_params.py +++ b/src/increase/types/wire_transfer_list_params.py @@ -2,13 +2,13 @@ from __future__ import annotations -from typing import Union +from typing import List, Union from datetime import datetime -from typing_extensions import Annotated, TypedDict +from typing_extensions import Literal, Annotated, TypedDict from .._utils import PropertyInfo -__all__ = ["WireTransferListParams", "CreatedAt"] +__all__ = ["WireTransferListParams", "CreatedAt", "Status"] class WireTransferListParams(TypedDict, total=False): @@ -37,6 +37,8 @@ class WireTransferListParams(TypedDict, total=False): The default (and maximum) is 100 objects. """ + status: Status + class CreatedAt(TypedDict, total=False): after: Annotated[Union[str, datetime], PropertyInfo(format="iso8601")] @@ -62,3 +64,28 @@ class CreatedAt(TypedDict, total=False): Return results on or before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp. """ + + +_StatusReservedKeywords = TypedDict( + "_StatusReservedKeywords", + { + "in": List[ + Literal[ + "pending_approval", + "canceled", + "pending_reviewing", + "rejected", + "requires_attention", + "pending_creating", + "reversed", + "submitted", + "complete", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/tests/api_resources/entities/__init__.py b/tests/api_resources/entities/__init__.py deleted file mode 100644 index fd8019a9a..000000000 --- a/tests/api_resources/entities/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/entities/test_beneficial_owners.py b/tests/api_resources/entities/test_beneficial_owners.py deleted file mode 100644 index 6511d6691..000000000 --- a/tests/api_resources/entities/test_beneficial_owners.py +++ /dev/null @@ -1,479 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types import Entity -from increase._utils import parse_date - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBeneficialOwners: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Increase) -> None: - beneficial_owner = client.entities.beneficial_owners.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "identification": { - "method": "social_security_number", - "number": "078051120", - }, - }, - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_method_create_with_all_params(self, client: Increase) -> None: - beneficial_owner = client.entities.beneficial_owners.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "line2": "x", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "078051120", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { - "country": "x", - "description": "x", - "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", - }, - }, - }, - "company_title": "CEO", - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Increase) -> None: - response = client.entities.beneficial_owners.with_raw_response.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "identification": { - "method": "social_security_number", - "number": "078051120", - }, - }, - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Increase) -> None: - with client.entities.beneficial_owners.with_streaming_response.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "identification": { - "method": "social_security_number", - "number": "078051120", - }, - }, - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_archive(self, client: Increase) -> None: - beneficial_owner = client.entities.beneficial_owners.archive( - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_raw_response_archive(self, client: Increase) -> None: - response = client.entities.beneficial_owners.with_raw_response.archive( - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_streaming_response_archive(self, client: Increase) -> None: - with client.entities.beneficial_owners.with_streaming_response.archive( - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_update_address(self, client: Increase) -> None: - beneficial_owner = client.entities.beneficial_owners.update_address( - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_method_update_address_with_all_params(self, client: Increase) -> None: - beneficial_owner = client.entities.beneficial_owners.update_address( - address={ - "line1": "33 Liberty Street", - "line2": "Unit 2", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_raw_response_update_address(self, client: Increase) -> None: - response = client.entities.beneficial_owners.with_raw_response.update_address( - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - def test_streaming_response_update_address(self, client: Increase) -> None: - with client.entities.beneficial_owners.with_streaming_response.update_address( - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncBeneficialOwners: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncIncrease) -> None: - beneficial_owner = await async_client.entities.beneficial_owners.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "identification": { - "method": "social_security_number", - "number": "078051120", - }, - }, - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: - beneficial_owner = await async_client.entities.beneficial_owners.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "line2": "x", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "078051120", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { - "country": "x", - "description": "x", - "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", - }, - }, - }, - "company_title": "CEO", - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.beneficial_owners.with_raw_response.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "identification": { - "method": "social_security_number", - "number": "078051120", - }, - }, - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.beneficial_owners.with_streaming_response.create( - beneficial_owner={ - "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), - "address": { - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - "identification": { - "method": "social_security_number", - "number": "078051120", - }, - }, - "prongs": ["control"], - }, - entity_id="entity_n8y8tnk2p9339ti393yi", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - beneficial_owner = await response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_archive(self, async_client: AsyncIncrease) -> None: - beneficial_owner = await async_client.entities.beneficial_owners.archive( - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_raw_response_archive(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.beneficial_owners.with_raw_response.archive( - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.beneficial_owners.with_streaming_response.archive( - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - beneficial_owner = await response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_update_address(self, async_client: AsyncIncrease) -> None: - beneficial_owner = await async_client.entities.beneficial_owners.update_address( - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_method_update_address_with_all_params(self, async_client: AsyncIncrease) -> None: - beneficial_owner = await async_client.entities.beneficial_owners.update_address( - address={ - "line1": "33 Liberty Street", - "line2": "Unit 2", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_raw_response_update_address(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.beneficial_owners.with_raw_response.update_address( - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - beneficial_owner = response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - @parametrize - async def test_streaming_response_update_address(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.beneficial_owners.with_streaming_response.update_address( - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - beneficial_owner_id="entity_setup_beneficial_owner_submission_vgkyk7dj5eb4sfhdbkx7", - entity_id="entity_n8y8tnk2p9339ti393yi", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - beneficial_owner = await response.parse() - assert_matches_type(Entity, beneficial_owner, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/entities/test_industry_code.py b/tests/api_resources/entities/test_industry_code.py deleted file mode 100644 index 2c3b6ab41..000000000 --- a/tests/api_resources/entities/test_industry_code.py +++ /dev/null @@ -1,106 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types import Entity - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestIndustryCode: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Increase) -> None: - industry_code = client.entities.industry_code.create( - "string", - industry_code="5132", - ) - assert_matches_type(Entity, industry_code, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Increase) -> None: - response = client.entities.industry_code.with_raw_response.create( - "string", - industry_code="5132", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - industry_code = response.parse() - assert_matches_type(Entity, industry_code, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Increase) -> None: - with client.entities.industry_code.with_streaming_response.create( - "string", - industry_code="5132", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - industry_code = response.parse() - assert_matches_type(Entity, industry_code, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - client.entities.industry_code.with_raw_response.create( - "", - industry_code="5132", - ) - - -class TestAsyncIndustryCode: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncIncrease) -> None: - industry_code = await async_client.entities.industry_code.create( - "string", - industry_code="5132", - ) - assert_matches_type(Entity, industry_code, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.industry_code.with_raw_response.create( - "string", - industry_code="5132", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - industry_code = response.parse() - assert_matches_type(Entity, industry_code, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.industry_code.with_streaming_response.create( - "string", - industry_code="5132", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - industry_code = await response.parse() - assert_matches_type(Entity, industry_code, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - await async_client.entities.industry_code.with_raw_response.create( - "", - industry_code="5132", - ) diff --git a/tests/api_resources/intrafi/__init__.py b/tests/api_resources/intrafi/__init__.py deleted file mode 100644 index fd8019a9a..000000000 --- a/tests/api_resources/intrafi/__init__.py +++ /dev/null @@ -1 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. diff --git a/tests/api_resources/intrafi/test_balances.py b/tests/api_resources/intrafi/test_balances.py deleted file mode 100644 index 19f5cef5b..000000000 --- a/tests/api_resources/intrafi/test_balances.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types.intrafi import IntrafiBalance - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestBalances: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_retrieve(self, client: Increase) -> None: - balance = client.intrafi.balances.retrieve( - "string", - ) - assert_matches_type(IntrafiBalance, balance, path=["response"]) - - @parametrize - def test_raw_response_retrieve(self, client: Increase) -> None: - response = client.intrafi.balances.with_raw_response.retrieve( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - balance = response.parse() - assert_matches_type(IntrafiBalance, balance, path=["response"]) - - @parametrize - def test_streaming_response_retrieve(self, client: Increase) -> None: - with client.intrafi.balances.with_streaming_response.retrieve( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - balance = response.parse() - assert_matches_type(IntrafiBalance, balance, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - client.intrafi.balances.with_raw_response.retrieve( - "", - ) - - -class TestAsyncBalances: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: - balance = await async_client.intrafi.balances.retrieve( - "string", - ) - assert_matches_type(IntrafiBalance, balance, path=["response"]) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.balances.with_raw_response.retrieve( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - balance = response.parse() - assert_matches_type(IntrafiBalance, balance, path=["response"]) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.balances.with_streaming_response.retrieve( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - balance = await response.parse() - assert_matches_type(IntrafiBalance, balance, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): - await async_client.intrafi.balances.with_raw_response.retrieve( - "", - ) diff --git a/tests/api_resources/simulations/test_account_statements.py b/tests/api_resources/simulations/test_account_statements.py index 619881fcb..e1ca7c033 100644 --- a/tests/api_resources/simulations/test_account_statements.py +++ b/tests/api_resources/simulations/test_account_statements.py @@ -50,7 +50,9 @@ def test_streaming_response_create(self, client: Increase) -> None: class TestAsyncAccountStatements: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -67,7 +69,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_statement = response.parse() + account_statement = await response.parse() assert_matches_type(AccountStatement, account_statement, path=["response"]) @parametrize diff --git a/tests/api_resources/simulations/test_account_transfers.py b/tests/api_resources/simulations/test_account_transfers.py index 6df6e1ad0..b9ef8d0ed 100644 --- a/tests/api_resources/simulations/test_account_transfers.py +++ b/tests/api_resources/simulations/test_account_transfers.py @@ -17,19 +17,17 @@ class TestAccountTransfers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_method_complete(self, client: Increase) -> None: account_transfer = client.simulations.account_transfers.complete( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_raw_response_complete(self, client: Increase) -> None: response = client.simulations.account_transfers.with_raw_response.complete( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True @@ -37,11 +35,10 @@ def test_raw_response_complete(self, client: Increase) -> None: account_transfer = response.parse() assert_matches_type(AccountTransfer, account_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_streaming_response_complete(self, client: Increase) -> None: with client.simulations.account_transfers.with_streaming_response.complete( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -51,7 +48,6 @@ def test_streaming_response_complete(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_path_params_complete(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_transfer_id` but received ''"): @@ -61,33 +57,32 @@ def test_path_params_complete(self, client: Increase) -> None: class TestAsyncAccountTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_method_complete(self, async_client: AsyncIncrease) -> None: account_transfer = await async_client.simulations.account_transfers.complete( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_raw_response_complete(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.account_transfers.with_raw_response.complete( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_transfer = response.parse() + account_transfer = await response.parse() assert_matches_type(AccountTransfer, account_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_streaming_response_complete(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.account_transfers.with_streaming_response.complete( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -97,7 +92,6 @@ async def test_streaming_response_complete(self, async_client: AsyncIncrease) -> assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_path_params_complete(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_transfer_id` but received ''"): diff --git a/tests/api_resources/simulations/test_ach_transfers.py b/tests/api_resources/simulations/test_ach_transfers.py index 471d9e1d0..9340180f5 100644 --- a/tests/api_resources/simulations/test_ach_transfers.py +++ b/tests/api_resources/simulations/test_ach_transfers.py @@ -9,8 +9,7 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import ACHTransfer, InboundACHTransfer -from increase._utils import parse_datetime +from increase.types import ACHTransfer base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -19,77 +18,108 @@ class TestACHTransfers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create_inbound(self, client: Increase) -> None: - ach_transfer = client.simulations.ach_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + def test_method_acknowledge(self, client: Increase) -> None: + ach_transfer = client.simulations.ach_transfers.acknowledge( + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) - - @parametrize - def test_method_create_inbound_with_all_params(self, client: Increase) -> None: - ach_transfer = client.simulations.ach_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - company_descriptive_date="x", - company_discretionary_data="x", - company_entry_description="x", - company_id="x", - company_name="x", - receiver_id_number="x", - receiver_name="x", - resolve_at=parse_datetime("2019-12-27T18:11:19.117Z"), + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + def test_raw_response_acknowledge(self, client: Increase) -> None: + response = client.simulations.ach_transfers.with_raw_response.acknowledge( + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ach_transfer = response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize - def test_raw_response_create_inbound(self, client: Increase) -> None: - response = client.simulations.ach_transfers.with_raw_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + def test_streaming_response_acknowledge(self, client: Increase) -> None: + with client.simulations.ach_transfers.with_streaming_response.acknowledge( + "ach_transfer_uoxatyh3lt5evrsdvo7q", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ach_transfer = response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_acknowledge(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): + client.simulations.ach_transfers.with_raw_response.acknowledge( + "", + ) + + @parametrize + def test_method_create_notification_of_change(self, client: Increase) -> None: + ach_transfer = client.simulations.ach_transfers.create_notification_of_change( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + change_code="incorrect_routing_number", + corrected_data="123456789", + ) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + def test_raw_response_create_notification_of_change(self, client: Increase) -> None: + response = client.simulations.ach_transfers.with_raw_response.create_notification_of_change( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + change_code="incorrect_routing_number", + corrected_data="123456789", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" ach_transfer = response.parse() - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize - def test_streaming_response_create_inbound(self, client: Increase) -> None: - with client.simulations.ach_transfers.with_streaming_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + def test_streaming_response_create_notification_of_change(self, client: Increase) -> None: + with client.simulations.ach_transfers.with_streaming_response.create_notification_of_change( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + change_code="incorrect_routing_number", + corrected_data="123456789", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" ach_transfer = response.parse() - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") + @parametrize + def test_path_params_create_notification_of_change(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): + client.simulations.ach_transfers.with_raw_response.create_notification_of_change( + ach_transfer_id="", + change_code="incorrect_routing_number", + corrected_data="123456789", + ) + @parametrize def test_method_return(self, client: Increase) -> None: ach_transfer = client.simulations.ach_transfers.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_method_return_with_all_params(self, client: Increase) -> None: ach_transfer = client.simulations.ach_transfers.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", reason="insufficient_fund", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_raw_response_return(self, client: Increase) -> None: response = client.simulations.ach_transfers.with_raw_response.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True @@ -97,11 +127,10 @@ def test_raw_response_return(self, client: Increase) -> None: ach_transfer = response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_streaming_response_return(self, client: Increase) -> None: with client.simulations.ach_transfers.with_streaming_response.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -111,27 +140,70 @@ def test_streaming_response_return(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_path_params_return(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): client.simulations.ach_transfers.with_raw_response.return_( - "", + ach_transfer_id="", + ) + + @parametrize + def test_method_settle(self, client: Increase) -> None: + ach_transfer = client.simulations.ach_transfers.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + ) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + def test_method_settle_with_all_params(self, client: Increase) -> None: + ach_transfer = client.simulations.ach_transfers.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + inbound_funds_hold_behavior="release_immediately", + ) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + def test_raw_response_settle(self, client: Increase) -> None: + response = client.simulations.ach_transfers.with_raw_response.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ach_transfer = response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + def test_streaming_response_settle(self, client: Increase) -> None: + with client.simulations.ach_transfers.with_streaming_response.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ach_transfer = response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_settle(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): + client.simulations.ach_transfers.with_raw_response.settle( + ach_transfer_id="", ) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_method_submit(self, client: Increase) -> None: ach_transfer = client.simulations.ach_transfers.submit( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_raw_response_submit(self, client: Increase) -> None: response = client.simulations.ach_transfers.with_raw_response.submit( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True @@ -139,11 +211,10 @@ def test_raw_response_submit(self, client: Increase) -> None: ach_transfer = response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_streaming_response_submit(self, client: Increase) -> None: with client.simulations.ach_transfers.with_streaming_response.submit( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -153,7 +224,6 @@ def test_streaming_response_submit(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_path_params_submit(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): @@ -163,92 +233,124 @@ def test_path_params_submit(self, client: Increase) -> None: class TestAsyncACHTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize - async def test_method_create_inbound(self, async_client: AsyncIncrease) -> None: - ach_transfer = await async_client.simulations.ach_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + async def test_method_acknowledge(self, async_client: AsyncIncrease) -> None: + ach_transfer = await async_client.simulations.ach_transfers.acknowledge( + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) - - @parametrize - async def test_method_create_inbound_with_all_params(self, async_client: AsyncIncrease) -> None: - ach_transfer = await async_client.simulations.ach_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - company_descriptive_date="x", - company_discretionary_data="x", - company_entry_description="x", - company_id="x", - company_name="x", - receiver_id_number="x", - receiver_name="x", - resolve_at=parse_datetime("2019-12-27T18:11:19.117Z"), + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + async def test_raw_response_acknowledge(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.ach_transfers.with_raw_response.acknowledge( + "ach_transfer_uoxatyh3lt5evrsdvo7q", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ach_transfer = await response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_acknowledge(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.ach_transfers.with_streaming_response.acknowledge( + "ach_transfer_uoxatyh3lt5evrsdvo7q", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ach_transfer = await response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_acknowledge(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): + await async_client.simulations.ach_transfers.with_raw_response.acknowledge( + "", + ) + + @parametrize + async def test_method_create_notification_of_change(self, async_client: AsyncIncrease) -> None: + ach_transfer = await async_client.simulations.ach_transfers.create_notification_of_change( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + change_code="incorrect_routing_number", + corrected_data="123456789", ) - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize - async def test_raw_response_create_inbound(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.ach_transfers.with_raw_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + async def test_raw_response_create_notification_of_change(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.ach_transfers.with_raw_response.create_notification_of_change( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + change_code="incorrect_routing_number", + corrected_data="123456789", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) + ach_transfer = await response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize - async def test_streaming_response_create_inbound(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.ach_transfers.with_streaming_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + async def test_streaming_response_create_notification_of_change(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.ach_transfers.with_streaming_response.create_notification_of_change( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + change_code="incorrect_routing_number", + corrected_data="123456789", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" ach_transfer = await response.parse() - assert_matches_type(InboundACHTransfer, ach_transfer, path=["response"]) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") + @parametrize + async def test_path_params_create_notification_of_change(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): + await async_client.simulations.ach_transfers.with_raw_response.create_notification_of_change( + ach_transfer_id="", + change_code="incorrect_routing_number", + corrected_data="123456789", + ) + @parametrize async def test_method_return(self, async_client: AsyncIncrease) -> None: ach_transfer = await async_client.simulations.ach_transfers.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_method_return_with_all_params(self, async_client: AsyncIncrease) -> None: ach_transfer = await async_client.simulations.ach_transfers.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", reason="insufficient_fund", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_raw_response_return(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.ach_transfers.with_raw_response.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() + ach_transfer = await response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_streaming_response_return(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.ach_transfers.with_streaming_response.return_( - "string", + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -258,39 +360,81 @@ async def test_streaming_response_return(self, async_client: AsyncIncrease) -> N assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_path_params_return(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): await async_client.simulations.ach_transfers.with_raw_response.return_( - "", + ach_transfer_id="", + ) + + @parametrize + async def test_method_settle(self, async_client: AsyncIncrease) -> None: + ach_transfer = await async_client.simulations.ach_transfers.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + ) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + async def test_method_settle_with_all_params(self, async_client: AsyncIncrease) -> None: + ach_transfer = await async_client.simulations.ach_transfers.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + inbound_funds_hold_behavior="release_immediately", + ) + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + async def test_raw_response_settle(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.ach_transfers.with_raw_response.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + ach_transfer = await response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_settle(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.ach_transfers.with_streaming_response.settle( + ach_transfer_id="ach_transfer_uoxatyh3lt5evrsdvo7q", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + ach_transfer = await response.parse() + assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_settle(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): + await async_client.simulations.ach_transfers.with_raw_response.settle( + ach_transfer_id="", ) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_method_submit(self, async_client: AsyncIncrease) -> None: ach_transfer = await async_client.simulations.ach_transfers.submit( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_raw_response_submit(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.ach_transfers.with_raw_response.submit( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() + ach_transfer = await response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.ach_transfers.with_streaming_response.submit( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -300,7 +444,6 @@ async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> N assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_path_params_submit(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `ach_transfer_id` but received ''"): diff --git a/tests/api_resources/simulations/test_card_authentications.py b/tests/api_resources/simulations/test_card_authentications.py new file mode 100644 index 000000000..6f5aabc2b --- /dev/null +++ b/tests/api_resources/simulations/test_card_authentications.py @@ -0,0 +1,274 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPayment + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardAuthentications: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_authentication = client.simulations.card_authentications.create( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_authentication = client.simulations.card_authentications.create( + card_id="card_oubs0hwk5rn6knuecxg2", + category="payment_authentication", + device_channel="app", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_country="US", + merchant_name="x", + purchase_amount=1000, + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_authentications.with_raw_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authentication = response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_authentications.with_streaming_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authentication = response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_challenge_attempts(self, client: Increase) -> None: + card_authentication = client.simulations.card_authentications.challenge_attempts( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + one_time_code="123456", + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + def test_raw_response_challenge_attempts(self, client: Increase) -> None: + response = client.simulations.card_authentications.with_raw_response.challenge_attempts( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + one_time_code="123456", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authentication = response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + def test_streaming_response_challenge_attempts(self, client: Increase) -> None: + with client.simulations.card_authentications.with_streaming_response.challenge_attempts( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + one_time_code="123456", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authentication = response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_challenge_attempts(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_payment_id` but received ''"): + client.simulations.card_authentications.with_raw_response.challenge_attempts( + card_payment_id="", + one_time_code="123456", + ) + + @parametrize + def test_method_challenges(self, client: Increase) -> None: + card_authentication = client.simulations.card_authentications.challenges( + "card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + def test_raw_response_challenges(self, client: Increase) -> None: + response = client.simulations.card_authentications.with_raw_response.challenges( + "card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authentication = response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + def test_streaming_response_challenges(self, client: Increase) -> None: + with client.simulations.card_authentications.with_streaming_response.challenges( + "card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authentication = response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_challenges(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_payment_id` but received ''"): + client.simulations.card_authentications.with_raw_response.challenges( + "", + ) + + +class TestAsyncCardAuthentications: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_authentication = await async_client.simulations.card_authentications.create( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_authentication = await async_client.simulations.card_authentications.create( + card_id="card_oubs0hwk5rn6knuecxg2", + category="payment_authentication", + device_channel="app", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_country="US", + merchant_name="x", + purchase_amount=1000, + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_authentications.with_raw_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authentication = await response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_authentications.with_streaming_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authentication = await response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_challenge_attempts(self, async_client: AsyncIncrease) -> None: + card_authentication = await async_client.simulations.card_authentications.challenge_attempts( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + one_time_code="123456", + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + async def test_raw_response_challenge_attempts(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_authentications.with_raw_response.challenge_attempts( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + one_time_code="123456", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authentication = await response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + async def test_streaming_response_challenge_attempts(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_authentications.with_streaming_response.challenge_attempts( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + one_time_code="123456", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authentication = await response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_challenge_attempts(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_payment_id` but received ''"): + await async_client.simulations.card_authentications.with_raw_response.challenge_attempts( + card_payment_id="", + one_time_code="123456", + ) + + @parametrize + async def test_method_challenges(self, async_client: AsyncIncrease) -> None: + card_authentication = await async_client.simulations.card_authentications.challenges( + "card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + async def test_raw_response_challenges(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_authentications.with_raw_response.challenges( + "card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authentication = await response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + @parametrize + async def test_streaming_response_challenges(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_authentications.with_streaming_response.challenges( + "card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authentication = await response.parse() + assert_matches_type(CardPayment, card_authentication, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_challenges(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_payment_id` but received ''"): + await async_client.simulations.card_authentications.with_raw_response.challenges( + "", + ) diff --git a/tests/api_resources/simulations/test_card_authorization_expirations.py b/tests/api_resources/simulations/test_card_authorization_expirations.py new file mode 100644 index 000000000..40d0f69e5 --- /dev/null +++ b/tests/api_resources/simulations/test_card_authorization_expirations.py @@ -0,0 +1,86 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPayment + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardAuthorizationExpirations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_authorization_expiration = client.simulations.card_authorization_expirations.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_authorization_expiration, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_authorization_expirations.with_raw_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authorization_expiration = response.parse() + assert_matches_type(CardPayment, card_authorization_expiration, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_authorization_expirations.with_streaming_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authorization_expiration = response.parse() + assert_matches_type(CardPayment, card_authorization_expiration, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardAuthorizationExpirations: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_authorization_expiration = await async_client.simulations.card_authorization_expirations.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_authorization_expiration, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_authorization_expirations.with_raw_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authorization_expiration = await response.parse() + assert_matches_type(CardPayment, card_authorization_expiration, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_authorization_expirations.with_streaming_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authorization_expiration = await response.parse() + assert_matches_type(CardPayment, card_authorization_expiration, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_card_authorizations.py b/tests/api_resources/simulations/test_card_authorizations.py new file mode 100644 index 000000000..4dd066d31 --- /dev/null +++ b/tests/api_resources/simulations/test_card_authorizations.py @@ -0,0 +1,138 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types.simulations import CardAuthorizationCreateResponse + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardAuthorizations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_authorization = client.simulations.card_authorizations.create( + amount=1000, + ) + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_authorization = client.simulations.card_authorizations.create( + amount=1000, + authenticated_card_payment_id="authenticated_card_payment_id", + card_id="card_oubs0hwk5rn6knuecxg2", + decline_reason="account_closed", + digital_wallet_token_id="digital_wallet_token_id", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_city="New York", + merchant_country="US", + merchant_descriptor="AMAZON.COM", + merchant_state="NY", + network_details={"visa": {"stand_in_processing_reason": "issuer_error"}}, + network_risk_score=0, + physical_card_id="physical_card_id", + processing_category={ + "category": "account_funding", + "refund": {"original_card_payment_id": "original_card_payment_id"}, + }, + terminal_id="x", + ) + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_authorizations.with_raw_response.create( + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authorization = response.parse() + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_authorizations.with_streaming_response.create( + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authorization = response.parse() + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardAuthorizations: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_authorization = await async_client.simulations.card_authorizations.create( + amount=1000, + ) + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_authorization = await async_client.simulations.card_authorizations.create( + amount=1000, + authenticated_card_payment_id="authenticated_card_payment_id", + card_id="card_oubs0hwk5rn6knuecxg2", + decline_reason="account_closed", + digital_wallet_token_id="digital_wallet_token_id", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_city="New York", + merchant_country="US", + merchant_descriptor="AMAZON.COM", + merchant_state="NY", + network_details={"visa": {"stand_in_processing_reason": "issuer_error"}}, + network_risk_score=0, + physical_card_id="physical_card_id", + processing_category={ + "category": "account_funding", + "refund": {"original_card_payment_id": "original_card_payment_id"}, + }, + terminal_id="x", + ) + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_authorizations.with_raw_response.create( + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_authorization = await response.parse() + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_authorizations.with_streaming_response.create( + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_authorization = await response.parse() + assert_matches_type(CardAuthorizationCreateResponse, card_authorization, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_card_balance_inquiries.py b/tests/api_resources/simulations/test_card_balance_inquiries.py new file mode 100644 index 000000000..afdcbd4fa --- /dev/null +++ b/tests/api_resources/simulations/test_card_balance_inquiries.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPayment + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardBalanceInquiries: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_balance_inquiry = client.simulations.card_balance_inquiries.create() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_balance_inquiry = client.simulations.card_balance_inquiries.create( + balance=1000000, + card_id="card_oubs0hwk5rn6knuecxg2", + decline_reason="account_closed", + digital_wallet_token_id="digital_wallet_token_id", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_city="New York", + merchant_country="US", + merchant_descriptor="CITIBANK", + merchant_state="NY", + network_details={"visa": {"stand_in_processing_reason": "issuer_error"}}, + network_risk_score=0, + physical_card_id="physical_card_id", + terminal_id="x", + ) + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_balance_inquiries.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_balance_inquiry = response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_balance_inquiries.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_balance_inquiry = response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardBalanceInquiries: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_balance_inquiry = await async_client.simulations.card_balance_inquiries.create() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_balance_inquiry = await async_client.simulations.card_balance_inquiries.create( + balance=1000000, + card_id="card_oubs0hwk5rn6knuecxg2", + decline_reason="account_closed", + digital_wallet_token_id="digital_wallet_token_id", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_city="New York", + merchant_country="US", + merchant_descriptor="CITIBANK", + merchant_state="NY", + network_details={"visa": {"stand_in_processing_reason": "issuer_error"}}, + network_risk_score=0, + physical_card_id="physical_card_id", + terminal_id="x", + ) + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_balance_inquiries.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_balance_inquiry = await response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_balance_inquiries.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_balance_inquiry = await response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_card_disputes.py b/tests/api_resources/simulations/test_card_disputes.py index 8c89036e3..a3ec76146 100644 --- a/tests/api_resources/simulations/test_card_disputes.py +++ b/tests/api_resources/simulations/test_card_disputes.py @@ -20,25 +20,37 @@ class TestCardDisputes: @parametrize def test_method_action(self, client: Increase) -> None: card_dispute = client.simulations.card_disputes.action( - "string", - status="rejected", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize def test_method_action_with_all_params(self, client: Increase) -> None: card_dispute = client.simulations.card_disputes.action( - "string", - status="rejected", - explanation="This was a valid recurring transaction", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + visa={ + "action": "accept_user_submission", + "accept_chargeback": {}, + "accept_user_submission": {}, + "decline_user_prearbitration": {}, + "receive_merchant_prearbitration": {}, + "represent": {}, + "request_further_information": {"reason": "x"}, + "time_out_chargeback": {}, + "time_out_merchant_prearbitration": {}, + "time_out_representment": {}, + "time_out_user_prearbitration": {}, + }, ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize def test_raw_response_action(self, client: Increase) -> None: response = client.simulations.card_disputes.with_raw_response.action( - "string", - status="rejected", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", ) assert response.is_closed is True @@ -49,8 +61,8 @@ def test_raw_response_action(self, client: Increase) -> None: @parametrize def test_streaming_response_action(self, client: Increase) -> None: with client.simulations.card_disputes.with_streaming_response.action( - "string", - status="rejected", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -64,48 +76,62 @@ def test_streaming_response_action(self, client: Increase) -> None: def test_path_params_action(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): client.simulations.card_disputes.with_raw_response.action( - "", - status="rejected", + card_dispute_id="", + network="visa", ) class TestAsyncCardDisputes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_action(self, async_client: AsyncIncrease) -> None: card_dispute = await async_client.simulations.card_disputes.action( - "string", - status="rejected", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize async def test_method_action_with_all_params(self, async_client: AsyncIncrease) -> None: card_dispute = await async_client.simulations.card_disputes.action( - "string", - status="rejected", - explanation="This was a valid recurring transaction", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + visa={ + "action": "accept_user_submission", + "accept_chargeback": {}, + "accept_user_submission": {}, + "decline_user_prearbitration": {}, + "receive_merchant_prearbitration": {}, + "represent": {}, + "request_further_information": {"reason": "x"}, + "time_out_chargeback": {}, + "time_out_merchant_prearbitration": {}, + "time_out_representment": {}, + "time_out_user_prearbitration": {}, + }, ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize async def test_raw_response_action(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.card_disputes.with_raw_response.action( - "string", - status="rejected", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_dispute = response.parse() + card_dispute = await response.parse() assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize async def test_streaming_response_action(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.card_disputes.with_streaming_response.action( - "string", - status="rejected", + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -119,6 +145,6 @@ async def test_streaming_response_action(self, async_client: AsyncIncrease) -> N async def test_path_params_action(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): await async_client.simulations.card_disputes.with_raw_response.action( - "", - status="rejected", + card_dispute_id="", + network="visa", ) diff --git a/tests/api_resources/simulations/test_card_fuel_confirmations.py b/tests/api_resources/simulations/test_card_fuel_confirmations.py new file mode 100644 index 000000000..905d30026 --- /dev/null +++ b/tests/api_resources/simulations/test_card_fuel_confirmations.py @@ -0,0 +1,92 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPayment + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardFuelConfirmations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_fuel_confirmation = client.simulations.card_fuel_confirmations.create( + amount=5000, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_fuel_confirmation, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_fuel_confirmations.with_raw_response.create( + amount=5000, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_fuel_confirmation = response.parse() + assert_matches_type(CardPayment, card_fuel_confirmation, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_fuel_confirmations.with_streaming_response.create( + amount=5000, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_fuel_confirmation = response.parse() + assert_matches_type(CardPayment, card_fuel_confirmation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardFuelConfirmations: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_fuel_confirmation = await async_client.simulations.card_fuel_confirmations.create( + amount=5000, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_fuel_confirmation, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_fuel_confirmations.with_raw_response.create( + amount=5000, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_fuel_confirmation = await response.parse() + assert_matches_type(CardPayment, card_fuel_confirmation, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_fuel_confirmations.with_streaming_response.create( + amount=5000, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_fuel_confirmation = await response.parse() + assert_matches_type(CardPayment, card_fuel_confirmation, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_card_increments.py b/tests/api_resources/simulations/test_card_increments.py new file mode 100644 index 000000000..b702ba581 --- /dev/null +++ b/tests/api_resources/simulations/test_card_increments.py @@ -0,0 +1,110 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPayment + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardIncrements: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_increment = client.simulations.card_increments.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_increment, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_increment = client.simulations.card_increments.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + event_subscription_id="event_subscription_id", + ) + assert_matches_type(CardPayment, card_increment, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_increments.with_raw_response.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_increment = response.parse() + assert_matches_type(CardPayment, card_increment, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_increments.with_streaming_response.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_increment = response.parse() + assert_matches_type(CardPayment, card_increment, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardIncrements: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_increment = await async_client.simulations.card_increments.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_increment, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_increment = await async_client.simulations.card_increments.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + event_subscription_id="event_subscription_id", + ) + assert_matches_type(CardPayment, card_increment, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_increments.with_raw_response.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_increment = await response.parse() + assert_matches_type(CardPayment, card_increment, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_increments.with_streaming_response.create( + amount=500, + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_increment = await response.parse() + assert_matches_type(CardPayment, card_increment, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_card_refunds.py b/tests/api_resources/simulations/test_card_refunds.py index 979ddd02c..f75e12c4c 100644 --- a/tests/api_resources/simulations/test_card_refunds.py +++ b/tests/api_resources/simulations/test_card_refunds.py @@ -19,16 +19,21 @@ class TestCardRefunds: @parametrize def test_method_create(self, client: Increase) -> None: + card_refund = client.simulations.card_refunds.create() + assert_matches_type(Transaction, card_refund, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: card_refund = client.simulations.card_refunds.create( + amount=1, + pending_transaction_id="pending_transaction_id", transaction_id="transaction_uyrp7fld2ium70oa7oi", ) assert_matches_type(Transaction, card_refund, path=["response"]) @parametrize def test_raw_response_create(self, client: Increase) -> None: - response = client.simulations.card_refunds.with_raw_response.create( - transaction_id="transaction_uyrp7fld2ium70oa7oi", - ) + response = client.simulations.card_refunds.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -37,9 +42,7 @@ def test_raw_response_create(self, client: Increase) -> None: @parametrize def test_streaming_response_create(self, client: Increase) -> None: - with client.simulations.card_refunds.with_streaming_response.create( - transaction_id="transaction_uyrp7fld2ium70oa7oi", - ) as response: + with client.simulations.card_refunds.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -50,31 +53,36 @@ def test_streaming_response_create(self, client: Increase) -> None: class TestAsyncCardRefunds: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_refund = await async_client.simulations.card_refunds.create() + assert_matches_type(Transaction, card_refund, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: card_refund = await async_client.simulations.card_refunds.create( + amount=1, + pending_transaction_id="pending_transaction_id", transaction_id="transaction_uyrp7fld2ium70oa7oi", ) assert_matches_type(Transaction, card_refund, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.card_refunds.with_raw_response.create( - transaction_id="transaction_uyrp7fld2ium70oa7oi", - ) + response = await async_client.simulations.card_refunds.with_raw_response.create() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_refund = response.parse() + card_refund = await response.parse() assert_matches_type(Transaction, card_refund, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.card_refunds.with_streaming_response.create( - transaction_id="transaction_uyrp7fld2ium70oa7oi", - ) as response: + async with async_client.simulations.card_refunds.with_streaming_response.create() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/simulations/test_card_reversals.py b/tests/api_resources/simulations/test_card_reversals.py new file mode 100644 index 000000000..42506f6b5 --- /dev/null +++ b/tests/api_resources/simulations/test_card_reversals.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPayment + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardReversals: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_reversal = client.simulations.card_reversals.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_reversal = client.simulations.card_reversals.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + amount=1, + ) + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_reversals.with_raw_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_reversal = response.parse() + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_reversals.with_streaming_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_reversal = response.parse() + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardReversals: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_reversal = await async_client.simulations.card_reversals.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_reversal = await async_client.simulations.card_reversals.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + amount=1, + ) + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_reversals.with_raw_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_reversal = await response.parse() + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_reversals.with_streaming_response.create( + card_payment_id="card_payment_nd3k2kacrqjli8482ave", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_reversal = await response.parse() + assert_matches_type(CardPayment, card_reversal, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_card_settlements.py b/tests/api_resources/simulations/test_card_settlements.py new file mode 100644 index 000000000..ecd707010 --- /dev/null +++ b/tests/api_resources/simulations/test_card_settlements.py @@ -0,0 +1,110 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import Transaction + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardSettlements: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_settlement = client.simulations.card_settlements.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + ) + assert_matches_type(Transaction, card_settlement, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_settlement = client.simulations.card_settlements.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + amount=1, + ) + assert_matches_type(Transaction, card_settlement, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_settlements.with_raw_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_settlement = response.parse() + assert_matches_type(Transaction, card_settlement, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_settlements.with_streaming_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_settlement = response.parse() + assert_matches_type(Transaction, card_settlement, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardSettlements: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_settlement = await async_client.simulations.card_settlements.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + ) + assert_matches_type(Transaction, card_settlement, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_settlement = await async_client.simulations.card_settlements.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + amount=1, + ) + assert_matches_type(Transaction, card_settlement, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_settlements.with_raw_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_settlement = await response.parse() + assert_matches_type(Transaction, card_settlement, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_settlements.with_streaming_response.create( + card_id="card_oubs0hwk5rn6knuecxg2", + pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_settlement = await response.parse() + assert_matches_type(Transaction, card_settlement, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_card_tokens.py b/tests/api_resources/simulations/test_card_tokens.py new file mode 100644 index 000000000..0dec7014f --- /dev/null +++ b/tests/api_resources/simulations/test_card_tokens.py @@ -0,0 +1,117 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardToken +from increase._utils import parse_date + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardTokens: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_token = client.simulations.card_tokens.create() + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_token = client.simulations.card_tokens.create( + capabilities=[ + { + "cross_border_push_transfers": "supported", + "domestic_push_transfers": "supported", + "route": "visa", + } + ], + expiration=parse_date("2019-12-27"), + last4="1234", + outcome={ + "result": "approve", + "decline": {"reason": "do_not_honor"}, + }, + prefix="41234567", + primary_account_number_length=16, + ) + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_tokens.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_tokens.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardTokens: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_token = await async_client.simulations.card_tokens.create() + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_token = await async_client.simulations.card_tokens.create( + capabilities=[ + { + "cross_border_push_transfers": "supported", + "domestic_push_transfers": "supported", + "route": "visa", + } + ], + expiration=parse_date("2019-12-27"), + last4="1234", + outcome={ + "result": "approve", + "decline": {"reason": "do_not_honor"}, + }, + prefix="41234567", + primary_account_number_length=16, + ) + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_tokens.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = await response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_tokens.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = await response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_cards.py b/tests/api_resources/simulations/test_cards.py deleted file mode 100644 index eef528851..000000000 --- a/tests/api_resources/simulations/test_cards.py +++ /dev/null @@ -1,203 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types import Transaction -from increase.types.simulations import CardAuthorizationSimulation - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestCards: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_authorize(self, client: Increase) -> None: - card = client.simulations.cards.authorize( - amount=1000, - ) - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - @parametrize - def test_method_authorize_with_all_params(self, client: Increase) -> None: - card = client.simulations.cards.authorize( - amount=1000, - card_id="card_oubs0hwk5rn6knuecxg2", - digital_wallet_token_id="string", - event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", - merchant_acceptor_id="5665270011000168", - merchant_category_code="5734", - merchant_city="New York", - merchant_country="US", - merchant_descriptor="AMAZON.COM", - physical_card_id="string", - ) - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - @parametrize - def test_raw_response_authorize(self, client: Increase) -> None: - response = client.simulations.cards.with_raw_response.authorize( - amount=1000, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - @parametrize - def test_streaming_response_authorize(self, client: Increase) -> None: - with client.simulations.cards.with_streaming_response.authorize( - amount=1000, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - card = response.parse() - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_settlement(self, client: Increase) -> None: - card = client.simulations.cards.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - ) - assert_matches_type(Transaction, card, path=["response"]) - - @parametrize - def test_method_settlement_with_all_params(self, client: Increase) -> None: - card = client.simulations.cards.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - amount=1, - ) - assert_matches_type(Transaction, card, path=["response"]) - - @parametrize - def test_raw_response_settlement(self, client: Increase) -> None: - response = client.simulations.cards.with_raw_response.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() - assert_matches_type(Transaction, card, path=["response"]) - - @parametrize - def test_streaming_response_settlement(self, client: Increase) -> None: - with client.simulations.cards.with_streaming_response.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - card = response.parse() - assert_matches_type(Transaction, card, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncCards: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_authorize(self, async_client: AsyncIncrease) -> None: - card = await async_client.simulations.cards.authorize( - amount=1000, - ) - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - @parametrize - async def test_method_authorize_with_all_params(self, async_client: AsyncIncrease) -> None: - card = await async_client.simulations.cards.authorize( - amount=1000, - card_id="card_oubs0hwk5rn6knuecxg2", - digital_wallet_token_id="string", - event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", - merchant_acceptor_id="5665270011000168", - merchant_category_code="5734", - merchant_city="New York", - merchant_country="US", - merchant_descriptor="AMAZON.COM", - physical_card_id="string", - ) - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - @parametrize - async def test_raw_response_authorize(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.cards.with_raw_response.authorize( - amount=1000, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - @parametrize - async def test_streaming_response_authorize(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.cards.with_streaming_response.authorize( - amount=1000, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - card = await response.parse() - assert_matches_type(CardAuthorizationSimulation, card, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_settlement(self, async_client: AsyncIncrease) -> None: - card = await async_client.simulations.cards.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - ) - assert_matches_type(Transaction, card, path=["response"]) - - @parametrize - async def test_method_settlement_with_all_params(self, async_client: AsyncIncrease) -> None: - card = await async_client.simulations.cards.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - amount=1, - ) - assert_matches_type(Transaction, card, path=["response"]) - - @parametrize - async def test_raw_response_settlement(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.cards.with_raw_response.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() - assert_matches_type(Transaction, card, path=["response"]) - - @parametrize - async def test_streaming_response_settlement(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.cards.with_streaming_response.settlement( - card_id="card_oubs0hwk5rn6knuecxg2", - pending_transaction_id="pending_transaction_k1sfetcau2qbvjbzgju4", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - card = await response.parse() - assert_matches_type(Transaction, card, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_check_deposits.py b/tests/api_resources/simulations/test_check_deposits.py index 395655e01..9d422a43a 100644 --- a/tests/api_resources/simulations/test_check_deposits.py +++ b/tests/api_resources/simulations/test_check_deposits.py @@ -17,19 +17,64 @@ class TestCheckDeposits: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") + @parametrize + def test_method_adjustment(self, client: Increase) -> None: + check_deposit = client.simulations.check_deposits.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + def test_method_adjustment_with_all_params(self, client: Increase) -> None: + check_deposit = client.simulations.check_deposits.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + amount=-1000000000, + reason="late_return", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + def test_raw_response_adjustment(self, client: Increase) -> None: + response = client.simulations.check_deposits.with_raw_response.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check_deposit = response.parse() + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_adjustment(self, client: Increase) -> None: + with client.simulations.check_deposits.with_streaming_response.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check_deposit = response.parse() + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_adjustment(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"): + client.simulations.check_deposits.with_raw_response.adjustment( + check_deposit_id="", + ) + @parametrize def test_method_reject(self, client: Increase) -> None: check_deposit = client.simulations.check_deposits.reject( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_raw_response_reject(self, client: Increase) -> None: response = client.simulations.check_deposits.with_raw_response.reject( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True @@ -37,11 +82,10 @@ def test_raw_response_reject(self, client: Increase) -> None: check_deposit = response.parse() assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_streaming_response_reject(self, client: Increase) -> None: with client.simulations.check_deposits.with_streaming_response.reject( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -51,7 +95,6 @@ def test_streaming_response_reject(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_path_params_reject(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"): @@ -62,14 +105,14 @@ def test_path_params_reject(self, client: Increase) -> None: @parametrize def test_method_return(self, client: Increase) -> None: check_deposit = client.simulations.check_deposits.return_( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) @parametrize def test_raw_response_return(self, client: Increase) -> None: response = client.simulations.check_deposits.with_raw_response.return_( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True @@ -80,7 +123,7 @@ def test_raw_response_return(self, client: Increase) -> None: @parametrize def test_streaming_response_return(self, client: Increase) -> None: with client.simulations.check_deposits.with_streaming_response.return_( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -97,19 +140,29 @@ def test_path_params_return(self, client: Increase) -> None: "", ) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_method_submit(self, client: Increase) -> None: check_deposit = client.simulations.check_deposits.submit( - "string", + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + def test_method_submit_with_all_params(self, client: Increase) -> None: + check_deposit = client.simulations.check_deposits.submit( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + scan={ + "account_number": "x", + "routing_number": "x", + "auxiliary_on_us": "x", + }, ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_raw_response_submit(self, client: Increase) -> None: response = client.simulations.check_deposits.with_raw_response.submit( - "string", + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True @@ -117,11 +170,10 @@ def test_raw_response_submit(self, client: Increase) -> None: check_deposit = response.parse() assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_streaming_response_submit(self, client: Increase) -> None: with client.simulations.check_deposits.with_streaming_response.submit( - "string", + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -131,43 +183,88 @@ def test_streaming_response_submit(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_path_params_submit(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"): client.simulations.check_deposits.with_raw_response.submit( - "", + check_deposit_id="", ) class TestAsyncCheckDeposits: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_adjustment(self, async_client: AsyncIncrease) -> None: + check_deposit = await async_client.simulations.check_deposits.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + async def test_method_adjustment_with_all_params(self, async_client: AsyncIncrease) -> None: + check_deposit = await async_client.simulations.check_deposits.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + amount=-1000000000, + reason="late_return", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_adjustment(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.check_deposits.with_raw_response.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + check_deposit = await response.parse() + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_adjustment(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.check_deposits.with_streaming_response.adjustment( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + check_deposit = await response.parse() + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_adjustment(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"): + await async_client.simulations.check_deposits.with_raw_response.adjustment( + check_deposit_id="", + ) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_method_reject(self, async_client: AsyncIncrease) -> None: check_deposit = await async_client.simulations.check_deposits.reject( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_raw_response_reject(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.check_deposits.with_raw_response.reject( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_deposit = response.parse() + check_deposit = await response.parse() assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_streaming_response_reject(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.check_deposits.with_streaming_response.reject( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -177,7 +274,6 @@ async def test_streaming_response_reject(self, async_client: AsyncIncrease) -> N assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_path_params_reject(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"): @@ -188,25 +284,25 @@ async def test_path_params_reject(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_return(self, async_client: AsyncIncrease) -> None: check_deposit = await async_client.simulations.check_deposits.return_( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) @parametrize async def test_raw_response_return(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.check_deposits.with_raw_response.return_( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_deposit = response.parse() + check_deposit = await response.parse() assert_matches_type(CheckDeposit, check_deposit, path=["response"]) @parametrize async def test_streaming_response_return(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.check_deposits.with_streaming_response.return_( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -223,31 +319,40 @@ async def test_path_params_return(self, async_client: AsyncIncrease) -> None: "", ) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_method_submit(self, async_client: AsyncIncrease) -> None: check_deposit = await async_client.simulations.check_deposits.submit( - "string", + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + + @parametrize + async def test_method_submit_with_all_params(self, async_client: AsyncIncrease) -> None: + check_deposit = await async_client.simulations.check_deposits.submit( + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", + scan={ + "account_number": "x", + "routing_number": "x", + "auxiliary_on_us": "x", + }, ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_raw_response_submit(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.check_deposits.with_raw_response.submit( - "string", + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_deposit = response.parse() + check_deposit = await response.parse() assert_matches_type(CheckDeposit, check_deposit, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.check_deposits.with_streaming_response.submit( - "string", + check_deposit_id="check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -257,10 +362,9 @@ async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> N assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_path_params_submit(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_deposit_id` but received ''"): await async_client.simulations.check_deposits.with_raw_response.submit( - "", + check_deposit_id="", ) diff --git a/tests/api_resources/simulations/test_check_transfers.py b/tests/api_resources/simulations/test_check_transfers.py index 45fad5096..bdef4bd1c 100644 --- a/tests/api_resources/simulations/test_check_transfers.py +++ b/tests/api_resources/simulations/test_check_transfers.py @@ -17,57 +17,17 @@ class TestCheckTransfers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @parametrize - def test_method_deposit(self, client: Increase) -> None: - check_transfer = client.simulations.check_transfers.deposit( - "string", - ) - assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - - @parametrize - def test_raw_response_deposit(self, client: Increase) -> None: - response = client.simulations.check_transfers.with_raw_response.deposit( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() - assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - - @parametrize - def test_streaming_response_deposit(self, client: Increase) -> None: - with client.simulations.check_transfers.with_streaming_response.deposit( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - check_transfer = response.parse() - assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_deposit(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_transfer_id` but received ''"): - client.simulations.check_transfers.with_raw_response.deposit( - "", - ) - - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_method_mail(self, client: Increase) -> None: check_transfer = client.simulations.check_transfers.mail( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_raw_response_mail(self, client: Increase) -> None: response = client.simulations.check_transfers.with_raw_response.mail( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True @@ -75,11 +35,10 @@ def test_raw_response_mail(self, client: Increase) -> None: check_transfer = response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_streaming_response_mail(self, client: Increase) -> None: with client.simulations.check_transfers.with_streaming_response.mail( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -89,7 +48,6 @@ def test_streaming_response_mail(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize def test_path_params_mail(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_transfer_id` but received ''"): @@ -99,71 +57,32 @@ def test_path_params_mail(self, client: Increase) -> None: class TestAsyncCheckTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) - @parametrize - async def test_method_deposit(self, async_client: AsyncIncrease) -> None: - check_transfer = await async_client.simulations.check_transfers.deposit( - "string", - ) - assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - - @parametrize - async def test_raw_response_deposit(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.check_transfers.with_raw_response.deposit( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() - assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - - @parametrize - async def test_streaming_response_deposit(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.check_transfers.with_streaming_response.deposit( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - check_transfer = await response.parse() - assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_deposit(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_transfer_id` but received ''"): - await async_client.simulations.check_transfers.with_raw_response.deposit( - "", - ) - - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_method_mail(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.simulations.check_transfers.mail( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_raw_response_mail(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.check_transfers.with_raw_response.mail( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() + check_transfer = await response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_streaming_response_mail(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.check_transfers.with_streaming_response.mail( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -173,7 +92,6 @@ async def test_streaming_response_mail(self, async_client: AsyncIncrease) -> Non assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism incorrectly returns an invalid JSON error") @parametrize async def test_path_params_mail(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_transfer_id` but received ''"): diff --git a/tests/api_resources/simulations/test_digital_wallet_token_requests.py b/tests/api_resources/simulations/test_digital_wallet_token_requests.py index 7d4d8cb36..948ffcd51 100644 --- a/tests/api_resources/simulations/test_digital_wallet_token_requests.py +++ b/tests/api_resources/simulations/test_digital_wallet_token_requests.py @@ -54,7 +54,9 @@ def test_streaming_response_create(self, client: Increase) -> None: class TestAsyncDigitalWalletTokenRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -71,7 +73,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_wallet_token_request = response.parse() + digital_wallet_token_request = await response.parse() assert_matches_type(DigitalWalletTokenRequestCreateResponse, digital_wallet_token_request, path=["response"]) @parametrize diff --git a/tests/api_resources/simulations/test_documents.py b/tests/api_resources/simulations/test_documents.py deleted file mode 100644 index 3eedf06da..000000000 --- a/tests/api_resources/simulations/test_documents.py +++ /dev/null @@ -1,84 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types import Document - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestDocuments: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Increase) -> None: - document = client.simulations.documents.create( - account_id="account_in71c4amph0vgo2qllky", - ) - assert_matches_type(Document, document, path=["response"]) - - @parametrize - def test_raw_response_create(self, client: Increase) -> None: - response = client.simulations.documents.with_raw_response.create( - account_id="account_in71c4amph0vgo2qllky", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(Document, document, path=["response"]) - - @parametrize - def test_streaming_response_create(self, client: Increase) -> None: - with client.simulations.documents.with_streaming_response.create( - account_id="account_in71c4amph0vgo2qllky", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - document = response.parse() - assert_matches_type(Document, document, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncDocuments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncIncrease) -> None: - document = await async_client.simulations.documents.create( - account_id="account_in71c4amph0vgo2qllky", - ) - assert_matches_type(Document, document, path=["response"]) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.documents.with_raw_response.create( - account_id="account_in71c4amph0vgo2qllky", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(Document, document, path=["response"]) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.documents.with_streaming_response.create( - account_id="account_in71c4amph0vgo2qllky", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - document = await response.parse() - assert_matches_type(Document, document, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_entity_onboarding_sessions.py b/tests/api_resources/simulations/test_entity_onboarding_sessions.py new file mode 100644 index 000000000..17cf84265 --- /dev/null +++ b/tests/api_resources/simulations/test_entity_onboarding_sessions.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import EntityOnboardingSession + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEntityOnboardingSessions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_submit(self, client: Increase) -> None: + entity_onboarding_session = client.simulations.entity_onboarding_sessions.submit( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_raw_response_submit(self, client: Increase) -> None: + response = client.simulations.entity_onboarding_sessions.with_raw_response.submit( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_streaming_response_submit(self, client: Increase) -> None: + with client.simulations.entity_onboarding_sessions.with_streaming_response.submit( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_submit(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_onboarding_session_id` but received ''" + ): + client.simulations.entity_onboarding_sessions.with_raw_response.submit( + "", + ) + + +class TestAsyncEntityOnboardingSessions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_submit(self, async_client: AsyncIncrease) -> None: + entity_onboarding_session = await async_client.simulations.entity_onboarding_sessions.submit( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_raw_response_submit(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.entity_onboarding_sessions.with_raw_response.submit( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.entity_onboarding_sessions.with_streaming_response.submit( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_onboarding_session_id` but received ''" + ): + await async_client.simulations.entity_onboarding_sessions.with_raw_response.submit( + "", + ) diff --git a/tests/api_resources/simulations/test_exports.py b/tests/api_resources/simulations/test_exports.py new file mode 100644 index 000000000..b36461d02 --- /dev/null +++ b/tests/api_resources/simulations/test_exports.py @@ -0,0 +1,102 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import Export + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestExports: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + export = client.simulations.exports.create( + category="form_1099_int", + ) + assert_matches_type(Export, export, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + export = client.simulations.exports.create( + category="form_1099_int", + form_1099_int={"account_id": "account_in71c4amph0vgo2qllky"}, + ) + assert_matches_type(Export, export, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.exports.with_raw_response.create( + category="form_1099_int", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + export = response.parse() + assert_matches_type(Export, export, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.exports.with_streaming_response.create( + category="form_1099_int", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + export = response.parse() + assert_matches_type(Export, export, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncExports: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + export = await async_client.simulations.exports.create( + category="form_1099_int", + ) + assert_matches_type(Export, export, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + export = await async_client.simulations.exports.create( + category="form_1099_int", + form_1099_int={"account_id": "account_in71c4amph0vgo2qllky"}, + ) + assert_matches_type(Export, export, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.exports.with_raw_response.create( + category="form_1099_int", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + export = await response.parse() + assert_matches_type(Export, export, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.exports.with_streaming_response.create( + category="form_1099_int", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + export = await response.parse() + assert_matches_type(Export, export, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_inbound_ach_transfers.py b/tests/api_resources/simulations/test_inbound_ach_transfers.py new file mode 100644 index 000000000..9c76d64f8 --- /dev/null +++ b/tests/api_resources/simulations/test_inbound_ach_transfers.py @@ -0,0 +1,135 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundACHTransfer +from increase._utils import parse_datetime + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundACHTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + inbound_ach_transfer = client.simulations.inbound_ach_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + inbound_ach_transfer = client.simulations.inbound_ach_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + addenda={ + "category": "freeform", + "freeform": {"entries": [{"payment_related_information": "x"}]}, + }, + company_descriptive_date="x", + company_discretionary_data="x", + company_entry_description="x", + company_id="x", + company_name="x", + receiver_id_number="x", + receiver_name="x", + resolve_at=parse_datetime("2019-12-27T18:11:19.117Z"), + standard_entry_class_code="corporate_credit_or_debit", + ) + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.inbound_ach_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_ach_transfer = response.parse() + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.inbound_ach_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_ach_transfer = response.parse() + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInboundACHTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + inbound_ach_transfer = await async_client.simulations.inbound_ach_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_ach_transfer = await async_client.simulations.inbound_ach_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + addenda={ + "category": "freeform", + "freeform": {"entries": [{"payment_related_information": "x"}]}, + }, + company_descriptive_date="x", + company_discretionary_data="x", + company_entry_description="x", + company_id="x", + company_name="x", + receiver_id_number="x", + receiver_name="x", + resolve_at=parse_datetime("2019-12-27T18:11:19.117Z"), + standard_entry_class_code="corporate_credit_or_debit", + ) + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.inbound_ach_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_ach_transfer = await response.parse() + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.inbound_ach_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_ach_transfer = await response.parse() + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_inbound_check_deposits.py b/tests/api_resources/simulations/test_inbound_check_deposits.py new file mode 100644 index 000000000..44a6f16a6 --- /dev/null +++ b/tests/api_resources/simulations/test_inbound_check_deposits.py @@ -0,0 +1,216 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundCheckDeposit + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundCheckDeposits: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + inbound_check_deposit = client.simulations.inbound_check_deposits.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + inbound_check_deposit = client.simulations.inbound_check_deposits.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + payee_name_analysis="name_matches", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.inbound_check_deposits.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.inbound_check_deposits.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_adjustment(self, client: Increase) -> None: + inbound_check_deposit = client.simulations.inbound_check_deposits.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_method_adjustment_with_all_params(self, client: Increase) -> None: + inbound_check_deposit = client.simulations.inbound_check_deposits.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + amount=1000, + reason="late_return", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_raw_response_adjustment(self, client: Increase) -> None: + response = client.simulations.inbound_check_deposits.with_raw_response.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_adjustment(self, client: Increase) -> None: + with client.simulations.inbound_check_deposits.with_streaming_response.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_adjustment(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + client.simulations.inbound_check_deposits.with_raw_response.adjustment( + inbound_check_deposit_id="", + ) + + +class TestAsyncInboundCheckDeposits: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.simulations.inbound_check_deposits.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.simulations.inbound_check_deposits.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + payee_name_analysis="name_matches", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.inbound_check_deposits.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.inbound_check_deposits.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + check_number="1234567890", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_adjustment(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.simulations.inbound_check_deposits.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_method_adjustment_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.simulations.inbound_check_deposits.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + amount=1000, + reason="late_return", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_adjustment(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.inbound_check_deposits.with_raw_response.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_adjustment(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.inbound_check_deposits.with_streaming_response.adjustment( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_adjustment(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + await async_client.simulations.inbound_check_deposits.with_raw_response.adjustment( + inbound_check_deposit_id="", + ) diff --git a/tests/api_resources/simulations/test_inbound_fednow_transfers.py b/tests/api_resources/simulations/test_inbound_fednow_transfers.py new file mode 100644 index 000000000..9de1d1f0b --- /dev/null +++ b/tests/api_resources/simulations/test_inbound_fednow_transfers.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundFednowTransfer + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundFednowTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + inbound_fednow_transfer = client.simulations.inbound_fednow_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + inbound_fednow_transfer = client.simulations.inbound_fednow_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + debtor_account_number="x", + debtor_name="x", + debtor_routing_number="xxxxxxxxx", + unstructured_remittance_information="x", + ) + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.inbound_fednow_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_fednow_transfer = response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.inbound_fednow_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_fednow_transfer = response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInboundFednowTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + inbound_fednow_transfer = await async_client.simulations.inbound_fednow_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_fednow_transfer = await async_client.simulations.inbound_fednow_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + debtor_account_number="x", + debtor_name="x", + debtor_routing_number="xxxxxxxxx", + unstructured_remittance_information="x", + ) + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.inbound_fednow_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_fednow_transfer = await response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.inbound_fednow_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_fednow_transfer = await response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_inbound_funds_holds.py b/tests/api_resources/simulations/test_inbound_funds_holds.py deleted file mode 100644 index 6645d9fdc..000000000 --- a/tests/api_resources/simulations/test_inbound_funds_holds.py +++ /dev/null @@ -1,98 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types.simulations import InboundFundsHoldReleaseResponse - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestInboundFundsHolds: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_release(self, client: Increase) -> None: - inbound_funds_hold = client.simulations.inbound_funds_holds.release( - "string", - ) - assert_matches_type(InboundFundsHoldReleaseResponse, inbound_funds_hold, path=["response"]) - - @parametrize - def test_raw_response_release(self, client: Increase) -> None: - response = client.simulations.inbound_funds_holds.with_raw_response.release( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_funds_hold = response.parse() - assert_matches_type(InboundFundsHoldReleaseResponse, inbound_funds_hold, path=["response"]) - - @parametrize - def test_streaming_response_release(self, client: Increase) -> None: - with client.simulations.inbound_funds_holds.with_streaming_response.release( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - inbound_funds_hold = response.parse() - assert_matches_type(InboundFundsHoldReleaseResponse, inbound_funds_hold, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_release(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_funds_hold_id` but received ''"): - client.simulations.inbound_funds_holds.with_raw_response.release( - "", - ) - - -class TestAsyncInboundFundsHolds: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_release(self, async_client: AsyncIncrease) -> None: - inbound_funds_hold = await async_client.simulations.inbound_funds_holds.release( - "string", - ) - assert_matches_type(InboundFundsHoldReleaseResponse, inbound_funds_hold, path=["response"]) - - @parametrize - async def test_raw_response_release(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.inbound_funds_holds.with_raw_response.release( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_funds_hold = response.parse() - assert_matches_type(InboundFundsHoldReleaseResponse, inbound_funds_hold, path=["response"]) - - @parametrize - async def test_streaming_response_release(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.inbound_funds_holds.with_streaming_response.release( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - inbound_funds_hold = await response.parse() - assert_matches_type(InboundFundsHoldReleaseResponse, inbound_funds_hold, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_release(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_funds_hold_id` but received ''"): - await async_client.simulations.inbound_funds_holds.with_raw_response.release( - "", - ) diff --git a/tests/api_resources/simulations/test_inbound_mail_items.py b/tests/api_resources/simulations/test_inbound_mail_items.py new file mode 100755 index 000000000..cb86a0502 --- /dev/null +++ b/tests/api_resources/simulations/test_inbound_mail_items.py @@ -0,0 +1,110 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundMailItem + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundMailItems: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + inbound_mail_item = client.simulations.inbound_mail_items.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + inbound_mail_item = client.simulations.inbound_mail_items.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + contents_file_id="contents_file_id", + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.inbound_mail_items.with_raw_response.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.inbound_mail_items.with_streaming_response.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInboundMailItems: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + inbound_mail_item = await async_client.simulations.inbound_mail_items.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_mail_item = await async_client.simulations.inbound_mail_items.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + contents_file_id="contents_file_id", + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.inbound_mail_items.with_raw_response.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = await response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.inbound_mail_items.with_streaming_response.create( + amount=1000, + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = await response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_inbound_real_time_payments_transfers.py b/tests/api_resources/simulations/test_inbound_real_time_payments_transfers.py new file mode 100644 index 000000000..bc7fb08bc --- /dev/null +++ b/tests/api_resources/simulations/test_inbound_real_time_payments_transfers.py @@ -0,0 +1,122 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundRealTimePaymentsTransfer + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundRealTimePaymentsTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + inbound_real_time_payments_transfer = client.simulations.inbound_real_time_payments_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + inbound_real_time_payments_transfer = client.simulations.inbound_real_time_payments_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + debtor_account_number="x", + debtor_name="x", + debtor_routing_number="xxxxxxxxx", + request_for_payment_id="real_time_payments_request_for_payment_28kcliz1oevcnqyn9qp7", + unstructured_remittance_information="x", + ) + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.inbound_real_time_payments_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_real_time_payments_transfer = response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.inbound_real_time_payments_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_real_time_payments_transfer = response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInboundRealTimePaymentsTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + inbound_real_time_payments_transfer = ( + await async_client.simulations.inbound_real_time_payments_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + ) + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_real_time_payments_transfer = ( + await async_client.simulations.inbound_real_time_payments_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + debtor_account_number="x", + debtor_name="x", + debtor_routing_number="xxxxxxxxx", + request_for_payment_id="real_time_payments_request_for_payment_28kcliz1oevcnqyn9qp7", + unstructured_remittance_information="x", + ) + ) + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.inbound_real_time_payments_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_real_time_payments_transfer = await response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.inbound_real_time_payments_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_real_time_payments_transfer = await response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_inbound_wire_drawdown_requests.py b/tests/api_resources/simulations/test_inbound_wire_drawdown_requests.py index e03b70c12..7a3b305ec 100644 --- a/tests/api_resources/simulations/test_inbound_wire_drawdown_requests.py +++ b/tests/api_resources/simulations/test_inbound_wire_drawdown_requests.py @@ -21,12 +21,9 @@ class TestInboundWireDrawdownRequests: def test_method_create(self, client: Increase) -> None: inbound_wire_drawdown_request = client.simulations.inbound_wire_drawdown_requests.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @@ -35,25 +32,24 @@ def test_method_create(self, client: Increase) -> None: def test_method_create_with_all_params(self, client: Increase) -> None: inbound_wire_drawdown_request = client.simulations.inbound_wire_drawdown_requests.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - beneficiary_address_line1="33 Liberty Street", - beneficiary_address_line2="New York, NY, 10045", - beneficiary_address_line3="x", - beneficiary_name="Ian Crease", - originator_address_line1="33 Liberty Street", - originator_address_line2="New York, NY, 10045", - originator_address_line3="x", - originator_name="Ian Crease", - originator_to_beneficiary_information_line1="x", - originator_to_beneficiary_information_line2="x", - originator_to_beneficiary_information_line3="x", - originator_to_beneficiary_information_line4="x", + creditor_address_line1="33 Liberty Street", + creditor_address_line2="New York, NY, 10045", + creditor_address_line3="x", + creditor_name="Ian Crease", + debtor_account_number="987654321", + debtor_address_line1="33 Liberty Street", + debtor_address_line2="New York, NY, 10045", + debtor_address_line3="x", + debtor_name="Ian Crease", + debtor_routing_number="101050001", + end_to_end_identification="x", + instruction_identification="x", + unique_end_to_end_transaction_reference="x", + unstructured_remittance_information="x", ) assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @@ -61,12 +57,9 @@ def test_method_create_with_all_params(self, client: Increase) -> None: def test_raw_response_create(self, client: Increase) -> None: response = client.simulations.inbound_wire_drawdown_requests.with_raw_response.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) @@ -79,12 +72,9 @@ def test_raw_response_create(self, client: Increase) -> None: def test_streaming_response_create(self, client: Increase) -> None: with client.simulations.inbound_wire_drawdown_requests.with_streaming_response.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed @@ -97,18 +87,17 @@ def test_streaming_response_create(self, client: Increase) -> None: class TestAsyncInboundWireDrawdownRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: inbound_wire_drawdown_request = await async_client.simulations.inbound_wire_drawdown_requests.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @@ -117,25 +106,24 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: inbound_wire_drawdown_request = await async_client.simulations.inbound_wire_drawdown_requests.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - beneficiary_address_line1="33 Liberty Street", - beneficiary_address_line2="New York, NY, 10045", - beneficiary_address_line3="x", - beneficiary_name="Ian Crease", - originator_address_line1="33 Liberty Street", - originator_address_line2="New York, NY, 10045", - originator_address_line3="x", - originator_name="Ian Crease", - originator_to_beneficiary_information_line1="x", - originator_to_beneficiary_information_line2="x", - originator_to_beneficiary_information_line3="x", - originator_to_beneficiary_information_line4="x", + creditor_address_line1="33 Liberty Street", + creditor_address_line2="New York, NY, 10045", + creditor_address_line3="x", + creditor_name="Ian Crease", + debtor_account_number="987654321", + debtor_address_line1="33 Liberty Street", + debtor_address_line2="New York, NY, 10045", + debtor_address_line3="x", + debtor_name="Ian Crease", + debtor_routing_number="101050001", + end_to_end_identification="x", + instruction_identification="x", + unique_end_to_end_transaction_reference="x", + unstructured_remittance_information="x", ) assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @@ -143,30 +131,24 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.inbound_wire_drawdown_requests.with_raw_response.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_wire_drawdown_request = response.parse() + inbound_wire_drawdown_request = await response.parse() assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.inbound_wire_drawdown_requests.with_streaming_response.create( amount=10000, - beneficiary_account_number="987654321", - beneficiary_routing_number="101050001", + creditor_account_number="987654321", + creditor_routing_number="101050001", currency="USD", - message_to_recipient="Invoice 29582", - originator_account_number="987654321", - originator_routing_number="101050001", recipient_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed diff --git a/tests/api_resources/simulations/test_inbound_wire_transfers.py b/tests/api_resources/simulations/test_inbound_wire_transfers.py new file mode 100644 index 000000000..f57c174b4 --- /dev/null +++ b/tests/api_resources/simulations/test_inbound_wire_transfers.py @@ -0,0 +1,136 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundWireTransfer + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundWireTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + inbound_wire_transfer = client.simulations.inbound_wire_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + inbound_wire_transfer = client.simulations.inbound_wire_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + creditor_address_line1="x", + creditor_address_line2="x", + creditor_address_line3="x", + creditor_name="x", + debtor_address_line1="x", + debtor_address_line2="x", + debtor_address_line3="x", + debtor_name="x", + end_to_end_identification="x", + instructing_agent_routing_number="x", + instruction_identification="x", + unique_end_to_end_transaction_reference="x", + unstructured_remittance_information="x", + wire_drawdown_request_id="wire_drawdown_request_id", + ) + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.inbound_wire_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_wire_transfer = response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.inbound_wire_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_wire_transfer = response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInboundWireTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + inbound_wire_transfer = await async_client.simulations.inbound_wire_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_wire_transfer = await async_client.simulations.inbound_wire_transfers.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + creditor_address_line1="x", + creditor_address_line2="x", + creditor_address_line3="x", + creditor_name="x", + debtor_address_line1="x", + debtor_address_line2="x", + debtor_address_line3="x", + debtor_name="x", + end_to_end_identification="x", + instructing_agent_routing_number="x", + instruction_identification="x", + unique_end_to_end_transaction_reference="x", + unstructured_remittance_information="x", + wire_drawdown_request_id="wire_drawdown_request_id", + ) + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.inbound_wire_transfers.with_raw_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_wire_transfer = await response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.inbound_wire_transfers.with_streaming_response.create( + account_number_id="account_number_v18nkfqm6afpsrvy82b2", + amount=1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_wire_transfer = await response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_interest_payments.py b/tests/api_resources/simulations/test_interest_payments.py index d755d9a81..6f7ebffad 100644 --- a/tests/api_resources/simulations/test_interest_payments.py +++ b/tests/api_resources/simulations/test_interest_payments.py @@ -31,6 +31,7 @@ def test_method_create_with_all_params(self, client: Increase) -> None: interest_payment = client.simulations.interest_payments.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + accrued_on_account_id="accrued_on_account_id", period_end=parse_datetime("2019-12-27T18:11:19.117Z"), period_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -64,7 +65,9 @@ def test_streaming_response_create(self, client: Increase) -> None: class TestAsyncInterestPayments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -79,6 +82,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) interest_payment = await async_client.simulations.interest_payments.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + accrued_on_account_id="accrued_on_account_id", period_end=parse_datetime("2019-12-27T18:11:19.117Z"), period_start=parse_datetime("2019-12-27T18:11:19.117Z"), ) @@ -93,7 +97,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - interest_payment = response.parse() + interest_payment = await response.parse() assert_matches_type(Transaction, interest_payment, path=["response"]) @parametrize diff --git a/tests/api_resources/simulations/test_pending_transactions.py b/tests/api_resources/simulations/test_pending_transactions.py new file mode 100644 index 000000000..9b647a211 --- /dev/null +++ b/tests/api_resources/simulations/test_pending_transactions.py @@ -0,0 +1,104 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import PendingTransaction + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestPendingTransactions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_release_inbound_funds_hold(self, client: Increase) -> None: + pending_transaction = client.simulations.pending_transactions.release_inbound_funds_hold( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + def test_raw_response_release_inbound_funds_hold(self, client: Increase) -> None: + response = client.simulations.pending_transactions.with_raw_response.release_inbound_funds_hold( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pending_transaction = response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + def test_streaming_response_release_inbound_funds_hold(self, client: Increase) -> None: + with client.simulations.pending_transactions.with_streaming_response.release_inbound_funds_hold( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pending_transaction = response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_release_inbound_funds_hold(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `pending_transaction_id` but received ''" + ): + client.simulations.pending_transactions.with_raw_response.release_inbound_funds_hold( + "", + ) + + +class TestAsyncPendingTransactions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_release_inbound_funds_hold(self, async_client: AsyncIncrease) -> None: + pending_transaction = await async_client.simulations.pending_transactions.release_inbound_funds_hold( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + async def test_raw_response_release_inbound_funds_hold(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.pending_transactions.with_raw_response.release_inbound_funds_hold( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pending_transaction = await response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + async def test_streaming_response_release_inbound_funds_hold(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.pending_transactions.with_streaming_response.release_inbound_funds_hold( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pending_transaction = await response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_release_inbound_funds_hold(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `pending_transaction_id` but received ''" + ): + await async_client.simulations.pending_transactions.with_raw_response.release_inbound_funds_hold( + "", + ) diff --git a/tests/api_resources/simulations/test_physical_cards.py b/tests/api_resources/simulations/test_physical_cards.py index 191a470b8..735dc8324 100644 --- a/tests/api_resources/simulations/test_physical_cards.py +++ b/tests/api_resources/simulations/test_physical_cards.py @@ -10,6 +10,7 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type from increase.types import PhysicalCard +from increase._utils import parse_datetime base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,17 +19,71 @@ class TestPhysicalCards: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_shipment_advance(self, client: Increase) -> None: - physical_card = client.simulations.physical_cards.shipment_advance( - "string", + def test_method_create(self, client: Increase) -> None: + physical_card = client.simulations.physical_cards.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + ) + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + physical_card = client.simulations.physical_cards.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + carrier_estimated_delivery_at=parse_datetime("2019-12-27T18:11:19.117Z"), + city="New York", + postal_code="10045", + state="NY", + ) + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.physical_cards.with_raw_response.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + physical_card = response.parse() + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.physical_cards.with_streaming_response.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + physical_card = response.parse() + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `physical_card_id` but received ''"): + client.simulations.physical_cards.with_raw_response.create( + physical_card_id="", + category="delivered", + ) + + @parametrize + def test_method_advance_shipment(self, client: Increase) -> None: + physical_card = client.simulations.physical_cards.advance_shipment( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", shipment_status="shipped", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize - def test_raw_response_shipment_advance(self, client: Increase) -> None: - response = client.simulations.physical_cards.with_raw_response.shipment_advance( - "string", + def test_raw_response_advance_shipment(self, client: Increase) -> None: + response = client.simulations.physical_cards.with_raw_response.advance_shipment( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", shipment_status="shipped", ) @@ -38,9 +93,9 @@ def test_raw_response_shipment_advance(self, client: Increase) -> None: assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize - def test_streaming_response_shipment_advance(self, client: Increase) -> None: - with client.simulations.physical_cards.with_streaming_response.shipment_advance( - "string", + def test_streaming_response_advance_shipment(self, client: Increase) -> None: + with client.simulations.physical_cards.with_streaming_response.advance_shipment( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", shipment_status="shipped", ) as response: assert not response.is_closed @@ -52,41 +107,97 @@ def test_streaming_response_shipment_advance(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_shipment_advance(self, client: Increase) -> None: + def test_path_params_advance_shipment(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `physical_card_id` but received ''"): - client.simulations.physical_cards.with_raw_response.shipment_advance( - "", + client.simulations.physical_cards.with_raw_response.advance_shipment( + physical_card_id="", shipment_status="shipped", ) class TestAsyncPhysicalCards: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize - async def test_method_shipment_advance(self, async_client: AsyncIncrease) -> None: - physical_card = await async_client.simulations.physical_cards.shipment_advance( - "string", + async def test_method_create(self, async_client: AsyncIncrease) -> None: + physical_card = await async_client.simulations.physical_cards.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + ) + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + physical_card = await async_client.simulations.physical_cards.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + carrier_estimated_delivery_at=parse_datetime("2019-12-27T18:11:19.117Z"), + city="New York", + postal_code="10045", + state="NY", + ) + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.physical_cards.with_raw_response.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + physical_card = await response.parse() + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.physical_cards.with_streaming_response.create( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", + category="delivered", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + physical_card = await response.parse() + assert_matches_type(PhysicalCard, physical_card, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `physical_card_id` but received ''"): + await async_client.simulations.physical_cards.with_raw_response.create( + physical_card_id="", + category="delivered", + ) + + @parametrize + async def test_method_advance_shipment(self, async_client: AsyncIncrease) -> None: + physical_card = await async_client.simulations.physical_cards.advance_shipment( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", shipment_status="shipped", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize - async def test_raw_response_shipment_advance(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.physical_cards.with_raw_response.shipment_advance( - "string", + async def test_raw_response_advance_shipment(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.physical_cards.with_raw_response.advance_shipment( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", shipment_status="shipped", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card = response.parse() + physical_card = await response.parse() assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize - async def test_streaming_response_shipment_advance(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.physical_cards.with_streaming_response.shipment_advance( - "string", + async def test_streaming_response_advance_shipment(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.physical_cards.with_streaming_response.advance_shipment( + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", shipment_status="shipped", ) as response: assert not response.is_closed @@ -98,9 +209,9 @@ async def test_streaming_response_shipment_advance(self, async_client: AsyncIncr assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_shipment_advance(self, async_client: AsyncIncrease) -> None: + async def test_path_params_advance_shipment(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `physical_card_id` but received ''"): - await async_client.simulations.physical_cards.with_raw_response.shipment_advance( - "", + await async_client.simulations.physical_cards.with_raw_response.advance_shipment( + physical_card_id="", shipment_status="shipped", ) diff --git a/tests/api_resources/simulations/test_programs.py b/tests/api_resources/simulations/test_programs.py index 348c8bdf6..72c010c9e 100644 --- a/tests/api_resources/simulations/test_programs.py +++ b/tests/api_resources/simulations/test_programs.py @@ -24,6 +24,16 @@ def test_method_create(self, client: Increase) -> None: ) assert_matches_type(Program, program, path=["response"]) + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + program = client.simulations.programs.create( + name="For Benefit Of", + bank="core_bank", + lending_maximum_extendable_credit=0, + reserve_account_id="reserve_account_id", + ) + assert_matches_type(Program, program, path=["response"]) + @parametrize def test_raw_response_create(self, client: Increase) -> None: response = client.simulations.programs.with_raw_response.create( @@ -50,7 +60,9 @@ def test_streaming_response_create(self, client: Increase) -> None: class TestAsyncPrograms: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -59,6 +71,16 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: ) assert_matches_type(Program, program, path=["response"]) + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + program = await async_client.simulations.programs.create( + name="For Benefit Of", + bank="core_bank", + lending_maximum_extendable_credit=0, + reserve_account_id="reserve_account_id", + ) + assert_matches_type(Program, program, path=["response"]) + @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.programs.with_raw_response.create( @@ -67,7 +89,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - program = response.parse() + program = await response.parse() assert_matches_type(Program, program, path=["response"]) @parametrize diff --git a/tests/api_resources/simulations/test_real_time_payments_transfers.py b/tests/api_resources/simulations/test_real_time_payments_transfers.py index de09f21ae..f98b5538b 100644 --- a/tests/api_resources/simulations/test_real_time_payments_transfers.py +++ b/tests/api_resources/simulations/test_real_time_payments_transfers.py @@ -10,9 +10,6 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type from increase.types import RealTimePaymentsTransfer -from increase.types.simulations import ( - InboundRealTimePaymentsTransferSimulationResult, -) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,14 +20,14 @@ class TestRealTimePaymentsTransfers: @parametrize def test_method_complete(self, client: Increase) -> None: real_time_payments_transfer = client.simulations.real_time_payments_transfers.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @parametrize def test_method_complete_with_all_params(self, client: Increase) -> None: real_time_payments_transfer = client.simulations.real_time_payments_transfers.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", rejection={"reject_reason_code": "account_closed"}, ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @@ -38,7 +35,7 @@ def test_method_complete_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_complete(self, client: Increase) -> None: response = client.simulations.real_time_payments_transfers.with_raw_response.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert response.is_closed is True @@ -49,7 +46,7 @@ def test_raw_response_complete(self, client: Increase) -> None: @parametrize def test_streaming_response_complete(self, client: Increase) -> None: with client.simulations.real_time_payments_transfers.with_streaming_response.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,79 +62,26 @@ def test_path_params_complete(self, client: Increase) -> None: ValueError, match=r"Expected a non-empty value for `real_time_payments_transfer_id` but received ''" ): client.simulations.real_time_payments_transfers.with_raw_response.complete( - "", + real_time_payments_transfer_id="", ) - @parametrize - def test_method_create_inbound(self, client: Increase) -> None: - real_time_payments_transfer = client.simulations.real_time_payments_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - ) - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - @parametrize - def test_method_create_inbound_with_all_params(self, client: Increase) -> None: - real_time_payments_transfer = client.simulations.real_time_payments_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - debtor_account_number="x", - debtor_name="x", - debtor_routing_number="xxxxxxxxx", - remittance_information="x", - request_for_payment_id="real_time_payments_request_for_payment_28kcliz1oevcnqyn9qp7", - ) - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - @parametrize - def test_raw_response_create_inbound(self, client: Increase) -> None: - response = client.simulations.real_time_payments_transfers.with_raw_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_transfer = response.parse() - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - @parametrize - def test_streaming_response_create_inbound(self, client: Increase) -> None: - with client.simulations.real_time_payments_transfers.with_streaming_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_transfer = response.parse() - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - class TestAsyncRealTimePaymentsTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_complete(self, async_client: AsyncIncrease) -> None: real_time_payments_transfer = await async_client.simulations.real_time_payments_transfers.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @parametrize async def test_method_complete_with_all_params(self, async_client: AsyncIncrease) -> None: real_time_payments_transfer = await async_client.simulations.real_time_payments_transfers.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", rejection={"reject_reason_code": "account_closed"}, ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @@ -145,18 +89,18 @@ async def test_method_complete_with_all_params(self, async_client: AsyncIncrease @parametrize async def test_raw_response_complete(self, async_client: AsyncIncrease) -> None: response = await async_client.simulations.real_time_payments_transfers.with_raw_response.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_transfer = response.parse() + real_time_payments_transfer = await response.parse() assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @parametrize async def test_streaming_response_complete(self, async_client: AsyncIncrease) -> None: async with async_client.simulations.real_time_payments_transfers.with_streaming_response.complete( - "string", + real_time_payments_transfer_id="real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -172,60 +116,5 @@ async def test_path_params_complete(self, async_client: AsyncIncrease) -> None: ValueError, match=r"Expected a non-empty value for `real_time_payments_transfer_id` but received ''" ): await async_client.simulations.real_time_payments_transfers.with_raw_response.complete( - "", + real_time_payments_transfer_id="", ) - - @parametrize - async def test_method_create_inbound(self, async_client: AsyncIncrease) -> None: - real_time_payments_transfer = await async_client.simulations.real_time_payments_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - ) - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - @parametrize - async def test_method_create_inbound_with_all_params(self, async_client: AsyncIncrease) -> None: - real_time_payments_transfer = await async_client.simulations.real_time_payments_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - debtor_account_number="x", - debtor_name="x", - debtor_routing_number="xxxxxxxxx", - remittance_information="x", - request_for_payment_id="real_time_payments_request_for_payment_28kcliz1oevcnqyn9qp7", - ) - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - @parametrize - async def test_raw_response_create_inbound(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.real_time_payments_transfers.with_raw_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_transfer = response.parse() - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - @parametrize - async def test_streaming_response_create_inbound(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.real_time_payments_transfers.with_streaming_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_transfer = await response.parse() - assert_matches_type( - InboundRealTimePaymentsTransferSimulationResult, real_time_payments_transfer, path=["response"] - ) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/simulations/test_wire_drawdown_requests.py b/tests/api_resources/simulations/test_wire_drawdown_requests.py new file mode 100644 index 000000000..87a563311 --- /dev/null +++ b/tests/api_resources/simulations/test_wire_drawdown_requests.py @@ -0,0 +1,184 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import WireDrawdownRequest + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestWireDrawdownRequests: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_refuse(self, client: Increase) -> None: + wire_drawdown_request = client.simulations.wire_drawdown_requests.refuse( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + def test_raw_response_refuse(self, client: Increase) -> None: + response = client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_drawdown_request = response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + def test_streaming_response_refuse(self, client: Increase) -> None: + with client.simulations.wire_drawdown_requests.with_streaming_response.refuse( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_drawdown_request = response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_refuse(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `wire_drawdown_request_id` but received ''" + ): + client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "", + ) + + @parametrize + def test_method_submit(self, client: Increase) -> None: + wire_drawdown_request = client.simulations.wire_drawdown_requests.submit( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + def test_raw_response_submit(self, client: Increase) -> None: + response = client.simulations.wire_drawdown_requests.with_raw_response.submit( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_drawdown_request = response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + def test_streaming_response_submit(self, client: Increase) -> None: + with client.simulations.wire_drawdown_requests.with_streaming_response.submit( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_drawdown_request = response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_submit(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `wire_drawdown_request_id` but received ''" + ): + client.simulations.wire_drawdown_requests.with_raw_response.submit( + "", + ) + + +class TestAsyncWireDrawdownRequests: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_refuse(self, async_client: AsyncIncrease) -> None: + wire_drawdown_request = await async_client.simulations.wire_drawdown_requests.refuse( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + async def test_raw_response_refuse(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_drawdown_request = await response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + async def test_streaming_response_refuse(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.wire_drawdown_requests.with_streaming_response.refuse( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_drawdown_request = await response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_refuse(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `wire_drawdown_request_id` but received ''" + ): + await async_client.simulations.wire_drawdown_requests.with_raw_response.refuse( + "", + ) + + @parametrize + async def test_method_submit(self, async_client: AsyncIncrease) -> None: + wire_drawdown_request = await async_client.simulations.wire_drawdown_requests.submit( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + async def test_raw_response_submit(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.wire_drawdown_requests.with_raw_response.submit( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_drawdown_request = await response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + @parametrize + async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.wire_drawdown_requests.with_streaming_response.submit( + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_drawdown_request = await response.parse() + assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `wire_drawdown_request_id` but received ''" + ): + await async_client.simulations.wire_drawdown_requests.with_raw_response.submit( + "", + ) diff --git a/tests/api_resources/simulations/test_wire_transfers.py b/tests/api_resources/simulations/test_wire_transfers.py index 8a699bc38..183f1342f 100644 --- a/tests/api_resources/simulations/test_wire_transfers.py +++ b/tests/api_resources/simulations/test_wire_transfers.py @@ -9,7 +9,7 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import InboundWireTransfer +from increase.types import WireTransfer base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -18,117 +18,159 @@ class TestWireTransfers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_create_inbound(self, client: Increase) -> None: - wire_transfer = client.simulations.wire_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + def test_method_reverse(self, client: Increase) -> None: + wire_transfer = client.simulations.wire_transfers.reverse( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) - - @parametrize - def test_method_create_inbound_with_all_params(self, client: Increase) -> None: - wire_transfer = client.simulations.wire_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - beneficiary_address_line1="x", - beneficiary_address_line2="x", - beneficiary_address_line3="x", - beneficiary_name="x", - beneficiary_reference="x", - originator_address_line1="x", - originator_address_line2="x", - originator_address_line3="x", - originator_name="x", - originator_routing_number="x", - originator_to_beneficiary_information_line1="x", - originator_to_beneficiary_information_line2="x", - originator_to_beneficiary_information_line3="x", - originator_to_beneficiary_information_line4="x", + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) + + @parametrize + def test_raw_response_reverse(self, client: Increase) -> None: + response = client.simulations.wire_transfers.with_raw_response.reverse( + "wire_transfer_5akynk7dqsq25qwk9q2u", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_transfer = response.parse() + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) + + @parametrize + def test_streaming_response_reverse(self, client: Increase) -> None: + with client.simulations.wire_transfers.with_streaming_response.reverse( + "wire_transfer_5akynk7dqsq25qwk9q2u", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_transfer = response.parse() + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_reverse(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): + client.simulations.wire_transfers.with_raw_response.reverse( + "", + ) + + @parametrize + def test_method_submit(self, client: Increase) -> None: + wire_transfer = client.simulations.wire_transfers.submit( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize - def test_raw_response_create_inbound(self, client: Increase) -> None: - response = client.simulations.wire_transfers.with_raw_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + def test_raw_response_submit(self, client: Increase) -> None: + response = client.simulations.wire_transfers.with_raw_response.submit( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" wire_transfer = response.parse() - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize - def test_streaming_response_create_inbound(self, client: Increase) -> None: - with client.simulations.wire_transfers.with_streaming_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + def test_streaming_response_submit(self, client: Increase) -> None: + with client.simulations.wire_transfers.with_streaming_response.submit( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" wire_transfer = response.parse() - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) assert cast(Any, response.is_closed) is True + @parametrize + def test_path_params_submit(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): + client.simulations.wire_transfers.with_raw_response.submit( + "", + ) + class TestAsyncWireTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize - async def test_method_create_inbound(self, async_client: AsyncIncrease) -> None: - wire_transfer = await async_client.simulations.wire_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + async def test_method_reverse(self, async_client: AsyncIncrease) -> None: + wire_transfer = await async_client.simulations.wire_transfers.reverse( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) - - @parametrize - async def test_method_create_inbound_with_all_params(self, async_client: AsyncIncrease) -> None: - wire_transfer = await async_client.simulations.wire_transfers.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, - beneficiary_address_line1="x", - beneficiary_address_line2="x", - beneficiary_address_line3="x", - beneficiary_name="x", - beneficiary_reference="x", - originator_address_line1="x", - originator_address_line2="x", - originator_address_line3="x", - originator_name="x", - originator_routing_number="x", - originator_to_beneficiary_information_line1="x", - originator_to_beneficiary_information_line2="x", - originator_to_beneficiary_information_line3="x", - originator_to_beneficiary_information_line4="x", + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) + + @parametrize + async def test_raw_response_reverse(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.wire_transfers.with_raw_response.reverse( + "wire_transfer_5akynk7dqsq25qwk9q2u", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + wire_transfer = await response.parse() + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_reverse(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.wire_transfers.with_streaming_response.reverse( + "wire_transfer_5akynk7dqsq25qwk9q2u", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + wire_transfer = await response.parse() + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_reverse(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): + await async_client.simulations.wire_transfers.with_raw_response.reverse( + "", + ) + + @parametrize + async def test_method_submit(self, async_client: AsyncIncrease) -> None: + wire_transfer = await async_client.simulations.wire_transfers.submit( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize - async def test_raw_response_create_inbound(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.wire_transfers.with_raw_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + async def test_raw_response_submit(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.wire_transfers.with_raw_response.submit( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) + wire_transfer = await response.parse() + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize - async def test_streaming_response_create_inbound(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.wire_transfers.with_streaming_response.create_inbound( - account_number_id="account_number_v18nkfqm6afpsrvy82b2", - amount=1000, + async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.wire_transfers.with_streaming_response.submit( + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" wire_transfer = await response.parse() - assert_matches_type(InboundWireTransfer, wire_transfer, path=["response"]) + assert_matches_type(WireTransfer, wire_transfer, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): + await async_client.simulations.wire_transfers.with_raw_response.submit( + "", + ) diff --git a/tests/api_resources/test_account_numbers.py b/tests/api_resources/test_account_numbers.py index 514c878fa..d97124c78 100644 --- a/tests/api_resources/test_account_numbers.py +++ b/tests/api_resources/test_account_numbers.py @@ -68,14 +68,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: account_number = client.account_numbers.retrieve( - "string", + "account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(AccountNumber, account_number, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.account_numbers.with_raw_response.retrieve( - "string", + "account_number_v18nkfqm6afpsrvy82b2", ) assert response.is_closed is True @@ -86,7 +86,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.account_numbers.with_streaming_response.retrieve( - "string", + "account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -106,14 +106,14 @@ def test_path_params_retrieve(self, client: Increase) -> None: @parametrize def test_method_update(self, client: Increase) -> None: account_number = client.account_numbers.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(AccountNumber, account_number, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Increase) -> None: account_number = client.account_numbers.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", inbound_ach={"debit_status": "blocked"}, inbound_checks={"status": "allowed"}, name="x", @@ -124,7 +124,7 @@ def test_method_update_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_update(self, client: Increase) -> None: response = client.account_numbers.with_raw_response.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert response.is_closed is True @@ -135,7 +135,7 @@ def test_raw_response_update(self, client: Increase) -> None: @parametrize def test_streaming_response_update(self, client: Increase) -> None: with client.account_numbers.with_streaming_response.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -149,7 +149,7 @@ def test_streaming_response_update(self, client: Increase) -> None: def test_path_params_update(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_number_id` but received ''"): client.account_numbers.with_raw_response.update( - "", + account_number_id="", ) @parametrize @@ -160,18 +160,18 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: account_number = client.account_numbers.list( - account_id="string", - ach_debit_status="allowed", + account_id="account_id", + ach_debit_status={"in": ["allowed"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status="active", + status={"in": ["active"]}, ) assert_matches_type(SyncPage[AccountNumber], account_number, path=["response"]) @@ -197,7 +197,9 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncAccountNumbers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -226,7 +228,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_number = response.parse() + account_number = await response.parse() assert_matches_type(AccountNumber, account_number, path=["response"]) @parametrize @@ -246,25 +248,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: account_number = await async_client.account_numbers.retrieve( - "string", + "account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(AccountNumber, account_number, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.account_numbers.with_raw_response.retrieve( - "string", + "account_number_v18nkfqm6afpsrvy82b2", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_number = response.parse() + account_number = await response.parse() assert_matches_type(AccountNumber, account_number, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.account_numbers.with_streaming_response.retrieve( - "string", + "account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -284,14 +286,14 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_update(self, async_client: AsyncIncrease) -> None: account_number = await async_client.account_numbers.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(AccountNumber, account_number, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: account_number = await async_client.account_numbers.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", inbound_ach={"debit_status": "blocked"}, inbound_checks={"status": "allowed"}, name="x", @@ -302,18 +304,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: response = await async_client.account_numbers.with_raw_response.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_number = response.parse() + account_number = await response.parse() assert_matches_type(AccountNumber, account_number, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: async with async_client.account_numbers.with_streaming_response.update( - "string", + account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -327,7 +329,7 @@ async def test_streaming_response_update(self, async_client: AsyncIncrease) -> N async def test_path_params_update(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_number_id` but received ''"): await async_client.account_numbers.with_raw_response.update( - "", + account_number_id="", ) @parametrize @@ -338,18 +340,18 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: account_number = await async_client.account_numbers.list( - account_id="string", - ach_debit_status="allowed", + account_id="account_id", + ach_debit_status={"in": ["allowed"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status="active", + status={"in": ["active"]}, ) assert_matches_type(AsyncPage[AccountNumber], account_number, path=["response"]) @@ -359,7 +361,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_number = response.parse() + account_number = await response.parse() assert_matches_type(AsyncPage[AccountNumber], account_number, path=["response"]) @parametrize diff --git a/tests/api_resources/test_account_statements.py b/tests/api_resources/test_account_statements.py index d548cc5be..0caeb7f48 100644 --- a/tests/api_resources/test_account_statements.py +++ b/tests/api_resources/test_account_statements.py @@ -22,14 +22,14 @@ class TestAccountStatements: @parametrize def test_method_retrieve(self, client: Increase) -> None: account_statement = client.account_statements.retrieve( - "string", + "account_statement_lkc03a4skm2k7f38vj15", ) assert_matches_type(AccountStatement, account_statement, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.account_statements.with_raw_response.retrieve( - "string", + "account_statement_lkc03a4skm2k7f38vj15", ) assert response.is_closed is True @@ -40,7 +40,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.account_statements.with_streaming_response.retrieve( - "string", + "account_statement_lkc03a4skm2k7f38vj15", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,8 +65,8 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: account_statement = client.account_statements.list( - account_id="string", - cursor="string", + account_id="account_id", + cursor="cursor", limit=1, statement_period_start={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -99,30 +99,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncAccountStatements: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: account_statement = await async_client.account_statements.retrieve( - "string", + "account_statement_lkc03a4skm2k7f38vj15", ) assert_matches_type(AccountStatement, account_statement, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.account_statements.with_raw_response.retrieve( - "string", + "account_statement_lkc03a4skm2k7f38vj15", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_statement = response.parse() + account_statement = await response.parse() assert_matches_type(AccountStatement, account_statement, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.account_statements.with_streaming_response.retrieve( - "string", + "account_statement_lkc03a4skm2k7f38vj15", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -147,8 +149,8 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: account_statement = await async_client.account_statements.list( - account_id="string", - cursor="string", + account_id="account_id", + cursor="cursor", limit=1, statement_period_start={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -165,7 +167,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_statement = response.parse() + account_statement = await response.parse() assert_matches_type(AsyncPage[AccountStatement], account_statement, path=["response"]) @parametrize diff --git a/tests/api_resources/test_account_transfers.py b/tests/api_resources/test_account_transfers.py index e4f7e540f..02f608a43 100644 --- a/tests/api_resources/test_account_transfers.py +++ b/tests/api_resources/test_account_transfers.py @@ -73,14 +73,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: account_transfer = client.account_transfers.retrieve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.account_transfers.with_raw_response.retrieve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True @@ -91,7 +91,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.account_transfers.with_streaming_response.retrieve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -116,14 +116,14 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: account_transfer = client.account_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -152,14 +152,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_approve(self, client: Increase) -> None: account_transfer = client.account_transfers.approve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize def test_raw_response_approve(self, client: Increase) -> None: response = client.account_transfers.with_raw_response.approve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True @@ -170,7 +170,7 @@ def test_raw_response_approve(self, client: Increase) -> None: @parametrize def test_streaming_response_approve(self, client: Increase) -> None: with client.account_transfers.with_streaming_response.approve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -190,14 +190,14 @@ def test_path_params_approve(self, client: Increase) -> None: @parametrize def test_method_cancel(self, client: Increase) -> None: account_transfer = client.account_transfers.cancel( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize def test_raw_response_cancel(self, client: Increase) -> None: response = client.account_transfers.with_raw_response.cancel( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True @@ -208,7 +208,7 @@ def test_raw_response_cancel(self, client: Increase) -> None: @parametrize def test_streaming_response_cancel(self, client: Increase) -> None: with client.account_transfers.with_streaming_response.cancel( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -227,7 +227,9 @@ def test_path_params_cancel(self, client: Increase) -> None: class TestAsyncAccountTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -261,7 +263,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_transfer = response.parse() + account_transfer = await response.parse() assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize @@ -283,25 +285,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: account_transfer = await async_client.account_transfers.retrieve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.account_transfers.with_raw_response.retrieve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_transfer = response.parse() + account_transfer = await response.parse() assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.account_transfers.with_streaming_response.retrieve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -326,14 +328,14 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: account_transfer = await async_client.account_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -345,7 +347,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_transfer = response.parse() + account_transfer = await response.parse() assert_matches_type(AsyncPage[AccountTransfer], account_transfer, path=["response"]) @parametrize @@ -362,25 +364,25 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_approve(self, async_client: AsyncIncrease) -> None: account_transfer = await async_client.account_transfers.approve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: response = await async_client.account_transfers.with_raw_response.approve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_transfer = response.parse() + account_transfer = await response.parse() assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: async with async_client.account_transfers.with_streaming_response.approve( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -400,25 +402,25 @@ async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_cancel(self, async_client: AsyncIncrease) -> None: account_transfer = await async_client.account_transfers.cancel( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: response = await async_client.account_transfers.with_raw_response.cancel( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_transfer = response.parse() + account_transfer = await response.parse() assert_matches_type(AccountTransfer, account_transfer, path=["response"]) @parametrize async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: async with async_client.account_transfers.with_streaming_response.cancel( - "string", + "account_transfer_7k9qe1ysdgqztnt63l7n", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_accounts.py b/tests/api_resources/test_accounts.py index d4d7ccfe8..d208450c5 100644 --- a/tests/api_resources/test_accounts.py +++ b/tests/api_resources/test_accounts.py @@ -13,7 +13,7 @@ Account, BalanceLookup, ) -from increase._utils import parse_datetime +from increase._utils import parse_date, parse_datetime from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -34,7 +34,15 @@ def test_method_create_with_all_params(self, client: Increase) -> None: account = client.accounts.create( name="New Account!", entity_id="entity_n8y8tnk2p9339ti393yi", - informational_entity_id="string", + funding="loan", + informational_entity_id="informational_entity_id", + loan={ + "credit_limit": 0, + "grace_period_days": 0, + "statement_day_of_month": 1, + "statement_payment_type": "balance", + "maturity_date": parse_date("2019-12-27"), + }, program_id="program_i2v2os4mwza1oetokh9i", ) assert_matches_type(Account, account, path=["response"]) @@ -66,14 +74,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: account = client.accounts.retrieve( - "string", + "account_in71c4amph0vgo2qllky", ) assert_matches_type(Account, account, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.accounts.with_raw_response.retrieve( - "string", + "account_in71c4amph0vgo2qllky", ) assert response.is_closed is True @@ -84,7 +92,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.accounts.with_streaming_response.retrieve( - "string", + "account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -104,14 +112,15 @@ def test_path_params_retrieve(self, client: Increase) -> None: @parametrize def test_method_update(self, client: Increase) -> None: account = client.accounts.update( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert_matches_type(Account, account, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Increase) -> None: account = client.accounts.update( - "string", + account_id="account_in71c4amph0vgo2qllky", + loan={"credit_limit": 0}, name="My renamed account", ) assert_matches_type(Account, account, path=["response"]) @@ -119,7 +128,7 @@ def test_method_update_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_update(self, client: Increase) -> None: response = client.accounts.with_raw_response.update( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert response.is_closed is True @@ -130,7 +139,7 @@ def test_raw_response_update(self, client: Increase) -> None: @parametrize def test_streaming_response_update(self, client: Increase) -> None: with client.accounts.with_streaming_response.update( - "string", + account_id="account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -144,7 +153,7 @@ def test_streaming_response_update(self, client: Increase) -> None: def test_path_params_update(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.accounts.with_raw_response.update( - "", + account_id="", ) @parametrize @@ -161,12 +170,13 @@ def test_method_list_with_all_params(self, client: Increase) -> None: "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - entity_id="string", + cursor="cursor", + entity_id="entity_id", idempotency_key="x", - informational_entity_id="string", + informational_entity_id="informational_entity_id", limit=1, - status="open", + program_id="program_id", + status={"in": ["closed"]}, ) assert_matches_type(SyncPage[Account], account, path=["response"]) @@ -193,14 +203,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_balance(self, client: Increase) -> None: account = client.accounts.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert_matches_type(BalanceLookup, account, path=["response"]) @parametrize def test_method_balance_with_all_params(self, client: Increase) -> None: account = client.accounts.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", at_time=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(BalanceLookup, account, path=["response"]) @@ -208,7 +218,7 @@ def test_method_balance_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_balance(self, client: Increase) -> None: response = client.accounts.with_raw_response.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert response.is_closed is True @@ -219,7 +229,7 @@ def test_raw_response_balance(self, client: Increase) -> None: @parametrize def test_streaming_response_balance(self, client: Increase) -> None: with client.accounts.with_streaming_response.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -233,22 +243,20 @@ def test_streaming_response_balance(self, client: Increase) -> None: def test_path_params_balance(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): client.accounts.with_raw_response.balance( - "", + account_id="", ) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_method_close(self, client: Increase) -> None: account = client.accounts.close( - "string", + "account_in71c4amph0vgo2qllky", ) assert_matches_type(Account, account, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_raw_response_close(self, client: Increase) -> None: response = client.accounts.with_raw_response.close( - "string", + "account_in71c4amph0vgo2qllky", ) assert response.is_closed is True @@ -256,11 +264,10 @@ def test_raw_response_close(self, client: Increase) -> None: account = response.parse() assert_matches_type(Account, account, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_streaming_response_close(self, client: Increase) -> None: with client.accounts.with_streaming_response.close( - "string", + "account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -270,7 +277,6 @@ def test_streaming_response_close(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_path_params_close(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): @@ -280,7 +286,9 @@ def test_path_params_close(self, client: Increase) -> None: class TestAsyncAccounts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -294,7 +302,15 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) account = await async_client.accounts.create( name="New Account!", entity_id="entity_n8y8tnk2p9339ti393yi", - informational_entity_id="string", + funding="loan", + informational_entity_id="informational_entity_id", + loan={ + "credit_limit": 0, + "grace_period_days": 0, + "statement_day_of_month": 1, + "statement_payment_type": "balance", + "maturity_date": parse_date("2019-12-27"), + }, program_id="program_i2v2os4mwza1oetokh9i", ) assert_matches_type(Account, account, path=["response"]) @@ -307,7 +323,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account = response.parse() + account = await response.parse() assert_matches_type(Account, account, path=["response"]) @parametrize @@ -326,25 +342,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: account = await async_client.accounts.retrieve( - "string", + "account_in71c4amph0vgo2qllky", ) assert_matches_type(Account, account, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.accounts.with_raw_response.retrieve( - "string", + "account_in71c4amph0vgo2qllky", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account = response.parse() + account = await response.parse() assert_matches_type(Account, account, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.accounts.with_streaming_response.retrieve( - "string", + "account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -364,14 +380,15 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_update(self, async_client: AsyncIncrease) -> None: account = await async_client.accounts.update( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert_matches_type(Account, account, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: account = await async_client.accounts.update( - "string", + account_id="account_in71c4amph0vgo2qllky", + loan={"credit_limit": 0}, name="My renamed account", ) assert_matches_type(Account, account, path=["response"]) @@ -379,18 +396,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: response = await async_client.accounts.with_raw_response.update( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account = response.parse() + account = await response.parse() assert_matches_type(Account, account, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: async with async_client.accounts.with_streaming_response.update( - "string", + account_id="account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -404,7 +421,7 @@ async def test_streaming_response_update(self, async_client: AsyncIncrease) -> N async def test_path_params_update(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.accounts.with_raw_response.update( - "", + account_id="", ) @parametrize @@ -421,12 +438,13 @@ async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - entity_id="string", + cursor="cursor", + entity_id="entity_id", idempotency_key="x", - informational_entity_id="string", + informational_entity_id="informational_entity_id", limit=1, - status="open", + program_id="program_id", + status={"in": ["closed"]}, ) assert_matches_type(AsyncPage[Account], account, path=["response"]) @@ -436,7 +454,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account = response.parse() + account = await response.parse() assert_matches_type(AsyncPage[Account], account, path=["response"]) @parametrize @@ -453,14 +471,14 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_balance(self, async_client: AsyncIncrease) -> None: account = await async_client.accounts.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert_matches_type(BalanceLookup, account, path=["response"]) @parametrize async def test_method_balance_with_all_params(self, async_client: AsyncIncrease) -> None: account = await async_client.accounts.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", at_time=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(BalanceLookup, account, path=["response"]) @@ -468,18 +486,18 @@ async def test_method_balance_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_balance(self, async_client: AsyncIncrease) -> None: response = await async_client.accounts.with_raw_response.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account = response.parse() + account = await response.parse() assert_matches_type(BalanceLookup, account, path=["response"]) @parametrize async def test_streaming_response_balance(self, async_client: AsyncIncrease) -> None: async with async_client.accounts.with_streaming_response.balance( - "string", + account_id="account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -493,34 +511,31 @@ async def test_streaming_response_balance(self, async_client: AsyncIncrease) -> async def test_path_params_balance(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): await async_client.accounts.with_raw_response.balance( - "", + account_id="", ) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_method_close(self, async_client: AsyncIncrease) -> None: account = await async_client.accounts.close( - "string", + "account_in71c4amph0vgo2qllky", ) assert_matches_type(Account, account, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_raw_response_close(self, async_client: AsyncIncrease) -> None: response = await async_client.accounts.with_raw_response.close( - "string", + "account_in71c4amph0vgo2qllky", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account = response.parse() + account = await response.parse() assert_matches_type(Account, account, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_streaming_response_close(self, async_client: AsyncIncrease) -> None: async with async_client.accounts.with_streaming_response.close( - "string", + "account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -530,7 +545,6 @@ async def test_streaming_response_close(self, async_client: AsyncIncrease) -> No assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_path_params_close(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): diff --git a/tests/api_resources/test_ach_prenotifications.py b/tests/api_resources/test_ach_prenotifications.py index 5924cdcd1..c86c20448 100644 --- a/tests/api_resources/test_ach_prenotifications.py +++ b/tests/api_resources/test_ach_prenotifications.py @@ -22,6 +22,7 @@ class TestACHPrenotifications: @parametrize def test_method_create(self, client: Increase) -> None: ach_prenotification = client.ach_prenotifications.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", ) @@ -30,6 +31,7 @@ def test_method_create(self, client: Increase) -> None: @parametrize def test_method_create_with_all_params(self, client: Increase) -> None: ach_prenotification = client.ach_prenotifications.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", addendum="x", @@ -48,6 +50,7 @@ def test_method_create_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_create(self, client: Increase) -> None: response = client.ach_prenotifications.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", ) @@ -60,6 +63,7 @@ def test_raw_response_create(self, client: Increase) -> None: @parametrize def test_streaming_response_create(self, client: Increase) -> None: with client.ach_prenotifications.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", ) as response: @@ -74,14 +78,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: ach_prenotification = client.ach_prenotifications.retrieve( - "string", + "ach_prenotification_ubjf9qqsxl3obbcn1u34", ) assert_matches_type(ACHPrenotification, ach_prenotification, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.ach_prenotifications.with_raw_response.retrieve( - "string", + "ach_prenotification_ubjf9qqsxl3obbcn1u34", ) assert response.is_closed is True @@ -92,7 +96,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.ach_prenotifications.with_streaming_response.retrieve( - "string", + "ach_prenotification_ubjf9qqsxl3obbcn1u34", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -125,7 +129,7 @@ def test_method_list_with_all_params(self, client: Increase) -> None: "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -153,11 +157,14 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncACHPrenotifications: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: ach_prenotification = await async_client.ach_prenotifications.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", ) @@ -166,6 +173,7 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: ach_prenotification = await async_client.ach_prenotifications.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", addendum="x", @@ -184,18 +192,20 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.ach_prenotifications.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_prenotification = response.parse() + ach_prenotification = await response.parse() assert_matches_type(ACHPrenotification, ach_prenotification, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: async with async_client.ach_prenotifications.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", account_number="987654321", routing_number="101050001", ) as response: @@ -210,25 +220,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: ach_prenotification = await async_client.ach_prenotifications.retrieve( - "string", + "ach_prenotification_ubjf9qqsxl3obbcn1u34", ) assert_matches_type(ACHPrenotification, ach_prenotification, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.ach_prenotifications.with_raw_response.retrieve( - "string", + "ach_prenotification_ubjf9qqsxl3obbcn1u34", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_prenotification = response.parse() + ach_prenotification = await response.parse() assert_matches_type(ACHPrenotification, ach_prenotification, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.ach_prenotifications.with_streaming_response.retrieve( - "string", + "ach_prenotification_ubjf9qqsxl3obbcn1u34", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -261,7 +271,7 @@ async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -273,7 +283,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_prenotification = response.parse() + ach_prenotification = await response.parse() assert_matches_type(AsyncPage[ACHPrenotification], ach_prenotification, path=["response"]) @parametrize diff --git a/tests/api_resources/test_ach_transfers.py b/tests/api_resources/test_ach_transfers.py index d2aef2a9e..103899c14 100644 --- a/tests/api_resources/test_ach_transfers.py +++ b/tests/api_resources/test_ach_transfers.py @@ -37,27 +37,13 @@ def test_method_create_with_all_params(self, client: Increase) -> None: account_number="987654321", addenda={ "category": "freeform", - "freeform": { - "entries": [ - {"payment_related_information": "x"}, - {"payment_related_information": "x"}, - {"payment_related_information": "x"}, - ] - }, + "freeform": {"entries": [{"payment_related_information": "x"}]}, "payment_order_remittance_advice": { "invoices": [ { "invoice_number": "x", "paid_amount": 0, - }, - { - "invoice_number": "x", - "paid_amount": 0, - }, - { - "invoice_number": "x", - "paid_amount": 0, - }, + } ] }, }, @@ -66,14 +52,18 @@ def test_method_create_with_all_params(self, client: Increase) -> None: company_entry_description="x", company_name="x", destination_account_holder="business", - effective_date=parse_date("2019-12-27"), - external_account_id="string", + external_account_id="external_account_id", funding="checking", individual_id="x", individual_name="x", + preferred_effective_date={ + "date": parse_date("2019-12-27"), + "settlement_schedule": "same_day", + }, require_approval=True, routing_number="101050001", standard_entry_class_code="corporate_credit_or_debit", + transaction_timing="synchronous", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @@ -108,14 +98,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: ach_transfer = client.ach_transfers.retrieve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.ach_transfers.with_raw_response.retrieve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True @@ -126,7 +116,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.ach_transfers.with_streaming_response.retrieve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -151,17 +141,18 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: ach_transfer = client.ach_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - external_account_id="string", + cursor="cursor", + external_account_id="external_account_id", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(SyncPage[ACHTransfer], ach_transfer, path=["response"]) @@ -188,14 +179,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_approve(self, client: Increase) -> None: ach_transfer = client.ach_transfers.approve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize def test_raw_response_approve(self, client: Increase) -> None: response = client.ach_transfers.with_raw_response.approve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True @@ -206,7 +197,7 @@ def test_raw_response_approve(self, client: Increase) -> None: @parametrize def test_streaming_response_approve(self, client: Increase) -> None: with client.ach_transfers.with_streaming_response.approve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -226,14 +217,14 @@ def test_path_params_approve(self, client: Increase) -> None: @parametrize def test_method_cancel(self, client: Increase) -> None: ach_transfer = client.ach_transfers.cancel( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize def test_raw_response_cancel(self, client: Increase) -> None: response = client.ach_transfers.with_raw_response.cancel( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True @@ -244,7 +235,7 @@ def test_raw_response_cancel(self, client: Increase) -> None: @parametrize def test_streaming_response_cancel(self, client: Increase) -> None: with client.ach_transfers.with_streaming_response.cancel( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -263,7 +254,9 @@ def test_path_params_cancel(self, client: Increase) -> None: class TestAsyncACHTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -283,27 +276,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) account_number="987654321", addenda={ "category": "freeform", - "freeform": { - "entries": [ - {"payment_related_information": "x"}, - {"payment_related_information": "x"}, - {"payment_related_information": "x"}, - ] - }, + "freeform": {"entries": [{"payment_related_information": "x"}]}, "payment_order_remittance_advice": { "invoices": [ { "invoice_number": "x", "paid_amount": 0, - }, - { - "invoice_number": "x", - "paid_amount": 0, - }, - { - "invoice_number": "x", - "paid_amount": 0, - }, + } ] }, }, @@ -312,14 +291,18 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) company_entry_description="x", company_name="x", destination_account_holder="business", - effective_date=parse_date("2019-12-27"), - external_account_id="string", + external_account_id="external_account_id", funding="checking", individual_id="x", individual_name="x", + preferred_effective_date={ + "date": parse_date("2019-12-27"), + "settlement_schedule": "same_day", + }, require_approval=True, routing_number="101050001", standard_entry_class_code="corporate_credit_or_debit", + transaction_timing="synchronous", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @@ -333,7 +316,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() + ach_transfer = await response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize @@ -354,25 +337,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: ach_transfer = await async_client.ach_transfers.retrieve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.ach_transfers.with_raw_response.retrieve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() + ach_transfer = await response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.ach_transfers.with_streaming_response.retrieve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -397,17 +380,18 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: ach_transfer = await async_client.ach_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - external_account_id="string", + cursor="cursor", + external_account_id="external_account_id", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(AsyncPage[ACHTransfer], ach_transfer, path=["response"]) @@ -417,7 +401,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() + ach_transfer = await response.parse() assert_matches_type(AsyncPage[ACHTransfer], ach_transfer, path=["response"]) @parametrize @@ -434,25 +418,25 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_approve(self, async_client: AsyncIncrease) -> None: ach_transfer = await async_client.ach_transfers.approve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: response = await async_client.ach_transfers.with_raw_response.approve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() + ach_transfer = await response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: async with async_client.ach_transfers.with_streaming_response.approve( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -472,25 +456,25 @@ async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_cancel(self, async_client: AsyncIncrease) -> None: ach_transfer = await async_client.ach_transfers.cancel( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: response = await async_client.ach_transfers.with_raw_response.cancel( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - ach_transfer = response.parse() + ach_transfer = await response.parse() assert_matches_type(ACHTransfer, ach_transfer, path=["response"]) @parametrize async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: async with async_client.ach_transfers.with_streaming_response.cancel( - "string", + "ach_transfer_uoxatyh3lt5evrsdvo7q", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_beneficial_owners.py b/tests/api_resources/test_beneficial_owners.py new file mode 100644 index 000000000..f41b5c45f --- /dev/null +++ b/tests/api_resources/test_beneficial_owners.py @@ -0,0 +1,662 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import ( + EntityBeneficialOwner, +) +from increase._utils import parse_date +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestBeneficialOwners: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + }, + "name": "Ian Crease", + }, + prongs=["control"], + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "state": "NY", + "zip": "10045", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + "drivers_license": { + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + "state": "x", + "back_file_id": "back_file_id", + }, + "other": { + "country": "x", + "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + }, + }, + "name": "Ian Crease", + "confirmed_no_us_tax_id": True, + }, + prongs=["control"], + company_title="CEO", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.beneficial_owners.with_raw_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + }, + "name": "Ian Crease", + }, + prongs=["control"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.beneficial_owners.with_streaming_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + }, + "name": "Ian Crease", + }, + prongs=["control"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.retrieve( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.beneficial_owners.with_raw_response.retrieve( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.beneficial_owners.with_streaming_response.retrieve( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_beneficial_owner_id` but received ''" + ): + client.beneficial_owners.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_update(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "Unit 2", + "state": "NY", + "zip": "10045", + }, + confirmed_no_us_tax_id=True, + identification={ + "method": "social_security_number", + "number": "xxxx", + "drivers_license": { + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + "state": "x", + "back_file_id": "back_file_id", + }, + "other": { + "country": "x", + "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + }, + }, + name="x", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Increase) -> None: + response = client.beneficial_owners.with_raw_response.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Increase) -> None: + with client.beneficial_owners.with_streaming_response.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_beneficial_owner_id` but received ''" + ): + client.beneficial_owners.with_raw_response.update( + entity_beneficial_owner_id="", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.list( + entity_id="entity_id", + ) + assert_matches_type(SyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.list( + entity_id="entity_id", + cursor="cursor", + idempotency_key="x", + limit=1, + ) + assert_matches_type(SyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.beneficial_owners.with_raw_response.list( + entity_id="entity_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = response.parse() + assert_matches_type(SyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.beneficial_owners.with_streaming_response.list( + entity_id="entity_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = response.parse() + assert_matches_type(SyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_archive(self, client: Increase) -> None: + beneficial_owner = client.beneficial_owners.archive( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_raw_response_archive(self, client: Increase) -> None: + response = client.beneficial_owners.with_raw_response.archive( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + def test_streaming_response_archive(self, client: Increase) -> None: + with client.beneficial_owners.with_streaming_response.archive( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_archive(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_beneficial_owner_id` but received ''" + ): + client.beneficial_owners.with_raw_response.archive( + "", + ) + + +class TestAsyncBeneficialOwners: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + }, + "name": "Ian Crease", + }, + prongs=["control"], + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "state": "NY", + "zip": "10045", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + "drivers_license": { + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + "state": "x", + "back_file_id": "back_file_id", + }, + "other": { + "country": "x", + "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + }, + }, + "name": "Ian Crease", + "confirmed_no_us_tax_id": True, + }, + prongs=["control"], + company_title="CEO", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.beneficial_owners.with_raw_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + }, + "name": "Ian Crease", + }, + prongs=["control"], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.beneficial_owners.with_streaming_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", + individual={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + "date_of_birth": parse_date("1970-01-31"), + "identification": { + "method": "social_security_number", + "number": "078051120", + }, + "name": "Ian Crease", + }, + prongs=["control"], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.retrieve( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.beneficial_owners.with_raw_response.retrieve( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.beneficial_owners.with_streaming_response.retrieve( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_beneficial_owner_id` but received ''" + ): + await async_client.beneficial_owners.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "Unit 2", + "state": "NY", + "zip": "10045", + }, + confirmed_no_us_tax_id=True, + identification={ + "method": "social_security_number", + "number": "xxxx", + "drivers_license": { + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + "state": "x", + "back_file_id": "back_file_id", + }, + "other": { + "country": "x", + "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", + }, + }, + name="x", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: + response = await async_client.beneficial_owners.with_raw_response.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: + async with async_client.beneficial_owners.with_streaming_response.update( + entity_beneficial_owner_id="entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_beneficial_owner_id` but received ''" + ): + await async_client.beneficial_owners.with_raw_response.update( + entity_beneficial_owner_id="", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.list( + entity_id="entity_id", + ) + assert_matches_type(AsyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.list( + entity_id="entity_id", + cursor="cursor", + idempotency_key="x", + limit=1, + ) + assert_matches_type(AsyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.beneficial_owners.with_raw_response.list( + entity_id="entity_id", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = await response.parse() + assert_matches_type(AsyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.beneficial_owners.with_streaming_response.list( + entity_id="entity_id", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = await response.parse() + assert_matches_type(AsyncPage[EntityBeneficialOwner], beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_archive(self, async_client: AsyncIncrease) -> None: + beneficial_owner = await async_client.beneficial_owners.archive( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_raw_response_archive(self, async_client: AsyncIncrease) -> None: + response = await async_client.beneficial_owners.with_raw_response.archive( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + @parametrize + async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> None: + async with async_client.beneficial_owners.with_streaming_response.archive( + "entity_beneficial_owner_vozma8szzu1sxezp5zq6", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + beneficial_owner = await response.parse() + assert_matches_type(EntityBeneficialOwner, beneficial_owner, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_archive(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_beneficial_owner_id` but received ''" + ): + await async_client.beneficial_owners.with_raw_response.archive( + "", + ) diff --git a/tests/api_resources/test_bookkeeping_accounts.py b/tests/api_resources/test_bookkeeping_accounts.py index 7ebf4c3bc..e22057f1d 100644 --- a/tests/api_resources/test_bookkeeping_accounts.py +++ b/tests/api_resources/test_bookkeeping_accounts.py @@ -33,9 +33,9 @@ def test_method_create(self, client: Increase) -> None: def test_method_create_with_all_params(self, client: Increase) -> None: bookkeeping_account = client.bookkeeping_accounts.create( name="New Account!", - account_id="string", + account_id="account_id", compliance_category="commingled_cash", - entity_id="string", + entity_id="entity_id", ) assert_matches_type(BookkeepingAccount, bookkeeping_account, path=["response"]) @@ -66,7 +66,7 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_update(self, client: Increase) -> None: bookkeeping_account = client.bookkeeping_accounts.update( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", name="Deprecated Account", ) assert_matches_type(BookkeepingAccount, bookkeeping_account, path=["response"]) @@ -74,7 +74,7 @@ def test_method_update(self, client: Increase) -> None: @parametrize def test_raw_response_update(self, client: Increase) -> None: response = client.bookkeeping_accounts.with_raw_response.update( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", name="Deprecated Account", ) @@ -86,7 +86,7 @@ def test_raw_response_update(self, client: Increase) -> None: @parametrize def test_streaming_response_update(self, client: Increase) -> None: with client.bookkeeping_accounts.with_streaming_response.update( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", name="Deprecated Account", ) as response: assert not response.is_closed @@ -103,7 +103,7 @@ def test_path_params_update(self, client: Increase) -> None: ValueError, match=r"Expected a non-empty value for `bookkeeping_account_id` but received ''" ): client.bookkeeping_accounts.with_raw_response.update( - "", + bookkeeping_account_id="", name="Deprecated Account", ) @@ -115,7 +115,7 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: bookkeeping_account = client.bookkeeping_accounts.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -144,14 +144,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_balance(self, client: Increase) -> None: bookkeeping_account = client.bookkeeping_accounts.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", ) assert_matches_type(BookkeepingBalanceLookup, bookkeeping_account, path=["response"]) @parametrize def test_method_balance_with_all_params(self, client: Increase) -> None: bookkeeping_account = client.bookkeeping_accounts.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", at_time=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(BookkeepingBalanceLookup, bookkeeping_account, path=["response"]) @@ -159,7 +159,7 @@ def test_method_balance_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_balance(self, client: Increase) -> None: response = client.bookkeeping_accounts.with_raw_response.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", ) assert response.is_closed is True @@ -170,7 +170,7 @@ def test_raw_response_balance(self, client: Increase) -> None: @parametrize def test_streaming_response_balance(self, client: Increase) -> None: with client.bookkeeping_accounts.with_streaming_response.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -186,12 +186,14 @@ def test_path_params_balance(self, client: Increase) -> None: ValueError, match=r"Expected a non-empty value for `bookkeeping_account_id` but received ''" ): client.bookkeeping_accounts.with_raw_response.balance( - "", + bookkeeping_account_id="", ) class TestAsyncBookkeepingAccounts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -204,9 +206,9 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: bookkeeping_account = await async_client.bookkeeping_accounts.create( name="New Account!", - account_id="string", + account_id="account_id", compliance_category="commingled_cash", - entity_id="string", + entity_id="entity_id", ) assert_matches_type(BookkeepingAccount, bookkeeping_account, path=["response"]) @@ -218,7 +220,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_account = response.parse() + bookkeeping_account = await response.parse() assert_matches_type(BookkeepingAccount, bookkeeping_account, path=["response"]) @parametrize @@ -237,7 +239,7 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_update(self, async_client: AsyncIncrease) -> None: bookkeeping_account = await async_client.bookkeeping_accounts.update( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", name="Deprecated Account", ) assert_matches_type(BookkeepingAccount, bookkeeping_account, path=["response"]) @@ -245,19 +247,19 @@ async def test_method_update(self, async_client: AsyncIncrease) -> None: @parametrize async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: response = await async_client.bookkeeping_accounts.with_raw_response.update( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", name="Deprecated Account", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_account = response.parse() + bookkeeping_account = await response.parse() assert_matches_type(BookkeepingAccount, bookkeeping_account, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: async with async_client.bookkeeping_accounts.with_streaming_response.update( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", name="Deprecated Account", ) as response: assert not response.is_closed @@ -274,7 +276,7 @@ async def test_path_params_update(self, async_client: AsyncIncrease) -> None: ValueError, match=r"Expected a non-empty value for `bookkeeping_account_id` but received ''" ): await async_client.bookkeeping_accounts.with_raw_response.update( - "", + bookkeeping_account_id="", name="Deprecated Account", ) @@ -286,7 +288,7 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: bookkeeping_account = await async_client.bookkeeping_accounts.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -298,7 +300,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_account = response.parse() + bookkeeping_account = await response.parse() assert_matches_type(AsyncPage[BookkeepingAccount], bookkeeping_account, path=["response"]) @parametrize @@ -315,14 +317,14 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_balance(self, async_client: AsyncIncrease) -> None: bookkeeping_account = await async_client.bookkeeping_accounts.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", ) assert_matches_type(BookkeepingBalanceLookup, bookkeeping_account, path=["response"]) @parametrize async def test_method_balance_with_all_params(self, async_client: AsyncIncrease) -> None: bookkeeping_account = await async_client.bookkeeping_accounts.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", at_time=parse_datetime("2019-12-27T18:11:19.117Z"), ) assert_matches_type(BookkeepingBalanceLookup, bookkeeping_account, path=["response"]) @@ -330,18 +332,18 @@ async def test_method_balance_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_balance(self, async_client: AsyncIncrease) -> None: response = await async_client.bookkeeping_accounts.with_raw_response.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_account = response.parse() + bookkeeping_account = await response.parse() assert_matches_type(BookkeepingBalanceLookup, bookkeeping_account, path=["response"]) @parametrize async def test_streaming_response_balance(self, async_client: AsyncIncrease) -> None: async with async_client.bookkeeping_accounts.with_streaming_response.balance( - "string", + bookkeeping_account_id="bookkeeping_account_e37p1f1iuocw5intf35v", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -357,5 +359,5 @@ async def test_path_params_balance(self, async_client: AsyncIncrease) -> None: ValueError, match=r"Expected a non-empty value for `bookkeeping_account_id` but received ''" ): await async_client.bookkeeping_accounts.with_raw_response.balance( - "", + bookkeeping_account_id="", ) diff --git a/tests/api_resources/test_bookkeeping_entries.py b/tests/api_resources/test_bookkeeping_entries.py index d129ae9dc..2e78003b4 100644 --- a/tests/api_resources/test_bookkeeping_entries.py +++ b/tests/api_resources/test_bookkeeping_entries.py @@ -21,14 +21,14 @@ class TestBookkeepingEntries: @parametrize def test_method_retrieve(self, client: Increase) -> None: bookkeeping_entry = client.bookkeeping_entries.retrieve( - "string", + "bookkeeping_entry_ctjpajsj3ks2blx10375", ) assert_matches_type(BookkeepingEntry, bookkeeping_entry, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.bookkeeping_entries.with_raw_response.retrieve( - "string", + "bookkeeping_entry_ctjpajsj3ks2blx10375", ) assert response.is_closed is True @@ -39,7 +39,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.bookkeeping_entries.with_streaming_response.retrieve( - "string", + "bookkeeping_entry_ctjpajsj3ks2blx10375", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -64,7 +64,8 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: bookkeeping_entry = client.bookkeeping_entries.list( - cursor="string", + account_id="account_id", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[BookkeepingEntry], bookkeeping_entry, path=["response"]) @@ -91,30 +92,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncBookkeepingEntries: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: bookkeeping_entry = await async_client.bookkeeping_entries.retrieve( - "string", + "bookkeeping_entry_ctjpajsj3ks2blx10375", ) assert_matches_type(BookkeepingEntry, bookkeeping_entry, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.bookkeeping_entries.with_raw_response.retrieve( - "string", + "bookkeeping_entry_ctjpajsj3ks2blx10375", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_entry = response.parse() + bookkeeping_entry = await response.parse() assert_matches_type(BookkeepingEntry, bookkeeping_entry, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.bookkeeping_entries.with_streaming_response.retrieve( - "string", + "bookkeeping_entry_ctjpajsj3ks2blx10375", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -139,7 +142,8 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: bookkeeping_entry = await async_client.bookkeeping_entries.list( - cursor="string", + account_id="account_id", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[BookkeepingEntry], bookkeeping_entry, path=["response"]) @@ -150,7 +154,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_entry = response.parse() + bookkeeping_entry = await response.parse() assert_matches_type(AsyncPage[BookkeepingEntry], bookkeeping_entry, path=["response"]) @parametrize diff --git a/tests/api_resources/test_bookkeeping_entry_sets.py b/tests/api_resources/test_bookkeeping_entry_sets.py index 0edd3fdab..e13a51f2e 100644 --- a/tests/api_resources/test_bookkeeping_entry_sets.py +++ b/tests/api_resources/test_bookkeeping_entry_sets.py @@ -98,14 +98,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: bookkeeping_entry_set = client.bookkeeping_entry_sets.retrieve( - "string", + "bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf", ) assert_matches_type(BookkeepingEntrySet, bookkeeping_entry_set, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.bookkeeping_entry_sets.with_raw_response.retrieve( - "string", + "bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf", ) assert response.is_closed is True @@ -116,7 +116,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.bookkeeping_entry_sets.with_streaming_response.retrieve( - "string", + "bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -143,10 +143,10 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: bookkeeping_entry_set = client.bookkeeping_entry_sets.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - transaction_id="string", + transaction_id="transaction_id", ) assert_matches_type(SyncPage[BookkeepingEntrySet], bookkeeping_entry_set, path=["response"]) @@ -172,7 +172,9 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncBookkeepingEntrySets: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -225,7 +227,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_entry_set = response.parse() + bookkeeping_entry_set = await response.parse() assert_matches_type(BookkeepingEntrySet, bookkeeping_entry_set, path=["response"]) @parametrize @@ -253,25 +255,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: bookkeeping_entry_set = await async_client.bookkeeping_entry_sets.retrieve( - "string", + "bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf", ) assert_matches_type(BookkeepingEntrySet, bookkeeping_entry_set, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.bookkeeping_entry_sets.with_raw_response.retrieve( - "string", + "bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_entry_set = response.parse() + bookkeeping_entry_set = await response.parse() assert_matches_type(BookkeepingEntrySet, bookkeeping_entry_set, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.bookkeeping_entry_sets.with_streaming_response.retrieve( - "string", + "bookkeeping_entry_set_n80c6wr2p8gtc6p4ingf", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -298,10 +300,10 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: bookkeeping_entry_set = await async_client.bookkeeping_entry_sets.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - transaction_id="string", + transaction_id="transaction_id", ) assert_matches_type(AsyncPage[BookkeepingEntrySet], bookkeeping_entry_set, path=["response"]) @@ -311,7 +313,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - bookkeeping_entry_set = response.parse() + bookkeeping_entry_set = await response.parse() assert_matches_type(AsyncPage[BookkeepingEntrySet], bookkeeping_entry_set, path=["response"]) @parametrize diff --git a/tests/api_resources/test_card_disputes.py b/tests/api_resources/test_card_disputes.py index 55be0d43b..8557c6742 100644 --- a/tests/api_resources/test_card_disputes.py +++ b/tests/api_resources/test_card_disputes.py @@ -9,8 +9,10 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import CardDispute -from increase._utils import parse_datetime +from increase.types import ( + CardDispute, +) +from increase._utils import parse_date, parse_datetime from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,7 +25,260 @@ class TestCardDisputes: def test_method_create(self, client: Increase) -> None: card_dispute = client.card_disputes.create( disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", - explanation="Unauthorized recurring transaction.", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_dispute = client.card_disputes.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + amount=100, + attachment_files=[{"file_id": "file_id"}], + explanation="x", + visa={ + "category": "fraud", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "explanation": "x", + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @@ -31,7 +286,7 @@ def test_method_create(self, client: Increase) -> None: def test_raw_response_create(self, client: Increase) -> None: response = client.card_disputes.with_raw_response.create( disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", - explanation="Unauthorized recurring transaction.", + network="visa", ) assert response.is_closed is True @@ -43,7 +298,7 @@ def test_raw_response_create(self, client: Increase) -> None: def test_streaming_response_create(self, client: Increase) -> None: with client.card_disputes.with_streaming_response.create( disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", - explanation="Unauthorized recurring transaction.", + network="visa", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -56,14 +311,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: card_dispute = client.card_disputes.retrieve( - "string", + "card_dispute_h9sc95nbl1cgltpp7men", ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.card_disputes.with_raw_response.retrieve( - "string", + "card_dispute_h9sc95nbl1cgltpp7men", ) assert response.is_closed is True @@ -74,7 +329,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.card_disputes.with_streaming_response.retrieve( - "string", + "card_dispute_h9sc95nbl1cgltpp7men", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -105,10 +360,10 @@ def test_method_list_with_all_params(self, client: Increase) -> None: "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending_reviewing", "accepted", "rejected"]}, + status={"in": ["user_submission_required"]}, ) assert_matches_type(SyncPage[CardDispute], card_dispute, path=["response"]) @@ -132,15 +387,624 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_submit_user_submission(self, client: Increase) -> None: + card_dispute = client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_method_submit_user_submission_with_all_params(self, client: Increase) -> None: + card_dispute = client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + amount=1, + attachment_files=[{"file_id": "file_id"}], + explanation="x", + visa={ + "category": "merchant_prearbitration_decline", + "chargeback": { + "category": "authorization", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "explanation": "x", + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, + "merchant_prearbitration_decline": { + "reason": "The pre-arbitration received from the merchantdoes not explain how they obtained permission to charge the card." + }, + "user_prearbitration": { + "reason": "x", + "category_change": { + "category": "authorization", + "reason": "x", + }, + }, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_raw_response_submit_user_submission(self, client: Increase) -> None: + response = client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_submit_user_submission(self, client: Increase) -> None: + with client.card_disputes.with_streaming_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_submit_user_submission(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="", + network="visa", + ) + + @parametrize + def test_method_withdraw(self, client: Increase) -> None: + card_dispute = client.card_disputes.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_method_withdraw_with_all_params(self, client: Increase) -> None: + card_dispute = client.card_disputes.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + explanation="The explanation for withdrawing the Card Dispute.", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_raw_response_withdraw(self, client: Increase) -> None: + response = client.card_disputes.with_raw_response.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_withdraw(self, client: Increase) -> None: + with client.card_disputes.with_streaming_response.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_withdraw(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + client.card_disputes.with_raw_response.withdraw( + card_dispute_id="", + ) + class TestAsyncCardDisputes: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: card_dispute = await async_client.card_disputes.create( disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", - explanation="Unauthorized recurring transaction.", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + amount=100, + attachment_files=[{"file_id": "file_id"}], + explanation="x", + visa={ + "category": "fraud", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "explanation": "x", + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @@ -148,19 +1012,19 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.card_disputes.with_raw_response.create( disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", - explanation="Unauthorized recurring transaction.", + network="visa", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_dispute = response.parse() + card_dispute = await response.parse() assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: async with async_client.card_disputes.with_streaming_response.create( disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", - explanation="Unauthorized recurring transaction.", + network="visa", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -173,25 +1037,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: card_dispute = await async_client.card_disputes.retrieve( - "string", + "card_dispute_h9sc95nbl1cgltpp7men", ) assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.card_disputes.with_raw_response.retrieve( - "string", + "card_dispute_h9sc95nbl1cgltpp7men", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_dispute = response.parse() + card_dispute = await response.parse() assert_matches_type(CardDispute, card_dispute, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.card_disputes.with_streaming_response.retrieve( - "string", + "card_dispute_h9sc95nbl1cgltpp7men", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -222,10 +1086,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending_reviewing", "accepted", "rejected"]}, + status={"in": ["user_submission_required"]}, ) assert_matches_type(AsyncPage[CardDispute], card_dispute, path=["response"]) @@ -235,7 +1099,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_dispute = response.parse() + card_dispute = await response.parse() assert_matches_type(AsyncPage[CardDispute], card_dispute, path=["response"]) @parametrize @@ -248,3 +1112,357 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert_matches_type(AsyncPage[CardDispute], card_dispute, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_submit_user_submission(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_method_submit_user_submission_with_all_params(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + amount=1, + attachment_files=[{"file_id": "file_id"}], + explanation="x", + visa={ + "category": "merchant_prearbitration_decline", + "chargeback": { + "category": "authorization", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "explanation": "x", + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, + "merchant_prearbitration_decline": { + "reason": "The pre-arbitration received from the merchantdoes not explain how they obtained permission to charge the card." + }, + "user_prearbitration": { + "reason": "x", + "category_change": { + "category": "authorization", + "reason": "x", + }, + }, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_submit_user_submission(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_submit_user_submission(self, async_client: AsyncIncrease) -> None: + async with async_client.card_disputes.with_streaming_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit_user_submission(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + await async_client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="", + network="visa", + ) + + @parametrize + async def test_method_withdraw(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_method_withdraw_with_all_params(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + explanation="The explanation for withdrawing the Card Dispute.", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_withdraw(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_disputes.with_raw_response.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_withdraw(self, async_client: AsyncIncrease) -> None: + async with async_client.card_disputes.with_streaming_response.withdraw( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_withdraw(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + await async_client.card_disputes.with_raw_response.withdraw( + card_dispute_id="", + ) diff --git a/tests/api_resources/test_card_payments.py b/tests/api_resources/test_card_payments.py index 0291ae1d4..aa0b599ff 100644 --- a/tests/api_resources/test_card_payments.py +++ b/tests/api_resources/test_card_payments.py @@ -22,14 +22,14 @@ class TestCardPayments: @parametrize def test_method_retrieve(self, client: Increase) -> None: card_payment = client.card_payments.retrieve( - "string", + "card_payment_nd3k2kacrqjli8482ave", ) assert_matches_type(CardPayment, card_payment, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.card_payments.with_raw_response.retrieve( - "string", + "card_payment_nd3k2kacrqjli8482ave", ) assert response.is_closed is True @@ -40,7 +40,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.card_payments.with_streaming_response.retrieve( - "string", + "card_payment_nd3k2kacrqjli8482ave", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,15 +65,15 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: card_payment = client.card_payments.list( - account_id="string", - card_id="string", + account_id="account_id", + card_id="card_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[CardPayment], card_payment, path=["response"]) @@ -100,30 +100,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncCardPayments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: card_payment = await async_client.card_payments.retrieve( - "string", + "card_payment_nd3k2kacrqjli8482ave", ) assert_matches_type(CardPayment, card_payment, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.card_payments.with_raw_response.retrieve( - "string", + "card_payment_nd3k2kacrqjli8482ave", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_payment = response.parse() + card_payment = await response.parse() assert_matches_type(CardPayment, card_payment, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.card_payments.with_streaming_response.retrieve( - "string", + "card_payment_nd3k2kacrqjli8482ave", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -148,15 +150,15 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: card_payment = await async_client.card_payments.list( - account_id="string", - card_id="string", + account_id="account_id", + card_id="card_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[CardPayment], card_payment, path=["response"]) @@ -167,7 +169,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_payment = response.parse() + card_payment = await response.parse() assert_matches_type(AsyncPage[CardPayment], card_payment, path=["response"]) @parametrize diff --git a/tests/api_resources/test_card_purchase_supplements.py b/tests/api_resources/test_card_purchase_supplements.py index 8cd3e7906..7bbf0fcd1 100644 --- a/tests/api_resources/test_card_purchase_supplements.py +++ b/tests/api_resources/test_card_purchase_supplements.py @@ -22,14 +22,14 @@ class TestCardPurchaseSupplements: @parametrize def test_method_retrieve(self, client: Increase) -> None: card_purchase_supplement = client.card_purchase_supplements.retrieve( - "string", + "card_purchase_supplement_ijuc45iym4jchnh2sfk3", ) assert_matches_type(CardPurchaseSupplement, card_purchase_supplement, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.card_purchase_supplements.with_raw_response.retrieve( - "string", + "card_purchase_supplement_ijuc45iym4jchnh2sfk3", ) assert response.is_closed is True @@ -40,7 +40,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.card_purchase_supplements.with_streaming_response.retrieve( - "string", + "card_purchase_supplement_ijuc45iym4jchnh2sfk3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,14 +67,14 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: card_purchase_supplement = client.card_purchase_supplements.list( - card_payment_id="string", + card_payment_id="card_payment_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[CardPurchaseSupplement], card_purchase_supplement, path=["response"]) @@ -101,30 +101,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncCardPurchaseSupplements: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: card_purchase_supplement = await async_client.card_purchase_supplements.retrieve( - "string", + "card_purchase_supplement_ijuc45iym4jchnh2sfk3", ) assert_matches_type(CardPurchaseSupplement, card_purchase_supplement, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.card_purchase_supplements.with_raw_response.retrieve( - "string", + "card_purchase_supplement_ijuc45iym4jchnh2sfk3", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_purchase_supplement = response.parse() + card_purchase_supplement = await response.parse() assert_matches_type(CardPurchaseSupplement, card_purchase_supplement, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.card_purchase_supplements.with_streaming_response.retrieve( - "string", + "card_purchase_supplement_ijuc45iym4jchnh2sfk3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -151,14 +153,14 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: card_purchase_supplement = await async_client.card_purchase_supplements.list( - card_payment_id="string", + card_payment_id="card_payment_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[CardPurchaseSupplement], card_purchase_supplement, path=["response"]) @@ -169,7 +171,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card_purchase_supplement = response.parse() + card_purchase_supplement = await response.parse() assert_matches_type(AsyncPage[CardPurchaseSupplement], card_purchase_supplement, path=["response"]) @parametrize diff --git a/tests/api_resources/test_card_push_transfers.py b/tests/api_resources/test_card_push_transfers.py new file mode 100644 index 000000000..a936ec353 --- /dev/null +++ b/tests/api_resources/test_card_push_transfers.py @@ -0,0 +1,572 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPushTransfer +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardPushTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_push_transfer = client.card_push_transfers.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_push_transfer = client.card_push_transfers.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + merchant_legal_business_name="x", + merchant_street_address="x", + recipient_address_city="x", + recipient_address_line1="x", + recipient_address_postal_code="x", + recipient_address_state="x", + require_approval=True, + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.card_push_transfers.with_raw_response.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.card_push_transfers.with_streaming_response.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + card_push_transfer = client.card_push_transfers.retrieve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.card_push_transfers.with_raw_response.retrieve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.card_push_transfers.with_streaming_response.retrieve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_push_transfer_id` but received ''"): + client.card_push_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + card_push_transfer = client.card_push_transfers.list() + assert_matches_type(SyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + card_push_transfer = client.card_push_transfers.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["pending_approval"]}, + ) + assert_matches_type(SyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.card_push_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = response.parse() + assert_matches_type(SyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.card_push_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = response.parse() + assert_matches_type(SyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_approve(self, client: Increase) -> None: + card_push_transfer = client.card_push_transfers.approve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_raw_response_approve(self, client: Increase) -> None: + response = client.card_push_transfers.with_raw_response.approve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_streaming_response_approve(self, client: Increase) -> None: + with client.card_push_transfers.with_streaming_response.approve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_approve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_push_transfer_id` but received ''"): + client.card_push_transfers.with_raw_response.approve( + "", + ) + + @parametrize + def test_method_cancel(self, client: Increase) -> None: + card_push_transfer = client.card_push_transfers.cancel( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: Increase) -> None: + response = client.card_push_transfers.with_raw_response.cancel( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: Increase) -> None: + with client.card_push_transfers.with_streaming_response.cancel( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_push_transfer_id` but received ''"): + client.card_push_transfers.with_raw_response.cancel( + "", + ) + + +class TestAsyncCardPushTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_push_transfer = await async_client.card_push_transfers.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_push_transfer = await async_client.card_push_transfers.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + merchant_legal_business_name="x", + merchant_street_address="x", + recipient_address_city="x", + recipient_address_line1="x", + recipient_address_postal_code="x", + recipient_address_state="x", + require_approval=True, + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_push_transfers.with_raw_response.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.card_push_transfers.with_streaming_response.create( + business_application_identifier="funds_disbursement", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_name_prefix="Acme", + merchant_postal_code="10045", + merchant_state="NY", + presentment_amount={ + "currency": "USD", + "value": "1234.56", + }, + recipient_name="Ian Crease", + sender_address_city="New York", + sender_address_line1="33 Liberty Street", + sender_address_postal_code="10045", + sender_address_state="NY", + sender_name="Ian Crease", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + card_push_transfer = await async_client.card_push_transfers.retrieve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_push_transfers.with_raw_response.retrieve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.card_push_transfers.with_streaming_response.retrieve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_push_transfer_id` but received ''"): + await async_client.card_push_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + card_push_transfer = await async_client.card_push_transfers.list() + assert_matches_type(AsyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + card_push_transfer = await async_client.card_push_transfers.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["pending_approval"]}, + ) + assert_matches_type(AsyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_push_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = await response.parse() + assert_matches_type(AsyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.card_push_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = await response.parse() + assert_matches_type(AsyncPage[CardPushTransfer], card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_approve(self, async_client: AsyncIncrease) -> None: + card_push_transfer = await async_client.card_push_transfers.approve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_push_transfers.with_raw_response.approve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: + async with async_client.card_push_transfers.with_streaming_response.approve( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_push_transfer_id` but received ''"): + await async_client.card_push_transfers.with_raw_response.approve( + "", + ) + + @parametrize + async def test_method_cancel(self, async_client: AsyncIncrease) -> None: + card_push_transfer = await async_client.card_push_transfers.cancel( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_push_transfers.with_raw_response.cancel( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: + async with async_client.card_push_transfers.with_streaming_response.cancel( + "outbound_card_push_transfer_e0z9rdpamraczh4tvwye", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_push_transfer = await response.parse() + assert_matches_type(CardPushTransfer, card_push_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_push_transfer_id` but received ''"): + await async_client.card_push_transfers.with_raw_response.cancel( + "", + ) diff --git a/tests/api_resources/test_card_tokens.py b/tests/api_resources/test_card_tokens.py new file mode 100644 index 000000000..f25e35b70 --- /dev/null +++ b/tests/api_resources/test_card_tokens.py @@ -0,0 +1,256 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardToken, CardTokenCapabilities +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardTokens: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + card_token = client.card_tokens.retrieve( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.card_tokens.with_raw_response.retrieve( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.card_tokens.with_streaming_response.retrieve( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token_id` but received ''"): + client.card_tokens.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + card_token = client.card_tokens.list() + assert_matches_type(SyncPage[CardToken], card_token, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + card_token = client.card_tokens.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + ) + assert_matches_type(SyncPage[CardToken], card_token, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.card_tokens.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = response.parse() + assert_matches_type(SyncPage[CardToken], card_token, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.card_tokens.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = response.parse() + assert_matches_type(SyncPage[CardToken], card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_capabilities(self, client: Increase) -> None: + card_token = client.card_tokens.capabilities( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + assert_matches_type(CardTokenCapabilities, card_token, path=["response"]) + + @parametrize + def test_raw_response_capabilities(self, client: Increase) -> None: + response = client.card_tokens.with_raw_response.capabilities( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = response.parse() + assert_matches_type(CardTokenCapabilities, card_token, path=["response"]) + + @parametrize + def test_streaming_response_capabilities(self, client: Increase) -> None: + with client.card_tokens.with_streaming_response.capabilities( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = response.parse() + assert_matches_type(CardTokenCapabilities, card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_capabilities(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token_id` but received ''"): + client.card_tokens.with_raw_response.capabilities( + "", + ) + + +class TestAsyncCardTokens: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + card_token = await async_client.card_tokens.retrieve( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_tokens.with_raw_response.retrieve( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = await response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.card_tokens.with_streaming_response.retrieve( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = await response.parse() + assert_matches_type(CardToken, card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token_id` but received ''"): + await async_client.card_tokens.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + card_token = await async_client.card_tokens.list() + assert_matches_type(AsyncPage[CardToken], card_token, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + card_token = await async_client.card_tokens.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + ) + assert_matches_type(AsyncPage[CardToken], card_token, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_tokens.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = await response.parse() + assert_matches_type(AsyncPage[CardToken], card_token, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.card_tokens.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = await response.parse() + assert_matches_type(AsyncPage[CardToken], card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_capabilities(self, async_client: AsyncIncrease) -> None: + card_token = await async_client.card_tokens.capabilities( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + assert_matches_type(CardTokenCapabilities, card_token, path=["response"]) + + @parametrize + async def test_raw_response_capabilities(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_tokens.with_raw_response.capabilities( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_token = await response.parse() + assert_matches_type(CardTokenCapabilities, card_token, path=["response"]) + + @parametrize + async def test_streaming_response_capabilities(self, async_client: AsyncIncrease) -> None: + async with async_client.card_tokens.with_streaming_response.capabilities( + "outbound_card_token_zlt0ml6youq3q7vcdlg0", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_token = await response.parse() + assert_matches_type(CardTokenCapabilities, card_token, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_capabilities(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_token_id` but received ''"): + await async_client.card_tokens.with_raw_response.capabilities( + "", + ) diff --git a/tests/api_resources/test_card_validations.py b/tests/api_resources/test_card_validations.py new file mode 100644 index 000000000..566aeed1c --- /dev/null +++ b/tests/api_resources/test_card_validations.py @@ -0,0 +1,320 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardValidation +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardValidations: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_validation = client.card_validations.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + ) + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_validation = client.card_validations.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + cardholder_first_name="Dee", + cardholder_last_name="Hock", + cardholder_middle_name="Ward", + cardholder_postal_code="10045", + cardholder_street_address="33 Liberty Street", + ) + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.card_validations.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_validation = response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.card_validations.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_validation = response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + card_validation = client.card_validations.retrieve( + "outbound_card_validation_qqlzagpc6v1x2gcdhe24", + ) + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.card_validations.with_raw_response.retrieve( + "outbound_card_validation_qqlzagpc6v1x2gcdhe24", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_validation = response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.card_validations.with_streaming_response.retrieve( + "outbound_card_validation_qqlzagpc6v1x2gcdhe24", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_validation = response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_validation_id` but received ''"): + client.card_validations.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + card_validation = client.card_validations.list() + assert_matches_type(SyncPage[CardValidation], card_validation, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + card_validation = client.card_validations.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["requires_attention"]}, + ) + assert_matches_type(SyncPage[CardValidation], card_validation, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.card_validations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_validation = response.parse() + assert_matches_type(SyncPage[CardValidation], card_validation, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.card_validations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_validation = response.parse() + assert_matches_type(SyncPage[CardValidation], card_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardValidations: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_validation = await async_client.card_validations.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + ) + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_validation = await async_client.card_validations.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + cardholder_first_name="Dee", + cardholder_last_name="Hock", + cardholder_middle_name="Ward", + cardholder_postal_code="10045", + cardholder_street_address="33 Liberty Street", + ) + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_validations.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_validation = await response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.card_validations.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + card_token_id="outbound_card_token_zlt0ml6youq3q7vcdlg0", + merchant_category_code="1234", + merchant_city_name="New York", + merchant_name="Acme Corp", + merchant_postal_code="10045", + merchant_state="NY", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_validation = await response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + card_validation = await async_client.card_validations.retrieve( + "outbound_card_validation_qqlzagpc6v1x2gcdhe24", + ) + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_validations.with_raw_response.retrieve( + "outbound_card_validation_qqlzagpc6v1x2gcdhe24", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_validation = await response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.card_validations.with_streaming_response.retrieve( + "outbound_card_validation_qqlzagpc6v1x2gcdhe24", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_validation = await response.parse() + assert_matches_type(CardValidation, card_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_validation_id` but received ''"): + await async_client.card_validations.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + card_validation = await async_client.card_validations.list() + assert_matches_type(AsyncPage[CardValidation], card_validation, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + card_validation = await async_client.card_validations.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["requires_attention"]}, + ) + assert_matches_type(AsyncPage[CardValidation], card_validation, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_validations.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_validation = await response.parse() + assert_matches_type(AsyncPage[CardValidation], card_validation, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.card_validations.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_validation = await response.parse() + assert_matches_type(AsyncPage[CardValidation], card_validation, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_cards.py b/tests/api_resources/test_cards.py index d05ab4c3f..bfa0bf63c 100644 --- a/tests/api_resources/test_cards.py +++ b/tests/api_resources/test_cards.py @@ -9,7 +9,11 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import Card, CardDetails +from increase.types import ( + Card, + CardDetails, + CardIframeURL, +) from increase._utils import parse_datetime from increase.pagination import SyncPage, AsyncPage @@ -30,20 +34,52 @@ def test_method_create(self, client: Increase) -> None: def test_method_create_with_all_params(self, client: Increase) -> None: card = client.cards.create( account_id="account_in71c4amph0vgo2qllky", + authorization_controls={ + "merchant_acceptor_identifier": { + "allowed": [{"identifier": "x"}], + "blocked": [{"identifier": "x"}], + }, + "merchant_category_code": { + "allowed": [{"code": "xxxx"}], + "blocked": [{"code": "xxxx"}], + }, + "merchant_country": { + "allowed": [{"country": "xx"}], + "blocked": [{"country": "xx"}], + }, + "usage": { + "category": "single_use", + "multi_use": { + "spending_limits": [ + { + "interval": "all_time", + "settlement_amount": 0, + "merchant_category_codes": [{"code": "x"}], + } + ] + }, + "single_use": { + "settlement_amount": { + "comparison": "equals", + "value": 0, + } + }, + }, + }, billing_address={ - "line1": "x", - "line2": "x", "city": "x", - "state": "x", + "line1": "x", "postal_code": "x", + "state": "x", + "line2": "x", }, description="Card for Ian Crease", digital_wallet={ - "email": "x", + "digital_card_profile_id": "digital_card_profile_id", + "email": "dev@stainless.com", "phone": "x", - "digital_card_profile_id": "string", }, - entity_id="string", + entity_id="entity_id", ) assert_matches_type(Card, card, path=["response"]) @@ -74,14 +110,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: card = client.cards.retrieve( - "string", + "card_oubs0hwk5rn6knuecxg2", ) assert_matches_type(Card, card, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.cards.with_raw_response.retrieve( - "string", + "card_oubs0hwk5rn6knuecxg2", ) assert response.is_closed is True @@ -92,7 +128,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.cards.with_streaming_response.retrieve( - "string", + "card_oubs0hwk5rn6knuecxg2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -112,28 +148,60 @@ def test_path_params_retrieve(self, client: Increase) -> None: @parametrize def test_method_update(self, client: Increase) -> None: card = client.cards.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", ) assert_matches_type(Card, card, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Increase) -> None: card = client.cards.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", + authorization_controls={ + "merchant_acceptor_identifier": { + "allowed": [{"identifier": "x"}], + "blocked": [{"identifier": "x"}], + }, + "merchant_category_code": { + "allowed": [{"code": "xxxx"}], + "blocked": [{"code": "xxxx"}], + }, + "merchant_country": { + "allowed": [{"country": "xx"}], + "blocked": [{"country": "xx"}], + }, + "usage": { + "category": "single_use", + "multi_use": { + "spending_limits": [ + { + "interval": "all_time", + "settlement_amount": 0, + "merchant_category_codes": [{"code": "x"}], + } + ] + }, + "single_use": { + "settlement_amount": { + "comparison": "equals", + "value": 0, + } + }, + }, + }, billing_address={ - "line1": "x", - "line2": "x", "city": "x", - "state": "x", + "line1": "x", "postal_code": "x", + "state": "x", + "line2": "x", }, description="New description", digital_wallet={ - "email": "x", + "digital_card_profile_id": "digital_card_profile_id", + "email": "dev@stainless.com", "phone": "x", - "digital_card_profile_id": "string", }, - entity_id="string", + entity_id="entity_id", status="active", ) assert_matches_type(Card, card, path=["response"]) @@ -141,7 +209,7 @@ def test_method_update_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_update(self, client: Increase) -> None: response = client.cards.with_raw_response.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", ) assert response.is_closed is True @@ -152,7 +220,7 @@ def test_raw_response_update(self, client: Increase) -> None: @parametrize def test_streaming_response_update(self, client: Increase) -> None: with client.cards.with_streaming_response.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -166,7 +234,7 @@ def test_streaming_response_update(self, client: Increase) -> None: def test_path_params_update(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): client.cards.with_raw_response.update( - "", + card_id="", ) @parametrize @@ -177,16 +245,17 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: card = client.cards.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, + status={"in": ["active"]}, ) assert_matches_type(SyncPage[Card], card, path=["response"]) @@ -211,16 +280,62 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_retrieve_sensitive_details(self, client: Increase) -> None: - card = client.cards.retrieve_sensitive_details( - "string", + def test_method_create_details_iframe(self, client: Increase) -> None: + card = client.cards.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + assert_matches_type(CardIframeURL, card, path=["response"]) + + @parametrize + def test_method_create_details_iframe_with_all_params(self, client: Increase) -> None: + card = client.cards.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + physical_card_id="physical_card_id", + ) + assert_matches_type(CardIframeURL, card, path=["response"]) + + @parametrize + def test_raw_response_create_details_iframe(self, client: Increase) -> None: + response = client.cards.with_raw_response.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card = response.parse() + assert_matches_type(CardIframeURL, card, path=["response"]) + + @parametrize + def test_streaming_response_create_details_iframe(self, client: Increase) -> None: + with client.cards.with_streaming_response.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card = response.parse() + assert_matches_type(CardIframeURL, card, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_create_details_iframe(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): + client.cards.with_raw_response.create_details_iframe( + card_id="", + ) + + @parametrize + def test_method_details(self, client: Increase) -> None: + card = client.cards.details( + "card_oubs0hwk5rn6knuecxg2", ) assert_matches_type(CardDetails, card, path=["response"]) @parametrize - def test_raw_response_retrieve_sensitive_details(self, client: Increase) -> None: - response = client.cards.with_raw_response.retrieve_sensitive_details( - "string", + def test_raw_response_details(self, client: Increase) -> None: + response = client.cards.with_raw_response.details( + "card_oubs0hwk5rn6knuecxg2", ) assert response.is_closed is True @@ -229,9 +344,9 @@ def test_raw_response_retrieve_sensitive_details(self, client: Increase) -> None assert_matches_type(CardDetails, card, path=["response"]) @parametrize - def test_streaming_response_retrieve_sensitive_details(self, client: Increase) -> None: - with client.cards.with_streaming_response.retrieve_sensitive_details( - "string", + def test_streaming_response_details(self, client: Increase) -> None: + with client.cards.with_streaming_response.details( + "card_oubs0hwk5rn6knuecxg2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -242,15 +357,59 @@ def test_streaming_response_retrieve_sensitive_details(self, client: Increase) - assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_retrieve_sensitive_details(self, client: Increase) -> None: + def test_path_params_details(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): - client.cards.with_raw_response.retrieve_sensitive_details( + client.cards.with_raw_response.details( "", ) + @parametrize + def test_method_update_pin(self, client: Increase) -> None: + card = client.cards.update_pin( + card_id="card_oubs0hwk5rn6knuecxg2", + pin="1234", + ) + assert_matches_type(CardDetails, card, path=["response"]) + + @parametrize + def test_raw_response_update_pin(self, client: Increase) -> None: + response = client.cards.with_raw_response.update_pin( + card_id="card_oubs0hwk5rn6knuecxg2", + pin="1234", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card = response.parse() + assert_matches_type(CardDetails, card, path=["response"]) + + @parametrize + def test_streaming_response_update_pin(self, client: Increase) -> None: + with client.cards.with_streaming_response.update_pin( + card_id="card_oubs0hwk5rn6knuecxg2", + pin="1234", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card = response.parse() + assert_matches_type(CardDetails, card, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update_pin(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): + client.cards.with_raw_response.update_pin( + card_id="", + pin="1234", + ) + class TestAsyncCards: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -263,20 +422,52 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: card = await async_client.cards.create( account_id="account_in71c4amph0vgo2qllky", + authorization_controls={ + "merchant_acceptor_identifier": { + "allowed": [{"identifier": "x"}], + "blocked": [{"identifier": "x"}], + }, + "merchant_category_code": { + "allowed": [{"code": "xxxx"}], + "blocked": [{"code": "xxxx"}], + }, + "merchant_country": { + "allowed": [{"country": "xx"}], + "blocked": [{"country": "xx"}], + }, + "usage": { + "category": "single_use", + "multi_use": { + "spending_limits": [ + { + "interval": "all_time", + "settlement_amount": 0, + "merchant_category_codes": [{"code": "x"}], + } + ] + }, + "single_use": { + "settlement_amount": { + "comparison": "equals", + "value": 0, + } + }, + }, + }, billing_address={ - "line1": "x", - "line2": "x", "city": "x", - "state": "x", + "line1": "x", "postal_code": "x", + "state": "x", + "line2": "x", }, description="Card for Ian Crease", digital_wallet={ - "email": "x", + "digital_card_profile_id": "digital_card_profile_id", + "email": "dev@stainless.com", "phone": "x", - "digital_card_profile_id": "string", }, - entity_id="string", + entity_id="entity_id", ) assert_matches_type(Card, card, path=["response"]) @@ -288,7 +479,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() + card = await response.parse() assert_matches_type(Card, card, path=["response"]) @parametrize @@ -307,25 +498,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: card = await async_client.cards.retrieve( - "string", + "card_oubs0hwk5rn6knuecxg2", ) assert_matches_type(Card, card, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.cards.with_raw_response.retrieve( - "string", + "card_oubs0hwk5rn6knuecxg2", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() + card = await response.parse() assert_matches_type(Card, card, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.cards.with_streaming_response.retrieve( - "string", + "card_oubs0hwk5rn6knuecxg2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -345,28 +536,60 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_update(self, async_client: AsyncIncrease) -> None: card = await async_client.cards.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", ) assert_matches_type(Card, card, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: card = await async_client.cards.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", + authorization_controls={ + "merchant_acceptor_identifier": { + "allowed": [{"identifier": "x"}], + "blocked": [{"identifier": "x"}], + }, + "merchant_category_code": { + "allowed": [{"code": "xxxx"}], + "blocked": [{"code": "xxxx"}], + }, + "merchant_country": { + "allowed": [{"country": "xx"}], + "blocked": [{"country": "xx"}], + }, + "usage": { + "category": "single_use", + "multi_use": { + "spending_limits": [ + { + "interval": "all_time", + "settlement_amount": 0, + "merchant_category_codes": [{"code": "x"}], + } + ] + }, + "single_use": { + "settlement_amount": { + "comparison": "equals", + "value": 0, + } + }, + }, + }, billing_address={ - "line1": "x", - "line2": "x", "city": "x", - "state": "x", + "line1": "x", "postal_code": "x", + "state": "x", + "line2": "x", }, description="New description", digital_wallet={ - "email": "x", + "digital_card_profile_id": "digital_card_profile_id", + "email": "dev@stainless.com", "phone": "x", - "digital_card_profile_id": "string", }, - entity_id="string", + entity_id="entity_id", status="active", ) assert_matches_type(Card, card, path=["response"]) @@ -374,18 +597,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: response = await async_client.cards.with_raw_response.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() + card = await response.parse() assert_matches_type(Card, card, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: async with async_client.cards.with_streaming_response.update( - "string", + card_id="card_oubs0hwk5rn6knuecxg2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -399,7 +622,7 @@ async def test_streaming_response_update(self, async_client: AsyncIncrease) -> N async def test_path_params_update(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): await async_client.cards.with_raw_response.update( - "", + card_id="", ) @parametrize @@ -410,16 +633,17 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: card = await async_client.cards.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, + status={"in": ["active"]}, ) assert_matches_type(AsyncPage[Card], card, path=["response"]) @@ -429,7 +653,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() + card = await response.parse() assert_matches_type(AsyncPage[Card], card, path=["response"]) @parametrize @@ -444,27 +668,73 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert cast(Any, response.is_closed) is True @parametrize - async def test_method_retrieve_sensitive_details(self, async_client: AsyncIncrease) -> None: - card = await async_client.cards.retrieve_sensitive_details( - "string", + async def test_method_create_details_iframe(self, async_client: AsyncIncrease) -> None: + card = await async_client.cards.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + assert_matches_type(CardIframeURL, card, path=["response"]) + + @parametrize + async def test_method_create_details_iframe_with_all_params(self, async_client: AsyncIncrease) -> None: + card = await async_client.cards.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + physical_card_id="physical_card_id", + ) + assert_matches_type(CardIframeURL, card, path=["response"]) + + @parametrize + async def test_raw_response_create_details_iframe(self, async_client: AsyncIncrease) -> None: + response = await async_client.cards.with_raw_response.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card = await response.parse() + assert_matches_type(CardIframeURL, card, path=["response"]) + + @parametrize + async def test_streaming_response_create_details_iframe(self, async_client: AsyncIncrease) -> None: + async with async_client.cards.with_streaming_response.create_details_iframe( + card_id="card_oubs0hwk5rn6knuecxg2", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card = await response.parse() + assert_matches_type(CardIframeURL, card, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_create_details_iframe(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): + await async_client.cards.with_raw_response.create_details_iframe( + card_id="", + ) + + @parametrize + async def test_method_details(self, async_client: AsyncIncrease) -> None: + card = await async_client.cards.details( + "card_oubs0hwk5rn6knuecxg2", ) assert_matches_type(CardDetails, card, path=["response"]) @parametrize - async def test_raw_response_retrieve_sensitive_details(self, async_client: AsyncIncrease) -> None: - response = await async_client.cards.with_raw_response.retrieve_sensitive_details( - "string", + async def test_raw_response_details(self, async_client: AsyncIncrease) -> None: + response = await async_client.cards.with_raw_response.details( + "card_oubs0hwk5rn6knuecxg2", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - card = response.parse() + card = await response.parse() assert_matches_type(CardDetails, card, path=["response"]) @parametrize - async def test_streaming_response_retrieve_sensitive_details(self, async_client: AsyncIncrease) -> None: - async with async_client.cards.with_streaming_response.retrieve_sensitive_details( - "string", + async def test_streaming_response_details(self, async_client: AsyncIncrease) -> None: + async with async_client.cards.with_streaming_response.details( + "card_oubs0hwk5rn6knuecxg2", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -475,8 +745,50 @@ async def test_streaming_response_retrieve_sensitive_details(self, async_client: assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_retrieve_sensitive_details(self, async_client: AsyncIncrease) -> None: + async def test_path_params_details(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): - await async_client.cards.with_raw_response.retrieve_sensitive_details( + await async_client.cards.with_raw_response.details( "", ) + + @parametrize + async def test_method_update_pin(self, async_client: AsyncIncrease) -> None: + card = await async_client.cards.update_pin( + card_id="card_oubs0hwk5rn6knuecxg2", + pin="1234", + ) + assert_matches_type(CardDetails, card, path=["response"]) + + @parametrize + async def test_raw_response_update_pin(self, async_client: AsyncIncrease) -> None: + response = await async_client.cards.with_raw_response.update_pin( + card_id="card_oubs0hwk5rn6knuecxg2", + pin="1234", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card = await response.parse() + assert_matches_type(CardDetails, card, path=["response"]) + + @parametrize + async def test_streaming_response_update_pin(self, async_client: AsyncIncrease) -> None: + async with async_client.cards.with_streaming_response.update_pin( + card_id="card_oubs0hwk5rn6knuecxg2", + pin="1234", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card = await response.parse() + assert_matches_type(CardDetails, card, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update_pin(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_id` but received ''"): + await async_client.cards.with_raw_response.update_pin( + card_id="", + pin="1234", + ) diff --git a/tests/api_resources/test_check_deposits.py b/tests/api_resources/test_check_deposits.py index f17078a6c..9f9a14b84 100644 --- a/tests/api_resources/test_check_deposits.py +++ b/tests/api_resources/test_check_deposits.py @@ -25,18 +25,27 @@ def test_method_create(self, client: Increase) -> None: account_id="account_in71c4amph0vgo2qllky", amount=1000, back_image_file_id="file_26khfk98mzfz90a11oqx", - currency="USD", front_image_file_id="file_hkv175ovmc2tb2v2zbrm", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + check_deposit = client.check_deposits.create( + account_id="account_in71c4amph0vgo2qllky", + amount=1000, + back_image_file_id="file_26khfk98mzfz90a11oqx", + front_image_file_id="file_hkv175ovmc2tb2v2zbrm", + description="Vendor payment", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + @parametrize def test_raw_response_create(self, client: Increase) -> None: response = client.check_deposits.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, back_image_file_id="file_26khfk98mzfz90a11oqx", - currency="USD", front_image_file_id="file_hkv175ovmc2tb2v2zbrm", ) @@ -51,7 +60,6 @@ def test_streaming_response_create(self, client: Increase) -> None: account_id="account_in71c4amph0vgo2qllky", amount=1000, back_image_file_id="file_26khfk98mzfz90a11oqx", - currency="USD", front_image_file_id="file_hkv175ovmc2tb2v2zbrm", ) as response: assert not response.is_closed @@ -65,14 +73,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: check_deposit = client.check_deposits.retrieve( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.check_deposits.with_raw_response.retrieve( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True @@ -83,7 +91,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.check_deposits.with_streaming_response.retrieve( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -108,14 +116,14 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: check_deposit = client.check_deposits.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -143,7 +151,9 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncCheckDeposits: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -151,24 +161,33 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: account_id="account_in71c4amph0vgo2qllky", amount=1000, back_image_file_id="file_26khfk98mzfz90a11oqx", - currency="USD", front_image_file_id="file_hkv175ovmc2tb2v2zbrm", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + check_deposit = await async_client.check_deposits.create( + account_id="account_in71c4amph0vgo2qllky", + amount=1000, + back_image_file_id="file_26khfk98mzfz90a11oqx", + front_image_file_id="file_hkv175ovmc2tb2v2zbrm", + description="Vendor payment", + ) + assert_matches_type(CheckDeposit, check_deposit, path=["response"]) + @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.check_deposits.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, back_image_file_id="file_26khfk98mzfz90a11oqx", - currency="USD", front_image_file_id="file_hkv175ovmc2tb2v2zbrm", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_deposit = response.parse() + check_deposit = await response.parse() assert_matches_type(CheckDeposit, check_deposit, path=["response"]) @parametrize @@ -177,7 +196,6 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N account_id="account_in71c4amph0vgo2qllky", amount=1000, back_image_file_id="file_26khfk98mzfz90a11oqx", - currency="USD", front_image_file_id="file_hkv175ovmc2tb2v2zbrm", ) as response: assert not response.is_closed @@ -191,25 +209,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: check_deposit = await async_client.check_deposits.retrieve( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert_matches_type(CheckDeposit, check_deposit, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.check_deposits.with_raw_response.retrieve( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_deposit = response.parse() + check_deposit = await response.parse() assert_matches_type(CheckDeposit, check_deposit, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.check_deposits.with_streaming_response.retrieve( - "string", + "check_deposit_f06n9gpg7sxn8t19lfc1", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -234,14 +252,14 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: check_deposit = await async_client.check_deposits.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -253,7 +271,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_deposit = response.parse() + check_deposit = await response.parse() assert_matches_type(AsyncPage[CheckDeposit], check_deposit, path=["response"]) @parametrize diff --git a/tests/api_resources/test_check_transfers.py b/tests/api_resources/test_check_transfers.py index 672206f70..fa0afb17e 100644 --- a/tests/api_resources/test_check_transfers.py +++ b/tests/api_resources/test_check_transfers.py @@ -12,7 +12,7 @@ from increase.types import ( CheckTransfer, ) -from increase._utils import parse_datetime +from increase._utils import parse_date, parse_datetime from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -26,6 +26,7 @@ def test_method_create(self, client: Increase) -> None: check_transfer = client.check_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + fulfillment_method="physical_check", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @@ -35,30 +36,44 @@ def test_method_create_with_all_params(self, client: Increase) -> None: check_transfer = client.check_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, - source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", fulfillment_method="physical_check", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + balance_check="full", + check_number="x", physical_check={ - "memo": "Check payment", - "note": "x", - "recipient_name": "Ian Crease", "mailing_address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", - "line2": "x", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", "postal_code": "10045", + "state": "NY", + "line2": "x", + "name": "Ian Crease", + "phone": "+16505046304", }, + "memo": "Check payment", + "recipient_name": "Ian Crease", + "attachment_file_id": "attachment_file_id", + "check_voucher_image_file_id": "check_voucher_image_file_id", + "note": "x", + "payer": [{"contents": "x"}], "return_address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", + "city": "x", + "line1": "x", + "name": "x", + "postal_code": "x", + "state": "x", "line2": "x", - "city": "New York", - "state": "NY", - "postal_code": "10045", + "phone": "x", + }, + "shipping_method": "usps_first_class", + "signature": { + "image_file_id": "image_file_id", + "text": "Ian Crease", }, }, require_approval=True, + third_party={"recipient_name": "x"}, + valid_until_date=parse_date("2025-12-31"), ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @@ -67,6 +82,7 @@ def test_raw_response_create(self, client: Increase) -> None: response = client.check_transfers.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + fulfillment_method="physical_check", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) @@ -80,6 +96,7 @@ def test_streaming_response_create(self, client: Increase) -> None: with client.check_transfers.with_streaming_response.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + fulfillment_method="physical_check", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed @@ -93,14 +110,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: check_transfer = client.check_transfers.retrieve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.check_transfers.with_raw_response.retrieve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True @@ -111,7 +128,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.check_transfers.with_streaming_response.retrieve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -136,16 +153,17 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: check_transfer = client.check_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(SyncPage[CheckTransfer], check_transfer, path=["response"]) @@ -172,14 +190,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_approve(self, client: Increase) -> None: check_transfer = client.check_transfers.approve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize def test_raw_response_approve(self, client: Increase) -> None: response = client.check_transfers.with_raw_response.approve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True @@ -190,7 +208,7 @@ def test_raw_response_approve(self, client: Increase) -> None: @parametrize def test_streaming_response_approve(self, client: Increase) -> None: with client.check_transfers.with_streaming_response.approve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -210,14 +228,14 @@ def test_path_params_approve(self, client: Increase) -> None: @parametrize def test_method_cancel(self, client: Increase) -> None: check_transfer = client.check_transfers.cancel( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize def test_raw_response_cancel(self, client: Increase) -> None: response = client.check_transfers.with_raw_response.cancel( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True @@ -228,7 +246,7 @@ def test_raw_response_cancel(self, client: Increase) -> None: @parametrize def test_streaming_response_cancel(self, client: Increase) -> None: with client.check_transfers.with_streaming_response.cancel( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -245,28 +263,25 @@ def test_path_params_cancel(self, client: Increase) -> None: "", ) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize def test_method_stop_payment(self, client: Increase) -> None: check_transfer = client.check_transfers.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize def test_method_stop_payment_with_all_params(self, client: Increase) -> None: check_transfer = client.check_transfers.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", reason="mail_delivery_failed", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize def test_raw_response_stop_payment(self, client: Increase) -> None: response = client.check_transfers.with_raw_response.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True @@ -274,11 +289,10 @@ def test_raw_response_stop_payment(self, client: Increase) -> None: check_transfer = response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize def test_streaming_response_stop_payment(self, client: Increase) -> None: with client.check_transfers.with_streaming_response.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -288,23 +302,25 @@ def test_streaming_response_stop_payment(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize def test_path_params_stop_payment(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_transfer_id` but received ''"): client.check_transfers.with_raw_response.stop_payment( - "", + check_transfer_id="", ) class TestAsyncCheckTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.check_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + fulfillment_method="physical_check", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @@ -314,30 +330,44 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) check_transfer = await async_client.check_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, - source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", fulfillment_method="physical_check", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + balance_check="full", + check_number="x", physical_check={ - "memo": "Check payment", - "note": "x", - "recipient_name": "Ian Crease", "mailing_address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", - "line2": "x", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", "postal_code": "10045", + "state": "NY", + "line2": "x", + "name": "Ian Crease", + "phone": "+16505046304", }, + "memo": "Check payment", + "recipient_name": "Ian Crease", + "attachment_file_id": "attachment_file_id", + "check_voucher_image_file_id": "check_voucher_image_file_id", + "note": "x", + "payer": [{"contents": "x"}], "return_address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", + "city": "x", + "line1": "x", + "name": "x", + "postal_code": "x", + "state": "x", "line2": "x", - "city": "New York", - "state": "NY", - "postal_code": "10045", + "phone": "x", + }, + "shipping_method": "usps_first_class", + "signature": { + "image_file_id": "image_file_id", + "text": "Ian Crease", }, }, require_approval=True, + third_party={"recipient_name": "x"}, + valid_until_date=parse_date("2025-12-31"), ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @@ -346,12 +376,13 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.check_transfers.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + fulfillment_method="physical_check", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() + check_transfer = await response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize @@ -359,6 +390,7 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N async with async_client.check_transfers.with_streaming_response.create( account_id="account_in71c4amph0vgo2qllky", amount=1000, + fulfillment_method="physical_check", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", ) as response: assert not response.is_closed @@ -372,25 +404,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.check_transfers.retrieve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.check_transfers.with_raw_response.retrieve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() + check_transfer = await response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.check_transfers.with_streaming_response.retrieve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -415,16 +447,17 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.check_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(AsyncPage[CheckTransfer], check_transfer, path=["response"]) @@ -434,7 +467,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() + check_transfer = await response.parse() assert_matches_type(AsyncPage[CheckTransfer], check_transfer, path=["response"]) @parametrize @@ -451,25 +484,25 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_approve(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.check_transfers.approve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: response = await async_client.check_transfers.with_raw_response.approve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() + check_transfer = await response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: async with async_client.check_transfers.with_streaming_response.approve( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -489,25 +522,25 @@ async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_cancel(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.check_transfers.cancel( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: response = await async_client.check_transfers.with_raw_response.cancel( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() + check_transfer = await response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) @parametrize async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: async with async_client.check_transfers.with_streaming_response.cancel( - "string", + "check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -524,40 +557,36 @@ async def test_path_params_cancel(self, async_client: AsyncIncrease) -> None: "", ) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize async def test_method_stop_payment(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.check_transfers.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize async def test_method_stop_payment_with_all_params(self, async_client: AsyncIncrease) -> None: check_transfer = await async_client.check_transfers.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", reason="mail_delivery_failed", ) assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize async def test_raw_response_stop_payment(self, async_client: AsyncIncrease) -> None: response = await async_client.check_transfers.with_raw_response.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - check_transfer = response.parse() + check_transfer = await response.parse() assert_matches_type(CheckTransfer, check_transfer, path=["response"]) - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize async def test_streaming_response_stop_payment(self, async_client: AsyncIncrease) -> None: async with async_client.check_transfers.with_streaming_response.stop_payment( - "string", + check_transfer_id="check_transfer_30b43acfu9vw8fyc4f5", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -567,10 +596,9 @@ async def test_streaming_response_stop_payment(self, async_client: AsyncIncrease assert cast(Any, response.is_closed) is True - @pytest.mark.skip(reason="Prism doesn't accept no request body being sent but returns 415 if it is sent") @parametrize async def test_path_params_stop_payment(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `check_transfer_id` but received ''"): await async_client.check_transfers.with_raw_response.stop_payment( - "", + check_transfer_id="", ) diff --git a/tests/api_resources/test_declined_transactions.py b/tests/api_resources/test_declined_transactions.py index be25b92b2..dbacde8c0 100644 --- a/tests/api_resources/test_declined_transactions.py +++ b/tests/api_resources/test_declined_transactions.py @@ -22,14 +22,14 @@ class TestDeclinedTransactions: @parametrize def test_method_retrieve(self, client: Increase) -> None: declined_transaction = client.declined_transactions.retrieve( - "string", + "declined_transaction_17jbn0yyhvkt4v4ooym8", ) assert_matches_type(DeclinedTransaction, declined_transaction, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.declined_transactions.with_raw_response.retrieve( - "string", + "declined_transaction_17jbn0yyhvkt4v4ooym8", ) assert response.is_closed is True @@ -40,7 +40,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.declined_transactions.with_streaming_response.retrieve( - "string", + "declined_transaction_17jbn0yyhvkt4v4ooym8", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,17 +67,17 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: declined_transaction = client.declined_transactions.list( - account_id="string", - category={"in": ["ach_decline", "card_decline", "check_decline"]}, + account_id="account_id", + category={"in": ["ach_decline"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - route_id="string", + route_id="route_id", ) assert_matches_type(SyncPage[DeclinedTransaction], declined_transaction, path=["response"]) @@ -103,30 +103,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncDeclinedTransactions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: declined_transaction = await async_client.declined_transactions.retrieve( - "string", + "declined_transaction_17jbn0yyhvkt4v4ooym8", ) assert_matches_type(DeclinedTransaction, declined_transaction, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.declined_transactions.with_raw_response.retrieve( - "string", + "declined_transaction_17jbn0yyhvkt4v4ooym8", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - declined_transaction = response.parse() + declined_transaction = await response.parse() assert_matches_type(DeclinedTransaction, declined_transaction, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.declined_transactions.with_streaming_response.retrieve( - "string", + "declined_transaction_17jbn0yyhvkt4v4ooym8", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -153,17 +155,17 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: declined_transaction = await async_client.declined_transactions.list( - account_id="string", - category={"in": ["ach_decline", "card_decline", "check_decline"]}, + account_id="account_id", + category={"in": ["ach_decline"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - route_id="string", + route_id="route_id", ) assert_matches_type(AsyncPage[DeclinedTransaction], declined_transaction, path=["response"]) @@ -173,7 +175,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - declined_transaction = response.parse() + declined_transaction = await response.parse() assert_matches_type(AsyncPage[DeclinedTransaction], declined_transaction, path=["response"]) @parametrize diff --git a/tests/api_resources/test_digital_card_profiles.py b/tests/api_resources/test_digital_card_profiles.py index 1a9a7c31c..38bbafeea 100644 --- a/tests/api_resources/test_digital_card_profiles.py +++ b/tests/api_resources/test_digital_card_profiles.py @@ -43,9 +43,9 @@ def test_method_create_with_all_params(self, client: Increase) -> None: contact_phone="+18885551212", contact_website="https://example.com", text_color={ - "red": 26, - "green": 43, "blue": 59, + "green": 43, + "red": 26, }, ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @@ -85,14 +85,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: digital_card_profile = client.digital_card_profiles.retrieve( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.digital_card_profiles.with_raw_response.retrieve( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert response.is_closed is True @@ -103,7 +103,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.digital_card_profiles.with_streaming_response.retrieve( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -130,10 +130,10 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: digital_card_profile = client.digital_card_profiles.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending", "rejected", "active"]}, + status={"in": ["pending"]}, ) assert_matches_type(SyncPage[DigitalCardProfile], digital_card_profile, path=["response"]) @@ -160,14 +160,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_archive(self, client: Increase) -> None: digital_card_profile = client.digital_card_profiles.archive( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize def test_raw_response_archive(self, client: Increase) -> None: response = client.digital_card_profiles.with_raw_response.archive( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert response.is_closed is True @@ -178,7 +178,7 @@ def test_raw_response_archive(self, client: Increase) -> None: @parametrize def test_streaming_response_archive(self, client: Increase) -> None: with client.digital_card_profiles.with_streaming_response.archive( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -200,26 +200,26 @@ def test_path_params_archive(self, client: Increase) -> None: @parametrize def test_method_clone(self, client: Increase) -> None: digital_card_profile = client.digital_card_profiles.clone( - "string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize def test_method_clone_with_all_params(self, client: Increase) -> None: digital_card_profile = client.digital_card_profiles.clone( - "string", - app_icon_file_id="string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", + app_icon_file_id="app_icon_file_id", background_image_file_id="file_1ai913suu1zfn1pdetru", card_description="x", - contact_email="x", + contact_email="dev@stainless.com", contact_phone="x", - contact_website="string", + contact_website="contact_website", description="x", issuer_name="x", text_color={ - "red": 0, - "green": 0, "blue": 0, + "green": 0, + "red": 0, }, ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @@ -227,7 +227,7 @@ def test_method_clone_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_clone(self, client: Increase) -> None: response = client.digital_card_profiles.with_raw_response.clone( - "string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", ) assert response.is_closed is True @@ -238,7 +238,7 @@ def test_raw_response_clone(self, client: Increase) -> None: @parametrize def test_streaming_response_clone(self, client: Increase) -> None: with client.digital_card_profiles.with_streaming_response.clone( - "string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -254,12 +254,14 @@ def test_path_params_clone(self, client: Increase) -> None: ValueError, match=r"Expected a non-empty value for `digital_card_profile_id` but received ''" ): client.digital_card_profiles.with_raw_response.clone( - "", + digital_card_profile_id="", ) class TestAsyncDigitalCardProfiles: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -284,9 +286,9 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) contact_phone="+18885551212", contact_website="https://example.com", text_color={ - "red": 26, - "green": 43, "blue": 59, + "green": 43, + "red": 26, }, ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @@ -303,7 +305,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_card_profile = response.parse() + digital_card_profile = await response.parse() assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize @@ -326,25 +328,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: digital_card_profile = await async_client.digital_card_profiles.retrieve( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.digital_card_profiles.with_raw_response.retrieve( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_card_profile = response.parse() + digital_card_profile = await response.parse() assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.digital_card_profiles.with_streaming_response.retrieve( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -371,10 +373,10 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: digital_card_profile = await async_client.digital_card_profiles.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending", "rejected", "active"]}, + status={"in": ["pending"]}, ) assert_matches_type(AsyncPage[DigitalCardProfile], digital_card_profile, path=["response"]) @@ -384,7 +386,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_card_profile = response.parse() + digital_card_profile = await response.parse() assert_matches_type(AsyncPage[DigitalCardProfile], digital_card_profile, path=["response"]) @parametrize @@ -401,25 +403,25 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_archive(self, async_client: AsyncIncrease) -> None: digital_card_profile = await async_client.digital_card_profiles.archive( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize async def test_raw_response_archive(self, async_client: AsyncIncrease) -> None: response = await async_client.digital_card_profiles.with_raw_response.archive( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_card_profile = response.parse() + digital_card_profile = await response.parse() assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> None: async with async_client.digital_card_profiles.with_streaming_response.archive( - "string", + "digital_card_profile_s3puplu90f04xhcwkiga", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -441,26 +443,26 @@ async def test_path_params_archive(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_clone(self, async_client: AsyncIncrease) -> None: digital_card_profile = await async_client.digital_card_profiles.clone( - "string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize async def test_method_clone_with_all_params(self, async_client: AsyncIncrease) -> None: digital_card_profile = await async_client.digital_card_profiles.clone( - "string", - app_icon_file_id="string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", + app_icon_file_id="app_icon_file_id", background_image_file_id="file_1ai913suu1zfn1pdetru", card_description="x", - contact_email="x", + contact_email="dev@stainless.com", contact_phone="x", - contact_website="string", + contact_website="contact_website", description="x", issuer_name="x", text_color={ - "red": 0, - "green": 0, "blue": 0, + "green": 0, + "red": 0, }, ) assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @@ -468,18 +470,18 @@ async def test_method_clone_with_all_params(self, async_client: AsyncIncrease) - @parametrize async def test_raw_response_clone(self, async_client: AsyncIncrease) -> None: response = await async_client.digital_card_profiles.with_raw_response.clone( - "string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_card_profile = response.parse() + digital_card_profile = await response.parse() assert_matches_type(DigitalCardProfile, digital_card_profile, path=["response"]) @parametrize async def test_streaming_response_clone(self, async_client: AsyncIncrease) -> None: async with async_client.digital_card_profiles.with_streaming_response.clone( - "string", + digital_card_profile_id="digital_card_profile_s3puplu90f04xhcwkiga", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -495,5 +497,5 @@ async def test_path_params_clone(self, async_client: AsyncIncrease) -> None: ValueError, match=r"Expected a non-empty value for `digital_card_profile_id` but received ''" ): await async_client.digital_card_profiles.with_raw_response.clone( - "", + digital_card_profile_id="", ) diff --git a/tests/api_resources/test_digital_wallet_tokens.py b/tests/api_resources/test_digital_wallet_tokens.py index aefac4490..1ce1ba95b 100644 --- a/tests/api_resources/test_digital_wallet_tokens.py +++ b/tests/api_resources/test_digital_wallet_tokens.py @@ -22,14 +22,14 @@ class TestDigitalWalletTokens: @parametrize def test_method_retrieve(self, client: Increase) -> None: digital_wallet_token = client.digital_wallet_tokens.retrieve( - "string", + "digital_wallet_token_izi62go3h51p369jrie0", ) assert_matches_type(DigitalWalletToken, digital_wallet_token, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.digital_wallet_tokens.with_raw_response.retrieve( - "string", + "digital_wallet_token_izi62go3h51p369jrie0", ) assert response.is_closed is True @@ -40,7 +40,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.digital_wallet_tokens.with_streaming_response.retrieve( - "string", + "digital_wallet_token_izi62go3h51p369jrie0", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,14 +67,14 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: digital_wallet_token = client.digital_wallet_tokens.list( - card_id="string", + card_id="card_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[DigitalWalletToken], digital_wallet_token, path=["response"]) @@ -101,30 +101,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncDigitalWalletTokens: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: digital_wallet_token = await async_client.digital_wallet_tokens.retrieve( - "string", + "digital_wallet_token_izi62go3h51p369jrie0", ) assert_matches_type(DigitalWalletToken, digital_wallet_token, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.digital_wallet_tokens.with_raw_response.retrieve( - "string", + "digital_wallet_token_izi62go3h51p369jrie0", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_wallet_token = response.parse() + digital_wallet_token = await response.parse() assert_matches_type(DigitalWalletToken, digital_wallet_token, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.digital_wallet_tokens.with_streaming_response.retrieve( - "string", + "digital_wallet_token_izi62go3h51p369jrie0", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -151,14 +153,14 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: digital_wallet_token = await async_client.digital_wallet_tokens.list( - card_id="string", + card_id="card_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[DigitalWalletToken], digital_wallet_token, path=["response"]) @@ -169,7 +171,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - digital_wallet_token = response.parse() + digital_wallet_token = await response.parse() assert_matches_type(AsyncPage[DigitalWalletToken], digital_wallet_token, path=["response"]) @parametrize diff --git a/tests/api_resources/test_entities.py b/tests/api_resources/test_entities.py index 90de64872..8618c9fa5 100644 --- a/tests/api_resources/test_entities.py +++ b/tests/api_resources/test_entities.py @@ -9,9 +9,7 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import ( - Entity, -) +from increase.types import Entity from increase._utils import parse_date, parse_datetime from increase.pagination import SyncPage, AsyncPage @@ -33,363 +31,259 @@ def test_method_create_with_all_params(self, client: Increase) -> None: entity = client.entities.create( structure="corporation", corporation={ - "name": "National Phonograph Company", - "website": "https://example.com", - "tax_identifier": "602214076", - "incorporation_state": "NY", - "industry_code": "x", "address": { + "city": "New York", + "country": "x", "line1": "33 Liberty Street", "line2": "x", - "city": "New York", "state": "NY", "zip": "10045", }, "beneficial_owners": [ { "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), "address": { + "city": "New York", + "country": "x", "line1": "33 Liberty Street", "line2": "x", - "city": "New York", "state": "NY", "zip": "10045", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("1970-01-31"), "identification": { "method": "social_security_number", "number": "078051120", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, + "name": "Ian Crease", + "confirmed_no_us_tax_id": True, }, - "company_title": "CEO", "prongs": ["control"], + "company_title": "CEO", } ], + "legal_identifier": { + "value": "602214076", + "category": "us_employer_identification_number", + }, + "name": "National Phonograph Company", + "beneficial_ownership_exemption_reason": "regulated_financial_institution", + "email": "dev@stainless.com", + "incorporation_state": "NY", + "industry_code": "x", + "website": "https://example.com", }, description="x", - joint={ + government_authority={ + "address": { + "city": "x", + "line1": "x", + "state": "x", + "zip": "x", + "line2": "x", + }, + "authorized_persons": [{"name": "x"}], + "category": "municipality", "name": "x", + "tax_identifier": "x", + "website": "website", + }, + joint={ "individuals": [ { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", }, - }, - }, - { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, - "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { "country": "x", - "description": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, - }, - { "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { - "country": "x", - "description": "x", - "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", - }, - }, - }, - ], + } + ] }, natural_person={ - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, + "name": "x", + "confirmed_no_us_tax_id": True, + }, + risk_rating={ + "rated_at": parse_datetime("2019-12-27T18:11:19.117Z"), + "rating": "low", }, - relationship="affiliated", supplemental_documents=[{"file_id": "file_makxrc67oh9l6sg7w9yc"}], + terms_agreements=[ + { + "agreed_at": parse_datetime("2019-12-27T18:11:19.117Z"), + "ip_address": "x", + "terms_url": "x", + } + ], + third_party_verification={ + "reference": "x", + "vendor": "alloy", + }, trust={ - "name": "x", - "category": "revocable", - "tax_identifier": "x", - "formation_state": "x", "address": { - "line1": "x", - "line2": "x", "city": "x", + "line1": "x", "state": "x", "zip": "x", + "line2": "x", }, - "formation_document_file_id": "string", + "category": "revocable", + "name": "x", "trustees": [ { "structure": "individual", "individual": { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", }, - }, - }, - }, - { - "structure": "individual", - "individual": { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, - "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { "country": "x", - "description": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, - }, - }, - { - "structure": "individual", - "individual": { "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { - "country": "x", - "description": "x", - "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", - }, - }, }, - }, + } ], + "formation_document_file_id": "formation_document_file_id", + "formation_state": "x", "grantor": { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, + "name": "x", + "confirmed_no_us_tax_id": True, }, + "tax_identifier": "x", }, ) assert_matches_type(Entity, entity, path=["response"]) @@ -421,14 +315,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: entity = client.entities.retrieve( - "string", + "entity_n8y8tnk2p9339ti393yi", ) assert_matches_type(Entity, entity, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.entities.with_raw_response.retrieve( - "string", + "entity_n8y8tnk2p9339ti393yi", ) assert response.is_closed is True @@ -439,7 +333,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.entities.with_streaming_response.retrieve( - "string", + "entity_n8y8tnk2p9339ti393yi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -457,57 +351,81 @@ def test_path_params_retrieve(self, client: Increase) -> None: ) @parametrize - def test_method_list(self, client: Increase) -> None: - entity = client.entities.list() - assert_matches_type(SyncPage[Entity], entity, path=["response"]) - - @parametrize - def test_method_list_with_all_params(self, client: Increase) -> None: - entity = client.entities.list( - created_at={ - "after": parse_datetime("2019-12-27T18:11:19.117Z"), - "before": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), - }, - cursor="string", - idempotency_key="x", - limit=1, - status={"in": ["active", "archived", "disabled"]}, + def test_method_update(self, client: Increase) -> None: + entity = client.entities.update( + entity_id="entity_n8y8tnk2p9339ti393yi", ) - assert_matches_type(SyncPage[Entity], entity, path=["response"]) - - @parametrize - def test_raw_response_list(self, client: Increase) -> None: - response = client.entities.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - entity = response.parse() - assert_matches_type(SyncPage[Entity], entity, path=["response"]) + assert_matches_type(Entity, entity, path=["response"]) @parametrize - def test_streaming_response_list(self, client: Increase) -> None: - with client.entities.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - entity = response.parse() - assert_matches_type(SyncPage[Entity], entity, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_archive(self, client: Increase) -> None: - entity = client.entities.archive( - "string", + def test_method_update_with_all_params(self, client: Increase) -> None: + entity = client.entities.update( + entity_id="entity_n8y8tnk2p9339ti393yi", + corporation={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "Unit 2", + "state": "NY", + "zip": "10045", + }, + "email": "dev@stainless.com", + "incorporation_state": "x", + "industry_code": "x", + "legal_identifier": { + "value": "x", + "category": "us_employer_identification_number", + }, + "name": "x", + }, + details_confirmed_at=parse_datetime("2019-12-27T18:11:19.117Z"), + government_authority={ + "address": { + "city": "x", + "line1": "x", + "state": "x", + "zip": "x", + "line2": "x", + }, + "name": "x", + }, + natural_person={ + "address": { + "city": "x", + "country": "x", + "line1": "x", + "line2": "x", + "state": "x", + "zip": "x", + }, + "name": "x", + }, + risk_rating={ + "rated_at": parse_datetime("2020-01-31T23:59:59Z"), + "rating": "low", + }, + third_party_verification={ + "reference": "x", + "vendor": "alloy", + }, + trust={ + "address": { + "city": "x", + "line1": "x", + "state": "x", + "zip": "x", + "line2": "x", + }, + "name": "x", + }, ) assert_matches_type(Entity, entity, path=["response"]) @parametrize - def test_raw_response_archive(self, client: Increase) -> None: - response = client.entities.with_raw_response.archive( - "string", + def test_raw_response_update(self, client: Increase) -> None: + response = client.entities.with_raw_response.update( + entity_id="entity_n8y8tnk2p9339ti393yi", ) assert response.is_closed is True @@ -516,9 +434,9 @@ def test_raw_response_archive(self, client: Increase) -> None: assert_matches_type(Entity, entity, path=["response"]) @parametrize - def test_streaming_response_archive(self, client: Increase) -> None: - with client.entities.with_streaming_response.archive( - "string", + def test_streaming_response_update(self, client: Increase) -> None: + with client.entities.with_streaming_response.update( + entity_id="entity_n8y8tnk2p9339ti393yi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -529,95 +447,64 @@ def test_streaming_response_archive(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_archive(self, client: Increase) -> None: + def test_path_params_update(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - client.entities.with_raw_response.archive( - "", + client.entities.with_raw_response.update( + entity_id="", ) @parametrize - def test_method_confirm(self, client: Increase) -> None: - entity = client.entities.confirm( - "string", - ) - assert_matches_type(Entity, entity, path=["response"]) + def test_method_list(self, client: Increase) -> None: + entity = client.entities.list() + assert_matches_type(SyncPage[Entity], entity, path=["response"]) @parametrize - def test_method_confirm_with_all_params(self, client: Increase) -> None: - entity = client.entities.confirm( - "string", - confirmed_at=parse_datetime("2019-12-27T18:11:19.117Z"), + def test_method_list_with_all_params(self, client: Increase) -> None: + entity = client.entities.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["active"]}, ) - assert_matches_type(Entity, entity, path=["response"]) + assert_matches_type(SyncPage[Entity], entity, path=["response"]) @parametrize - def test_raw_response_confirm(self, client: Increase) -> None: - response = client.entities.with_raw_response.confirm( - "string", - ) + def test_raw_response_list(self, client: Increase) -> None: + response = client.entities.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" entity = response.parse() - assert_matches_type(Entity, entity, path=["response"]) + assert_matches_type(SyncPage[Entity], entity, path=["response"]) @parametrize - def test_streaming_response_confirm(self, client: Increase) -> None: - with client.entities.with_streaming_response.confirm( - "string", - ) as response: + def test_streaming_response_list(self, client: Increase) -> None: + with client.entities.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" entity = response.parse() - assert_matches_type(Entity, entity, path=["response"]) + assert_matches_type(SyncPage[Entity], entity, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_confirm(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - client.entities.with_raw_response.confirm( - "", - ) - - @parametrize - def test_method_update_address(self, client: Increase) -> None: - entity = client.entities.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - ) - assert_matches_type(Entity, entity, path=["response"]) - - @parametrize - def test_method_update_address_with_all_params(self, client: Increase) -> None: - entity = client.entities.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "line2": "Unit 2", - "city": "New York", - "state": "NY", - "zip": "10045", - }, + def test_method_archive(self, client: Increase) -> None: + entity = client.entities.archive( + "entity_n8y8tnk2p9339ti393yi", ) assert_matches_type(Entity, entity, path=["response"]) @parametrize - def test_raw_response_update_address(self, client: Increase) -> None: - response = client.entities.with_raw_response.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, + def test_raw_response_archive(self, client: Increase) -> None: + response = client.entities.with_raw_response.archive( + "entity_n8y8tnk2p9339ti393yi", ) assert response.is_closed is True @@ -626,15 +513,9 @@ def test_raw_response_update_address(self, client: Increase) -> None: assert_matches_type(Entity, entity, path=["response"]) @parametrize - def test_streaming_response_update_address(self, client: Increase) -> None: - with client.entities.with_streaming_response.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, + def test_streaming_response_archive(self, client: Increase) -> None: + with client.entities.with_streaming_response.archive( + "entity_n8y8tnk2p9339ti393yi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -645,21 +526,17 @@ def test_streaming_response_update_address(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_update_address(self, client: Increase) -> None: + def test_path_params_archive(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - client.entities.with_raw_response.update_address( + client.entities.with_raw_response.archive( "", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, ) class TestAsyncEntities: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -673,363 +550,259 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) entity = await async_client.entities.create( structure="corporation", corporation={ - "name": "National Phonograph Company", - "website": "https://example.com", - "tax_identifier": "602214076", - "incorporation_state": "NY", - "industry_code": "x", "address": { + "city": "New York", + "country": "x", "line1": "33 Liberty Street", "line2": "x", - "city": "New York", "state": "NY", "zip": "10045", }, "beneficial_owners": [ { "individual": { - "name": "Ian Crease", - "date_of_birth": parse_date("1970-01-31"), "address": { + "city": "New York", + "country": "x", "line1": "33 Liberty Street", "line2": "x", - "city": "New York", "state": "NY", "zip": "10045", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("1970-01-31"), "identification": { "method": "social_security_number", "number": "078051120", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + }, + "passport": { + "country": "x", + "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", }, }, + "name": "Ian Crease", + "confirmed_no_us_tax_id": True, }, - "company_title": "CEO", "prongs": ["control"], + "company_title": "CEO", } ], + "legal_identifier": { + "value": "602214076", + "category": "us_employer_identification_number", + }, + "name": "National Phonograph Company", + "beneficial_ownership_exemption_reason": "regulated_financial_institution", + "email": "dev@stainless.com", + "incorporation_state": "NY", + "industry_code": "x", + "website": "https://example.com", }, description="x", - joint={ + government_authority={ + "address": { + "city": "x", + "line1": "x", + "state": "x", + "zip": "x", + "line2": "x", + }, + "authorized_persons": [{"name": "x"}], + "category": "municipality", "name": "x", + "tax_identifier": "x", + "website": "website", + }, + joint={ "individuals": [ { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", }, - }, - }, - { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, - "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { "country": "x", - "description": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, - }, - { "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { - "country": "x", - "description": "x", - "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", - }, - }, - }, - ], + } + ] }, natural_person={ - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, + "name": "x", + "confirmed_no_us_tax_id": True, + }, + risk_rating={ + "rated_at": parse_datetime("2019-12-27T18:11:19.117Z"), + "rating": "low", }, - relationship="affiliated", supplemental_documents=[{"file_id": "file_makxrc67oh9l6sg7w9yc"}], + terms_agreements=[ + { + "agreed_at": parse_datetime("2019-12-27T18:11:19.117Z"), + "ip_address": "x", + "terms_url": "x", + } + ], + third_party_verification={ + "reference": "x", + "vendor": "alloy", + }, trust={ - "name": "x", - "category": "revocable", - "tax_identifier": "x", - "formation_state": "x", "address": { - "line1": "x", - "line2": "x", "city": "x", + "line1": "x", "state": "x", "zip": "x", + "line2": "x", }, - "formation_document_file_id": "string", + "category": "revocable", + "name": "x", "trustees": [ { "structure": "individual", "individual": { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", }, - }, - }, - }, - { - "structure": "individual", - "individual": { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, - "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { - "country": "x", - "description": "x", - "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, - }, - }, - { - "structure": "individual", - "individual": { "name": "x", - "date_of_birth": parse_date("2019-12-27"), - "address": { - "line1": "x", - "line2": "x", - "city": "x", - "state": "x", - "zip": "x", - }, "confirmed_no_us_tax_id": True, - "identification": { - "method": "social_security_number", - "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, - "drivers_license": { - "file_id": "string", - "back_file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "state": "x", - }, - "other": { - "country": "x", - "description": "x", - "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", - }, - }, }, - }, + } ], + "formation_document_file_id": "formation_document_file_id", + "formation_state": "x", "grantor": { - "name": "x", - "date_of_birth": parse_date("2019-12-27"), "address": { + "city": "x", + "country": "x", "line1": "x", "line2": "x", - "city": "x", "state": "x", "zip": "x", }, - "confirmed_no_us_tax_id": True, + "date_of_birth": parse_date("2019-12-27"), "identification": { "method": "social_security_number", "number": "xxxx", - "passport": { - "file_id": "string", - "expiration_date": parse_date("2019-12-27"), - "country": "x", - }, "drivers_license": { - "file_id": "string", - "back_file_id": "string", "expiration_date": parse_date("2019-12-27"), + "file_id": "file_id", "state": "x", + "back_file_id": "back_file_id", }, "other": { "country": "x", "description": "x", + "file_id": "file_id", + "back_file_id": "back_file_id", + "expiration_date": parse_date("2019-12-27"), + }, + "passport": { + "country": "x", "expiration_date": parse_date("2019-12-27"), - "file_id": "string", - "back_file_id": "string", + "file_id": "file_id", }, }, + "name": "x", + "confirmed_no_us_tax_id": True, }, + "tax_identifier": "x", }, ) assert_matches_type(Entity, entity, path=["response"]) @@ -1042,7 +815,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - entity = response.parse() + entity = await response.parse() assert_matches_type(Entity, entity, path=["response"]) @parametrize @@ -1061,25 +834,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: entity = await async_client.entities.retrieve( - "string", + "entity_n8y8tnk2p9339ti393yi", ) assert_matches_type(Entity, entity, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.entities.with_raw_response.retrieve( - "string", + "entity_n8y8tnk2p9339ti393yi", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - entity = response.parse() + entity = await response.parse() assert_matches_type(Entity, entity, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.entities.with_streaming_response.retrieve( - "string", + "entity_n8y8tnk2p9339ti393yi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1097,68 +870,92 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: ) @parametrize - async def test_method_list(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.list() - assert_matches_type(AsyncPage[Entity], entity, path=["response"]) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.list( - created_at={ - "after": parse_datetime("2019-12-27T18:11:19.117Z"), - "before": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), - }, - cursor="string", - idempotency_key="x", - limit=1, - status={"in": ["active", "archived", "disabled"]}, + async def test_method_update(self, async_client: AsyncIncrease) -> None: + entity = await async_client.entities.update( + entity_id="entity_n8y8tnk2p9339ti393yi", ) - assert_matches_type(AsyncPage[Entity], entity, path=["response"]) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - entity = response.parse() - assert_matches_type(AsyncPage[Entity], entity, path=["response"]) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - entity = await response.parse() - assert_matches_type(AsyncPage[Entity], entity, path=["response"]) - - assert cast(Any, response.is_closed) is True + assert_matches_type(Entity, entity, path=["response"]) @parametrize - async def test_method_archive(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.archive( - "string", + async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: + entity = await async_client.entities.update( + entity_id="entity_n8y8tnk2p9339ti393yi", + corporation={ + "address": { + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "Unit 2", + "state": "NY", + "zip": "10045", + }, + "email": "dev@stainless.com", + "incorporation_state": "x", + "industry_code": "x", + "legal_identifier": { + "value": "x", + "category": "us_employer_identification_number", + }, + "name": "x", + }, + details_confirmed_at=parse_datetime("2019-12-27T18:11:19.117Z"), + government_authority={ + "address": { + "city": "x", + "line1": "x", + "state": "x", + "zip": "x", + "line2": "x", + }, + "name": "x", + }, + natural_person={ + "address": { + "city": "x", + "country": "x", + "line1": "x", + "line2": "x", + "state": "x", + "zip": "x", + }, + "name": "x", + }, + risk_rating={ + "rated_at": parse_datetime("2020-01-31T23:59:59Z"), + "rating": "low", + }, + third_party_verification={ + "reference": "x", + "vendor": "alloy", + }, + trust={ + "address": { + "city": "x", + "line1": "x", + "state": "x", + "zip": "x", + "line2": "x", + }, + "name": "x", + }, ) assert_matches_type(Entity, entity, path=["response"]) @parametrize - async def test_raw_response_archive(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.with_raw_response.archive( - "string", + async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: + response = await async_client.entities.with_raw_response.update( + entity_id="entity_n8y8tnk2p9339ti393yi", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - entity = response.parse() + entity = await response.parse() assert_matches_type(Entity, entity, path=["response"]) @parametrize - async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.with_streaming_response.archive( - "string", + async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: + async with async_client.entities.with_streaming_response.update( + entity_id="entity_n8y8tnk2p9339ti393yi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1169,112 +966,75 @@ async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_archive(self, async_client: AsyncIncrease) -> None: + async def test_path_params_update(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - await async_client.entities.with_raw_response.archive( - "", + await async_client.entities.with_raw_response.update( + entity_id="", ) @parametrize - async def test_method_confirm(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.confirm( - "string", - ) - assert_matches_type(Entity, entity, path=["response"]) + async def test_method_list(self, async_client: AsyncIncrease) -> None: + entity = await async_client.entities.list() + assert_matches_type(AsyncPage[Entity], entity, path=["response"]) @parametrize - async def test_method_confirm_with_all_params(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.confirm( - "string", - confirmed_at=parse_datetime("2019-12-27T18:11:19.117Z"), + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + entity = await async_client.entities.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["active"]}, ) - assert_matches_type(Entity, entity, path=["response"]) + assert_matches_type(AsyncPage[Entity], entity, path=["response"]) @parametrize - async def test_raw_response_confirm(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.with_raw_response.confirm( - "string", - ) + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.entities.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - entity = response.parse() - assert_matches_type(Entity, entity, path=["response"]) + entity = await response.parse() + assert_matches_type(AsyncPage[Entity], entity, path=["response"]) @parametrize - async def test_streaming_response_confirm(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.with_streaming_response.confirm( - "string", - ) as response: + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.entities.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" entity = await response.parse() - assert_matches_type(Entity, entity, path=["response"]) + assert_matches_type(AsyncPage[Entity], entity, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_confirm(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - await async_client.entities.with_raw_response.confirm( - "", - ) - - @parametrize - async def test_method_update_address(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, - ) - assert_matches_type(Entity, entity, path=["response"]) - - @parametrize - async def test_method_update_address_with_all_params(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "line2": "Unit 2", - "city": "New York", - "state": "NY", - "zip": "10045", - }, + async def test_method_archive(self, async_client: AsyncIncrease) -> None: + entity = await async_client.entities.archive( + "entity_n8y8tnk2p9339ti393yi", ) assert_matches_type(Entity, entity, path=["response"]) @parametrize - async def test_raw_response_update_address(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.with_raw_response.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, + async def test_raw_response_archive(self, async_client: AsyncIncrease) -> None: + response = await async_client.entities.with_raw_response.archive( + "entity_n8y8tnk2p9339ti393yi", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - entity = response.parse() + entity = await response.parse() assert_matches_type(Entity, entity, path=["response"]) @parametrize - async def test_streaming_response_update_address(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.with_streaming_response.update_address( - "string", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, + async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> None: + async with async_client.entities.with_streaming_response.archive( + "entity_n8y8tnk2p9339ti393yi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -1285,14 +1045,8 @@ async def test_streaming_response_update_address(self, async_client: AsyncIncrea assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_update_address(self, async_client: AsyncIncrease) -> None: + async def test_path_params_archive(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - await async_client.entities.with_raw_response.update_address( + await async_client.entities.with_raw_response.archive( "", - address={ - "line1": "33 Liberty Street", - "city": "New York", - "state": "NY", - "zip": "10045", - }, ) diff --git a/tests/api_resources/test_entity_onboarding_sessions.py b/tests/api_resources/test_entity_onboarding_sessions.py new file mode 100644 index 000000000..cd90a32e1 --- /dev/null +++ b/tests/api_resources/test_entity_onboarding_sessions.py @@ -0,0 +1,343 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import ( + EntityOnboardingSession, +) +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestEntityOnboardingSessions: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + entity_onboarding_session = client.entity_onboarding_sessions.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + entity_onboarding_session = client.entity_onboarding_sessions.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + entity_id="entity_id", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.entity_onboarding_sessions.with_raw_response.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.entity_onboarding_sessions.with_streaming_response.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + entity_onboarding_session = client.entity_onboarding_sessions.retrieve( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.entity_onboarding_sessions.with_raw_response.retrieve( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.entity_onboarding_sessions.with_streaming_response.retrieve( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_onboarding_session_id` but received ''" + ): + client.entity_onboarding_sessions.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + entity_onboarding_session = client.entity_onboarding_sessions.list() + assert_matches_type(SyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + entity_onboarding_session = client.entity_onboarding_sessions.list( + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["active"]}, + ) + assert_matches_type(SyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.entity_onboarding_sessions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = response.parse() + assert_matches_type(SyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.entity_onboarding_sessions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = response.parse() + assert_matches_type(SyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_expire(self, client: Increase) -> None: + entity_onboarding_session = client.entity_onboarding_sessions.expire( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_raw_response_expire(self, client: Increase) -> None: + response = client.entity_onboarding_sessions.with_raw_response.expire( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + def test_streaming_response_expire(self, client: Increase) -> None: + with client.entity_onboarding_sessions.with_streaming_response.expire( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_expire(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_onboarding_session_id` but received ''" + ): + client.entity_onboarding_sessions.with_raw_response.expire( + "", + ) + + +class TestAsyncEntityOnboardingSessions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + entity_onboarding_session = await async_client.entity_onboarding_sessions.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + entity_onboarding_session = await async_client.entity_onboarding_sessions.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + entity_id="entity_id", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.entity_onboarding_sessions.with_raw_response.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.entity_onboarding_sessions.with_streaming_response.create( + program_id="program_i2v2os4mwza1oetokh9i", + redirect_url="https://example.com/onboarding/session", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + entity_onboarding_session = await async_client.entity_onboarding_sessions.retrieve( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.entity_onboarding_sessions.with_raw_response.retrieve( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.entity_onboarding_sessions.with_streaming_response.retrieve( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_onboarding_session_id` but received ''" + ): + await async_client.entity_onboarding_sessions.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + entity_onboarding_session = await async_client.entity_onboarding_sessions.list() + assert_matches_type(AsyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + entity_onboarding_session = await async_client.entity_onboarding_sessions.list( + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["active"]}, + ) + assert_matches_type(AsyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.entity_onboarding_sessions.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = await response.parse() + assert_matches_type(AsyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.entity_onboarding_sessions.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = await response.parse() + assert_matches_type(AsyncPage[EntityOnboardingSession], entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_expire(self, async_client: AsyncIncrease) -> None: + entity_onboarding_session = await async_client.entity_onboarding_sessions.expire( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_raw_response_expire(self, async_client: AsyncIncrease) -> None: + response = await async_client.entity_onboarding_sessions.with_raw_response.expire( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + @parametrize + async def test_streaming_response_expire(self, async_client: AsyncIncrease) -> None: + async with async_client.entity_onboarding_sessions.with_streaming_response.expire( + "entity_onboarding_session_wid2ug11fsmvh3k9hymd", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + entity_onboarding_session = await response.parse() + assert_matches_type(EntityOnboardingSession, entity_onboarding_session, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_expire(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `entity_onboarding_session_id` but received ''" + ): + await async_client.entity_onboarding_sessions.with_raw_response.expire( + "", + ) diff --git a/tests/api_resources/test_event_subscriptions.py b/tests/api_resources/test_event_subscriptions.py index f239a179f..2962c9c00 100644 --- a/tests/api_resources/test_event_subscriptions.py +++ b/tests/api_resources/test_event_subscriptions.py @@ -31,8 +31,10 @@ def test_method_create(self, client: Increase) -> None: def test_method_create_with_all_params(self, client: Increase) -> None: event_subscription = client.event_subscriptions.create( url="https://website.com/webhooks", - selected_event_category="account.created", + oauth_connection_id="x", + selected_event_categories=[{"event_category": "account.created"}], shared_secret="x", + status="active", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @@ -63,14 +65,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: event_subscription = client.event_subscriptions.retrieve( - "string", + "event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.event_subscriptions.with_raw_response.retrieve( - "string", + "event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert response.is_closed is True @@ -81,7 +83,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.event_subscriptions.with_streaming_response.retrieve( - "string", + "event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -101,14 +103,14 @@ def test_path_params_retrieve(self, client: Increase) -> None: @parametrize def test_method_update(self, client: Increase) -> None: event_subscription = client.event_subscriptions.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Increase) -> None: event_subscription = client.event_subscriptions.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", status="active", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @@ -116,7 +118,7 @@ def test_method_update_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_update(self, client: Increase) -> None: response = client.event_subscriptions.with_raw_response.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert response.is_closed is True @@ -127,7 +129,7 @@ def test_raw_response_update(self, client: Increase) -> None: @parametrize def test_streaming_response_update(self, client: Increase) -> None: with client.event_subscriptions.with_streaming_response.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -141,7 +143,7 @@ def test_streaming_response_update(self, client: Increase) -> None: def test_path_params_update(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_subscription_id` but received ''"): client.event_subscriptions.with_raw_response.update( - "", + event_subscription_id="", ) @parametrize @@ -152,7 +154,7 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: event_subscription = client.event_subscriptions.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -180,7 +182,9 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncEventSubscriptions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -193,8 +197,10 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: event_subscription = await async_client.event_subscriptions.create( url="https://website.com/webhooks", - selected_event_category="account.created", + oauth_connection_id="x", + selected_event_categories=[{"event_category": "account.created"}], shared_secret="x", + status="active", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @@ -206,7 +212,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event_subscription = response.parse() + event_subscription = await response.parse() assert_matches_type(EventSubscription, event_subscription, path=["response"]) @parametrize @@ -225,25 +231,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: event_subscription = await async_client.event_subscriptions.retrieve( - "string", + "event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.event_subscriptions.with_raw_response.retrieve( - "string", + "event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event_subscription = response.parse() + event_subscription = await response.parse() assert_matches_type(EventSubscription, event_subscription, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.event_subscriptions.with_streaming_response.retrieve( - "string", + "event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -263,14 +269,14 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_update(self, async_client: AsyncIncrease) -> None: event_subscription = await async_client.event_subscriptions.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: event_subscription = await async_client.event_subscriptions.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", status="active", ) assert_matches_type(EventSubscription, event_subscription, path=["response"]) @@ -278,18 +284,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: response = await async_client.event_subscriptions.with_raw_response.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event_subscription = response.parse() + event_subscription = await response.parse() assert_matches_type(EventSubscription, event_subscription, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: async with async_client.event_subscriptions.with_streaming_response.update( - "string", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -303,7 +309,7 @@ async def test_streaming_response_update(self, async_client: AsyncIncrease) -> N async def test_path_params_update(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `event_subscription_id` but received ''"): await async_client.event_subscriptions.with_raw_response.update( - "", + event_subscription_id="", ) @parametrize @@ -314,7 +320,7 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: event_subscription = await async_client.event_subscriptions.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -326,7 +332,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event_subscription = response.parse() + event_subscription = await response.parse() assert_matches_type(AsyncPage[EventSubscription], event_subscription, path=["response"]) @parametrize diff --git a/tests/api_resources/test_events.py b/tests/api_resources/test_events.py index 619b5e2d6..55aacb27c 100644 --- a/tests/api_resources/test_events.py +++ b/tests/api_resources/test_events.py @@ -4,8 +4,10 @@ import os from typing import Any, cast +from datetime import datetime, timezone import pytest +import standardwebhooks from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type @@ -22,14 +24,14 @@ class TestEvents: @parametrize def test_method_retrieve(self, client: Increase) -> None: event = client.events.retrieve( - "string", + "event_001dzz0r20rzr4zrhrr1364hy80", ) assert_matches_type(Event, event, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.events.with_raw_response.retrieve( - "string", + "event_001dzz0r20rzr4zrhrr1364hy80", ) assert response.is_closed is True @@ -40,7 +42,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.events.with_streaming_response.retrieve( - "string", + "event_001dzz0r20rzr4zrhrr1364hy80", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,15 +67,15 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: event = client.events.list( - associated_object_id="string", - category={"in": ["account.created", "account.updated", "account_number.created"]}, + associated_object_id="associated_object_id", + category={"in": ["account.created"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[Event], event, path=["response"]) @@ -98,32 +100,73 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True + @pytest.mark.parametrize( + "client_opt,method_opt", + [ + ("secret\n", None), + ("wrong", b"secret\n"), + ("wrong", "whsec_c2VjcmV0Cg=="), + (None, b"secret\n"), + (None, "whsec_c2VjcmV0Cg=="), + ], + ) + def test_method_unwrap(self, client: Increase, client_opt: str | None, method_opt: str | bytes | None) -> None: + hook = standardwebhooks.Webhook(b"secret\n") + + client = client.with_options(webhook_secret=client_opt) + + data = """{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"}""" + msg_id = "1" + timestamp = datetime.now(tz=timezone.utc) + sig = hook.sign(msg_id=msg_id, timestamp=timestamp, data=data) + headers = { + "webhook-id": msg_id, + "webhook-timestamp": str(int(timestamp.timestamp())), + "webhook-signature": sig, + } + + try: + _ = client.events.unwrap(data, headers=headers, key=method_opt) + except standardwebhooks.WebhookVerificationError as e: + raise AssertionError("Failed to unwrap valid webhook") from e + + bad_headers = [ + {**headers, "webhook-signature": hook.sign(msg_id=msg_id, timestamp=timestamp, data="xxx")}, + {**headers, "webhook-id": "bad"}, + {**headers, "webhook-timestamp": "0"}, + ] + for bad_header in bad_headers: + with pytest.raises(standardwebhooks.WebhookVerificationError): + _ = client.events.unwrap(data, headers=bad_header, key=method_opt) + class TestAsyncEvents: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: event = await async_client.events.retrieve( - "string", + "event_001dzz0r20rzr4zrhrr1364hy80", ) assert_matches_type(Event, event, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.events.with_raw_response.retrieve( - "string", + "event_001dzz0r20rzr4zrhrr1364hy80", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() + event = await response.parse() assert_matches_type(Event, event, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.events.with_streaming_response.retrieve( - "string", + "event_001dzz0r20rzr4zrhrr1364hy80", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -148,15 +191,15 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: event = await async_client.events.list( - associated_object_id="string", - category={"in": ["account.created", "account.updated", "account_number.created"]}, + associated_object_id="associated_object_id", + category={"in": ["account.created"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[Event], event, path=["response"]) @@ -167,7 +210,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - event = response.parse() + event = await response.parse() assert_matches_type(AsyncPage[Event], event, path=["response"]) @parametrize @@ -180,3 +223,44 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert_matches_type(AsyncPage[Event], event, path=["response"]) assert cast(Any, response.is_closed) is True + + @pytest.mark.parametrize( + "client_opt,method_opt", + [ + ("secret\n", None), + ("wrong", b"secret\n"), + ("wrong", "whsec_c2VjcmV0Cg=="), + (None, b"secret\n"), + (None, "whsec_c2VjcmV0Cg=="), + ], + ) + def test_method_unwrap( + self, async_client: Increase, client_opt: str | None, method_opt: str | bytes | None + ) -> None: + hook = standardwebhooks.Webhook(b"secret\n") + + async_client = async_client.with_options(webhook_secret=client_opt) + + data = """{"id":"event_001dzz0r20rzr4zrhrr1364hy80","associated_object_id":"account_in71c4amph0vgo2qllky","associated_object_type":"account","category":"account.created","created_at":"2020-01-31T23:59:59Z","type":"event"}""" + msg_id = "1" + timestamp = datetime.now(tz=timezone.utc) + sig = hook.sign(msg_id=msg_id, timestamp=timestamp, data=data) + headers = { + "webhook-id": msg_id, + "webhook-timestamp": str(int(timestamp.timestamp())), + "webhook-signature": sig, + } + + try: + _ = async_client.events.unwrap(data, headers=headers, key=method_opt) + except standardwebhooks.WebhookVerificationError as e: + raise AssertionError("Failed to unwrap valid webhook") from e + + bad_headers = [ + {**headers, "webhook-signature": hook.sign(msg_id=msg_id, timestamp=timestamp, data="xxx")}, + {**headers, "webhook-id": "bad"}, + {**headers, "webhook-timestamp": "0"}, + ] + for bad_header in bad_headers: + with pytest.raises(standardwebhooks.WebhookVerificationError): + _ = async_client.events.unwrap(data, headers=bad_header, key=method_opt) diff --git a/tests/api_resources/test_exports.py b/tests/api_resources/test_exports.py index ccb95eb23..29dac3000 100644 --- a/tests/api_resources/test_exports.py +++ b/tests/api_resources/test_exports.py @@ -10,7 +10,7 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type from increase.types import Export -from increase._utils import parse_datetime +from increase._utils import parse_date, parse_datetime from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -30,8 +30,13 @@ def test_method_create(self, client: Increase) -> None: def test_method_create_with_all_params(self, client: Increase) -> None: export = client.exports.create( category="transaction_csv", + account_statement_bai2={ + "account_id": "account_id", + "effective_date": parse_date("2019-12-27"), + "program_id": "program_id", + }, account_statement_ofx={ - "account_id": "string", + "account_id": "account_id", "created_at": { "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -39,8 +44,12 @@ def test_method_create_with_all_params(self, client: Increase) -> None: "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, }, + account_verification_letter={ + "account_number_id": "account_number_id", + "balance_date": parse_date("2019-12-27"), + }, balance_csv={ - "account_id": "string", + "account_id": "account_id", "created_at": { "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -49,7 +58,7 @@ def test_method_create_with_all_params(self, client: Increase) -> None: }, }, bookkeeping_account_balance_csv={ - "bookkeeping_account_id": "string", + "bookkeeping_account_id": "bookkeeping_account_id", "created_at": { "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -57,7 +66,13 @@ def test_method_create_with_all_params(self, client: Increase) -> None: "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, }, - entity_csv={"status": {"in": ["active", "archived", "disabled"]}}, + daily_account_balance_csv={ + "account_id": "account_id", + "on_or_after_date": parse_date("2019-12-27"), + "on_or_before_date": parse_date("2019-12-27"), + }, + entity_csv={}, + funding_instructions={"account_number_id": "account_number_id"}, transaction_csv={ "account_id": "account_in71c4amph0vgo2qllky", "created_at": { @@ -67,6 +82,11 @@ def test_method_create_with_all_params(self, client: Increase) -> None: "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, }, + vendor_csv={}, + voided_check={ + "account_number_id": "account_number_id", + "payer": [{"line": "x"}], + }, ) assert_matches_type(Export, export, path=["response"]) @@ -97,14 +117,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: export = client.exports.retrieve( - "string", + "export_8s4m48qz3bclzje0zwh9", ) assert_matches_type(Export, export, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.exports.with_raw_response.retrieve( - "string", + "export_8s4m48qz3bclzje0zwh9", ) assert response.is_closed is True @@ -115,7 +135,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.exports.with_streaming_response.retrieve( - "string", + "export_8s4m48qz3bclzje0zwh9", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -140,8 +160,19 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: export = client.exports.list( - cursor="string", + category="account_statement_ofx", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + form_1099_int={"account_id": "account_id"}, + form_1099_misc={"account_id": "account_id"}, + idempotency_key="x", limit=1, + status={"in": ["pending"]}, ) assert_matches_type(SyncPage[Export], export, path=["response"]) @@ -167,7 +198,9 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncExports: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -180,8 +213,13 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: export = await async_client.exports.create( category="transaction_csv", + account_statement_bai2={ + "account_id": "account_id", + "effective_date": parse_date("2019-12-27"), + "program_id": "program_id", + }, account_statement_ofx={ - "account_id": "string", + "account_id": "account_id", "created_at": { "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -189,8 +227,12 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, }, + account_verification_letter={ + "account_number_id": "account_number_id", + "balance_date": parse_date("2019-12-27"), + }, balance_csv={ - "account_id": "string", + "account_id": "account_id", "created_at": { "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -199,7 +241,7 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) }, }, bookkeeping_account_balance_csv={ - "bookkeeping_account_id": "string", + "bookkeeping_account_id": "bookkeeping_account_id", "created_at": { "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), @@ -207,7 +249,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, }, - entity_csv={"status": {"in": ["active", "archived", "disabled"]}}, + daily_account_balance_csv={ + "account_id": "account_id", + "on_or_after_date": parse_date("2019-12-27"), + "on_or_before_date": parse_date("2019-12-27"), + }, + entity_csv={}, + funding_instructions={"account_number_id": "account_number_id"}, transaction_csv={ "account_id": "account_in71c4amph0vgo2qllky", "created_at": { @@ -217,6 +265,11 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, }, + vendor_csv={}, + voided_check={ + "account_number_id": "account_number_id", + "payer": [{"line": "x"}], + }, ) assert_matches_type(Export, export, path=["response"]) @@ -228,7 +281,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - export = response.parse() + export = await response.parse() assert_matches_type(Export, export, path=["response"]) @parametrize @@ -247,25 +300,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: export = await async_client.exports.retrieve( - "string", + "export_8s4m48qz3bclzje0zwh9", ) assert_matches_type(Export, export, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.exports.with_raw_response.retrieve( - "string", + "export_8s4m48qz3bclzje0zwh9", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - export = response.parse() + export = await response.parse() assert_matches_type(Export, export, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.exports.with_streaming_response.retrieve( - "string", + "export_8s4m48qz3bclzje0zwh9", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -290,8 +343,19 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: export = await async_client.exports.list( - cursor="string", + category="account_statement_ofx", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + form_1099_int={"account_id": "account_id"}, + form_1099_misc={"account_id": "account_id"}, + idempotency_key="x", limit=1, + status={"in": ["pending"]}, ) assert_matches_type(AsyncPage[Export], export, path=["response"]) @@ -301,7 +365,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - export = response.parse() + export = await response.parse() assert_matches_type(AsyncPage[Export], export, path=["response"]) @parametrize diff --git a/tests/api_resources/test_external_accounts.py b/tests/api_resources/test_external_accounts.py index 9a7b7e476..4d639e66e 100644 --- a/tests/api_resources/test_external_accounts.py +++ b/tests/api_resources/test_external_accounts.py @@ -71,14 +71,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: external_account = client.external_accounts.retrieve( - "string", + "external_account_ukk55lr923a3ac0pp7iv", ) assert_matches_type(ExternalAccount, external_account, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.external_accounts.with_raw_response.retrieve( - "string", + "external_account_ukk55lr923a3ac0pp7iv", ) assert response.is_closed is True @@ -89,7 +89,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.external_accounts.with_streaming_response.retrieve( - "string", + "external_account_ukk55lr923a3ac0pp7iv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -109,14 +109,14 @@ def test_path_params_retrieve(self, client: Increase) -> None: @parametrize def test_method_update(self, client: Increase) -> None: external_account = client.external_accounts.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", ) assert_matches_type(ExternalAccount, external_account, path=["response"]) @parametrize def test_method_update_with_all_params(self, client: Increase) -> None: external_account = client.external_accounts.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", account_holder="business", description="New description", funding="checking", @@ -127,7 +127,7 @@ def test_method_update_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_update(self, client: Increase) -> None: response = client.external_accounts.with_raw_response.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", ) assert response.is_closed is True @@ -138,7 +138,7 @@ def test_raw_response_update(self, client: Increase) -> None: @parametrize def test_streaming_response_update(self, client: Increase) -> None: with client.external_accounts.with_streaming_response.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -152,7 +152,7 @@ def test_streaming_response_update(self, client: Increase) -> None: def test_path_params_update(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_account_id` but received ''"): client.external_accounts.with_raw_response.update( - "", + external_account_id="", ) @parametrize @@ -163,11 +163,11 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: external_account = client.external_accounts.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, routing_number="xxxxxxxxx", - status={"in": ["active", "archived"]}, + status={"in": ["active"]}, ) assert_matches_type(SyncPage[ExternalAccount], external_account, path=["response"]) @@ -193,7 +193,9 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncExternalAccounts: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -225,7 +227,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - external_account = response.parse() + external_account = await response.parse() assert_matches_type(ExternalAccount, external_account, path=["response"]) @parametrize @@ -246,25 +248,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: external_account = await async_client.external_accounts.retrieve( - "string", + "external_account_ukk55lr923a3ac0pp7iv", ) assert_matches_type(ExternalAccount, external_account, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.external_accounts.with_raw_response.retrieve( - "string", + "external_account_ukk55lr923a3ac0pp7iv", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - external_account = response.parse() + external_account = await response.parse() assert_matches_type(ExternalAccount, external_account, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.external_accounts.with_streaming_response.retrieve( - "string", + "external_account_ukk55lr923a3ac0pp7iv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -284,14 +286,14 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_update(self, async_client: AsyncIncrease) -> None: external_account = await async_client.external_accounts.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", ) assert_matches_type(ExternalAccount, external_account, path=["response"]) @parametrize async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: external_account = await async_client.external_accounts.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", account_holder="business", description="New description", funding="checking", @@ -302,18 +304,18 @@ async def test_method_update_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: response = await async_client.external_accounts.with_raw_response.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - external_account = response.parse() + external_account = await response.parse() assert_matches_type(ExternalAccount, external_account, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: async with async_client.external_accounts.with_streaming_response.update( - "string", + external_account_id="external_account_ukk55lr923a3ac0pp7iv", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -327,7 +329,7 @@ async def test_streaming_response_update(self, async_client: AsyncIncrease) -> N async def test_path_params_update(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `external_account_id` but received ''"): await async_client.external_accounts.with_raw_response.update( - "", + external_account_id="", ) @parametrize @@ -338,11 +340,11 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: external_account = await async_client.external_accounts.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, routing_number="xxxxxxxxx", - status={"in": ["active", "archived"]}, + status={"in": ["active"]}, ) assert_matches_type(AsyncPage[ExternalAccount], external_account, path=["response"]) @@ -352,7 +354,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - external_account = response.parse() + external_account = await response.parse() assert_matches_type(AsyncPage[ExternalAccount], external_account, path=["response"]) @parametrize diff --git a/tests/api_resources/test_fednow_transfers.py b/tests/api_resources/test_fednow_transfers.py new file mode 100644 index 000000000..9059977e2 --- /dev/null +++ b/tests/api_resources/test_fednow_transfers.py @@ -0,0 +1,480 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import FednowTransfer +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFednowTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + fednow_transfer = client.fednow_transfers.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + fednow_transfer = client.fednow_transfers.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + account_number="987654321", + creditor_address={ + "city": "New York", + "postal_code": "10045", + "state": "NY", + "line1": "33 Liberty Street", + }, + debtor_address={ + "city": "x", + "postal_code": "x", + "state": "x", + "line1": "x", + }, + external_account_id="external_account_id", + require_approval=True, + routing_number="101050001", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.fednow_transfers.with_raw_response.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.fednow_transfers.with_streaming_response.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + fednow_transfer = client.fednow_transfers.retrieve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.fednow_transfers.with_raw_response.retrieve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.fednow_transfers.with_streaming_response.retrieve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `fednow_transfer_id` but received ''"): + client.fednow_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + fednow_transfer = client.fednow_transfers.list() + assert_matches_type(SyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + fednow_transfer = client.fednow_transfers.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + external_account_id="external_account_id", + idempotency_key="x", + limit=1, + status={"in": ["pending_reviewing"]}, + ) + assert_matches_type(SyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.fednow_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = response.parse() + assert_matches_type(SyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.fednow_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = response.parse() + assert_matches_type(SyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_approve(self, client: Increase) -> None: + fednow_transfer = client.fednow_transfers.approve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_raw_response_approve(self, client: Increase) -> None: + response = client.fednow_transfers.with_raw_response.approve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_streaming_response_approve(self, client: Increase) -> None: + with client.fednow_transfers.with_streaming_response.approve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_approve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `fednow_transfer_id` but received ''"): + client.fednow_transfers.with_raw_response.approve( + "", + ) + + @parametrize + def test_method_cancel(self, client: Increase) -> None: + fednow_transfer = client.fednow_transfers.cancel( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: Increase) -> None: + response = client.fednow_transfers.with_raw_response.cancel( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: Increase) -> None: + with client.fednow_transfers.with_streaming_response.cancel( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `fednow_transfer_id` but received ''"): + client.fednow_transfers.with_raw_response.cancel( + "", + ) + + +class TestAsyncFednowTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + fednow_transfer = await async_client.fednow_transfers.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + fednow_transfer = await async_client.fednow_transfers.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + account_number="987654321", + creditor_address={ + "city": "New York", + "postal_code": "10045", + "state": "NY", + "line1": "33 Liberty Street", + }, + debtor_address={ + "city": "x", + "postal_code": "x", + "state": "x", + "line1": "x", + }, + external_account_id="external_account_id", + require_approval=True, + routing_number="101050001", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.fednow_transfers.with_raw_response.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.fednow_transfers.with_streaming_response.create( + amount=100, + creditor_name="Ian Crease", + debtor_name="National Phonograph Company", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + fednow_transfer = await async_client.fednow_transfers.retrieve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.fednow_transfers.with_raw_response.retrieve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.fednow_transfers.with_streaming_response.retrieve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `fednow_transfer_id` but received ''"): + await async_client.fednow_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + fednow_transfer = await async_client.fednow_transfers.list() + assert_matches_type(AsyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + fednow_transfer = await async_client.fednow_transfers.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + external_account_id="external_account_id", + idempotency_key="x", + limit=1, + status={"in": ["pending_reviewing"]}, + ) + assert_matches_type(AsyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.fednow_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = await response.parse() + assert_matches_type(AsyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.fednow_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = await response.parse() + assert_matches_type(AsyncPage[FednowTransfer], fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_approve(self, async_client: AsyncIncrease) -> None: + fednow_transfer = await async_client.fednow_transfers.approve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: + response = await async_client.fednow_transfers.with_raw_response.approve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: + async with async_client.fednow_transfers.with_streaming_response.approve( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `fednow_transfer_id` but received ''"): + await async_client.fednow_transfers.with_raw_response.approve( + "", + ) + + @parametrize + async def test_method_cancel(self, async_client: AsyncIncrease) -> None: + fednow_transfer = await async_client.fednow_transfers.cancel( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: + response = await async_client.fednow_transfers.with_raw_response.cancel( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: + async with async_client.fednow_transfers.with_streaming_response.cancel( + "fednow_transfer_4i0mptrdu1mueg1196bg", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + fednow_transfer = await response.parse() + assert_matches_type(FednowTransfer, fednow_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `fednow_transfer_id` but received ''"): + await async_client.fednow_transfers.with_raw_response.cancel( + "", + ) diff --git a/tests/api_resources/test_file_links.py b/tests/api_resources/test_file_links.py new file mode 100644 index 000000000..6c80129ad --- /dev/null +++ b/tests/api_resources/test_file_links.py @@ -0,0 +1,103 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import FileLink +from increase._utils import parse_datetime + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestFileLinks: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + file_link = client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + file_link = client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.file_links.with_raw_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.file_links.with_streaming_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncFileLinks: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + file_link = await async_client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + file_link = await async_client.file_links.create( + file_id="file_makxrc67oh9l6sg7w9yc", + expires_at=parse_datetime("2019-12-27T18:11:19.117Z"), + ) + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.file_links.with_raw_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + file_link = await response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.file_links.with_streaming_response.create( + file_id="file_makxrc67oh9l6sg7w9yc", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + file_link = await response.parse() + assert_matches_type(FileLink, file_link, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_files.py b/tests/api_resources/test_files.py index 550cb6824..172094476 100644 --- a/tests/api_resources/test_files.py +++ b/tests/api_resources/test_files.py @@ -22,7 +22,7 @@ class TestFiles: @parametrize def test_method_create(self, client: Increase) -> None: file = client.files.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", ) assert_matches_type(File, file, path=["response"]) @@ -30,7 +30,7 @@ def test_method_create(self, client: Increase) -> None: @parametrize def test_method_create_with_all_params(self, client: Increase) -> None: file = client.files.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", description="x", ) @@ -39,7 +39,7 @@ def test_method_create_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_create(self, client: Increase) -> None: response = client.files.with_raw_response.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", ) @@ -51,7 +51,7 @@ def test_raw_response_create(self, client: Increase) -> None: @parametrize def test_streaming_response_create(self, client: Increase) -> None: with client.files.with_streaming_response.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", ) as response: assert not response.is_closed @@ -65,14 +65,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: file = client.files.retrieve( - "string", + "file_makxrc67oh9l6sg7w9yc", ) assert_matches_type(File, file, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.files.with_raw_response.retrieve( - "string", + "file_makxrc67oh9l6sg7w9yc", ) assert response.is_closed is True @@ -83,7 +83,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.files.with_streaming_response.retrieve( - "string", + "file_makxrc67oh9l6sg7w9yc", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -114,10 +114,10 @@ def test_method_list_with_all_params(self, client: Increase) -> None: "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - purpose={"in": ["check_image_front", "check_image_back", "mailed_check_image"]}, + purpose={"in": ["card_dispute_attachment"]}, ) assert_matches_type(SyncPage[File], file, path=["response"]) @@ -143,12 +143,14 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncFiles: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: file = await async_client.files.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", ) assert_matches_type(File, file, path=["response"]) @@ -156,7 +158,7 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: file = await async_client.files.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", description="x", ) @@ -165,19 +167,19 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.files.with_raw_response.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() + file = await response.parse() assert_matches_type(File, file, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: async with async_client.files.with_streaming_response.create( - file=b"raw file contents", + file=b"Example data", purpose="check_image_front", ) as response: assert not response.is_closed @@ -191,25 +193,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: file = await async_client.files.retrieve( - "string", + "file_makxrc67oh9l6sg7w9yc", ) assert_matches_type(File, file, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.files.with_raw_response.retrieve( - "string", + "file_makxrc67oh9l6sg7w9yc", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() + file = await response.parse() assert_matches_type(File, file, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.files.with_streaming_response.retrieve( - "string", + "file_makxrc67oh9l6sg7w9yc", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -240,10 +242,10 @@ async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - purpose={"in": ["check_image_front", "check_image_back", "mailed_check_image"]}, + purpose={"in": ["card_dispute_attachment"]}, ) assert_matches_type(AsyncPage[File], file, path=["response"]) @@ -253,7 +255,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - file = response.parse() + file = await response.parse() assert_matches_type(AsyncPage[File], file, path=["response"]) @parametrize diff --git a/tests/api_resources/test_groups.py b/tests/api_resources/test_groups.py index f0b1a4e4d..51838c324 100644 --- a/tests/api_resources/test_groups.py +++ b/tests/api_resources/test_groups.py @@ -18,13 +18,13 @@ class TestGroups: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize - def test_method_retrieve_details(self, client: Increase) -> None: - group = client.groups.retrieve_details() + def test_method_retrieve(self, client: Increase) -> None: + group = client.groups.retrieve() assert_matches_type(Group, group, path=["response"]) @parametrize - def test_raw_response_retrieve_details(self, client: Increase) -> None: - response = client.groups.with_raw_response.retrieve_details() + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.groups.with_raw_response.retrieve() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -32,8 +32,8 @@ def test_raw_response_retrieve_details(self, client: Increase) -> None: assert_matches_type(Group, group, path=["response"]) @parametrize - def test_streaming_response_retrieve_details(self, client: Increase) -> None: - with client.groups.with_streaming_response.retrieve_details() as response: + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.groups.with_streaming_response.retrieve() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -44,25 +44,27 @@ def test_streaming_response_retrieve_details(self, client: Increase) -> None: class TestAsyncGroups: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize - async def test_method_retrieve_details(self, async_client: AsyncIncrease) -> None: - group = await async_client.groups.retrieve_details() + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + group = await async_client.groups.retrieve() assert_matches_type(Group, group, path=["response"]) @parametrize - async def test_raw_response_retrieve_details(self, async_client: AsyncIncrease) -> None: - response = await async_client.groups.with_raw_response.retrieve_details() + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.groups.with_raw_response.retrieve() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - group = response.parse() + group = await response.parse() assert_matches_type(Group, group, path=["response"]) @parametrize - async def test_streaming_response_retrieve_details(self, async_client: AsyncIncrease) -> None: - async with async_client.groups.with_streaming_response.retrieve_details() as response: + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.groups.with_streaming_response.retrieve() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" diff --git a/tests/api_resources/test_inbound_ach_transfers.py b/tests/api_resources/test_inbound_ach_transfers.py index b774a19ee..9c73918f4 100644 --- a/tests/api_resources/test_inbound_ach_transfers.py +++ b/tests/api_resources/test_inbound_ach_transfers.py @@ -24,14 +24,14 @@ class TestInboundACHTransfers: @parametrize def test_method_retrieve(self, client: Increase) -> None: inbound_ach_transfer = client.inbound_ach_transfers.retrieve( - "string", + "inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.inbound_ach_transfers.with_raw_response.retrieve( - "string", + "inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert response.is_closed is True @@ -42,7 +42,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.inbound_ach_transfers.with_streaming_response.retrieve( - "string", + "inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -69,17 +69,17 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: inbound_ach_transfer = client.inbound_ach_transfers.list( - account_id="string", - account_number_id="string", + account_id="account_id", + account_number_id="account_number_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - status="pending", + status={"in": ["pending"]}, ) assert_matches_type(SyncPage[InboundACHTransfer], inbound_ach_transfer, path=["response"]) @@ -104,16 +104,25 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_method_decline(self, client: Increase) -> None: - inbound_ach_transfer = client.inbound_ach_transfers.decline( - "string", + def test_method_create_notification_of_change(self, client: Increase) -> None: + inbound_ach_transfer = client.inbound_ach_transfers.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - def test_raw_response_decline(self, client: Increase) -> None: - response = client.inbound_ach_transfers.with_raw_response.decline( - "string", + def test_method_create_notification_of_change_with_all_params(self, client: Increase) -> None: + inbound_ach_transfer = client.inbound_ach_transfers.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", + updated_account_number="987654321", + updated_routing_number="101050001", + ) + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + def test_raw_response_create_notification_of_change(self, client: Increase) -> None: + response = client.inbound_ach_transfers.with_raw_response.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert response.is_closed is True @@ -122,9 +131,9 @@ def test_raw_response_decline(self, client: Increase) -> None: assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - def test_streaming_response_decline(self, client: Increase) -> None: - with client.inbound_ach_transfers.with_streaming_response.decline( - "string", + def test_streaming_response_create_notification_of_change(self, client: Increase) -> None: + with client.inbound_ach_transfers.with_streaming_response.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -135,34 +144,33 @@ def test_streaming_response_decline(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_decline(self, client: Increase) -> None: + def test_path_params_create_notification_of_change(self, client: Increase) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `inbound_ach_transfer_id` but received ''" ): - client.inbound_ach_transfers.with_raw_response.decline( - "", + client.inbound_ach_transfers.with_raw_response.create_notification_of_change( + inbound_ach_transfer_id="", ) @parametrize - def test_method_notification_of_change(self, client: Increase) -> None: - inbound_ach_transfer = client.inbound_ach_transfers.notification_of_change( - "string", + def test_method_decline(self, client: Increase) -> None: + inbound_ach_transfer = client.inbound_ach_transfers.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - def test_method_notification_of_change_with_all_params(self, client: Increase) -> None: - inbound_ach_transfer = client.inbound_ach_transfers.notification_of_change( - "string", - updated_account_number="987654321", - updated_routing_number="101050001", + def test_method_decline_with_all_params(self, client: Increase) -> None: + inbound_ach_transfer = client.inbound_ach_transfers.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", + reason="payment_stopped", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - def test_raw_response_notification_of_change(self, client: Increase) -> None: - response = client.inbound_ach_transfers.with_raw_response.notification_of_change( - "string", + def test_raw_response_decline(self, client: Increase) -> None: + response = client.inbound_ach_transfers.with_raw_response.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert response.is_closed is True @@ -171,9 +179,9 @@ def test_raw_response_notification_of_change(self, client: Increase) -> None: assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - def test_streaming_response_notification_of_change(self, client: Increase) -> None: - with client.inbound_ach_transfers.with_streaming_response.notification_of_change( - "string", + def test_streaming_response_decline(self, client: Increase) -> None: + with client.inbound_ach_transfers.with_streaming_response.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -184,18 +192,18 @@ def test_streaming_response_notification_of_change(self, client: Increase) -> No assert cast(Any, response.is_closed) is True @parametrize - def test_path_params_notification_of_change(self, client: Increase) -> None: + def test_path_params_decline(self, client: Increase) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `inbound_ach_transfer_id` but received ''" ): - client.inbound_ach_transfers.with_raw_response.notification_of_change( - "", + client.inbound_ach_transfers.with_raw_response.decline( + inbound_ach_transfer_id="", ) @parametrize def test_method_transfer_return(self, client: Increase) -> None: inbound_ach_transfer = client.inbound_ach_transfers.transfer_return( - "string", + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", reason="payment_stopped", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @@ -203,7 +211,7 @@ def test_method_transfer_return(self, client: Increase) -> None: @parametrize def test_raw_response_transfer_return(self, client: Increase) -> None: response = client.inbound_ach_transfers.with_raw_response.transfer_return( - "string", + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", reason="payment_stopped", ) @@ -215,7 +223,7 @@ def test_raw_response_transfer_return(self, client: Increase) -> None: @parametrize def test_streaming_response_transfer_return(self, client: Increase) -> None: with client.inbound_ach_transfers.with_streaming_response.transfer_return( - "string", + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", reason="payment_stopped", ) as response: assert not response.is_closed @@ -232,36 +240,38 @@ def test_path_params_transfer_return(self, client: Increase) -> None: ValueError, match=r"Expected a non-empty value for `inbound_ach_transfer_id` but received ''" ): client.inbound_ach_transfers.with_raw_response.transfer_return( - "", + inbound_ach_transfer_id="", reason="payment_stopped", ) class TestAsyncInboundACHTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: inbound_ach_transfer = await async_client.inbound_ach_transfers.retrieve( - "string", + "inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.inbound_ach_transfers.with_raw_response.retrieve( - "string", + "inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_ach_transfer = response.parse() + inbound_ach_transfer = await response.parse() assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.inbound_ach_transfers.with_streaming_response.retrieve( - "string", + "inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -288,17 +298,17 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: inbound_ach_transfer = await async_client.inbound_ach_transfers.list( - account_id="string", - account_number_id="string", + account_id="account_id", + account_number_id="account_number_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - status="pending", + status={"in": ["pending"]}, ) assert_matches_type(AsyncPage[InboundACHTransfer], inbound_ach_transfer, path=["response"]) @@ -308,7 +318,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_ach_transfer = response.parse() + inbound_ach_transfer = await response.parse() assert_matches_type(AsyncPage[InboundACHTransfer], inbound_ach_transfer, path=["response"]) @parametrize @@ -323,27 +333,36 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert cast(Any, response.is_closed) is True @parametrize - async def test_method_decline(self, async_client: AsyncIncrease) -> None: - inbound_ach_transfer = await async_client.inbound_ach_transfers.decline( - "string", + async def test_method_create_notification_of_change(self, async_client: AsyncIncrease) -> None: + inbound_ach_transfer = await async_client.inbound_ach_transfers.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - async def test_raw_response_decline(self, async_client: AsyncIncrease) -> None: - response = await async_client.inbound_ach_transfers.with_raw_response.decline( - "string", + async def test_method_create_notification_of_change_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_ach_transfer = await async_client.inbound_ach_transfers.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", + updated_account_number="987654321", + updated_routing_number="101050001", + ) + assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create_notification_of_change(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_ach_transfers.with_raw_response.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_ach_transfer = response.parse() + inbound_ach_transfer = await response.parse() assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - async def test_streaming_response_decline(self, async_client: AsyncIncrease) -> None: - async with async_client.inbound_ach_transfers.with_streaming_response.decline( - "string", + async def test_streaming_response_create_notification_of_change(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_ach_transfers.with_streaming_response.create_notification_of_change( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -354,45 +373,44 @@ async def test_streaming_response_decline(self, async_client: AsyncIncrease) -> assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_decline(self, async_client: AsyncIncrease) -> None: + async def test_path_params_create_notification_of_change(self, async_client: AsyncIncrease) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `inbound_ach_transfer_id` but received ''" ): - await async_client.inbound_ach_transfers.with_raw_response.decline( - "", + await async_client.inbound_ach_transfers.with_raw_response.create_notification_of_change( + inbound_ach_transfer_id="", ) @parametrize - async def test_method_notification_of_change(self, async_client: AsyncIncrease) -> None: - inbound_ach_transfer = await async_client.inbound_ach_transfers.notification_of_change( - "string", + async def test_method_decline(self, async_client: AsyncIncrease) -> None: + inbound_ach_transfer = await async_client.inbound_ach_transfers.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - async def test_method_notification_of_change_with_all_params(self, async_client: AsyncIncrease) -> None: - inbound_ach_transfer = await async_client.inbound_ach_transfers.notification_of_change( - "string", - updated_account_number="987654321", - updated_routing_number="101050001", + async def test_method_decline_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_ach_transfer = await async_client.inbound_ach_transfers.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", + reason="payment_stopped", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - async def test_raw_response_notification_of_change(self, async_client: AsyncIncrease) -> None: - response = await async_client.inbound_ach_transfers.with_raw_response.notification_of_change( - "string", + async def test_raw_response_decline(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_ach_transfers.with_raw_response.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_ach_transfer = response.parse() + inbound_ach_transfer = await response.parse() assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize - async def test_streaming_response_notification_of_change(self, async_client: AsyncIncrease) -> None: - async with async_client.inbound_ach_transfers.with_streaming_response.notification_of_change( - "string", + async def test_streaming_response_decline(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_ach_transfers.with_streaming_response.decline( + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -403,18 +421,18 @@ async def test_streaming_response_notification_of_change(self, async_client: Asy assert cast(Any, response.is_closed) is True @parametrize - async def test_path_params_notification_of_change(self, async_client: AsyncIncrease) -> None: + async def test_path_params_decline(self, async_client: AsyncIncrease) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `inbound_ach_transfer_id` but received ''" ): - await async_client.inbound_ach_transfers.with_raw_response.notification_of_change( - "", + await async_client.inbound_ach_transfers.with_raw_response.decline( + inbound_ach_transfer_id="", ) @parametrize async def test_method_transfer_return(self, async_client: AsyncIncrease) -> None: inbound_ach_transfer = await async_client.inbound_ach_transfers.transfer_return( - "string", + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", reason="payment_stopped", ) assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @@ -422,19 +440,19 @@ async def test_method_transfer_return(self, async_client: AsyncIncrease) -> None @parametrize async def test_raw_response_transfer_return(self, async_client: AsyncIncrease) -> None: response = await async_client.inbound_ach_transfers.with_raw_response.transfer_return( - "string", + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", reason="payment_stopped", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_ach_transfer = response.parse() + inbound_ach_transfer = await response.parse() assert_matches_type(InboundACHTransfer, inbound_ach_transfer, path=["response"]) @parametrize async def test_streaming_response_transfer_return(self, async_client: AsyncIncrease) -> None: async with async_client.inbound_ach_transfers.with_streaming_response.transfer_return( - "string", + inbound_ach_transfer_id="inbound_ach_transfer_tdrwqr3fq9gnnq49odev", reason="payment_stopped", ) as response: assert not response.is_closed @@ -451,6 +469,6 @@ async def test_path_params_transfer_return(self, async_client: AsyncIncrease) -> ValueError, match=r"Expected a non-empty value for `inbound_ach_transfer_id` but received ''" ): await async_client.inbound_ach_transfers.with_raw_response.transfer_return( - "", + inbound_ach_transfer_id="", reason="payment_stopped", ) diff --git a/tests/api_resources/test_inbound_check_deposits.py b/tests/api_resources/test_inbound_check_deposits.py new file mode 100644 index 000000000..0b4064f1e --- /dev/null +++ b/tests/api_resources/test_inbound_check_deposits.py @@ -0,0 +1,356 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundCheckDeposit +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundCheckDeposits: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + inbound_check_deposit = client.inbound_check_deposits.retrieve( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.inbound_check_deposits.with_raw_response.retrieve( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.inbound_check_deposits.with_streaming_response.retrieve( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + client.inbound_check_deposits.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + inbound_check_deposit = client.inbound_check_deposits.list() + assert_matches_type(SyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + inbound_check_deposit = client.inbound_check_deposits.list( + account_id="account_id", + check_transfer_id="check_transfer_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + ) + assert_matches_type(SyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.inbound_check_deposits.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(SyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.inbound_check_deposits.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = response.parse() + assert_matches_type(SyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_decline(self, client: Increase) -> None: + inbound_check_deposit = client.inbound_check_deposits.decline( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_raw_response_decline(self, client: Increase) -> None: + response = client.inbound_check_deposits.with_raw_response.decline( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_decline(self, client: Increase) -> None: + with client.inbound_check_deposits.with_streaming_response.decline( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_decline(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + client.inbound_check_deposits.with_raw_response.decline( + "", + ) + + @parametrize + def test_method_return(self, client: Increase) -> None: + inbound_check_deposit = client.inbound_check_deposits.return_( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + reason="altered_or_fictitious", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_raw_response_return(self, client: Increase) -> None: + response = client.inbound_check_deposits.with_raw_response.return_( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + reason="altered_or_fictitious", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + def test_streaming_response_return(self, client: Increase) -> None: + with client.inbound_check_deposits.with_streaming_response.return_( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + reason="altered_or_fictitious", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_return(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + client.inbound_check_deposits.with_raw_response.return_( + inbound_check_deposit_id="", + reason="altered_or_fictitious", + ) + + +class TestAsyncInboundCheckDeposits: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.inbound_check_deposits.retrieve( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_check_deposits.with_raw_response.retrieve( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_check_deposits.with_streaming_response.retrieve( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + await async_client.inbound_check_deposits.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.inbound_check_deposits.list() + assert_matches_type(AsyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.inbound_check_deposits.list( + account_id="account_id", + check_transfer_id="check_transfer_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + ) + assert_matches_type(AsyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_check_deposits.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = await response.parse() + assert_matches_type(AsyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_check_deposits.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = await response.parse() + assert_matches_type(AsyncPage[InboundCheckDeposit], inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_decline(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.inbound_check_deposits.decline( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_decline(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_check_deposits.with_raw_response.decline( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_decline(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_check_deposits.with_streaming_response.decline( + "inbound_check_deposit_zoshvqybq0cjjm31mra", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_decline(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + await async_client.inbound_check_deposits.with_raw_response.decline( + "", + ) + + @parametrize + async def test_method_return(self, async_client: AsyncIncrease) -> None: + inbound_check_deposit = await async_client.inbound_check_deposits.return_( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + reason="altered_or_fictitious", + ) + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_raw_response_return(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_check_deposits.with_raw_response.return_( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + reason="altered_or_fictitious", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + @parametrize + async def test_streaming_response_return(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_check_deposits.with_streaming_response.return_( + inbound_check_deposit_id="inbound_check_deposit_zoshvqybq0cjjm31mra", + reason="altered_or_fictitious", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_check_deposit = await response.parse() + assert_matches_type(InboundCheckDeposit, inbound_check_deposit, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_return(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_check_deposit_id` but received ''" + ): + await async_client.inbound_check_deposits.with_raw_response.return_( + inbound_check_deposit_id="", + reason="altered_or_fictitious", + ) diff --git a/tests/api_resources/test_proof_of_authorization_requests.py b/tests/api_resources/test_inbound_fednow_transfers.py similarity index 51% rename from tests/api_resources/test_proof_of_authorization_requests.py rename to tests/api_resources/test_inbound_fednow_transfers.py index e5ec2bdbb..7ea08107c 100644 --- a/tests/api_resources/test_proof_of_authorization_requests.py +++ b/tests/api_resources/test_inbound_fednow_transfers.py @@ -9,178 +9,180 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import ProofOfAuthorizationRequest +from increase.types import InboundFednowTransfer from increase._utils import parse_datetime from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestProofOfAuthorizationRequests: +class TestInboundFednowTransfers: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: Increase) -> None: - proof_of_authorization_request = client.proof_of_authorization_requests.retrieve( - "string", + inbound_fednow_transfer = client.inbound_fednow_transfers.retrieve( + "inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20", ) - assert_matches_type(ProofOfAuthorizationRequest, proof_of_authorization_request, path=["response"]) + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: - response = client.proof_of_authorization_requests.with_raw_response.retrieve( - "string", + response = client.inbound_fednow_transfers.with_raw_response.retrieve( + "inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = response.parse() - assert_matches_type(ProofOfAuthorizationRequest, proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: - with client.proof_of_authorization_requests.with_streaming_response.retrieve( - "string", + with client.inbound_fednow_transfers.with_streaming_response.retrieve( + "inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = response.parse() - assert_matches_type(ProofOfAuthorizationRequest, proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: Increase) -> None: with pytest.raises( - ValueError, match=r"Expected a non-empty value for `proof_of_authorization_request_id` but received ''" + ValueError, match=r"Expected a non-empty value for `inbound_fednow_transfer_id` but received ''" ): - client.proof_of_authorization_requests.with_raw_response.retrieve( + client.inbound_fednow_transfers.with_raw_response.retrieve( "", ) @parametrize def test_method_list(self, client: Increase) -> None: - proof_of_authorization_request = client.proof_of_authorization_requests.list() - assert_matches_type(SyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = client.inbound_fednow_transfers.list() + assert_matches_type(SyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: - proof_of_authorization_request = client.proof_of_authorization_requests.list( + inbound_fednow_transfer = client.inbound_fednow_transfers.list( + account_id="account_id", + account_number_id="account_number_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) - assert_matches_type(SyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"]) + assert_matches_type(SyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) @parametrize def test_raw_response_list(self, client: Increase) -> None: - response = client.proof_of_authorization_requests.with_raw_response.list() + response = client.inbound_fednow_transfers.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = response.parse() - assert_matches_type(SyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = response.parse() + assert_matches_type(SyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) @parametrize def test_streaming_response_list(self, client: Increase) -> None: - with client.proof_of_authorization_requests.with_streaming_response.list() as response: + with client.inbound_fednow_transfers.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = response.parse() - assert_matches_type( - SyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"] - ) + inbound_fednow_transfer = response.parse() + assert_matches_type(SyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncProofOfAuthorizationRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) +class TestAsyncInboundFednowTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request = await async_client.proof_of_authorization_requests.retrieve( - "string", + inbound_fednow_transfer = await async_client.inbound_fednow_transfers.retrieve( + "inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20", ) - assert_matches_type(ProofOfAuthorizationRequest, proof_of_authorization_request, path=["response"]) + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: - response = await async_client.proof_of_authorization_requests.with_raw_response.retrieve( - "string", + response = await async_client.inbound_fednow_transfers.with_raw_response.retrieve( + "inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = response.parse() - assert_matches_type(ProofOfAuthorizationRequest, proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = await response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: - async with async_client.proof_of_authorization_requests.with_streaming_response.retrieve( - "string", + async with async_client.inbound_fednow_transfers.with_streaming_response.retrieve( + "inbound_fednow_transfer_ctxxbc07oh5ke5w1hk20", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = await response.parse() - assert_matches_type(ProofOfAuthorizationRequest, proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = await response.parse() + assert_matches_type(InboundFednowTransfer, inbound_fednow_transfer, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: with pytest.raises( - ValueError, match=r"Expected a non-empty value for `proof_of_authorization_request_id` but received ''" + ValueError, match=r"Expected a non-empty value for `inbound_fednow_transfer_id` but received ''" ): - await async_client.proof_of_authorization_requests.with_raw_response.retrieve( + await async_client.inbound_fednow_transfers.with_raw_response.retrieve( "", ) @parametrize async def test_method_list(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request = await async_client.proof_of_authorization_requests.list() - assert_matches_type(AsyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = await async_client.inbound_fednow_transfers.list() + assert_matches_type(AsyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request = await async_client.proof_of_authorization_requests.list( + inbound_fednow_transfer = await async_client.inbound_fednow_transfers.list( + account_id="account_id", + account_number_id="account_number_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, ) - assert_matches_type(AsyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"]) + assert_matches_type(AsyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.proof_of_authorization_requests.with_raw_response.list() + response = await async_client.inbound_fednow_transfers.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = response.parse() - assert_matches_type(AsyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"]) + inbound_fednow_transfer = await response.parse() + assert_matches_type(AsyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.proof_of_authorization_requests.with_streaming_response.list() as response: + async with async_client.inbound_fednow_transfers.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request = await response.parse() - assert_matches_type( - AsyncPage[ProofOfAuthorizationRequest], proof_of_authorization_request, path=["response"] - ) + inbound_fednow_transfer = await response.parse() + assert_matches_type(AsyncPage[InboundFednowTransfer], inbound_fednow_transfer, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_inbound_mail_items.py b/tests/api_resources/test_inbound_mail_items.py new file mode 100644 index 000000000..8f4229b5e --- /dev/null +++ b/tests/api_resources/test_inbound_mail_items.py @@ -0,0 +1,266 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundMailItem +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundMailItems: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + inbound_mail_item = client.inbound_mail_items.retrieve( + "inbound_mail_item_q6rrg7mmqpplx80zceev", + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.inbound_mail_items.with_raw_response.retrieve( + "inbound_mail_item_q6rrg7mmqpplx80zceev", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.inbound_mail_items.with_streaming_response.retrieve( + "inbound_mail_item_q6rrg7mmqpplx80zceev", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_mail_item_id` but received ''"): + client.inbound_mail_items.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + inbound_mail_item = client.inbound_mail_items.list() + assert_matches_type(SyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + inbound_mail_item = client.inbound_mail_items.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + lockbox_id="lockbox_id", + ) + assert_matches_type(SyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.inbound_mail_items.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = response.parse() + assert_matches_type(SyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.inbound_mail_items.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = response.parse() + assert_matches_type(SyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_action(self, client: Increase) -> None: + inbound_mail_item = client.inbound_mail_items.action( + inbound_mail_item_id="inbound_mail_item_q6rrg7mmqpplx80zceev", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + def test_raw_response_action(self, client: Increase) -> None: + response = client.inbound_mail_items.with_raw_response.action( + inbound_mail_item_id="inbound_mail_item_q6rrg7mmqpplx80zceev", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + def test_streaming_response_action(self, client: Increase) -> None: + with client.inbound_mail_items.with_streaming_response.action( + inbound_mail_item_id="inbound_mail_item_q6rrg7mmqpplx80zceev", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_mail_item_id` but received ''"): + client.inbound_mail_items.with_raw_response.action( + inbound_mail_item_id="", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) + + +class TestAsyncInboundMailItems: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + inbound_mail_item = await async_client.inbound_mail_items.retrieve( + "inbound_mail_item_q6rrg7mmqpplx80zceev", + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_mail_items.with_raw_response.retrieve( + "inbound_mail_item_q6rrg7mmqpplx80zceev", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = await response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_mail_items.with_streaming_response.retrieve( + "inbound_mail_item_q6rrg7mmqpplx80zceev", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = await response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_mail_item_id` but received ''"): + await async_client.inbound_mail_items.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + inbound_mail_item = await async_client.inbound_mail_items.list() + assert_matches_type(AsyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_mail_item = await async_client.inbound_mail_items.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + lockbox_id="lockbox_id", + ) + assert_matches_type(AsyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_mail_items.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = await response.parse() + assert_matches_type(AsyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_mail_items.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = await response.parse() + assert_matches_type(AsyncPage[InboundMailItem], inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_action(self, async_client: AsyncIncrease) -> None: + inbound_mail_item = await async_client.inbound_mail_items.action( + inbound_mail_item_id="inbound_mail_item_q6rrg7mmqpplx80zceev", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + async def test_raw_response_action(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_mail_items.with_raw_response.action( + inbound_mail_item_id="inbound_mail_item_q6rrg7mmqpplx80zceev", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_mail_item = await response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + @parametrize + async def test_streaming_response_action(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_mail_items.with_streaming_response.action( + inbound_mail_item_id="inbound_mail_item_q6rrg7mmqpplx80zceev", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_mail_item = await response.parse() + assert_matches_type(InboundMailItem, inbound_mail_item, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `inbound_mail_item_id` but received ''"): + await async_client.inbound_mail_items.with_raw_response.action( + inbound_mail_item_id="", + checks=[{"action": "deposit"}, {"action": "ignore"}], + ) diff --git a/tests/api_resources/test_inbound_real_time_payments_transfers.py b/tests/api_resources/test_inbound_real_time_payments_transfers.py new file mode 100755 index 000000000..305dfa6fc --- /dev/null +++ b/tests/api_resources/test_inbound_real_time_payments_transfers.py @@ -0,0 +1,204 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import InboundRealTimePaymentsTransfer +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestInboundRealTimePaymentsTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + inbound_real_time_payments_transfer = client.inbound_real_time_payments_transfers.retrieve( + "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr", + ) + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.inbound_real_time_payments_transfers.with_raw_response.retrieve( + "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_real_time_payments_transfer = response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.inbound_real_time_payments_transfers.with_streaming_response.retrieve( + "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_real_time_payments_transfer = response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_real_time_payments_transfer_id` but received ''" + ): + client.inbound_real_time_payments_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + inbound_real_time_payments_transfer = client.inbound_real_time_payments_transfers.list() + assert_matches_type( + SyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + inbound_real_time_payments_transfer = client.inbound_real_time_payments_transfers.list( + account_id="account_id", + account_number_id="account_number_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + ) + assert_matches_type( + SyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.inbound_real_time_payments_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_real_time_payments_transfer = response.parse() + assert_matches_type( + SyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.inbound_real_time_payments_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_real_time_payments_transfer = response.parse() + assert_matches_type( + SyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncInboundRealTimePaymentsTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + inbound_real_time_payments_transfer = await async_client.inbound_real_time_payments_transfers.retrieve( + "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr", + ) + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_real_time_payments_transfers.with_raw_response.retrieve( + "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_real_time_payments_transfer = await response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_real_time_payments_transfers.with_streaming_response.retrieve( + "inbound_real_time_payments_transfer_63hlz498vcxg644hcrzr", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_real_time_payments_transfer = await response.parse() + assert_matches_type(InboundRealTimePaymentsTransfer, inbound_real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_real_time_payments_transfer_id` but received ''" + ): + await async_client.inbound_real_time_payments_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + inbound_real_time_payments_transfer = await async_client.inbound_real_time_payments_transfers.list() + assert_matches_type( + AsyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + inbound_real_time_payments_transfer = await async_client.inbound_real_time_payments_transfers.list( + account_id="account_id", + account_number_id="account_number_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + limit=1, + ) + assert_matches_type( + AsyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_real_time_payments_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_real_time_payments_transfer = await response.parse() + assert_matches_type( + AsyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_real_time_payments_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_real_time_payments_transfer = await response.parse() + assert_matches_type( + AsyncPage[InboundRealTimePaymentsTransfer], inbound_real_time_payments_transfer, path=["response"] + ) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_inbound_wire_drawdown_requests.py b/tests/api_resources/test_inbound_wire_drawdown_requests.py index 9e642f50a..8d0fb6d07 100644 --- a/tests/api_resources/test_inbound_wire_drawdown_requests.py +++ b/tests/api_resources/test_inbound_wire_drawdown_requests.py @@ -21,14 +21,14 @@ class TestInboundWireDrawdownRequests: @parametrize def test_method_retrieve(self, client: Increase) -> None: inbound_wire_drawdown_request = client.inbound_wire_drawdown_requests.retrieve( - "string", + "inbound_wire_drawdown_request_u5a92ikqhz1ytphn799e", ) assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.inbound_wire_drawdown_requests.with_raw_response.retrieve( - "string", + "inbound_wire_drawdown_request_u5a92ikqhz1ytphn799e", ) assert response.is_closed is True @@ -39,7 +39,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.inbound_wire_drawdown_requests.with_streaming_response.retrieve( - "string", + "inbound_wire_drawdown_request_u5a92ikqhz1ytphn799e", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -66,7 +66,7 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: inbound_wire_drawdown_request = client.inbound_wire_drawdown_requests.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[InboundWireDrawdownRequest], inbound_wire_drawdown_request, path=["response"]) @@ -93,30 +93,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncInboundWireDrawdownRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: inbound_wire_drawdown_request = await async_client.inbound_wire_drawdown_requests.retrieve( - "string", + "inbound_wire_drawdown_request_u5a92ikqhz1ytphn799e", ) assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.inbound_wire_drawdown_requests.with_raw_response.retrieve( - "string", + "inbound_wire_drawdown_request_u5a92ikqhz1ytphn799e", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_wire_drawdown_request = response.parse() + inbound_wire_drawdown_request = await response.parse() assert_matches_type(InboundWireDrawdownRequest, inbound_wire_drawdown_request, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.inbound_wire_drawdown_requests.with_streaming_response.retrieve( - "string", + "inbound_wire_drawdown_request_u5a92ikqhz1ytphn799e", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -143,7 +145,7 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: inbound_wire_drawdown_request = await async_client.inbound_wire_drawdown_requests.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[InboundWireDrawdownRequest], inbound_wire_drawdown_request, path=["response"]) @@ -154,7 +156,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_wire_drawdown_request = response.parse() + inbound_wire_drawdown_request = await response.parse() assert_matches_type(AsyncPage[InboundWireDrawdownRequest], inbound_wire_drawdown_request, path=["response"]) @parametrize diff --git a/tests/api_resources/test_inbound_wire_transfers.py b/tests/api_resources/test_inbound_wire_transfers.py index 30427a1ee..6087c698d 100644 --- a/tests/api_resources/test_inbound_wire_transfers.py +++ b/tests/api_resources/test_inbound_wire_transfers.py @@ -22,14 +22,14 @@ class TestInboundWireTransfers: @parametrize def test_method_retrieve(self, client: Increase) -> None: inbound_wire_transfer = client.inbound_wire_transfers.retrieve( - "string", + "inbound_wire_transfer_f228m6bmhtcxjco9pwp0", ) assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.inbound_wire_transfers.with_raw_response.retrieve( - "string", + "inbound_wire_transfer_f228m6bmhtcxjco9pwp0", ) assert response.is_closed is True @@ -40,7 +40,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.inbound_wire_transfers.with_streaming_response.retrieve( - "string", + "inbound_wire_transfer_f228m6bmhtcxjco9pwp0", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,17 +67,18 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: inbound_wire_transfer = client.inbound_wire_transfers.list( - account_id="string", - account_number_id="string", + account_id="account_id", + account_number_id="account_number_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - status="pending", + status={"in": ["pending"]}, + wire_drawdown_request_id="wire_drawdown_request_id", ) assert_matches_type(SyncPage[InboundWireTransfer], inbound_wire_transfer, path=["response"]) @@ -101,32 +102,78 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_reverse(self, client: Increase) -> None: + inbound_wire_transfer = client.inbound_wire_transfers.reverse( + inbound_wire_transfer_id="inbound_wire_transfer_f228m6bmhtcxjco9pwp0", + reason="creditor_request", + ) + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + def test_raw_response_reverse(self, client: Increase) -> None: + response = client.inbound_wire_transfers.with_raw_response.reverse( + inbound_wire_transfer_id="inbound_wire_transfer_f228m6bmhtcxjco9pwp0", + reason="creditor_request", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_wire_transfer = response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + def test_streaming_response_reverse(self, client: Increase) -> None: + with client.inbound_wire_transfers.with_streaming_response.reverse( + inbound_wire_transfer_id="inbound_wire_transfer_f228m6bmhtcxjco9pwp0", + reason="creditor_request", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_wire_transfer = response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_reverse(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_wire_transfer_id` but received ''" + ): + client.inbound_wire_transfers.with_raw_response.reverse( + inbound_wire_transfer_id="", + reason="creditor_request", + ) + class TestAsyncInboundWireTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: inbound_wire_transfer = await async_client.inbound_wire_transfers.retrieve( - "string", + "inbound_wire_transfer_f228m6bmhtcxjco9pwp0", ) assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.inbound_wire_transfers.with_raw_response.retrieve( - "string", + "inbound_wire_transfer_f228m6bmhtcxjco9pwp0", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_wire_transfer = response.parse() + inbound_wire_transfer = await response.parse() assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.inbound_wire_transfers.with_streaming_response.retrieve( - "string", + "inbound_wire_transfer_f228m6bmhtcxjco9pwp0", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -153,17 +200,18 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: inbound_wire_transfer = await async_client.inbound_wire_transfers.list( - account_id="string", - account_number_id="string", + account_id="account_id", + account_number_id="account_number_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - status="pending", + status={"in": ["pending"]}, + wire_drawdown_request_id="wire_drawdown_request_id", ) assert_matches_type(AsyncPage[InboundWireTransfer], inbound_wire_transfer, path=["response"]) @@ -173,7 +221,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - inbound_wire_transfer = response.parse() + inbound_wire_transfer = await response.parse() assert_matches_type(AsyncPage[InboundWireTransfer], inbound_wire_transfer, path=["response"]) @parametrize @@ -186,3 +234,47 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert_matches_type(AsyncPage[InboundWireTransfer], inbound_wire_transfer, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_reverse(self, async_client: AsyncIncrease) -> None: + inbound_wire_transfer = await async_client.inbound_wire_transfers.reverse( + inbound_wire_transfer_id="inbound_wire_transfer_f228m6bmhtcxjco9pwp0", + reason="creditor_request", + ) + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + async def test_raw_response_reverse(self, async_client: AsyncIncrease) -> None: + response = await async_client.inbound_wire_transfers.with_raw_response.reverse( + inbound_wire_transfer_id="inbound_wire_transfer_f228m6bmhtcxjco9pwp0", + reason="creditor_request", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + inbound_wire_transfer = await response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_reverse(self, async_client: AsyncIncrease) -> None: + async with async_client.inbound_wire_transfers.with_streaming_response.reverse( + inbound_wire_transfer_id="inbound_wire_transfer_f228m6bmhtcxjco9pwp0", + reason="creditor_request", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + inbound_wire_transfer = await response.parse() + assert_matches_type(InboundWireTransfer, inbound_wire_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_reverse(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `inbound_wire_transfer_id` but received ''" + ): + await async_client.inbound_wire_transfers.with_raw_response.reverse( + inbound_wire_transfer_id="", + reason="creditor_request", + ) diff --git a/tests/api_resources/intrafi/test_account_enrollments.py b/tests/api_resources/test_intrafi_account_enrollments.py similarity index 56% rename from tests/api_resources/intrafi/test_account_enrollments.py rename to tests/api_resources/test_intrafi_account_enrollments.py index 6e120c600..8ed6b9981 100644 --- a/tests/api_resources/intrafi/test_account_enrollments.py +++ b/tests/api_resources/test_intrafi_account_enrollments.py @@ -9,79 +9,79 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.pagination import SyncPage, AsyncPage -from increase.types.intrafi import ( +from increase.types import ( IntrafiAccountEnrollment, ) +from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestAccountEnrollments: +class TestIntrafiAccountEnrollments: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Increase) -> None: - account_enrollment = client.intrafi.account_enrollments.create( + intrafi_account_enrollment = client.intrafi_account_enrollments.create( account_id="account_in71c4amph0vgo2qllky", email_address="user@example.com", ) - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize def test_raw_response_create(self, client: Increase) -> None: - response = client.intrafi.account_enrollments.with_raw_response.create( + response = client.intrafi_account_enrollments.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", email_address="user@example.com", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize def test_streaming_response_create(self, client: Increase) -> None: - with client.intrafi.account_enrollments.with_streaming_response.create( + with client.intrafi_account_enrollments.with_streaming_response.create( account_id="account_in71c4amph0vgo2qllky", email_address="user@example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_retrieve(self, client: Increase) -> None: - account_enrollment = client.intrafi.account_enrollments.retrieve( - "string", + intrafi_account_enrollment = client.intrafi_account_enrollments.retrieve( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: - response = client.intrafi.account_enrollments.with_raw_response.retrieve( - "string", + response = client.intrafi_account_enrollments.with_raw_response.retrieve( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: - with client.intrafi.account_enrollments.with_streaming_response.retrieve( - "string", + with client.intrafi_account_enrollments.with_streaming_response.retrieve( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -90,74 +90,74 @@ def test_path_params_retrieve(self, client: Increase) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `intrafi_account_enrollment_id` but received ''" ): - client.intrafi.account_enrollments.with_raw_response.retrieve( + client.intrafi_account_enrollments.with_raw_response.retrieve( "", ) @parametrize def test_method_list(self, client: Increase) -> None: - account_enrollment = client.intrafi.account_enrollments.list() - assert_matches_type(SyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + intrafi_account_enrollment = client.intrafi_account_enrollments.list() + assert_matches_type(SyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: - account_enrollment = client.intrafi.account_enrollments.list( - account_id="string", - cursor="string", + intrafi_account_enrollment = client.intrafi_account_enrollments.list( + account_id="account_id", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending_enrolling", "enrolled", "pending_unenrolling"]}, + status={"in": ["pending_enrolling"]}, ) - assert_matches_type(SyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + assert_matches_type(SyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) @parametrize def test_raw_response_list(self, client: Increase) -> None: - response = client.intrafi.account_enrollments.with_raw_response.list() + response = client.intrafi_account_enrollments.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(SyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(SyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) @parametrize def test_streaming_response_list(self, client: Increase) -> None: - with client.intrafi.account_enrollments.with_streaming_response.list() as response: + with client.intrafi_account_enrollments.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(SyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(SyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_unenroll(self, client: Increase) -> None: - account_enrollment = client.intrafi.account_enrollments.unenroll( - "string", + intrafi_account_enrollment = client.intrafi_account_enrollments.unenroll( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize def test_raw_response_unenroll(self, client: Increase) -> None: - response = client.intrafi.account_enrollments.with_raw_response.unenroll( - "string", + response = client.intrafi_account_enrollments.with_raw_response.unenroll( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize def test_streaming_response_unenroll(self, client: Increase) -> None: - with client.intrafi.account_enrollments.with_streaming_response.unenroll( - "string", + with client.intrafi_account_enrollments.with_streaming_response.unenroll( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -166,76 +166,78 @@ def test_path_params_unenroll(self, client: Increase) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `intrafi_account_enrollment_id` but received ''" ): - client.intrafi.account_enrollments.with_raw_response.unenroll( + client.intrafi_account_enrollments.with_raw_response.unenroll( "", ) -class TestAsyncAccountEnrollments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) +class TestAsyncIntrafiAccountEnrollments: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: - account_enrollment = await async_client.intrafi.account_enrollments.create( + intrafi_account_enrollment = await async_client.intrafi_account_enrollments.create( account_id="account_in71c4amph0vgo2qllky", email_address="user@example.com", ) - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.account_enrollments.with_raw_response.create( + response = await async_client.intrafi_account_enrollments.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", email_address="user@example.com", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.account_enrollments.with_streaming_response.create( + async with async_client.intrafi_account_enrollments.with_streaming_response.create( account_id="account_in71c4amph0vgo2qllky", email_address="user@example.com", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = await response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: - account_enrollment = await async_client.intrafi.account_enrollments.retrieve( - "string", + intrafi_account_enrollment = await async_client.intrafi_account_enrollments.retrieve( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.account_enrollments.with_raw_response.retrieve( - "string", + response = await async_client.intrafi_account_enrollments.with_raw_response.retrieve( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.account_enrollments.with_streaming_response.retrieve( - "string", + async with async_client.intrafi_account_enrollments.with_streaming_response.retrieve( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = await response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -244,74 +246,74 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `intrafi_account_enrollment_id` but received ''" ): - await async_client.intrafi.account_enrollments.with_raw_response.retrieve( + await async_client.intrafi_account_enrollments.with_raw_response.retrieve( "", ) @parametrize async def test_method_list(self, async_client: AsyncIncrease) -> None: - account_enrollment = await async_client.intrafi.account_enrollments.list() - assert_matches_type(AsyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + intrafi_account_enrollment = await async_client.intrafi_account_enrollments.list() + assert_matches_type(AsyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - account_enrollment = await async_client.intrafi.account_enrollments.list( - account_id="string", - cursor="string", + intrafi_account_enrollment = await async_client.intrafi_account_enrollments.list( + account_id="account_id", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending_enrolling", "enrolled", "pending_unenrolling"]}, + status={"in": ["pending_enrolling"]}, ) - assert_matches_type(AsyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + assert_matches_type(AsyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.account_enrollments.with_raw_response.list() + response = await async_client.intrafi_account_enrollments.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(AsyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(AsyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.account_enrollments.with_streaming_response.list() as response: + async with async_client.intrafi_account_enrollments.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = await response.parse() - assert_matches_type(AsyncPage[IntrafiAccountEnrollment], account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(AsyncPage[IntrafiAccountEnrollment], intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_unenroll(self, async_client: AsyncIncrease) -> None: - account_enrollment = await async_client.intrafi.account_enrollments.unenroll( - "string", + intrafi_account_enrollment = await async_client.intrafi_account_enrollments.unenroll( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize async def test_raw_response_unenroll(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.account_enrollments.with_raw_response.unenroll( - "string", + response = await async_client.intrafi_account_enrollments.with_raw_response.unenroll( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) @parametrize async def test_streaming_response_unenroll(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.account_enrollments.with_streaming_response.unenroll( - "string", + async with async_client.intrafi_account_enrollments.with_streaming_response.unenroll( + "intrafi_account_enrollment_w8l97znzreopkwf2tg75", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - account_enrollment = await response.parse() - assert_matches_type(IntrafiAccountEnrollment, account_enrollment, path=["response"]) + intrafi_account_enrollment = await response.parse() + assert_matches_type(IntrafiAccountEnrollment, intrafi_account_enrollment, path=["response"]) assert cast(Any, response.is_closed) is True @@ -320,6 +322,6 @@ async def test_path_params_unenroll(self, async_client: AsyncIncrease) -> None: with pytest.raises( ValueError, match=r"Expected a non-empty value for `intrafi_account_enrollment_id` but received ''" ): - await async_client.intrafi.account_enrollments.with_raw_response.unenroll( + await async_client.intrafi_account_enrollments.with_raw_response.unenroll( "", ) diff --git a/tests/api_resources/test_intrafi_balances.py b/tests/api_resources/test_intrafi_balances.py new file mode 100644 index 000000000..8f1a9953c --- /dev/null +++ b/tests/api_resources/test_intrafi_balances.py @@ -0,0 +1,100 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import IntrafiBalance + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestIntrafiBalances: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_intrafi_balance(self, client: Increase) -> None: + intrafi_balance = client.intrafi_balances.intrafi_balance( + "account_in71c4amph0vgo2qllky", + ) + assert_matches_type(IntrafiBalance, intrafi_balance, path=["response"]) + + @parametrize + def test_raw_response_intrafi_balance(self, client: Increase) -> None: + response = client.intrafi_balances.with_raw_response.intrafi_balance( + "account_in71c4amph0vgo2qllky", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + intrafi_balance = response.parse() + assert_matches_type(IntrafiBalance, intrafi_balance, path=["response"]) + + @parametrize + def test_streaming_response_intrafi_balance(self, client: Increase) -> None: + with client.intrafi_balances.with_streaming_response.intrafi_balance( + "account_in71c4amph0vgo2qllky", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + intrafi_balance = response.parse() + assert_matches_type(IntrafiBalance, intrafi_balance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_intrafi_balance(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + client.intrafi_balances.with_raw_response.intrafi_balance( + "", + ) + + +class TestAsyncIntrafiBalances: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_intrafi_balance(self, async_client: AsyncIncrease) -> None: + intrafi_balance = await async_client.intrafi_balances.intrafi_balance( + "account_in71c4amph0vgo2qllky", + ) + assert_matches_type(IntrafiBalance, intrafi_balance, path=["response"]) + + @parametrize + async def test_raw_response_intrafi_balance(self, async_client: AsyncIncrease) -> None: + response = await async_client.intrafi_balances.with_raw_response.intrafi_balance( + "account_in71c4amph0vgo2qllky", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + intrafi_balance = await response.parse() + assert_matches_type(IntrafiBalance, intrafi_balance, path=["response"]) + + @parametrize + async def test_streaming_response_intrafi_balance(self, async_client: AsyncIncrease) -> None: + async with async_client.intrafi_balances.with_streaming_response.intrafi_balance( + "account_in71c4amph0vgo2qllky", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + intrafi_balance = await response.parse() + assert_matches_type(IntrafiBalance, intrafi_balance, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_intrafi_balance(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `account_id` but received ''"): + await async_client.intrafi_balances.with_raw_response.intrafi_balance( + "", + ) diff --git a/tests/api_resources/intrafi/test_exclusions.py b/tests/api_resources/test_intrafi_exclusions.py similarity index 53% rename from tests/api_resources/intrafi/test_exclusions.py rename to tests/api_resources/test_intrafi_exclusions.py index 53629bd42..ba9928995 100644 --- a/tests/api_resources/intrafi/test_exclusions.py +++ b/tests/api_resources/test_intrafi_exclusions.py @@ -9,305 +9,307 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type +from increase.types import IntrafiExclusion from increase.pagination import SyncPage, AsyncPage -from increase.types.intrafi import IntrafiExclusion base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestExclusions: +class TestIntrafiExclusions: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_create(self, client: Increase) -> None: - exclusion = client.intrafi.exclusions.create( - bank_name="Example Bank", + intrafi_exclusion = client.intrafi_exclusions.create( entity_id="entity_n8y8tnk2p9339ti393yi", + fdic_certificate_number="314159", ) - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize def test_raw_response_create(self, client: Increase) -> None: - response = client.intrafi.exclusions.with_raw_response.create( - bank_name="Example Bank", + response = client.intrafi_exclusions.with_raw_response.create( entity_id="entity_n8y8tnk2p9339ti393yi", + fdic_certificate_number="314159", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize def test_streaming_response_create(self, client: Increase) -> None: - with client.intrafi.exclusions.with_streaming_response.create( - bank_name="Example Bank", + with client.intrafi_exclusions.with_streaming_response.create( entity_id="entity_n8y8tnk2p9339ti393yi", + fdic_certificate_number="314159", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_retrieve(self, client: Increase) -> None: - exclusion = client.intrafi.exclusions.retrieve( - "string", + intrafi_exclusion = client.intrafi_exclusions.retrieve( + "account_in71c4amph0vgo2qllky", ) - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: - response = client.intrafi.exclusions.with_raw_response.retrieve( - "string", + response = client.intrafi_exclusions.with_raw_response.retrieve( + "account_in71c4amph0vgo2qllky", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: - with client.intrafi.exclusions.with_streaming_response.retrieve( - "string", + with client.intrafi_exclusions.with_streaming_response.retrieve( + "account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `intrafi_exclusion_id` but received ''"): - client.intrafi.exclusions.with_raw_response.retrieve( + client.intrafi_exclusions.with_raw_response.retrieve( "", ) @parametrize def test_method_list(self, client: Increase) -> None: - exclusion = client.intrafi.exclusions.list() - assert_matches_type(SyncPage[IntrafiExclusion], exclusion, path=["response"]) + intrafi_exclusion = client.intrafi_exclusions.list() + assert_matches_type(SyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: - exclusion = client.intrafi.exclusions.list( - cursor="string", - entity_id="string", + intrafi_exclusion = client.intrafi_exclusions.list( + cursor="cursor", + entity_id="entity_id", idempotency_key="x", limit=1, ) - assert_matches_type(SyncPage[IntrafiExclusion], exclusion, path=["response"]) + assert_matches_type(SyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) @parametrize def test_raw_response_list(self, client: Increase) -> None: - response = client.intrafi.exclusions.with_raw_response.list() + response = client.intrafi_exclusions.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(SyncPage[IntrafiExclusion], exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(SyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) @parametrize def test_streaming_response_list(self, client: Increase) -> None: - with client.intrafi.exclusions.with_streaming_response.list() as response: + with client.intrafi_exclusions.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(SyncPage[IntrafiExclusion], exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(SyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_method_archive(self, client: Increase) -> None: - exclusion = client.intrafi.exclusions.archive( - "string", + intrafi_exclusion = client.intrafi_exclusions.archive( + "intrafi_exclusion_ygfqduuzpau3jqof6jyh", ) - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize def test_raw_response_archive(self, client: Increase) -> None: - response = client.intrafi.exclusions.with_raw_response.archive( - "string", + response = client.intrafi_exclusions.with_raw_response.archive( + "intrafi_exclusion_ygfqduuzpau3jqof6jyh", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize def test_streaming_response_archive(self, client: Increase) -> None: - with client.intrafi.exclusions.with_streaming_response.archive( - "string", + with client.intrafi_exclusions.with_streaming_response.archive( + "intrafi_exclusion_ygfqduuzpau3jqof6jyh", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_archive(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `intrafi_exclusion_id` but received ''"): - client.intrafi.exclusions.with_raw_response.archive( + client.intrafi_exclusions.with_raw_response.archive( "", ) -class TestAsyncExclusions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) +class TestAsyncIntrafiExclusions: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: - exclusion = await async_client.intrafi.exclusions.create( - bank_name="Example Bank", + intrafi_exclusion = await async_client.intrafi_exclusions.create( entity_id="entity_n8y8tnk2p9339ti393yi", + fdic_certificate_number="314159", ) - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.exclusions.with_raw_response.create( - bank_name="Example Bank", + response = await async_client.intrafi_exclusions.with_raw_response.create( entity_id="entity_n8y8tnk2p9339ti393yi", + fdic_certificate_number="314159", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.exclusions.with_streaming_response.create( - bank_name="Example Bank", + async with async_client.intrafi_exclusions.with_streaming_response.create( entity_id="entity_n8y8tnk2p9339ti393yi", + fdic_certificate_number="314159", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = await response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: - exclusion = await async_client.intrafi.exclusions.retrieve( - "string", + intrafi_exclusion = await async_client.intrafi_exclusions.retrieve( + "account_in71c4amph0vgo2qllky", ) - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.exclusions.with_raw_response.retrieve( - "string", + response = await async_client.intrafi_exclusions.with_raw_response.retrieve( + "account_in71c4amph0vgo2qllky", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.exclusions.with_streaming_response.retrieve( - "string", + async with async_client.intrafi_exclusions.with_streaming_response.retrieve( + "account_in71c4amph0vgo2qllky", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = await response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `intrafi_exclusion_id` but received ''"): - await async_client.intrafi.exclusions.with_raw_response.retrieve( + await async_client.intrafi_exclusions.with_raw_response.retrieve( "", ) @parametrize async def test_method_list(self, async_client: AsyncIncrease) -> None: - exclusion = await async_client.intrafi.exclusions.list() - assert_matches_type(AsyncPage[IntrafiExclusion], exclusion, path=["response"]) + intrafi_exclusion = await async_client.intrafi_exclusions.list() + assert_matches_type(AsyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - exclusion = await async_client.intrafi.exclusions.list( - cursor="string", - entity_id="string", + intrafi_exclusion = await async_client.intrafi_exclusions.list( + cursor="cursor", + entity_id="entity_id", idempotency_key="x", limit=1, ) - assert_matches_type(AsyncPage[IntrafiExclusion], exclusion, path=["response"]) + assert_matches_type(AsyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.exclusions.with_raw_response.list() + response = await async_client.intrafi_exclusions.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(AsyncPage[IntrafiExclusion], exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(AsyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.exclusions.with_streaming_response.list() as response: + async with async_client.intrafi_exclusions.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = await response.parse() - assert_matches_type(AsyncPage[IntrafiExclusion], exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(AsyncPage[IntrafiExclusion], intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_method_archive(self, async_client: AsyncIncrease) -> None: - exclusion = await async_client.intrafi.exclusions.archive( - "string", + intrafi_exclusion = await async_client.intrafi_exclusions.archive( + "intrafi_exclusion_ygfqduuzpau3jqof6jyh", ) - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize async def test_raw_response_archive(self, async_client: AsyncIncrease) -> None: - response = await async_client.intrafi.exclusions.with_raw_response.archive( - "string", + response = await async_client.intrafi_exclusions.with_raw_response.archive( + "intrafi_exclusion_ygfqduuzpau3jqof6jyh", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) @parametrize async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> None: - async with async_client.intrafi.exclusions.with_streaming_response.archive( - "string", + async with async_client.intrafi_exclusions.with_streaming_response.archive( + "intrafi_exclusion_ygfqduuzpau3jqof6jyh", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - exclusion = await response.parse() - assert_matches_type(IntrafiExclusion, exclusion, path=["response"]) + intrafi_exclusion = await response.parse() + assert_matches_type(IntrafiExclusion, intrafi_exclusion, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_archive(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `intrafi_exclusion_id` but received ''"): - await async_client.intrafi.exclusions.with_raw_response.archive( + await async_client.intrafi_exclusions.with_raw_response.archive( "", ) diff --git a/tests/api_resources/test_lockboxes.py b/tests/api_resources/test_lockboxes.py new file mode 100644 index 000000000..b8e2b12b9 --- /dev/null +++ b/tests/api_resources/test_lockboxes.py @@ -0,0 +1,360 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import Lockbox +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestLockboxes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + lockbox = client.lockboxes.create( + account_id="account_in71c4amph0vgo2qllky", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + lockbox = client.lockboxes.create( + account_id="account_in71c4amph0vgo2qllky", + description="Rent payments", + recipient_name="x", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.lockboxes.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.lockboxes.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + lockbox = client.lockboxes.retrieve( + "lockbox_3xt21ok13q19advds4t5", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.lockboxes.with_raw_response.retrieve( + "lockbox_3xt21ok13q19advds4t5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.lockboxes.with_streaming_response.retrieve( + "lockbox_3xt21ok13q19advds4t5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `lockbox_id` but received ''"): + client.lockboxes.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_update(self, client: Increase) -> None: + lockbox = client.lockboxes.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_method_update_with_all_params(self, client: Increase) -> None: + lockbox = client.lockboxes.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + check_deposit_behavior="disabled", + description="x", + recipient_name="x", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_raw_response_update(self, client: Increase) -> None: + response = client.lockboxes.with_raw_response.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + def test_streaming_response_update(self, client: Increase) -> None: + with client.lockboxes.with_streaming_response.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_update(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `lockbox_id` but received ''"): + client.lockboxes.with_raw_response.update( + lockbox_id="", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + lockbox = client.lockboxes.list() + assert_matches_type(SyncPage[Lockbox], lockbox, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + lockbox = client.lockboxes.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + ) + assert_matches_type(SyncPage[Lockbox], lockbox, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.lockboxes.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = response.parse() + assert_matches_type(SyncPage[Lockbox], lockbox, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.lockboxes.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = response.parse() + assert_matches_type(SyncPage[Lockbox], lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncLockboxes: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + lockbox = await async_client.lockboxes.create( + account_id="account_in71c4amph0vgo2qllky", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + lockbox = await async_client.lockboxes.create( + account_id="account_in71c4amph0vgo2qllky", + description="Rent payments", + recipient_name="x", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.lockboxes.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = await response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.lockboxes.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = await response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + lockbox = await async_client.lockboxes.retrieve( + "lockbox_3xt21ok13q19advds4t5", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.lockboxes.with_raw_response.retrieve( + "lockbox_3xt21ok13q19advds4t5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = await response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.lockboxes.with_streaming_response.retrieve( + "lockbox_3xt21ok13q19advds4t5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = await response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `lockbox_id` but received ''"): + await async_client.lockboxes.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_update(self, async_client: AsyncIncrease) -> None: + lockbox = await async_client.lockboxes.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_method_update_with_all_params(self, async_client: AsyncIncrease) -> None: + lockbox = await async_client.lockboxes.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + check_deposit_behavior="disabled", + description="x", + recipient_name="x", + ) + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: + response = await async_client.lockboxes.with_raw_response.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = await response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + @parametrize + async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: + async with async_client.lockboxes.with_streaming_response.update( + lockbox_id="lockbox_3xt21ok13q19advds4t5", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = await response.parse() + assert_matches_type(Lockbox, lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_update(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `lockbox_id` but received ''"): + await async_client.lockboxes.with_raw_response.update( + lockbox_id="", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + lockbox = await async_client.lockboxes.list() + assert_matches_type(AsyncPage[Lockbox], lockbox, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + lockbox = await async_client.lockboxes.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + ) + assert_matches_type(AsyncPage[Lockbox], lockbox, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.lockboxes.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + lockbox = await response.parse() + assert_matches_type(AsyncPage[Lockbox], lockbox, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.lockboxes.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + lockbox = await response.parse() + assert_matches_type(AsyncPage[Lockbox], lockbox, path=["response"]) + + assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_documents.py b/tests/api_resources/test_oauth_applications.py similarity index 53% rename from tests/api_resources/test_documents.py rename to tests/api_resources/test_oauth_applications.py index f7f67b6d0..17280bde0 100644 --- a/tests/api_resources/test_documents.py +++ b/tests/api_resources/test_oauth_applications.py @@ -9,174 +9,174 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import Document +from increase.types import OAuthApplication from increase._utils import parse_datetime from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") -class TestDocuments: +class TestOAuthApplications: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) @parametrize def test_method_retrieve(self, client: Increase) -> None: - document = client.documents.retrieve( - "string", + oauth_application = client.oauth_applications.retrieve( + "application_gj9ufmpgh5i56k4vyriy", ) - assert_matches_type(Document, document, path=["response"]) + assert_matches_type(OAuthApplication, oauth_application, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: - response = client.documents.with_raw_response.retrieve( - "string", + response = client.oauth_applications.with_raw_response.retrieve( + "application_gj9ufmpgh5i56k4vyriy", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(Document, document, path=["response"]) + oauth_application = response.parse() + assert_matches_type(OAuthApplication, oauth_application, path=["response"]) @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: - with client.documents.with_streaming_response.retrieve( - "string", + with client.oauth_applications.with_streaming_response.retrieve( + "application_gj9ufmpgh5i56k4vyriy", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(Document, document, path=["response"]) + oauth_application = response.parse() + assert_matches_type(OAuthApplication, oauth_application, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize def test_path_params_retrieve(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `document_id` but received ''"): - client.documents.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `oauth_application_id` but received ''"): + client.oauth_applications.with_raw_response.retrieve( "", ) @parametrize def test_method_list(self, client: Increase) -> None: - document = client.documents.list() - assert_matches_type(SyncPage[Document], document, path=["response"]) + oauth_application = client.oauth_applications.list() + assert_matches_type(SyncPage[OAuthApplication], oauth_application, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: - document = client.documents.list( - category={"in": ["form_1099_int", "proof_of_authorization", "company_information"]}, + oauth_application = client.oauth_applications.list( created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - entity_id="string", + cursor="cursor", limit=1, + status={"in": ["active"]}, ) - assert_matches_type(SyncPage[Document], document, path=["response"]) + assert_matches_type(SyncPage[OAuthApplication], oauth_application, path=["response"]) @parametrize def test_raw_response_list(self, client: Increase) -> None: - response = client.documents.with_raw_response.list() + response = client.oauth_applications.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(SyncPage[Document], document, path=["response"]) + oauth_application = response.parse() + assert_matches_type(SyncPage[OAuthApplication], oauth_application, path=["response"]) @parametrize def test_streaming_response_list(self, client: Increase) -> None: - with client.documents.with_streaming_response.list() as response: + with client.oauth_applications.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(SyncPage[Document], document, path=["response"]) + oauth_application = response.parse() + assert_matches_type(SyncPage[OAuthApplication], oauth_application, path=["response"]) assert cast(Any, response.is_closed) is True -class TestAsyncDocuments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) +class TestAsyncOAuthApplications: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: - document = await async_client.documents.retrieve( - "string", + oauth_application = await async_client.oauth_applications.retrieve( + "application_gj9ufmpgh5i56k4vyriy", ) - assert_matches_type(Document, document, path=["response"]) + assert_matches_type(OAuthApplication, oauth_application, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: - response = await async_client.documents.with_raw_response.retrieve( - "string", + response = await async_client.oauth_applications.with_raw_response.retrieve( + "application_gj9ufmpgh5i56k4vyriy", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(Document, document, path=["response"]) + oauth_application = await response.parse() + assert_matches_type(OAuthApplication, oauth_application, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: - async with async_client.documents.with_streaming_response.retrieve( - "string", + async with async_client.oauth_applications.with_streaming_response.retrieve( + "application_gj9ufmpgh5i56k4vyriy", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = await response.parse() - assert_matches_type(Document, document, path=["response"]) + oauth_application = await response.parse() + assert_matches_type(OAuthApplication, oauth_application, path=["response"]) assert cast(Any, response.is_closed) is True @parametrize async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `document_id` but received ''"): - await async_client.documents.with_raw_response.retrieve( + with pytest.raises(ValueError, match=r"Expected a non-empty value for `oauth_application_id` but received ''"): + await async_client.oauth_applications.with_raw_response.retrieve( "", ) @parametrize async def test_method_list(self, async_client: AsyncIncrease) -> None: - document = await async_client.documents.list() - assert_matches_type(AsyncPage[Document], document, path=["response"]) + oauth_application = await async_client.oauth_applications.list() + assert_matches_type(AsyncPage[OAuthApplication], oauth_application, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - document = await async_client.documents.list( - category={"in": ["form_1099_int", "proof_of_authorization", "company_information"]}, + oauth_application = await async_client.oauth_applications.list( created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - entity_id="string", + cursor="cursor", limit=1, + status={"in": ["active"]}, ) - assert_matches_type(AsyncPage[Document], document, path=["response"]) + assert_matches_type(AsyncPage[OAuthApplication], oauth_application, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.documents.with_raw_response.list() + response = await async_client.oauth_applications.with_raw_response.list() assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = response.parse() - assert_matches_type(AsyncPage[Document], document, path=["response"]) + oauth_application = await response.parse() + assert_matches_type(AsyncPage[OAuthApplication], oauth_application, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.documents.with_streaming_response.list() as response: + async with async_client.oauth_applications.with_streaming_response.list() as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" - document = await response.parse() - assert_matches_type(AsyncPage[Document], document, path=["response"]) + oauth_application = await response.parse() + assert_matches_type(AsyncPage[OAuthApplication], oauth_application, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_oauth_connections.py b/tests/api_resources/test_oauth_connections.py index 13687a75c..52eb24ab4 100644 --- a/tests/api_resources/test_oauth_connections.py +++ b/tests/api_resources/test_oauth_connections.py @@ -21,14 +21,14 @@ class TestOAuthConnections: @parametrize def test_method_retrieve(self, client: Increase) -> None: oauth_connection = client.oauth_connections.retrieve( - "string", + "connection_dauknoksyr4wilz4e6my", ) assert_matches_type(OAuthConnection, oauth_connection, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.oauth_connections.with_raw_response.retrieve( - "string", + "connection_dauknoksyr4wilz4e6my", ) assert response.is_closed is True @@ -39,7 +39,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.oauth_connections.with_streaming_response.retrieve( - "string", + "connection_dauknoksyr4wilz4e6my", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -64,8 +64,10 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: oauth_connection = client.oauth_connections.list( - cursor="string", + cursor="cursor", limit=1, + oauth_application_id="oauth_application_id", + status={"in": ["active"]}, ) assert_matches_type(SyncPage[OAuthConnection], oauth_connection, path=["response"]) @@ -91,30 +93,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncOAuthConnections: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: oauth_connection = await async_client.oauth_connections.retrieve( - "string", + "connection_dauknoksyr4wilz4e6my", ) assert_matches_type(OAuthConnection, oauth_connection, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.oauth_connections.with_raw_response.retrieve( - "string", + "connection_dauknoksyr4wilz4e6my", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - oauth_connection = response.parse() + oauth_connection = await response.parse() assert_matches_type(OAuthConnection, oauth_connection, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.oauth_connections.with_streaming_response.retrieve( - "string", + "connection_dauknoksyr4wilz4e6my", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -139,8 +143,10 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: oauth_connection = await async_client.oauth_connections.list( - cursor="string", + cursor="cursor", limit=1, + oauth_application_id="oauth_application_id", + status={"in": ["active"]}, ) assert_matches_type(AsyncPage[OAuthConnection], oauth_connection, path=["response"]) @@ -150,7 +156,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - oauth_connection = response.parse() + oauth_connection = await response.parse() assert_matches_type(AsyncPage[OAuthConnection], oauth_connection, path=["response"]) @parametrize diff --git a/tests/api_resources/test_oauth_tokens.py b/tests/api_resources/test_oauth_tokens.py index fac339dc0..6bef09ef4 100644 --- a/tests/api_resources/test_oauth_tokens.py +++ b/tests/api_resources/test_oauth_tokens.py @@ -61,7 +61,9 @@ def test_streaming_response_create(self, client: Increase) -> None: class TestAsyncOAuthTokens: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -89,7 +91,7 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - oauth_token = response.parse() + oauth_token = await response.parse() assert_matches_type(OAuthToken, oauth_token, path=["response"]) @parametrize diff --git a/tests/api_resources/test_pending_transactions.py b/tests/api_resources/test_pending_transactions.py index 39f895c98..af444a4d6 100644 --- a/tests/api_resources/test_pending_transactions.py +++ b/tests/api_resources/test_pending_transactions.py @@ -19,17 +19,60 @@ class TestPendingTransactions: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + @parametrize + def test_method_create(self, client: Increase) -> None: + pending_transaction = client.pending_transactions.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + pending_transaction = client.pending_transactions.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + description="Hold for pending transaction", + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.pending_transactions.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pending_transaction = response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.pending_transactions.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pending_transaction = response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True + @parametrize def test_method_retrieve(self, client: Increase) -> None: pending_transaction = client.pending_transactions.retrieve( - "string", + "pending_transaction_k1sfetcau2qbvjbzgju4", ) assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.pending_transactions.with_raw_response.retrieve( - "string", + "pending_transaction_k1sfetcau2qbvjbzgju4", ) assert response.is_closed is True @@ -40,7 +83,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.pending_transactions.with_streaming_response.retrieve( - "string", + "pending_transaction_k1sfetcau2qbvjbzgju4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -67,19 +110,18 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: pending_transaction = client.pending_transactions.list( - account_id="string", - category={"in": ["account_transfer_instruction", "ach_transfer_instruction", "card_authorization"]}, + account_id="account_id", + category={"in": ["account_transfer_instruction"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - route_id="string", - source_id="string", - status={"in": ["pending", "complete"]}, + route_id="route_id", + status={"in": ["pending"]}, ) assert_matches_type(SyncPage[PendingTransaction], pending_transaction, path=["response"]) @@ -103,32 +145,117 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_release(self, client: Increase) -> None: + pending_transaction = client.pending_transactions.release( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + def test_raw_response_release(self, client: Increase) -> None: + response = client.pending_transactions.with_raw_response.release( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pending_transaction = response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + def test_streaming_response_release(self, client: Increase) -> None: + with client.pending_transactions.with_streaming_response.release( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pending_transaction = response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_release(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `pending_transaction_id` but received ''" + ): + client.pending_transactions.with_raw_response.release( + "", + ) + class TestAsyncPendingTransactions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + pending_transaction = await async_client.pending_transactions.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + pending_transaction = await async_client.pending_transactions.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + description="Hold for pending transaction", + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.pending_transactions.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pending_transaction = await response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.pending_transactions.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + amount=-1000, + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pending_transaction = await response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: pending_transaction = await async_client.pending_transactions.retrieve( - "string", + "pending_transaction_k1sfetcau2qbvjbzgju4", ) assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.pending_transactions.with_raw_response.retrieve( - "string", + "pending_transaction_k1sfetcau2qbvjbzgju4", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pending_transaction = response.parse() + pending_transaction = await response.parse() assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.pending_transactions.with_streaming_response.retrieve( - "string", + "pending_transaction_k1sfetcau2qbvjbzgju4", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -155,19 +282,18 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: pending_transaction = await async_client.pending_transactions.list( - account_id="string", - category={"in": ["account_transfer_instruction", "ach_transfer_instruction", "card_authorization"]}, + account_id="account_id", + category={"in": ["account_transfer_instruction"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - route_id="string", - source_id="string", - status={"in": ["pending", "complete"]}, + route_id="route_id", + status={"in": ["pending"]}, ) assert_matches_type(AsyncPage[PendingTransaction], pending_transaction, path=["response"]) @@ -177,7 +303,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - pending_transaction = response.parse() + pending_transaction = await response.parse() assert_matches_type(AsyncPage[PendingTransaction], pending_transaction, path=["response"]) @parametrize @@ -190,3 +316,43 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert_matches_type(AsyncPage[PendingTransaction], pending_transaction, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_release(self, async_client: AsyncIncrease) -> None: + pending_transaction = await async_client.pending_transactions.release( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + async def test_raw_response_release(self, async_client: AsyncIncrease) -> None: + response = await async_client.pending_transactions.with_raw_response.release( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + pending_transaction = await response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + @parametrize + async def test_streaming_response_release(self, async_client: AsyncIncrease) -> None: + async with async_client.pending_transactions.with_streaming_response.release( + "pending_transaction_k1sfetcau2qbvjbzgju4", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + pending_transaction = await response.parse() + assert_matches_type(PendingTransaction, pending_transaction, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_release(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `pending_transaction_id` but received ''" + ): + await async_client.pending_transactions.with_raw_response.release( + "", + ) diff --git a/tests/api_resources/test_physical_card_profiles.py b/tests/api_resources/test_physical_card_profiles.py index 81461ff7a..012a20306 100644 --- a/tests/api_resources/test_physical_card_profiles.py +++ b/tests/api_resources/test_physical_card_profiles.py @@ -27,6 +27,22 @@ def test_method_create(self, client: Increase) -> None: contact_phone="+16505046304", description="My Card Profile", front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", + ) + assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + physical_card_profile = client.physical_card_profiles.create( + carrier_image_file_id="file_h6v7mtipe119os47ehlu", + contact_phone="+16505046304", + description="My Card Profile", + front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", + front_text={ + "line1": "x", + "line2": "x", + }, ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @@ -37,6 +53,7 @@ def test_raw_response_create(self, client: Increase) -> None: contact_phone="+16505046304", description="My Card Profile", front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", ) assert response.is_closed is True @@ -51,6 +68,7 @@ def test_streaming_response_create(self, client: Increase) -> None: contact_phone="+16505046304", description="My Card Profile", front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -63,14 +81,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: physical_card_profile = client.physical_card_profiles.retrieve( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.physical_card_profiles.with_raw_response.retrieve( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert response.is_closed is True @@ -81,7 +99,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.physical_card_profiles.with_streaming_response.retrieve( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -108,10 +126,10 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: physical_card_profile = client.physical_card_profiles.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending_creating", "pending_reviewing", "rejected"]}, + status={"in": ["pending_creating"]}, ) assert_matches_type(SyncPage[PhysicalCardProfile], physical_card_profile, path=["response"]) @@ -138,14 +156,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_archive(self, client: Increase) -> None: physical_card_profile = client.physical_card_profiles.archive( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize def test_raw_response_archive(self, client: Increase) -> None: response = client.physical_card_profiles.with_raw_response.archive( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert response.is_closed is True @@ -156,7 +174,7 @@ def test_raw_response_archive(self, client: Increase) -> None: @parametrize def test_streaming_response_archive(self, client: Increase) -> None: with client.physical_card_profiles.with_streaming_response.archive( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -178,15 +196,15 @@ def test_path_params_archive(self, client: Increase) -> None: @parametrize def test_method_clone(self, client: Increase) -> None: physical_card_profile = client.physical_card_profiles.clone( - "string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize def test_method_clone_with_all_params(self, client: Increase) -> None: physical_card_profile = client.physical_card_profiles.clone( - "string", - carrier_image_file_id="string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", + carrier_image_file_id="carrier_image_file_id", contact_phone="x", description="x", front_image_file_id="file_o6aex13wm1jcc36sgcj1", @@ -194,13 +212,14 @@ def test_method_clone_with_all_params(self, client: Increase) -> None: "line1": "x", "line2": "x", }, + program_id="program_id", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize def test_raw_response_clone(self, client: Increase) -> None: response = client.physical_card_profiles.with_raw_response.clone( - "string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert response.is_closed is True @@ -211,7 +230,7 @@ def test_raw_response_clone(self, client: Increase) -> None: @parametrize def test_streaming_response_clone(self, client: Increase) -> None: with client.physical_card_profiles.with_streaming_response.clone( - "string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -227,12 +246,14 @@ def test_path_params_clone(self, client: Increase) -> None: ValueError, match=r"Expected a non-empty value for `physical_card_profile_id` but received ''" ): client.physical_card_profiles.with_raw_response.clone( - "", + physical_card_profile_id="", ) class TestAsyncPhysicalCardProfiles: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -241,6 +262,22 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: contact_phone="+16505046304", description="My Card Profile", front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", + ) + assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + physical_card_profile = await async_client.physical_card_profiles.create( + carrier_image_file_id="file_h6v7mtipe119os47ehlu", + contact_phone="+16505046304", + description="My Card Profile", + front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", + front_text={ + "line1": "x", + "line2": "x", + }, ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @@ -251,11 +288,12 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: contact_phone="+16505046304", description="My Card Profile", front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card_profile = response.parse() + physical_card_profile = await response.parse() assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize @@ -265,6 +303,7 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N contact_phone="+16505046304", description="My Card Profile", front_image_file_id="file_o6aex13wm1jcc36sgcj1", + program_id="program_i2v2os4mwza1oetokh9i", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -277,25 +316,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: physical_card_profile = await async_client.physical_card_profiles.retrieve( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.physical_card_profiles.with_raw_response.retrieve( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card_profile = response.parse() + physical_card_profile = await response.parse() assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.physical_card_profiles.with_streaming_response.retrieve( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -322,10 +361,10 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: physical_card_profile = await async_client.physical_card_profiles.list( - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, - status={"in": ["pending_creating", "pending_reviewing", "rejected"]}, + status={"in": ["pending_creating"]}, ) assert_matches_type(AsyncPage[PhysicalCardProfile], physical_card_profile, path=["response"]) @@ -335,7 +374,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card_profile = response.parse() + physical_card_profile = await response.parse() assert_matches_type(AsyncPage[PhysicalCardProfile], physical_card_profile, path=["response"]) @parametrize @@ -352,25 +391,25 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_archive(self, async_client: AsyncIncrease) -> None: physical_card_profile = await async_client.physical_card_profiles.archive( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize async def test_raw_response_archive(self, async_client: AsyncIncrease) -> None: response = await async_client.physical_card_profiles.with_raw_response.archive( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card_profile = response.parse() + physical_card_profile = await response.parse() assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize async def test_streaming_response_archive(self, async_client: AsyncIncrease) -> None: async with async_client.physical_card_profiles.with_streaming_response.archive( - "string", + "physical_card_profile_m534d5rn9qyy9ufqxoec", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -392,15 +431,15 @@ async def test_path_params_archive(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_clone(self, async_client: AsyncIncrease) -> None: physical_card_profile = await async_client.physical_card_profiles.clone( - "string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize async def test_method_clone_with_all_params(self, async_client: AsyncIncrease) -> None: physical_card_profile = await async_client.physical_card_profiles.clone( - "string", - carrier_image_file_id="string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", + carrier_image_file_id="carrier_image_file_id", contact_phone="x", description="x", front_image_file_id="file_o6aex13wm1jcc36sgcj1", @@ -408,24 +447,25 @@ async def test_method_clone_with_all_params(self, async_client: AsyncIncrease) - "line1": "x", "line2": "x", }, + program_id="program_id", ) assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize async def test_raw_response_clone(self, async_client: AsyncIncrease) -> None: response = await async_client.physical_card_profiles.with_raw_response.clone( - "string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card_profile = response.parse() + physical_card_profile = await response.parse() assert_matches_type(PhysicalCardProfile, physical_card_profile, path=["response"]) @parametrize async def test_streaming_response_clone(self, async_client: AsyncIncrease) -> None: async with async_client.physical_card_profiles.with_streaming_response.clone( - "string", + physical_card_profile_id="physical_card_profile_m534d5rn9qyy9ufqxoec", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -441,5 +481,5 @@ async def test_path_params_clone(self, async_client: AsyncIncrease) -> None: ValueError, match=r"Expected a non-empty value for `physical_card_profile_id` but received ''" ): await async_client.physical_card_profiles.with_raw_response.clone( - "", + physical_card_profile_id="", ) diff --git a/tests/api_resources/test_physical_cards.py b/tests/api_resources/test_physical_cards.py index 6dc37a131..42fda8cd1 100644 --- a/tests/api_resources/test_physical_cards.py +++ b/tests/api_resources/test_physical_cards.py @@ -30,14 +30,14 @@ def test_method_create(self, client: Increase) -> None: "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", + "name": "Ian Crease", "postal_code": "10045", + "state": "NY", }, + "method": "usps", }, ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @@ -51,19 +51,21 @@ def test_method_create_with_all_params(self, client: Increase) -> None: "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", + "city": "New York", "line1": "33 Liberty Street", + "name": "Ian Crease", + "postal_code": "10045", + "state": "NY", + "country": "x", "line2": "Unit 2", "line3": "x", "phone_number": "x", - "city": "New York", - "state": "NY", - "postal_code": "10045", }, + "method": "usps", + "schedule": "next_day", }, - physical_card_profile_id="string", + physical_card_profile_id="physical_card_profile_id", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @@ -76,14 +78,14 @@ def test_raw_response_create(self, client: Increase) -> None: "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", + "name": "Ian Crease", "postal_code": "10045", + "state": "NY", }, + "method": "usps", }, ) @@ -101,14 +103,14 @@ def test_streaming_response_create(self, client: Increase) -> None: "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", + "name": "Ian Crease", "postal_code": "10045", + "state": "NY", }, + "method": "usps", }, ) as response: assert not response.is_closed @@ -122,14 +124,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: physical_card = client.physical_cards.retrieve( - "string", + "physical_card_ode8duyq5v2ynhjoharl", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.physical_cards.with_raw_response.retrieve( - "string", + "physical_card_ode8duyq5v2ynhjoharl", ) assert response.is_closed is True @@ -140,7 +142,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.physical_cards.with_streaming_response.retrieve( - "string", + "physical_card_ode8duyq5v2ynhjoharl", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -160,7 +162,7 @@ def test_path_params_retrieve(self, client: Increase) -> None: @parametrize def test_method_update(self, client: Increase) -> None: physical_card = client.physical_cards.update( - "string", + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", status="disabled", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @@ -168,7 +170,7 @@ def test_method_update(self, client: Increase) -> None: @parametrize def test_raw_response_update(self, client: Increase) -> None: response = client.physical_cards.with_raw_response.update( - "string", + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", status="disabled", ) @@ -180,7 +182,7 @@ def test_raw_response_update(self, client: Increase) -> None: @parametrize def test_streaming_response_update(self, client: Increase) -> None: with client.physical_cards.with_streaming_response.update( - "string", + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", status="disabled", ) as response: assert not response.is_closed @@ -195,7 +197,7 @@ def test_streaming_response_update(self, client: Increase) -> None: def test_path_params_update(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `physical_card_id` but received ''"): client.physical_cards.with_raw_response.update( - "", + physical_card_id="", status="disabled", ) @@ -207,14 +209,14 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: physical_card = client.physical_cards.list( - card_id="string", + card_id="card_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -242,7 +244,9 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncPhysicalCards: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: @@ -253,14 +257,14 @@ async def test_method_create(self, async_client: AsyncIncrease) -> None: "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", + "name": "Ian Crease", "postal_code": "10045", + "state": "NY", }, + "method": "usps", }, ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @@ -274,19 +278,21 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", + "city": "New York", "line1": "33 Liberty Street", + "name": "Ian Crease", + "postal_code": "10045", + "state": "NY", + "country": "x", "line2": "Unit 2", "line3": "x", "phone_number": "x", - "city": "New York", - "state": "NY", - "postal_code": "10045", }, + "method": "usps", + "schedule": "next_day", }, - physical_card_profile_id="string", + physical_card_profile_id="physical_card_profile_id", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @@ -299,20 +305,20 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", + "name": "Ian Crease", "postal_code": "10045", + "state": "NY", }, + "method": "usps", }, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card = response.parse() + physical_card = await response.parse() assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize @@ -324,14 +330,14 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N "last_name": "Crease", }, shipment={ - "method": "usps", "address": { - "name": "Ian Crease", - "line1": "33 Liberty Street", "city": "New York", - "state": "NY", + "line1": "33 Liberty Street", + "name": "Ian Crease", "postal_code": "10045", + "state": "NY", }, + "method": "usps", }, ) as response: assert not response.is_closed @@ -345,25 +351,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: physical_card = await async_client.physical_cards.retrieve( - "string", + "physical_card_ode8duyq5v2ynhjoharl", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.physical_cards.with_raw_response.retrieve( - "string", + "physical_card_ode8duyq5v2ynhjoharl", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card = response.parse() + physical_card = await response.parse() assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.physical_cards.with_streaming_response.retrieve( - "string", + "physical_card_ode8duyq5v2ynhjoharl", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -383,7 +389,7 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_update(self, async_client: AsyncIncrease) -> None: physical_card = await async_client.physical_cards.update( - "string", + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", status="disabled", ) assert_matches_type(PhysicalCard, physical_card, path=["response"]) @@ -391,19 +397,19 @@ async def test_method_update(self, async_client: AsyncIncrease) -> None: @parametrize async def test_raw_response_update(self, async_client: AsyncIncrease) -> None: response = await async_client.physical_cards.with_raw_response.update( - "string", + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", status="disabled", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card = response.parse() + physical_card = await response.parse() assert_matches_type(PhysicalCard, physical_card, path=["response"]) @parametrize async def test_streaming_response_update(self, async_client: AsyncIncrease) -> None: async with async_client.physical_cards.with_streaming_response.update( - "string", + physical_card_id="physical_card_ode8duyq5v2ynhjoharl", status="disabled", ) as response: assert not response.is_closed @@ -418,7 +424,7 @@ async def test_streaming_response_update(self, async_client: AsyncIncrease) -> N async def test_path_params_update(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `physical_card_id` but received ''"): await async_client.physical_cards.with_raw_response.update( - "", + physical_card_id="", status="disabled", ) @@ -430,14 +436,14 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: physical_card = await async_client.physical_cards.list( - card_id="string", + card_id="card_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", idempotency_key="x", limit=1, ) @@ -449,7 +455,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - physical_card = response.parse() + physical_card = await response.parse() assert_matches_type(AsyncPage[PhysicalCard], physical_card, path=["response"]) @parametrize diff --git a/tests/api_resources/test_programs.py b/tests/api_resources/test_programs.py index cff094a4a..1a4df07ac 100644 --- a/tests/api_resources/test_programs.py +++ b/tests/api_resources/test_programs.py @@ -21,14 +21,14 @@ class TestPrograms: @parametrize def test_method_retrieve(self, client: Increase) -> None: program = client.programs.retrieve( - "string", + "program_i2v2os4mwza1oetokh9i", ) assert_matches_type(Program, program, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.programs.with_raw_response.retrieve( - "string", + "program_i2v2os4mwza1oetokh9i", ) assert response.is_closed is True @@ -39,7 +39,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.programs.with_streaming_response.retrieve( - "string", + "program_i2v2os4mwza1oetokh9i", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -64,7 +64,7 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: program = client.programs.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(SyncPage[Program], program, path=["response"]) @@ -91,30 +91,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncPrograms: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: program = await async_client.programs.retrieve( - "string", + "program_i2v2os4mwza1oetokh9i", ) assert_matches_type(Program, program, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.programs.with_raw_response.retrieve( - "string", + "program_i2v2os4mwza1oetokh9i", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - program = response.parse() + program = await response.parse() assert_matches_type(Program, program, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.programs.with_streaming_response.retrieve( - "string", + "program_i2v2os4mwza1oetokh9i", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -139,7 +141,7 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: program = await async_client.programs.list( - cursor="string", + cursor="cursor", limit=1, ) assert_matches_type(AsyncPage[Program], program, path=["response"]) @@ -150,7 +152,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - program = response.parse() + program = await response.parse() assert_matches_type(AsyncPage[Program], program, path=["response"]) @parametrize diff --git a/tests/api_resources/test_proof_of_authorization_request_submissions.py b/tests/api_resources/test_proof_of_authorization_request_submissions.py deleted file mode 100644 index ca49929c7..000000000 --- a/tests/api_resources/test_proof_of_authorization_request_submissions.py +++ /dev/null @@ -1,388 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types import ( - ProofOfAuthorizationRequestSubmission, -) -from increase._utils import parse_datetime -from increase.pagination import SyncPage, AsyncPage - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestProofOfAuthorizationRequestSubmissions: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Increase) -> None: - proof_of_authorization_request_submission = client.proof_of_authorization_request_submissions.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - ) - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - def test_method_create_with_all_params(self, client: Increase) -> None: - proof_of_authorization_request_submission = client.proof_of_authorization_request_submissions.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - authorizer_company="National Phonograph Company", - authorizer_ip_address="x", - ) - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - def test_raw_response_create(self, client: Increase) -> None: - response = client.proof_of_authorization_request_submissions.with_raw_response.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - def test_streaming_response_create(self, client: Increase) -> None: - with client.proof_of_authorization_request_submissions.with_streaming_response.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Increase) -> None: - proof_of_authorization_request_submission = client.proof_of_authorization_request_submissions.retrieve( - "string", - ) - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - def test_raw_response_retrieve(self, client: Increase) -> None: - response = client.proof_of_authorization_request_submissions.with_raw_response.retrieve( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - def test_streaming_response_retrieve(self, client: Increase) -> None: - with client.proof_of_authorization_request_submissions.with_streaming_response.retrieve( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Increase) -> None: - with pytest.raises( - ValueError, - match=r"Expected a non-empty value for `proof_of_authorization_request_submission_id` but received ''", - ): - client.proof_of_authorization_request_submissions.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Increase) -> None: - proof_of_authorization_request_submission = client.proof_of_authorization_request_submissions.list() - assert_matches_type( - SyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - @parametrize - def test_method_list_with_all_params(self, client: Increase) -> None: - proof_of_authorization_request_submission = client.proof_of_authorization_request_submissions.list( - cursor="string", - idempotency_key="x", - limit=1, - proof_of_authorization_request_id="string", - ) - assert_matches_type( - SyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - @parametrize - def test_raw_response_list(self, client: Increase) -> None: - response = client.proof_of_authorization_request_submissions.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - SyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - @parametrize - def test_streaming_response_list(self, client: Increase) -> None: - with client.proof_of_authorization_request_submissions.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - SyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncProofOfAuthorizationRequestSubmissions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request_submission = ( - await async_client.proof_of_authorization_request_submissions.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - ) - ) - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request_submission = ( - await async_client.proof_of_authorization_request_submissions.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - authorizer_company="National Phonograph Company", - authorizer_ip_address="x", - ) - ) - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.proof_of_authorization_request_submissions.with_raw_response.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.proof_of_authorization_request_submissions.with_streaming_response.create( - authorization_terms="I agree to the terms of service.", - authorized_at=parse_datetime("2020-01-31T23:59:59Z"), - authorizer_email="user@example.com", - authorizer_name="Ian Crease", - customer_has_been_offboarded=True, - proof_of_authorization_request_id="proof_of_authorization_request_iwp8no25h3rjvil6ad3b", - validated_account_ownership_via_credential=True, - validated_account_ownership_with_account_statement=True, - validated_account_ownership_with_microdeposit=True, - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proof_of_authorization_request_submission = await response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request_submission = ( - await async_client.proof_of_authorization_request_submissions.retrieve( - "string", - ) - ) - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: - response = await async_client.proof_of_authorization_request_submissions.with_raw_response.retrieve( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: - async with async_client.proof_of_authorization_request_submissions.with_streaming_response.retrieve( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proof_of_authorization_request_submission = await response.parse() - assert_matches_type( - ProofOfAuthorizationRequestSubmission, proof_of_authorization_request_submission, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: - with pytest.raises( - ValueError, - match=r"Expected a non-empty value for `proof_of_authorization_request_submission_id` but received ''", - ): - await async_client.proof_of_authorization_request_submissions.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request_submission = await async_client.proof_of_authorization_request_submissions.list() - assert_matches_type( - AsyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - proof_of_authorization_request_submission = await async_client.proof_of_authorization_request_submissions.list( - cursor="string", - idempotency_key="x", - limit=1, - proof_of_authorization_request_id="string", - ) - assert_matches_type( - AsyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.proof_of_authorization_request_submissions.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - proof_of_authorization_request_submission = response.parse() - assert_matches_type( - AsyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.proof_of_authorization_request_submissions.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - proof_of_authorization_request_submission = await response.parse() - assert_matches_type( - AsyncPage[ProofOfAuthorizationRequestSubmission], - proof_of_authorization_request_submission, - path=["response"], - ) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_real_time_decisions.py b/tests/api_resources/test_real_time_decisions.py index fc58c2572..c25362743 100644 --- a/tests/api_resources/test_real_time_decisions.py +++ b/tests/api_resources/test_real_time_decisions.py @@ -20,14 +20,14 @@ class TestRealTimeDecisions: @parametrize def test_method_retrieve(self, client: Increase) -> None: real_time_decision = client.real_time_decisions.retrieve( - "string", + "real_time_decision_j76n2e810ezcg3zh5qtn", ) assert_matches_type(RealTimeDecision, real_time_decision, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.real_time_decisions.with_raw_response.retrieve( - "string", + "real_time_decision_j76n2e810ezcg3zh5qtn", ) assert response.is_closed is True @@ -38,7 +38,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.real_time_decisions.with_streaming_response.retrieve( - "string", + "real_time_decision_j76n2e810ezcg3zh5qtn", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -58,20 +58,48 @@ def test_path_params_retrieve(self, client: Increase) -> None: @parametrize def test_method_action(self, client: Increase) -> None: real_time_decision = client.real_time_decisions.action( - "string", + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", ) assert_matches_type(RealTimeDecision, real_time_decision, path=["response"]) @parametrize def test_method_action_with_all_params(self, client: Increase) -> None: real_time_decision = client.real_time_decisions.action( - "string", - card_authorization={"decision": "approve"}, - digital_wallet_authentication={"result": "success"}, + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", + card_authentication={"decision": "approve"}, + card_authentication_challenge={ + "result": "success", + "success": { + "email": "dev@stainless.com", + "phone": "x", + }, + }, + card_authorization={ + "decision": "approve", + "approval": { + "cardholder_address_verification_result": { + "line1": "match", + "postal_code": "no_match", + }, + "partial_amount": 1, + }, + "decline": {"reason": "insufficient_funds"}, + }, + card_balance_inquiry={ + "decision": "approve", + "approval": {"balance": 0}, + }, + digital_wallet_authentication={ + "result": "success", + "success": { + "email": "dev@stainless.com", + "phone": "x", + }, + }, digital_wallet_token={ "approval": { + "email": "dev@stainless.com", "phone": "x", - "email": "x", }, "decline": {"reason": "x"}, }, @@ -81,7 +109,7 @@ def test_method_action_with_all_params(self, client: Increase) -> None: @parametrize def test_raw_response_action(self, client: Increase) -> None: response = client.real_time_decisions.with_raw_response.action( - "string", + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", ) assert response.is_closed is True @@ -92,7 +120,7 @@ def test_raw_response_action(self, client: Increase) -> None: @parametrize def test_streaming_response_action(self, client: Increase) -> None: with client.real_time_decisions.with_streaming_response.action( - "string", + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -106,35 +134,37 @@ def test_streaming_response_action(self, client: Increase) -> None: def test_path_params_action(self, client: Increase) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `real_time_decision_id` but received ''"): client.real_time_decisions.with_raw_response.action( - "", + real_time_decision_id="", ) class TestAsyncRealTimeDecisions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: real_time_decision = await async_client.real_time_decisions.retrieve( - "string", + "real_time_decision_j76n2e810ezcg3zh5qtn", ) assert_matches_type(RealTimeDecision, real_time_decision, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.real_time_decisions.with_raw_response.retrieve( - "string", + "real_time_decision_j76n2e810ezcg3zh5qtn", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_decision = response.parse() + real_time_decision = await response.parse() assert_matches_type(RealTimeDecision, real_time_decision, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.real_time_decisions.with_streaming_response.retrieve( - "string", + "real_time_decision_j76n2e810ezcg3zh5qtn", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -154,20 +184,48 @@ async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_action(self, async_client: AsyncIncrease) -> None: real_time_decision = await async_client.real_time_decisions.action( - "string", + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", ) assert_matches_type(RealTimeDecision, real_time_decision, path=["response"]) @parametrize async def test_method_action_with_all_params(self, async_client: AsyncIncrease) -> None: real_time_decision = await async_client.real_time_decisions.action( - "string", - card_authorization={"decision": "approve"}, - digital_wallet_authentication={"result": "success"}, + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", + card_authentication={"decision": "approve"}, + card_authentication_challenge={ + "result": "success", + "success": { + "email": "dev@stainless.com", + "phone": "x", + }, + }, + card_authorization={ + "decision": "approve", + "approval": { + "cardholder_address_verification_result": { + "line1": "match", + "postal_code": "no_match", + }, + "partial_amount": 1, + }, + "decline": {"reason": "insufficient_funds"}, + }, + card_balance_inquiry={ + "decision": "approve", + "approval": {"balance": 0}, + }, + digital_wallet_authentication={ + "result": "success", + "success": { + "email": "dev@stainless.com", + "phone": "x", + }, + }, digital_wallet_token={ "approval": { + "email": "dev@stainless.com", "phone": "x", - "email": "x", }, "decline": {"reason": "x"}, }, @@ -177,18 +235,18 @@ async def test_method_action_with_all_params(self, async_client: AsyncIncrease) @parametrize async def test_raw_response_action(self, async_client: AsyncIncrease) -> None: response = await async_client.real_time_decisions.with_raw_response.action( - "string", + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_decision = response.parse() + real_time_decision = await response.parse() assert_matches_type(RealTimeDecision, real_time_decision, path=["response"]) @parametrize async def test_streaming_response_action(self, async_client: AsyncIncrease) -> None: async with async_client.real_time_decisions.with_streaming_response.action( - "string", + real_time_decision_id="real_time_decision_j76n2e810ezcg3zh5qtn", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -202,5 +260,5 @@ async def test_streaming_response_action(self, async_client: AsyncIncrease) -> N async def test_path_params_action(self, async_client: AsyncIncrease) -> None: with pytest.raises(ValueError, match=r"Expected a non-empty value for `real_time_decision_id` but received ''"): await async_client.real_time_decisions.with_raw_response.action( - "", + real_time_decision_id="", ) diff --git a/tests/api_resources/test_real_time_payments_request_for_payments.py b/tests/api_resources/test_real_time_payments_request_for_payments.py deleted file mode 100644 index 300f42449..000000000 --- a/tests/api_resources/test_real_time_payments_request_for_payments.py +++ /dev/null @@ -1,344 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types import ( - RealTimePaymentsRequestForPayment, -) -from increase._utils import parse_date, parse_datetime -from increase.pagination import SyncPage, AsyncPage - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestRealTimePaymentsRequestForPayments: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_create(self, client: Increase) -> None: - real_time_payments_request_for_payment = client.real_time_payments_request_for_payments.create( - amount=100, - debtor={ - "name": "Ian Crease", - "address": {"country": "US"}, - }, - destination_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - expires_at=parse_date("2025-12-31"), - remittance_information="Invoice 29582", - source_account_number="987654321", - source_routing_number="101050001", - ) - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - def test_raw_response_create(self, client: Increase) -> None: - response = client.real_time_payments_request_for_payments.with_raw_response.create( - amount=100, - debtor={ - "name": "Ian Crease", - "address": {"country": "US"}, - }, - destination_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - expires_at=parse_date("2025-12-31"), - remittance_information="Invoice 29582", - source_account_number="987654321", - source_routing_number="101050001", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - def test_streaming_response_create(self, client: Increase) -> None: - with client.real_time_payments_request_for_payments.with_streaming_response.create( - amount=100, - debtor={ - "name": "Ian Crease", - "address": {"country": "US"}, - }, - destination_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - expires_at=parse_date("2025-12-31"), - remittance_information="Invoice 29582", - source_account_number="987654321", - source_routing_number="101050001", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_retrieve(self, client: Increase) -> None: - real_time_payments_request_for_payment = client.real_time_payments_request_for_payments.retrieve( - "string", - ) - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - def test_raw_response_retrieve(self, client: Increase) -> None: - response = client.real_time_payments_request_for_payments.with_raw_response.retrieve( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - def test_streaming_response_retrieve(self, client: Increase) -> None: - with client.real_time_payments_request_for_payments.with_streaming_response.retrieve( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_retrieve(self, client: Increase) -> None: - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `request_for_payment_id` but received ''" - ): - client.real_time_payments_request_for_payments.with_raw_response.retrieve( - "", - ) - - @parametrize - def test_method_list(self, client: Increase) -> None: - real_time_payments_request_for_payment = client.real_time_payments_request_for_payments.list() - assert_matches_type( - SyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - def test_method_list_with_all_params(self, client: Increase) -> None: - real_time_payments_request_for_payment = client.real_time_payments_request_for_payments.list( - account_id="string", - created_at={ - "after": parse_datetime("2019-12-27T18:11:19.117Z"), - "before": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), - }, - cursor="string", - idempotency_key="x", - limit=1, - ) - assert_matches_type( - SyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - def test_raw_response_list(self, client: Increase) -> None: - response = client.real_time_payments_request_for_payments.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - SyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - def test_streaming_response_list(self, client: Increase) -> None: - with client.real_time_payments_request_for_payments.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - SyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncRealTimePaymentsRequestForPayments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_create(self, async_client: AsyncIncrease) -> None: - real_time_payments_request_for_payment = await async_client.real_time_payments_request_for_payments.create( - amount=100, - debtor={ - "name": "Ian Crease", - "address": {"country": "US"}, - }, - destination_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - expires_at=parse_date("2025-12-31"), - remittance_information="Invoice 29582", - source_account_number="987654321", - source_routing_number="101050001", - ) - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.real_time_payments_request_for_payments.with_raw_response.create( - amount=100, - debtor={ - "name": "Ian Crease", - "address": {"country": "US"}, - }, - destination_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - expires_at=parse_date("2025-12-31"), - remittance_information="Invoice 29582", - source_account_number="987654321", - source_routing_number="101050001", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.real_time_payments_request_for_payments.with_streaming_response.create( - amount=100, - debtor={ - "name": "Ian Crease", - "address": {"country": "US"}, - }, - destination_account_number_id="account_number_v18nkfqm6afpsrvy82b2", - expires_at=parse_date("2025-12-31"), - remittance_information="Invoice 29582", - source_account_number="987654321", - source_routing_number="101050001", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_request_for_payment = await response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: - real_time_payments_request_for_payment = await async_client.real_time_payments_request_for_payments.retrieve( - "string", - ) - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: - response = await async_client.real_time_payments_request_for_payments.with_raw_response.retrieve( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: - async with async_client.real_time_payments_request_for_payments.with_streaming_response.retrieve( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_request_for_payment = await response.parse() - assert_matches_type( - RealTimePaymentsRequestForPayment, real_time_payments_request_for_payment, path=["response"] - ) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: - with pytest.raises( - ValueError, match=r"Expected a non-empty value for `request_for_payment_id` but received ''" - ): - await async_client.real_time_payments_request_for_payments.with_raw_response.retrieve( - "", - ) - - @parametrize - async def test_method_list(self, async_client: AsyncIncrease) -> None: - real_time_payments_request_for_payment = await async_client.real_time_payments_request_for_payments.list() - assert_matches_type( - AsyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - real_time_payments_request_for_payment = await async_client.real_time_payments_request_for_payments.list( - account_id="string", - created_at={ - "after": parse_datetime("2019-12-27T18:11:19.117Z"), - "before": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), - "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), - }, - cursor="string", - idempotency_key="x", - limit=1, - ) - assert_matches_type( - AsyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.real_time_payments_request_for_payments.with_raw_response.list() - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_request_for_payment = response.parse() - assert_matches_type( - AsyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - @parametrize - async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.real_time_payments_request_for_payments.with_streaming_response.list() as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - real_time_payments_request_for_payment = await response.parse() - assert_matches_type( - AsyncPage[RealTimePaymentsRequestForPayment], real_time_payments_request_for_payment, path=["response"] - ) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_real_time_payments_transfers.py b/tests/api_resources/test_real_time_payments_transfers.py index e48d2c0a2..3996d9bcf 100644 --- a/tests/api_resources/test_real_time_payments_transfers.py +++ b/tests/api_resources/test_real_time_payments_transfers.py @@ -26,8 +26,8 @@ def test_method_create(self, client: Increase) -> None: real_time_payments_transfer = client.real_time_payments_transfers.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @@ -36,13 +36,13 @@ def test_method_create_with_all_params(self, client: Increase) -> None: real_time_payments_transfer = client.real_time_payments_transfers.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + account_number="987654321", debtor_name="x", - destination_account_number="987654321", - destination_routing_number="101050001", - external_account_id="string", + external_account_id="external_account_id", require_approval=True, + routing_number="101050001", ultimate_creditor_name="x", ultimate_debtor_name="x", ) @@ -53,8 +53,8 @@ def test_raw_response_create(self, client: Increase) -> None: response = client.real_time_payments_transfers.with_raw_response.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", ) assert response.is_closed is True @@ -67,8 +67,8 @@ def test_streaming_response_create(self, client: Increase) -> None: with client.real_time_payments_transfers.with_streaming_response.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -81,14 +81,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: real_time_payments_transfer = client.real_time_payments_transfers.retrieve( - "string", + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.real_time_payments_transfers.with_raw_response.retrieve( - "string", + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert response.is_closed is True @@ -99,7 +99,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.real_time_payments_transfers.with_streaming_response.retrieve( - "string", + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -126,17 +126,18 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: real_time_payments_transfer = client.real_time_payments_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - external_account_id="string", + cursor="cursor", + external_account_id="external_account_id", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(SyncPage[RealTimePaymentsTransfer], real_time_payments_transfer, path=["response"]) @@ -160,17 +161,99 @@ def test_streaming_response_list(self, client: Increase) -> None: assert cast(Any, response.is_closed) is True + @parametrize + def test_method_approve(self, client: Increase) -> None: + real_time_payments_transfer = client.real_time_payments_transfers.approve( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + def test_raw_response_approve(self, client: Increase) -> None: + response = client.real_time_payments_transfers.with_raw_response.approve( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + real_time_payments_transfer = response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + def test_streaming_response_approve(self, client: Increase) -> None: + with client.real_time_payments_transfers.with_streaming_response.approve( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + real_time_payments_transfer = response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_approve(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `real_time_payments_transfer_id` but received ''" + ): + client.real_time_payments_transfers.with_raw_response.approve( + "", + ) + + @parametrize + def test_method_cancel(self, client: Increase) -> None: + real_time_payments_transfer = client.real_time_payments_transfers.cancel( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: Increase) -> None: + response = client.real_time_payments_transfers.with_raw_response.cancel( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + real_time_payments_transfer = response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: Increase) -> None: + with client.real_time_payments_transfers.with_streaming_response.cancel( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + real_time_payments_transfer = response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: Increase) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `real_time_payments_transfer_id` but received ''" + ): + client.real_time_payments_transfers.with_raw_response.cancel( + "", + ) + class TestAsyncRealTimePaymentsTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: real_time_payments_transfer = await async_client.real_time_payments_transfers.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @@ -179,13 +262,13 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) real_time_payments_transfer = await async_client.real_time_payments_transfers.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", + account_number="987654321", debtor_name="x", - destination_account_number="987654321", - destination_routing_number="101050001", - external_account_id="string", + external_account_id="external_account_id", require_approval=True, + routing_number="101050001", ultimate_creditor_name="x", ultimate_debtor_name="x", ) @@ -196,13 +279,13 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.real_time_payments_transfers.with_raw_response.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_transfer = response.parse() + real_time_payments_transfer = await response.parse() assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @parametrize @@ -210,8 +293,8 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N async with async_client.real_time_payments_transfers.with_streaming_response.create( amount=100, creditor_name="Ian Crease", - remittance_information="Invoice 29582", source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="Invoice 29582", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -224,25 +307,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: real_time_payments_transfer = await async_client.real_time_payments_transfers.retrieve( - "string", + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.real_time_payments_transfers.with_raw_response.retrieve( - "string", + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_transfer = response.parse() + real_time_payments_transfer = await response.parse() assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.real_time_payments_transfers.with_streaming_response.retrieve( - "string", + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -269,17 +352,18 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: real_time_payments_transfer = await async_client.real_time_payments_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - external_account_id="string", + cursor="cursor", + external_account_id="external_account_id", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(AsyncPage[RealTimePaymentsTransfer], real_time_payments_transfer, path=["response"]) @@ -289,7 +373,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - real_time_payments_transfer = response.parse() + real_time_payments_transfer = await response.parse() assert_matches_type(AsyncPage[RealTimePaymentsTransfer], real_time_payments_transfer, path=["response"]) @parametrize @@ -302,3 +386,83 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert_matches_type(AsyncPage[RealTimePaymentsTransfer], real_time_payments_transfer, path=["response"]) assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_approve(self, async_client: AsyncIncrease) -> None: + real_time_payments_transfer = await async_client.real_time_payments_transfers.approve( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: + response = await async_client.real_time_payments_transfers.with_raw_response.approve( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + real_time_payments_transfer = await response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: + async with async_client.real_time_payments_transfers.with_streaming_response.approve( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + real_time_payments_transfer = await response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `real_time_payments_transfer_id` but received ''" + ): + await async_client.real_time_payments_transfers.with_raw_response.approve( + "", + ) + + @parametrize + async def test_method_cancel(self, async_client: AsyncIncrease) -> None: + real_time_payments_transfer = await async_client.real_time_payments_transfers.cancel( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: + response = await async_client.real_time_payments_transfers.with_raw_response.cancel( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + real_time_payments_transfer = await response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: + async with async_client.real_time_payments_transfers.with_streaming_response.cancel( + "real_time_payments_transfer_iyuhl5kdn7ssmup83mvq", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + real_time_payments_transfer = await response.parse() + assert_matches_type(RealTimePaymentsTransfer, real_time_payments_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncIncrease) -> None: + with pytest.raises( + ValueError, match=r"Expected a non-empty value for `real_time_payments_transfer_id` but received ''" + ): + await async_client.real_time_payments_transfers.with_raw_response.cancel( + "", + ) diff --git a/tests/api_resources/test_routing_numbers.py b/tests/api_resources/test_routing_numbers.py index 2b73295fa..62e2949a1 100644 --- a/tests/api_resources/test_routing_numbers.py +++ b/tests/api_resources/test_routing_numbers.py @@ -9,7 +9,7 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import RoutingNumber +from increase.types import RoutingNumberListResponse from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,16 +23,16 @@ def test_method_list(self, client: Increase) -> None: routing_number = client.routing_numbers.list( routing_number="xxxxxxxxx", ) - assert_matches_type(SyncPage[RoutingNumber], routing_number, path=["response"]) + assert_matches_type(SyncPage[RoutingNumberListResponse], routing_number, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: routing_number = client.routing_numbers.list( routing_number="xxxxxxxxx", - cursor="string", + cursor="cursor", limit=1, ) - assert_matches_type(SyncPage[RoutingNumber], routing_number, path=["response"]) + assert_matches_type(SyncPage[RoutingNumberListResponse], routing_number, path=["response"]) @parametrize def test_raw_response_list(self, client: Increase) -> None: @@ -43,7 +43,7 @@ def test_raw_response_list(self, client: Increase) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" routing_number = response.parse() - assert_matches_type(SyncPage[RoutingNumber], routing_number, path=["response"]) + assert_matches_type(SyncPage[RoutingNumberListResponse], routing_number, path=["response"]) @parametrize def test_streaming_response_list(self, client: Increase) -> None: @@ -54,29 +54,31 @@ def test_streaming_response_list(self, client: Increase) -> None: assert response.http_request.headers.get("X-Stainless-Lang") == "python" routing_number = response.parse() - assert_matches_type(SyncPage[RoutingNumber], routing_number, path=["response"]) + assert_matches_type(SyncPage[RoutingNumberListResponse], routing_number, path=["response"]) assert cast(Any, response.is_closed) is True class TestAsyncRoutingNumbers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_list(self, async_client: AsyncIncrease) -> None: routing_number = await async_client.routing_numbers.list( routing_number="xxxxxxxxx", ) - assert_matches_type(AsyncPage[RoutingNumber], routing_number, path=["response"]) + assert_matches_type(AsyncPage[RoutingNumberListResponse], routing_number, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: routing_number = await async_client.routing_numbers.list( routing_number="xxxxxxxxx", - cursor="string", + cursor="cursor", limit=1, ) - assert_matches_type(AsyncPage[RoutingNumber], routing_number, path=["response"]) + assert_matches_type(AsyncPage[RoutingNumberListResponse], routing_number, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: @@ -86,8 +88,8 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - routing_number = response.parse() - assert_matches_type(AsyncPage[RoutingNumber], routing_number, path=["response"]) + routing_number = await response.parse() + assert_matches_type(AsyncPage[RoutingNumberListResponse], routing_number, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: @@ -98,6 +100,6 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non assert response.http_request.headers.get("X-Stainless-Lang") == "python" routing_number = await response.parse() - assert_matches_type(AsyncPage[RoutingNumber], routing_number, path=["response"]) + assert_matches_type(AsyncPage[RoutingNumberListResponse], routing_number, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_simulations.py b/tests/api_resources/test_simulations.py deleted file mode 100644 index c519f0130..000000000 --- a/tests/api_resources/test_simulations.py +++ /dev/null @@ -1,318 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os -from typing import Any, cast - -import pytest - -from increase import Increase, AsyncIncrease -from tests.utils import assert_matches_type -from increase.types import ( - CardPayment, -) - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestSimulations: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - def test_method_card_authorization_expirations(self, client: Increase) -> None: - simulation = client.simulations.card_authorization_expirations( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_raw_response_card_authorization_expirations(self, client: Increase) -> None: - response = client.simulations.with_raw_response.card_authorization_expirations( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_streaming_response_card_authorization_expirations(self, client: Increase) -> None: - with client.simulations.with_streaming_response.card_authorization_expirations( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_card_fuel_confirmations(self, client: Increase) -> None: - simulation = client.simulations.card_fuel_confirmations( - amount=5000, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_raw_response_card_fuel_confirmations(self, client: Increase) -> None: - response = client.simulations.with_raw_response.card_fuel_confirmations( - amount=5000, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_streaming_response_card_fuel_confirmations(self, client: Increase) -> None: - with client.simulations.with_streaming_response.card_fuel_confirmations( - amount=5000, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_card_increments(self, client: Increase) -> None: - simulation = client.simulations.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_method_card_increments_with_all_params(self, client: Increase) -> None: - simulation = client.simulations.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - event_subscription_id="string", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_raw_response_card_increments(self, client: Increase) -> None: - response = client.simulations.with_raw_response.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_streaming_response_card_increments(self, client: Increase) -> None: - with client.simulations.with_streaming_response.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_method_card_reversals(self, client: Increase) -> None: - simulation = client.simulations.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_method_card_reversals_with_all_params(self, client: Increase) -> None: - simulation = client.simulations.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - amount=1, - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_raw_response_card_reversals(self, client: Increase) -> None: - response = client.simulations.with_raw_response.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - def test_streaming_response_card_reversals(self, client: Increase) -> None: - with client.simulations.with_streaming_response.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - -class TestAsyncSimulations: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - @parametrize - async def test_method_card_authorization_expirations(self, async_client: AsyncIncrease) -> None: - simulation = await async_client.simulations.card_authorization_expirations( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_raw_response_card_authorization_expirations(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.with_raw_response.card_authorization_expirations( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_streaming_response_card_authorization_expirations(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.with_streaming_response.card_authorization_expirations( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = await response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_card_fuel_confirmations(self, async_client: AsyncIncrease) -> None: - simulation = await async_client.simulations.card_fuel_confirmations( - amount=5000, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_raw_response_card_fuel_confirmations(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.with_raw_response.card_fuel_confirmations( - amount=5000, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_streaming_response_card_fuel_confirmations(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.with_streaming_response.card_fuel_confirmations( - amount=5000, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = await response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_card_increments(self, async_client: AsyncIncrease) -> None: - simulation = await async_client.simulations.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_method_card_increments_with_all_params(self, async_client: AsyncIncrease) -> None: - simulation = await async_client.simulations.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - event_subscription_id="string", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_raw_response_card_increments(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.with_raw_response.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_streaming_response_card_increments(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.with_streaming_response.card_increments( - amount=500, - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = await response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_method_card_reversals(self, async_client: AsyncIncrease) -> None: - simulation = await async_client.simulations.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_method_card_reversals_with_all_params(self, async_client: AsyncIncrease) -> None: - simulation = await async_client.simulations.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - amount=1, - ) - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_raw_response_card_reversals(self, async_client: AsyncIncrease) -> None: - response = await async_client.simulations.with_raw_response.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - simulation = response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - @parametrize - async def test_streaming_response_card_reversals(self, async_client: AsyncIncrease) -> None: - async with async_client.simulations.with_streaming_response.card_reversals( - card_payment_id="card_payment_nd3k2kacrqjli8482ave", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - simulation = await response.parse() - assert_matches_type(CardPayment, simulation, path=["response"]) - - assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/entities/test_supplemental_documents.py b/tests/api_resources/test_supplemental_documents.py similarity index 50% rename from tests/api_resources/entities/test_supplemental_documents.py rename to tests/api_resources/test_supplemental_documents.py index 7779b3ea3..5e15c2880 100644 --- a/tests/api_resources/entities/test_supplemental_documents.py +++ b/tests/api_resources/test_supplemental_documents.py @@ -9,11 +9,10 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import Entity -from increase.pagination import SyncPage, AsyncPage -from increase.types.entities import ( - SupplementalDocument, +from increase.types import ( + EntitySupplementalDocument, ) +from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -23,170 +22,156 @@ class TestSupplementalDocuments: @parametrize def test_method_create(self, client: Increase) -> None: - supplemental_document = client.entities.supplemental_documents.create( - "string", + supplemental_document = client.supplemental_documents.create( + entity_id="entity_n8y8tnk2p9339ti393yi", file_id="file_makxrc67oh9l6sg7w9yc", ) - assert_matches_type(Entity, supplemental_document, path=["response"]) + assert_matches_type(EntitySupplementalDocument, supplemental_document, path=["response"]) @parametrize def test_raw_response_create(self, client: Increase) -> None: - response = client.entities.supplemental_documents.with_raw_response.create( - "string", + response = client.supplemental_documents.with_raw_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", file_id="file_makxrc67oh9l6sg7w9yc", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" supplemental_document = response.parse() - assert_matches_type(Entity, supplemental_document, path=["response"]) + assert_matches_type(EntitySupplementalDocument, supplemental_document, path=["response"]) @parametrize def test_streaming_response_create(self, client: Increase) -> None: - with client.entities.supplemental_documents.with_streaming_response.create( - "string", + with client.supplemental_documents.with_streaming_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", file_id="file_makxrc67oh9l6sg7w9yc", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" supplemental_document = response.parse() - assert_matches_type(Entity, supplemental_document, path=["response"]) + assert_matches_type(EntitySupplementalDocument, supplemental_document, path=["response"]) assert cast(Any, response.is_closed) is True - @parametrize - def test_path_params_create(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - client.entities.supplemental_documents.with_raw_response.create( - "", - file_id="file_makxrc67oh9l6sg7w9yc", - ) - @parametrize def test_method_list(self, client: Increase) -> None: - supplemental_document = client.entities.supplemental_documents.list( - entity_id="string", + supplemental_document = client.supplemental_documents.list( + entity_id="entity_id", ) - assert_matches_type(SyncPage[SupplementalDocument], supplemental_document, path=["response"]) + assert_matches_type(SyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: - supplemental_document = client.entities.supplemental_documents.list( - entity_id="string", - cursor="string", + supplemental_document = client.supplemental_documents.list( + entity_id="entity_id", + cursor="cursor", idempotency_key="x", limit=1, ) - assert_matches_type(SyncPage[SupplementalDocument], supplemental_document, path=["response"]) + assert_matches_type(SyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) @parametrize def test_raw_response_list(self, client: Increase) -> None: - response = client.entities.supplemental_documents.with_raw_response.list( - entity_id="string", + response = client.supplemental_documents.with_raw_response.list( + entity_id="entity_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" supplemental_document = response.parse() - assert_matches_type(SyncPage[SupplementalDocument], supplemental_document, path=["response"]) + assert_matches_type(SyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) @parametrize def test_streaming_response_list(self, client: Increase) -> None: - with client.entities.supplemental_documents.with_streaming_response.list( - entity_id="string", + with client.supplemental_documents.with_streaming_response.list( + entity_id="entity_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" supplemental_document = response.parse() - assert_matches_type(SyncPage[SupplementalDocument], supplemental_document, path=["response"]) + assert_matches_type(SyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) assert cast(Any, response.is_closed) is True class TestAsyncSupplementalDocuments: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: - supplemental_document = await async_client.entities.supplemental_documents.create( - "string", + supplemental_document = await async_client.supplemental_documents.create( + entity_id="entity_n8y8tnk2p9339ti393yi", file_id="file_makxrc67oh9l6sg7w9yc", ) - assert_matches_type(Entity, supplemental_document, path=["response"]) + assert_matches_type(EntitySupplementalDocument, supplemental_document, path=["response"]) @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.supplemental_documents.with_raw_response.create( - "string", + response = await async_client.supplemental_documents.with_raw_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", file_id="file_makxrc67oh9l6sg7w9yc", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - supplemental_document = response.parse() - assert_matches_type(Entity, supplemental_document, path=["response"]) + supplemental_document = await response.parse() + assert_matches_type(EntitySupplementalDocument, supplemental_document, path=["response"]) @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.supplemental_documents.with_streaming_response.create( - "string", + async with async_client.supplemental_documents.with_streaming_response.create( + entity_id="entity_n8y8tnk2p9339ti393yi", file_id="file_makxrc67oh9l6sg7w9yc", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" supplemental_document = await response.parse() - assert_matches_type(Entity, supplemental_document, path=["response"]) + assert_matches_type(EntitySupplementalDocument, supplemental_document, path=["response"]) assert cast(Any, response.is_closed) is True - @parametrize - async def test_path_params_create(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `entity_id` but received ''"): - await async_client.entities.supplemental_documents.with_raw_response.create( - "", - file_id="file_makxrc67oh9l6sg7w9yc", - ) - @parametrize async def test_method_list(self, async_client: AsyncIncrease) -> None: - supplemental_document = await async_client.entities.supplemental_documents.list( - entity_id="string", + supplemental_document = await async_client.supplemental_documents.list( + entity_id="entity_id", ) - assert_matches_type(AsyncPage[SupplementalDocument], supplemental_document, path=["response"]) + assert_matches_type(AsyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: - supplemental_document = await async_client.entities.supplemental_documents.list( - entity_id="string", - cursor="string", + supplemental_document = await async_client.supplemental_documents.list( + entity_id="entity_id", + cursor="cursor", idempotency_key="x", limit=1, ) - assert_matches_type(AsyncPage[SupplementalDocument], supplemental_document, path=["response"]) + assert_matches_type(AsyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) @parametrize async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.supplemental_documents.with_raw_response.list( - entity_id="string", + response = await async_client.supplemental_documents.with_raw_response.list( + entity_id="entity_id", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - supplemental_document = response.parse() - assert_matches_type(AsyncPage[SupplementalDocument], supplemental_document, path=["response"]) + supplemental_document = await response.parse() + assert_matches_type(AsyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) @parametrize async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.supplemental_documents.with_streaming_response.list( - entity_id="string", + async with async_client.supplemental_documents.with_streaming_response.list( + entity_id="entity_id", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" supplemental_document = await response.parse() - assert_matches_type(AsyncPage[SupplementalDocument], supplemental_document, path=["response"]) + assert_matches_type(AsyncPage[EntitySupplementalDocument], supplemental_document, path=["response"]) assert cast(Any, response.is_closed) is True diff --git a/tests/api_resources/test_swift_transfers.py b/tests/api_resources/test_swift_transfers.py new file mode 100644 index 000000000..f2e2a35df --- /dev/null +++ b/tests/api_resources/test_swift_transfers.py @@ -0,0 +1,574 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import SwiftTransfer +from increase._utils import parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestSwiftTransfers: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + swift_transfer = client.swift_transfers.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + swift_transfer = client.swift_transfers.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + "line2": "x", + "postal_code": "60314", + "state": "x", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "postal_code": "10045", + "state": "NY", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + require_approval=True, + routing_number="x", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.swift_transfers.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.swift_transfers.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + swift_transfer = client.swift_transfers.retrieve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.swift_transfers.with_raw_response.retrieve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.swift_transfers.with_streaming_response.retrieve( + "swift_transfer_29h21xkng03788zwd3fh", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `swift_transfer_id` but received ''"): + client.swift_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + swift_transfer = client.swift_transfers.list() + assert_matches_type(SyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + swift_transfer = client.swift_transfers.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["pending_approval"]}, + ) + assert_matches_type(SyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.swift_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = response.parse() + assert_matches_type(SyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.swift_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = response.parse() + assert_matches_type(SyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_approve(self, client: Increase) -> None: + swift_transfer = client.swift_transfers.approve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_raw_response_approve(self, client: Increase) -> None: + response = client.swift_transfers.with_raw_response.approve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_streaming_response_approve(self, client: Increase) -> None: + with client.swift_transfers.with_streaming_response.approve( + "swift_transfer_29h21xkng03788zwd3fh", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_approve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `swift_transfer_id` but received ''"): + client.swift_transfers.with_raw_response.approve( + "", + ) + + @parametrize + def test_method_cancel(self, client: Increase) -> None: + swift_transfer = client.swift_transfers.cancel( + "swift_transfer_29h21xkng03788zwd3fh", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_raw_response_cancel(self, client: Increase) -> None: + response = client.swift_transfers.with_raw_response.cancel( + "swift_transfer_29h21xkng03788zwd3fh", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + def test_streaming_response_cancel(self, client: Increase) -> None: + with client.swift_transfers.with_streaming_response.cancel( + "swift_transfer_29h21xkng03788zwd3fh", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_cancel(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `swift_transfer_id` but received ''"): + client.swift_transfers.with_raw_response.cancel( + "", + ) + + +class TestAsyncSwiftTransfers: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + swift_transfer = await async_client.swift_transfers.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + swift_transfer = await async_client.swift_transfers.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + "line2": "x", + "postal_code": "60314", + "state": "x", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "postal_code": "10045", + "state": "NY", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + require_approval=True, + routing_number="x", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.swift_transfers.with_raw_response.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.swift_transfers.with_streaming_response.create( + account_id="account_in71c4amph0vgo2qllky", + account_number="987654321", + bank_identification_code="ECBFDEFFTPP", + creditor_address={ + "city": "Frankfurt", + "country": "DE", + "line1": "Sonnemannstrasse 20", + }, + creditor_name="Ian Crease", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="National Phonograph Company", + instructed_amount=100, + instructed_currency="USD", + source_account_number_id="account_number_v18nkfqm6afpsrvy82b2", + unstructured_remittance_information="New Swift transfer", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + swift_transfer = await async_client.swift_transfers.retrieve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.swift_transfers.with_raw_response.retrieve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.swift_transfers.with_streaming_response.retrieve( + "swift_transfer_29h21xkng03788zwd3fh", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `swift_transfer_id` but received ''"): + await async_client.swift_transfers.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + swift_transfer = await async_client.swift_transfers.list() + assert_matches_type(AsyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + swift_transfer = await async_client.swift_transfers.list( + account_id="account_id", + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["pending_approval"]}, + ) + assert_matches_type(AsyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.swift_transfers.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = await response.parse() + assert_matches_type(AsyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.swift_transfers.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = await response.parse() + assert_matches_type(AsyncPage[SwiftTransfer], swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_approve(self, async_client: AsyncIncrease) -> None: + swift_transfer = await async_client.swift_transfers.approve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: + response = await async_client.swift_transfers.with_raw_response.approve( + "swift_transfer_29h21xkng03788zwd3fh", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: + async with async_client.swift_transfers.with_streaming_response.approve( + "swift_transfer_29h21xkng03788zwd3fh", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `swift_transfer_id` but received ''"): + await async_client.swift_transfers.with_raw_response.approve( + "", + ) + + @parametrize + async def test_method_cancel(self, async_client: AsyncIncrease) -> None: + swift_transfer = await async_client.swift_transfers.cancel( + "swift_transfer_29h21xkng03788zwd3fh", + ) + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: + response = await async_client.swift_transfers.with_raw_response.cancel( + "swift_transfer_29h21xkng03788zwd3fh", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + @parametrize + async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: + async with async_client.swift_transfers.with_streaming_response.cancel( + "swift_transfer_29h21xkng03788zwd3fh", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + swift_transfer = await response.parse() + assert_matches_type(SwiftTransfer, swift_transfer, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_cancel(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `swift_transfer_id` but received ''"): + await async_client.swift_transfers.with_raw_response.cancel( + "", + ) diff --git a/tests/api_resources/test_transactions.py b/tests/api_resources/test_transactions.py index 1c66c4a7a..d5491798f 100644 --- a/tests/api_resources/test_transactions.py +++ b/tests/api_resources/test_transactions.py @@ -22,14 +22,14 @@ class TestTransactions: @parametrize def test_method_retrieve(self, client: Increase) -> None: transaction = client.transactions.retrieve( - "string", + "transaction_uyrp7fld2ium70oa7oi", ) assert_matches_type(Transaction, transaction, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.transactions.with_raw_response.retrieve( - "string", + "transaction_uyrp7fld2ium70oa7oi", ) assert response.is_closed is True @@ -40,7 +40,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.transactions.with_streaming_response.retrieve( - "string", + "transaction_uyrp7fld2ium70oa7oi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -65,17 +65,17 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: transaction = client.transactions.list( - account_id="string", - category={"in": ["account_transfer_intention", "ach_transfer_intention", "ach_transfer_rejection"]}, + account_id="account_id", + category={"in": ["account_transfer_intention"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - route_id="string", + route_id="route_id", ) assert_matches_type(SyncPage[Transaction], transaction, path=["response"]) @@ -101,30 +101,32 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncTransactions: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: transaction = await async_client.transactions.retrieve( - "string", + "transaction_uyrp7fld2ium70oa7oi", ) assert_matches_type(Transaction, transaction, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.transactions.with_raw_response.retrieve( - "string", + "transaction_uyrp7fld2ium70oa7oi", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - transaction = response.parse() + transaction = await response.parse() assert_matches_type(Transaction, transaction, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.transactions.with_streaming_response.retrieve( - "string", + "transaction_uyrp7fld2ium70oa7oi", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -149,17 +151,17 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: transaction = await async_client.transactions.list( - account_id="string", - category={"in": ["account_transfer_intention", "ach_transfer_intention", "ach_transfer_rejection"]}, + account_id="account_id", + category={"in": ["account_transfer_intention"]}, created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", + cursor="cursor", limit=1, - route_id="string", + route_id="route_id", ) assert_matches_type(AsyncPage[Transaction], transaction, path=["response"]) @@ -169,7 +171,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - transaction = response.parse() + transaction = await response.parse() assert_matches_type(AsyncPage[Transaction], transaction, path=["response"]) @parametrize diff --git a/tests/api_resources/test_webhooks.py b/tests/api_resources/test_webhooks.py deleted file mode 100644 index 1244ba189..000000000 --- a/tests/api_resources/test_webhooks.py +++ /dev/null @@ -1,95 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. - -from __future__ import annotations - -import os - -import pytest - -from increase import Increase, AsyncIncrease - -base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") - - -class TestWebhooks: - parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - - payload = '{"id":"event_123abc","created_at":"2020-01-31T23:59:59Z"}' - signature = "Dwa0AHInLL3XFo2sxcHamOQDrJNi7F654S3L6skMAOI=" - headers = { - "Increase-Webhook-Signature": f"t=2022-01-31T23:59:59Z,v1=3f9c3dcc820ca3adfae8e196d05b09dfef63b91db5ce5ac1407090f2aa424a6f", - } - secret = "whsec_zlFsbBZ8Xcodlpcu6NDTdSzZRLSdhkst" - - def test_unwrap_with_secret(self, client: Increase) -> None: - payload = self.payload - headers = self.headers - secret = self.secret - - expected = {"created_at": "2020-01-31T23:59:59Z", "id": "event_123abc"} - unwrapped = client.webhooks.unwrap(payload, headers, secret=secret) - - assert unwrapped == expected - - def test_unwrap_no_secret(self, client: Increase) -> None: - payload = self.payload - headers = self.headers - - expected = {"created_at": "2020-01-31T23:59:59Z", "id": "event_123abc"} - unwrapped = client.webhooks.unwrap(payload, headers) - - assert unwrapped == expected - - def test_verify_signature(self, client: Increase) -> None: - payload = self.payload - headers = self.headers - secret = self.secret - verify = client.webhooks.verify_signature - - assert verify(payload=payload, headers=headers, secret=secret) is None - - # wrong secret - with pytest.raises(ValueError, match=r"None of the given webhook signatures match the expected signature."): - verify(payload=payload, headers=headers, secret="invalid secret") - - -class TestAsyncWebhooks: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) - - payload = '{"id":"event_123abc","created_at":"2020-01-31T23:59:59Z"}' - signature = "Dwa0AHInLL3XFo2sxcHamOQDrJNi7F654S3L6skMAOI=" - headers = { - "Increase-Webhook-Signature": f"t=2022-01-31T23:59:59Z,v1=3f9c3dcc820ca3adfae8e196d05b09dfef63b91db5ce5ac1407090f2aa424a6f", - } - secret = "whsec_zlFsbBZ8Xcodlpcu6NDTdSzZRLSdhkst" - - def test_unwrap_with_secret(self, async_client: AsyncIncrease) -> None: - payload = self.payload - headers = self.headers - secret = self.secret - - expected = {"created_at": "2020-01-31T23:59:59Z", "id": "event_123abc"} - unwrapped = async_client.webhooks.unwrap(payload, headers, secret=secret) - - assert unwrapped == expected - - def test_unwrap_no_secret(self, async_client: AsyncIncrease) -> None: - payload = self.payload - headers = self.headers - - expected = {"created_at": "2020-01-31T23:59:59Z", "id": "event_123abc"} - unwrapped = async_client.webhooks.unwrap(payload, headers) - - assert unwrapped == expected - - def test_verify_signature(self, async_client: AsyncIncrease) -> None: - payload = self.payload - headers = self.headers - secret = self.secret - verify = async_client.webhooks.verify_signature - - assert verify(payload=payload, headers=headers, secret=secret) is None - - # wrong secret - with pytest.raises(ValueError, match=r"None of the given webhook signatures match the expected signature."): - verify(payload=payload, headers=headers, secret="invalid secret") diff --git a/tests/api_resources/test_wire_drawdown_requests.py b/tests/api_resources/test_wire_drawdown_requests.py index 7705d8059..62a036793 100644 --- a/tests/api_resources/test_wire_drawdown_requests.py +++ b/tests/api_resources/test_wire_drawdown_requests.py @@ -18,49 +18,77 @@ class TestWireDrawdownRequests: parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_method_create(self, client: Increase) -> None: wire_drawdown_request = client.wire_drawdown_requests.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", ) assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_method_create_with_all_params(self, client: Increase) -> None: wire_drawdown_request = client.wire_drawdown_requests.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", - originator_address_line1="x", - originator_address_line2="x", - originator_address_line3="x", - originator_name="x", - recipient_address_line1="33 Liberty Street", - recipient_address_line2="New York, NY, 10045", - recipient_address_line3="x", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "postal_code": "10045", + "state": "NY", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "postal_code": "10045", + "state": "NY", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", + charge_bearer="shared", + debtor_account_number="987654321", + debtor_external_account_id="debtor_external_account_id", + debtor_routing_number="101050001", + end_to_end_identification="x", ) assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_raw_response_create(self, client: Increase) -> None: response = client.wire_drawdown_requests.with_raw_response.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", ) assert response.is_closed is True @@ -68,16 +96,24 @@ def test_raw_response_create(self, client: Increase) -> None: wire_drawdown_request = response.parse() assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize def test_streaming_response_create(self, client: Increase) -> None: with client.wire_drawdown_requests.with_streaming_response.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -90,14 +126,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: wire_drawdown_request = client.wire_drawdown_requests.retrieve( - "string", + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", ) assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.wire_drawdown_requests.with_raw_response.retrieve( - "string", + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", ) assert response.is_closed is True @@ -108,7 +144,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.wire_drawdown_requests.with_streaming_response.retrieve( - "string", + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -135,8 +171,10 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: wire_drawdown_request = client.wire_drawdown_requests.list( - cursor="string", + cursor="cursor", + idempotency_key="x", limit=1, + status={"in": ["pending_submission"]}, ) assert_matches_type(SyncPage[WireDrawdownRequest], wire_drawdown_request, path=["response"]) @@ -162,68 +200,106 @@ def test_streaming_response_list(self, client: Increase) -> None: class TestAsyncWireDrawdownRequests: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: wire_drawdown_request = await async_client.wire_drawdown_requests.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", ) assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: wire_drawdown_request = await async_client.wire_drawdown_requests.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", - originator_address_line1="x", - originator_address_line2="x", - originator_address_line3="x", - originator_name="x", - recipient_address_line1="33 Liberty Street", - recipient_address_line2="New York, NY, 10045", - recipient_address_line3="x", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "postal_code": "10045", + "state": "NY", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + "line2": "x", + "postal_code": "10045", + "state": "NY", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", + charge_bearer="shared", + debtor_account_number="987654321", + debtor_external_account_id="debtor_external_account_id", + debtor_routing_number="101050001", + end_to_end_identification="x", ) assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.wire_drawdown_requests.with_raw_response.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_drawdown_request = response.parse() + wire_drawdown_request = await response.parse() assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) - @pytest.mark.skip(reason="Prism tests are broken") @parametrize async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: async with async_client.wire_drawdown_requests.with_streaming_response.create( account_number_id="account_number_v18nkfqm6afpsrvy82b2", amount=10000, - message_to_recipient="Invoice 29582", - recipient_account_number="987654321", - recipient_name="Ian Crease", - recipient_routing_number="101050001", + creditor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + creditor_name="National Phonograph Company", + debtor_address={ + "city": "New York", + "country": "US", + "line1": "33 Liberty Street", + }, + debtor_name="Ian Crease", + unstructured_remittance_information="Invoice 29582", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -236,25 +312,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: wire_drawdown_request = await async_client.wire_drawdown_requests.retrieve( - "string", + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", ) assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.wire_drawdown_requests.with_raw_response.retrieve( - "string", + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_drawdown_request = response.parse() + wire_drawdown_request = await response.parse() assert_matches_type(WireDrawdownRequest, wire_drawdown_request, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.wire_drawdown_requests.with_streaming_response.retrieve( - "string", + "wire_drawdown_request_q6lmocus3glo0lr2bfv3", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -281,8 +357,10 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: wire_drawdown_request = await async_client.wire_drawdown_requests.list( - cursor="string", + cursor="cursor", + idempotency_key="x", limit=1, + status={"in": ["pending_submission"]}, ) assert_matches_type(AsyncPage[WireDrawdownRequest], wire_drawdown_request, path=["response"]) @@ -292,7 +370,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_drawdown_request = response.parse() + wire_drawdown_request = await response.parse() assert_matches_type(AsyncPage[WireDrawdownRequest], wire_drawdown_request, path=["response"]) @parametrize diff --git a/tests/api_resources/test_wire_transfers.py b/tests/api_resources/test_wire_transfers.py index 4d10cc88d..77b147967 100644 --- a/tests/api_resources/test_wire_transfers.py +++ b/tests/api_resources/test_wire_transfers.py @@ -10,7 +10,7 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type from increase.types import WireTransfer -from increase._utils import parse_datetime +from increase._utils import parse_date, parse_datetime from increase.pagination import SyncPage, AsyncPage base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -24,8 +24,8 @@ def test_method_create(self, client: Increase) -> None: wire_transfer = client.wire_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={"name": "Ian Crease"}, + remittance={"category": "unstructured"}, ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @@ -34,19 +34,41 @@ def test_method_create_with_all_params(self, client: Increase) -> None: wire_transfer = client.wire_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={ + "name": "Ian Crease", + "address": { + "unstructured": { + "line1": "33 Liberty Street", + "line2": "New York", + "line3": "NY 10045", + } + }, + }, + remittance={ + "category": "unstructured", + "tax": { + "date": parse_date("2019-12-27"), + "identification_number": "xxxxxxxxx", + "type_code": "xxxxx", + }, + "unstructured": {"message": "New account transfer"}, + }, account_number="987654321", - beneficiary_address_line1="33 Liberty Street", - beneficiary_address_line2="New York", - beneficiary_address_line3="NY 10045", - external_account_id="string", - originator_address_line1="x", - originator_address_line2="x", - originator_address_line3="x", - originator_name="x", + debtor={ + "name": "x", + "address": { + "unstructured": { + "line1": "x", + "line2": "x", + "line3": "x", + } + }, + }, + external_account_id="external_account_id", + inbound_wire_drawdown_request_id="inbound_wire_drawdown_request_id", require_approval=True, routing_number="101050001", + source_account_number_id="source_account_number_id", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @@ -55,8 +77,8 @@ def test_raw_response_create(self, client: Increase) -> None: response = client.wire_transfers.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={"name": "Ian Crease"}, + remittance={"category": "unstructured"}, ) assert response.is_closed is True @@ -69,8 +91,8 @@ def test_streaming_response_create(self, client: Increase) -> None: with client.wire_transfers.with_streaming_response.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={"name": "Ian Crease"}, + remittance={"category": "unstructured"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -83,14 +105,14 @@ def test_streaming_response_create(self, client: Increase) -> None: @parametrize def test_method_retrieve(self, client: Increase) -> None: wire_transfer = client.wire_transfers.retrieve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize def test_raw_response_retrieve(self, client: Increase) -> None: response = client.wire_transfers.with_raw_response.retrieve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True @@ -101,7 +123,7 @@ def test_raw_response_retrieve(self, client: Increase) -> None: @parametrize def test_streaming_response_retrieve(self, client: Increase) -> None: with client.wire_transfers.with_streaming_response.retrieve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -126,17 +148,18 @@ def test_method_list(self, client: Increase) -> None: @parametrize def test_method_list_with_all_params(self, client: Increase) -> None: wire_transfer = client.wire_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - external_account_id="string", + cursor="cursor", + external_account_id="external_account_id", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(SyncPage[WireTransfer], wire_transfer, path=["response"]) @@ -163,14 +186,14 @@ def test_streaming_response_list(self, client: Increase) -> None: @parametrize def test_method_approve(self, client: Increase) -> None: wire_transfer = client.wire_transfers.approve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize def test_raw_response_approve(self, client: Increase) -> None: response = client.wire_transfers.with_raw_response.approve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True @@ -181,7 +204,7 @@ def test_raw_response_approve(self, client: Increase) -> None: @parametrize def test_streaming_response_approve(self, client: Increase) -> None: with client.wire_transfers.with_streaming_response.approve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -201,14 +224,14 @@ def test_path_params_approve(self, client: Increase) -> None: @parametrize def test_method_cancel(self, client: Increase) -> None: wire_transfer = client.wire_transfers.cancel( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize def test_raw_response_cancel(self, client: Increase) -> None: response = client.wire_transfers.with_raw_response.cancel( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True @@ -219,7 +242,7 @@ def test_raw_response_cancel(self, client: Increase) -> None: @parametrize def test_streaming_response_cancel(self, client: Increase) -> None: with client.wire_transfers.with_streaming_response.cancel( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -236,101 +259,19 @@ def test_path_params_cancel(self, client: Increase) -> None: "", ) - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_method_reverse(self, client: Increase) -> None: - wire_transfer = client.wire_transfers.reverse( - "string", - ) - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_raw_response_reverse(self, client: Increase) -> None: - response = client.wire_transfers.with_raw_response.reverse( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_streaming_response_reverse(self, client: Increase) -> None: - with client.wire_transfers.with_streaming_response.reverse( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - wire_transfer = response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_path_params_reverse(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): - client.wire_transfers.with_raw_response.reverse( - "", - ) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_method_submit(self, client: Increase) -> None: - wire_transfer = client.wire_transfers.submit( - "string", - ) - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_raw_response_submit(self, client: Increase) -> None: - response = client.wire_transfers.with_raw_response.submit( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_streaming_response_submit(self, client: Increase) -> None: - with client.wire_transfers.with_streaming_response.submit( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - wire_transfer = response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - def test_path_params_submit(self, client: Increase) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): - client.wire_transfers.with_raw_response.submit( - "", - ) - class TestAsyncWireTransfers: - parametrize = pytest.mark.parametrize("async_client", [False, True], indirect=True, ids=["loose", "strict"]) + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) @parametrize async def test_method_create(self, async_client: AsyncIncrease) -> None: wire_transfer = await async_client.wire_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={"name": "Ian Crease"}, + remittance={"category": "unstructured"}, ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @@ -339,19 +280,41 @@ async def test_method_create_with_all_params(self, async_client: AsyncIncrease) wire_transfer = await async_client.wire_transfers.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={ + "name": "Ian Crease", + "address": { + "unstructured": { + "line1": "33 Liberty Street", + "line2": "New York", + "line3": "NY 10045", + } + }, + }, + remittance={ + "category": "unstructured", + "tax": { + "date": parse_date("2019-12-27"), + "identification_number": "xxxxxxxxx", + "type_code": "xxxxx", + }, + "unstructured": {"message": "New account transfer"}, + }, account_number="987654321", - beneficiary_address_line1="33 Liberty Street", - beneficiary_address_line2="New York", - beneficiary_address_line3="NY 10045", - external_account_id="string", - originator_address_line1="x", - originator_address_line2="x", - originator_address_line3="x", - originator_name="x", + debtor={ + "name": "x", + "address": { + "unstructured": { + "line1": "x", + "line2": "x", + "line3": "x", + } + }, + }, + external_account_id="external_account_id", + inbound_wire_drawdown_request_id="inbound_wire_drawdown_request_id", require_approval=True, routing_number="101050001", + source_account_number_id="source_account_number_id", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @@ -360,13 +323,13 @@ async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: response = await async_client.wire_transfers.with_raw_response.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={"name": "Ian Crease"}, + remittance={"category": "unstructured"}, ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() + wire_transfer = await response.parse() assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize @@ -374,8 +337,8 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N async with async_client.wire_transfers.with_streaming_response.create( account_id="account_in71c4amph0vgo2qllky", amount=100, - beneficiary_name="Ian Crease", - message_to_recipient="New account transfer", + creditor={"name": "Ian Crease"}, + remittance={"category": "unstructured"}, ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -388,25 +351,25 @@ async def test_streaming_response_create(self, async_client: AsyncIncrease) -> N @parametrize async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: wire_transfer = await async_client.wire_transfers.retrieve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: response = await async_client.wire_transfers.with_raw_response.retrieve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() + wire_transfer = await response.parse() assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: async with async_client.wire_transfers.with_streaming_response.retrieve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -431,17 +394,18 @@ async def test_method_list(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: wire_transfer = await async_client.wire_transfers.list( - account_id="string", + account_id="account_id", created_at={ "after": parse_datetime("2019-12-27T18:11:19.117Z"), "before": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), }, - cursor="string", - external_account_id="string", + cursor="cursor", + external_account_id="external_account_id", idempotency_key="x", limit=1, + status={"in": ["pending_approval"]}, ) assert_matches_type(AsyncPage[WireTransfer], wire_transfer, path=["response"]) @@ -451,7 +415,7 @@ async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() + wire_transfer = await response.parse() assert_matches_type(AsyncPage[WireTransfer], wire_transfer, path=["response"]) @parametrize @@ -468,25 +432,25 @@ async def test_streaming_response_list(self, async_client: AsyncIncrease) -> Non @parametrize async def test_method_approve(self, async_client: AsyncIncrease) -> None: wire_transfer = await async_client.wire_transfers.approve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize async def test_raw_response_approve(self, async_client: AsyncIncrease) -> None: response = await async_client.wire_transfers.with_raw_response.approve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() + wire_transfer = await response.parse() assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize async def test_streaming_response_approve(self, async_client: AsyncIncrease) -> None: async with async_client.wire_transfers.with_streaming_response.approve( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -506,25 +470,25 @@ async def test_path_params_approve(self, async_client: AsyncIncrease) -> None: @parametrize async def test_method_cancel(self, async_client: AsyncIncrease) -> None: wire_transfer = await async_client.wire_transfers.cancel( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize async def test_raw_response_cancel(self, async_client: AsyncIncrease) -> None: response = await async_client.wire_transfers.with_raw_response.cancel( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) assert response.is_closed is True assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() + wire_transfer = await response.parse() assert_matches_type(WireTransfer, wire_transfer, path=["response"]) @parametrize async def test_streaming_response_cancel(self, async_client: AsyncIncrease) -> None: async with async_client.wire_transfers.with_streaming_response.cancel( - "string", + "wire_transfer_5akynk7dqsq25qwk9q2u", ) as response: assert not response.is_closed assert response.http_request.headers.get("X-Stainless-Lang") == "python" @@ -540,87 +504,3 @@ async def test_path_params_cancel(self, async_client: AsyncIncrease) -> None: await async_client.wire_transfers.with_raw_response.cancel( "", ) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_method_reverse(self, async_client: AsyncIncrease) -> None: - wire_transfer = await async_client.wire_transfers.reverse( - "string", - ) - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_raw_response_reverse(self, async_client: AsyncIncrease) -> None: - response = await async_client.wire_transfers.with_raw_response.reverse( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_streaming_response_reverse(self, async_client: AsyncIncrease) -> None: - async with async_client.wire_transfers.with_streaming_response.reverse( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - wire_transfer = await response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_path_params_reverse(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): - await async_client.wire_transfers.with_raw_response.reverse( - "", - ) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_method_submit(self, async_client: AsyncIncrease) -> None: - wire_transfer = await async_client.wire_transfers.submit( - "string", - ) - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_raw_response_submit(self, async_client: AsyncIncrease) -> None: - response = await async_client.wire_transfers.with_raw_response.submit( - "string", - ) - - assert response.is_closed is True - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - wire_transfer = response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_streaming_response_submit(self, async_client: AsyncIncrease) -> None: - async with async_client.wire_transfers.with_streaming_response.submit( - "string", - ) as response: - assert not response.is_closed - assert response.http_request.headers.get("X-Stainless-Lang") == "python" - - wire_transfer = await response.parse() - assert_matches_type(WireTransfer, wire_transfer, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @pytest.mark.skip(reason="Prism tests are broken") - @parametrize - async def test_path_params_submit(self, async_client: AsyncIncrease) -> None: - with pytest.raises(ValueError, match=r"Expected a non-empty value for `wire_transfer_id` but received ''"): - await async_client.wire_transfers.with_raw_response.submit( - "", - ) diff --git a/tests/conftest.py b/tests/conftest.py index 120908a4c..23340d746 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -1,27 +1,46 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + from __future__ import annotations import os -import asyncio import logging from typing import TYPE_CHECKING, Iterator, AsyncIterator +import httpx import pytest +from pytest_asyncio import is_async_test -from increase import Increase, AsyncIncrease +from increase import Increase, AsyncIncrease, DefaultAioHttpClient +from increase._utils import is_dict if TYPE_CHECKING: - from _pytest.fixtures import FixtureRequest + from _pytest.fixtures import FixtureRequest # pyright: ignore[reportPrivateImportUsage] pytest.register_assert_rewrite("tests.utils") logging.getLogger("increase").setLevel(logging.DEBUG) -@pytest.fixture(scope="session") -def event_loop() -> Iterator[asyncio.AbstractEventLoop]: - loop = asyncio.new_event_loop() - yield loop - loop.close() +# automatically add `pytest.mark.asyncio()` to all of our async tests +# so we don't have to add that boilerplate everywhere +def pytest_collection_modifyitems(items: list[pytest.Function]) -> None: + pytest_asyncio_tests = (item for item in items if is_async_test(item)) + session_scope_marker = pytest.mark.asyncio(loop_scope="session") + for async_test in pytest_asyncio_tests: + async_test.add_marker(session_scope_marker, append=False) + + # We skip tests that use both the aiohttp client and respx_mock as respx_mock + # doesn't support custom transports. + for item in items: + if "async_client" not in item.fixturenames or "respx_mock" not in item.fixturenames: + continue + + if not hasattr(item, "callspec"): + continue + + async_client_param = item.callspec.params.get("async_client") + if is_dict(async_client_param) and async_client_param.get("http_client") == "aiohttp": + item.add_marker(pytest.mark.skip(reason="aiohttp client is not compatible with respx_mock")) base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") @@ -41,9 +60,25 @@ def client(request: FixtureRequest) -> Iterator[Increase]: @pytest.fixture(scope="session") async def async_client(request: FixtureRequest) -> AsyncIterator[AsyncIncrease]: - strict = getattr(request, "param", True) - if not isinstance(strict, bool): - raise TypeError(f"Unexpected fixture parameter type {type(strict)}, expected {bool}") - - async with AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=strict) as client: + param = getattr(request, "param", True) + + # defaults + strict = True + http_client: None | httpx.AsyncClient = None + + if isinstance(param, bool): + strict = param + elif is_dict(param): + strict = param.get("strict", True) + assert isinstance(strict, bool) + + http_client_type = param.get("http_client", "httpx") + if http_client_type == "aiohttp": + http_client = DefaultAioHttpClient() + else: + raise TypeError(f"Unexpected fixture parameter type {type(param)}, expected bool or dict") + + async with AsyncIncrease( + base_url=base_url, api_key=api_key, _strict_response_validation=strict, http_client=http_client + ) as client: yield client diff --git a/tests/test_client.py b/tests/test_client.py index fb6f4c721..0102239e1 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -4,12 +4,15 @@ import gc import os +import sys import json import asyncio import inspect +import dataclasses import tracemalloc -from typing import Any, Union, cast +from typing import Any, Union, TypeVar, Callable, Iterable, Iterator, Optional, Coroutine, cast from unittest import mock +from typing_extensions import Literal, AsyncIterator, override import httpx import pytest @@ -17,19 +20,24 @@ from pydantic import ValidationError from increase import Increase, AsyncIncrease, APIResponseValidationError -from increase._client import Increase, AsyncIncrease +from increase._types import Omit +from increase._utils import asyncify from increase._models import BaseModel, FinalRequestOptions -from increase._constants import RAW_RESPONSE_HEADER from increase._exceptions import IncreaseError, APIStatusError, APITimeoutError, APIResponseValidationError from increase._base_client import ( DEFAULT_TIMEOUT, HTTPX_DEFAULT_TIMEOUT, BaseClient, + OtherPlatform, + DefaultHttpxClient, + DefaultAsyncHttpxClient, + get_platform, make_request_options, ) from .utils import update_env +T = TypeVar("T") base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") api_key = "My API Key" @@ -44,6 +52,57 @@ def _low_retry_timeout(*_args: Any, **_kwargs: Any) -> float: return 0.1 +def mirror_request_content(request: httpx.Request) -> httpx.Response: + return httpx.Response(200, content=request.content) + + +# note: we can't use the httpx.MockTransport class as it consumes the request +# body itself, which means we can't test that the body is read lazily +class MockTransport(httpx.BaseTransport, httpx.AsyncBaseTransport): + def __init__( + self, + handler: Callable[[httpx.Request], httpx.Response] + | Callable[[httpx.Request], Coroutine[Any, Any, httpx.Response]], + ) -> None: + self.handler = handler + + @override + def handle_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert not inspect.iscoroutinefunction(self.handler), "handler must not be a coroutine function" + assert inspect.isfunction(self.handler), "handler must be a function" + return self.handler(request) + + @override + async def handle_async_request( + self, + request: httpx.Request, + ) -> httpx.Response: + assert inspect.iscoroutinefunction(self.handler), "handler must be a coroutine function" + return await self.handler(request) + + +@dataclasses.dataclass +class Counter: + value: int = 0 + + +def _make_sync_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> Iterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + +async def _make_async_iterator(iterable: Iterable[T], counter: Optional[Counter] = None) -> AsyncIterator[T]: + for item in iterable: + if counter: + counter.value += 1 + yield item + + def _get_open_connections(client: Increase | AsyncIncrease) -> int: transport = client._client._transport assert isinstance(transport, httpx.HTTPTransport) or isinstance(transport, httpx.AsyncHTTPTransport) @@ -53,51 +112,49 @@ def _get_open_connections(client: Increase | AsyncIncrease) -> int: class TestIncrease: - client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) - @pytest.mark.respx(base_url=base_url) - def test_raw_response(self, respx_mock: MockRouter) -> None: + def test_raw_response(self, respx_mock: MockRouter, client: Increase) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + def test_raw_response_for_binary(self, respx_mock: MockRouter, client: Increase) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, client: Increase) -> None: + copied = client.copy() + assert id(copied) != id(client) - copied = self.client.copy(api_key="another My API Key") + copied = client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, client: Increase) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(client.timeout, httpx.Timeout) + copied = client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(client.timeout, httpx.Timeout) def test_copy_default_headers(self) -> None: client = Increase( @@ -132,6 +189,7 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + client.close() def test_copy_default_query(self) -> None: client = Increase( @@ -169,13 +227,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + client.close() + + def test_copy_signature(self, client: Increase) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -185,12 +245,13 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - def test_copy_build_request(self) -> None: + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") + def test_copy_build_request(self, client: Increase) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -247,14 +308,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + def test_request_timeout(self, client: Increase) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( - FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) - ) + request = client._build_request(FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0))) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(100.0) @@ -267,6 +326,8 @@ def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + client.close() + def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used with httpx.Client(timeout=None) as http_client: @@ -278,6 +339,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + client.close() + # no timeout given to the httpx client should not use the httpx default with httpx.Client() as http_client: client = Increase( @@ -288,6 +351,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + client.close() + # explicitly passing the default timeout currently results in it being ignored with httpx.Client(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = Increase( @@ -298,6 +363,8 @@ def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + client.close() + async def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): async with httpx.AsyncClient() as http_client: @@ -309,14 +376,14 @@ async def test_invalid_http_client(self) -> None: ) def test_default_headers_option(self) -> None: - client = Increase( + test_client = Increase( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = Increase( + test_client2 = Increase( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -325,17 +392,21 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + test_client.close() + test_client2.close() + def test_validate_headers(self) -> None: client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("Authorization") == f"Bearer {api_key}" with pytest.raises(IncreaseError): - client2 = Increase(base_url=base_url, api_key=None, _strict_response_validation=True) + with update_env(**{"INCREASE_API_KEY": Omit()}): + client2 = Increase(base_url=base_url, api_key=None, _strict_response_validation=True) _ = client2 def test_default_query_option(self) -> None: @@ -350,14 +421,40 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden"}, + params={"foo": "baz", "query_param": "overridden"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + + client.close() + + def test_hardcoded_query_params_in_url(self, client: Increase) -> None: + request = client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden"} + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} - def test_request_extra_json(self) -> None: - request = self.client._build_request( + request = client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" + + def test_request_extra_json(self, client: Increase) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -368,7 +465,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -379,7 +476,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -390,8 +487,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Increase) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -401,7 +498,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -412,8 +509,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Increase) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -426,7 +523,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -440,7 +537,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -456,7 +553,7 @@ def test_request_extra_query(self) -> None: def test_multipart_repeating_array(self, client: Increase) -> None: request = client._build_request( FinalRequestOptions.construct( - method="get", + method="post", url="/foo", headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, json_data={"array": ["foo", "bar"]}, @@ -483,7 +580,71 @@ def test_multipart_repeating_array(self, client: Increase) -> None: ] @pytest.mark.respx(base_url=base_url) - def test_basic_union_response(self, respx_mock: MockRouter) -> None: + def test_binary_content_upload(self, respx_mock: MockRouter, client: Increase) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + def test_binary_content_upload_with_iterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_sync_iterator([file_content], counter=counter) + + def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=request.read()) + + with Increase( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.Client(transport=MockTransport(handler=mock_handler)), + ) as client: + response = client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + def test_binary_content_upload_with_body_is_deprecated(self, respx_mock: MockRouter, client: Increase) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + @pytest.mark.respx(base_url=base_url) + def test_basic_union_response(self, respx_mock: MockRouter, client: Increase) -> None: class Model1(BaseModel): name: str @@ -492,12 +653,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + def test_union_response_different_types(self, respx_mock: MockRouter, client: Increase) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -508,18 +669,18 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter, client: Increase) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -535,29 +696,29 @@ class Model(BaseModel): ) ) - response = self.client.get("/foo", cast_to=Model) + response = client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 @pytest.mark.respx(base_url=base_url) - def test_idempotency_header_options(self, respx_mock: MockRouter) -> None: + def test_idempotency_header_options(self, respx_mock: MockRouter, client: Increase) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={})) - response = self.client.post("/foo", cast_to=httpx.Response) + response = client.post("/foo", cast_to=httpx.Response) header = response.request.headers.get("Idempotency-Key") assert header is not None assert header.startswith("stainless-python-retry") # explicit header - response = self.client.post( + response = client.post( "/foo", cast_to=httpx.Response, options=make_request_options(extra_headers={"Idempotency-Key": "custom-key"}), ) assert response.request.headers.get("Idempotency-Key") == "custom-key" - response = self.client.post( + response = client.post( "/foo", cast_to=httpx.Response, options=make_request_options(extra_headers={"idempotency-key": "custom-key"}), @@ -565,7 +726,7 @@ def test_idempotency_header_options(self, respx_mock: MockRouter) -> None: assert response.request.headers.get("Idempotency-Key") == "custom-key" # custom argument - response = self.client.post( + response = client.post( "/foo", cast_to=httpx.Response, options=make_request_options(idempotency_key="custom-key") ) assert response.request.headers.get("Idempotency-Key") == "custom-key" @@ -578,6 +739,8 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" + client.close() + def test_base_url_env(self) -> None: with update_env(INCREASE_BASE_URL="http://localhost:5000/from/env"): client = Increase(api_key=api_key, _strict_response_validation=True) @@ -593,6 +756,8 @@ def test_base_url_env(self) -> None: ) assert str(client.base_url).startswith("https://api.increase.com") + client.close() + @pytest.mark.parametrize( "client", [ @@ -615,6 +780,7 @@ def test_base_url_trailing_slash(self, client: Increase) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -638,6 +804,7 @@ def test_base_url_no_trailing_slash(self, client: Increase) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + client.close() @pytest.mark.parametrize( "client", @@ -661,129 +828,43 @@ def test_absolute_request_url(self, client: Increase) -> None: ), ) assert request.url == "https://myapi.com/foo" - - def test_transport_option_is_deprecated(self) -> None: - with pytest.warns( - DeprecationWarning, - match="The `transport` argument is deprecated. The `http_client` argument should be passed instead", - ): - transport = httpx.MockTransport( - lambda: None, # type: ignore - ) - - client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True, transport=transport) - - assert client._client._transport is transport - - def test_transport_option_mutually_exclusive_with_http_client(self) -> None: - with httpx.Client() as http_client: - with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `transport`"): - with pytest.warns(DeprecationWarning): - Increase( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - transport=httpx.MockTransport( - lambda: None, # type: ignore - ), - http_client=http_client, - ) - - def test_connection_pool_limits_option_is_deprecated(self) -> None: - with pytest.warns( - DeprecationWarning, - match="The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - ): - connection_pool_limits = httpx.Limits( - max_connections=101, max_keepalive_connections=76, keepalive_expiry=23 - ) - - client = Increase( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - connection_pool_limits=connection_pool_limits, - ) - - assert isinstance(client._client._transport, httpx.HTTPTransport) - assert client._client._transport._pool._max_connections == 101 - assert client._client._transport._pool._max_keepalive_connections == 76 - assert client._client._transport._pool._keepalive_expiry == 23 - - def test_connection_pool_limits_option_mutually_exclusive_with_http_client(self) -> None: - with httpx.Client() as http_client: - with pytest.raises( - ValueError, match="The `http_client` argument is mutually exclusive with `connection_pool_limits`" - ): - with pytest.warns(DeprecationWarning): - Increase( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - connection_pool_limits=httpx.Limits( - max_connections=101, max_keepalive_connections=76, keepalive_expiry=23 - ), - http_client=http_client, - ) - - def test_proxies_option_is_deprecated(self) -> None: - with pytest.warns( - DeprecationWarning, - match="The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - ): - proxies = "https://www.example.com/proxy" - - client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True, proxies=proxies) - - mounts = list(client._client._mounts.keys()) - assert len(mounts) == 1 - - pattern = mounts[0].pattern - assert pattern == "all://" - - def test_proxies_option_mutually_exclusive_with_http_client(self) -> None: - with httpx.Client() as http_client: - with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `proxies`"): - with pytest.warns(DeprecationWarning): - Increase( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - proxies="https://www.example.com/proxy", - http_client=http_client, - ) + client.close() def test_copied_client_does_not_close_http(self) -> None: - client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied - assert not client.is_closed() + assert not test_client.is_closed() def test_client_context_manager(self) -> None: - client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) - with client as c2: - assert c2 is client + test_client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) + with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + def test_client_response_validation_error(self, respx_mock: MockRouter, client: Increase) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - self.client.get("/foo", cast_to=Model) + client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) + def test_client_max_retries_validation(self) -> None: + with pytest.raises(TypeError, match=r"max_retries cannot be None"): + Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None)) + @pytest.mark.respx(base_url=base_url) def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: class Model(BaseModel): @@ -796,11 +877,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): strict_client.get("/foo", cast_to=Model) - client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = client.get("/foo", cast_to=Model) + response = non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + strict_client.close() + non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -819,12 +903,13 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = Increase(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, client: Increase + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) calculated = client._calculate_retry_timeout(remaining_retries, options, headers) @@ -832,85 +917,206 @@ def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter, client: Increase) -> None: respx_mock.post("/accounts").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - self.client.post( - "/accounts", - body=cast(object, dict(name="My First Increase Account")), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + client.accounts.with_streaming_response.create(name="New Account!").__enter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(client) == 0 @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter, client: Increase) -> None: respx_mock.post("/accounts").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - self.client.post( - "/accounts", - body=cast(object, dict(name="My First Increase Account")), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + client.accounts.with_streaming_response.create(name="New Account!").__enter__() + assert _get_open_connections(client) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + def test_retries_taken( + self, + client: Increase, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/accounts").mock(side_effect=retry_handler) + + response = client.accounts.with_raw_response.create(name="New Account!") + + assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + def test_omit_retry_count_header( + self, client: Increase, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = client.with_options(max_retries=4) - assert _get_open_connections(self.client) == 0 + nb_retries = 0 + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) -class TestAsyncIncrease: - client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) + respx_mock.post("/accounts").mock(side_effect=retry_handler) + response = client.accounts.with_raw_response.create( + name="New Account!", extra_headers={"x-stainless-retry-count": Omit()} + ) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response(self, respx_mock: MockRouter) -> None: + def test_overwrite_retry_count_header( + self, client: Increase, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/accounts").mock(side_effect=retry_handler) + + response = client.accounts.with_raw_response.create( + name="New Account!", extra_headers={"x-stainless-retry-count": "42"} + ) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" + + def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) + + client = DefaultHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), + ) + + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects(self, respx_mock: MockRouter, client: Increase) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + def test_follow_redirects_disabled(self, respx_mock: MockRouter, client: Increase) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + client.post("/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response) + + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" + + +class TestAsyncIncrease: + @pytest.mark.respx(base_url=base_url) + async def test_raw_response(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_raw_response_for_binary(self, respx_mock: MockRouter) -> None: + async def test_raw_response_for_binary(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: respx_mock.post("/foo").mock( return_value=httpx.Response(200, headers={"Content-Type": "application/binary"}, content='{"foo": "bar"}') ) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) assert response.status_code == 200 assert isinstance(response, httpx.Response) assert response.json() == {"foo": "bar"} - def test_copy(self) -> None: - copied = self.client.copy() - assert id(copied) != id(self.client) + def test_copy(self, async_client: AsyncIncrease) -> None: + copied = async_client.copy() + assert id(copied) != id(async_client) - copied = self.client.copy(api_key="another My API Key") + copied = async_client.copy(api_key="another My API Key") assert copied.api_key == "another My API Key" - assert self.client.api_key == "My API Key" + assert async_client.api_key == "My API Key" - def test_copy_default_options(self) -> None: + def test_copy_default_options(self, async_client: AsyncIncrease) -> None: # options that have a default are overridden correctly - copied = self.client.copy(max_retries=7) + copied = async_client.copy(max_retries=7) assert copied.max_retries == 7 - assert self.client.max_retries == 2 + assert async_client.max_retries == 2 copied2 = copied.copy(max_retries=6) assert copied2.max_retries == 6 assert copied.max_retries == 7 # timeout - assert isinstance(self.client.timeout, httpx.Timeout) - copied = self.client.copy(timeout=None) + assert isinstance(async_client.timeout, httpx.Timeout) + copied = async_client.copy(timeout=None) assert copied.timeout is None - assert isinstance(self.client.timeout, httpx.Timeout) + assert isinstance(async_client.timeout, httpx.Timeout) - def test_copy_default_headers(self) -> None: + async def test_copy_default_headers(self) -> None: client = AsyncIncrease( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) @@ -943,8 +1149,9 @@ def test_copy_default_headers(self) -> None: match="`default_headers` and `set_default_headers` arguments are mutually exclusive", ): client.copy(set_default_headers={}, default_headers={"X-Foo": "Bar"}) + await client.close() - def test_copy_default_query(self) -> None: + async def test_copy_default_query(self) -> None: client = AsyncIncrease( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"foo": "bar"} ) @@ -980,13 +1187,15 @@ def test_copy_default_query(self) -> None: ): client.copy(set_default_query={}, default_query={"foo": "Bar"}) - def test_copy_signature(self) -> None: + await client.close() + + def test_copy_signature(self, async_client: AsyncIncrease) -> None: # ensure the same parameters that can be passed to the client are defined in the `.copy()` method init_signature = inspect.signature( # mypy doesn't like that we access the `__init__` property. - self.client.__init__, # type: ignore[misc] + async_client.__init__, # type: ignore[misc] ) - copy_signature = inspect.signature(self.client.copy) + copy_signature = inspect.signature(async_client.copy) exclude_params = {"transport", "proxies", "_strict_response_validation"} for name in init_signature.parameters.keys(): @@ -996,12 +1205,13 @@ def test_copy_signature(self) -> None: copy_param = copy_signature.parameters.get(name) assert copy_param is not None, f"copy() signature is missing the {name} param" - def test_copy_build_request(self) -> None: + @pytest.mark.skipif(sys.version_info >= (3, 10), reason="fails because of a memory leak that started from 3.12") + def test_copy_build_request(self, async_client: AsyncIncrease) -> None: options = FinalRequestOptions(method="get", url="/foo") def build_request(options: FinalRequestOptions) -> None: - client = self.client.copy() - client._build_request(options) + client_copy = async_client.copy() + client_copy._build_request(options) # ensure that the machinery is warmed up before tracing starts. build_request(options) @@ -1058,12 +1268,12 @@ def add_leak(leaks: list[tracemalloc.StatisticDiff], diff: tracemalloc.Statistic print(frame) raise AssertionError() - async def test_request_timeout(self) -> None: - request = self.client._build_request(FinalRequestOptions(method="get", url="/foo")) + async def test_request_timeout(self, async_client: AsyncIncrease) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo")) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT - request = self.client._build_request( + request = async_client._build_request( FinalRequestOptions(method="get", url="/foo", timeout=httpx.Timeout(100.0)) ) timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore @@ -1078,6 +1288,8 @@ async def test_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(0) + await client.close() + async def test_http_client_timeout_option(self) -> None: # custom timeout given to the httpx client should be used async with httpx.AsyncClient(timeout=None) as http_client: @@ -1089,6 +1301,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == httpx.Timeout(None) + await client.close() + # no timeout given to the httpx client should not use the httpx default async with httpx.AsyncClient() as http_client: client = AsyncIncrease( @@ -1099,6 +1313,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT + await client.close() + # explicitly passing the default timeout currently results in it being ignored async with httpx.AsyncClient(timeout=HTTPX_DEFAULT_TIMEOUT) as http_client: client = AsyncIncrease( @@ -1109,6 +1325,8 @@ async def test_http_client_timeout_option(self) -> None: timeout = httpx.Timeout(**request.extensions["timeout"]) # type: ignore assert timeout == DEFAULT_TIMEOUT # our default + await client.close() + def test_invalid_http_client(self) -> None: with pytest.raises(TypeError, match="Invalid `http_client` arg"): with httpx.Client() as http_client: @@ -1119,15 +1337,15 @@ def test_invalid_http_client(self) -> None: http_client=cast(Any, http_client), ) - def test_default_headers_option(self) -> None: - client = AsyncIncrease( + async def test_default_headers_option(self) -> None: + test_client = AsyncIncrease( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_headers={"X-Foo": "bar"} ) - request = client._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "bar" assert request.headers.get("x-stainless-lang") == "python" - client2 = AsyncIncrease( + test_client2 = AsyncIncrease( base_url=base_url, api_key=api_key, _strict_response_validation=True, @@ -1136,20 +1354,24 @@ def test_default_headers_option(self) -> None: "X-Stainless-Lang": "my-overriding-header", }, ) - request = client2._build_request(FinalRequestOptions(method="get", url="/foo")) + request = test_client2._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("x-foo") == "stainless" assert request.headers.get("x-stainless-lang") == "my-overriding-header" + await test_client.close() + await test_client2.close() + def test_validate_headers(self) -> None: client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) request = client._build_request(FinalRequestOptions(method="get", url="/foo")) assert request.headers.get("Authorization") == f"Bearer {api_key}" with pytest.raises(IncreaseError): - client2 = AsyncIncrease(base_url=base_url, api_key=None, _strict_response_validation=True) + with update_env(**{"INCREASE_API_KEY": Omit()}): + client2 = AsyncIncrease(base_url=base_url, api_key=None, _strict_response_validation=True) _ = client2 - def test_default_query_option(self) -> None: + async def test_default_query_option(self) -> None: client = AsyncIncrease( base_url=base_url, api_key=api_key, _strict_response_validation=True, default_query={"query_param": "bar"} ) @@ -1161,14 +1383,40 @@ def test_default_query_option(self) -> None: FinalRequestOptions( method="get", url="/foo", - params={"foo": "baz", "query_param": "overriden"}, + params={"foo": "baz", "query_param": "overridden"}, + ) + ) + url = httpx.URL(request.url) + assert dict(url.params) == {"foo": "baz", "query_param": "overridden"} + + await client.close() + + async def test_hardcoded_query_params_in_url(self, async_client: AsyncIncrease) -> None: + request = async_client._build_request(FinalRequestOptions(method="get", url="/foo?beta=true")) + url = httpx.URL(request.url) + assert dict(url.params) == {"beta": "true"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/foo?beta=true", + params={"limit": "10", "page": "abc"}, ) ) url = httpx.URL(request.url) - assert dict(url.params) == {"foo": "baz", "query_param": "overriden"} + assert dict(url.params) == {"beta": "true", "limit": "10", "page": "abc"} + + request = async_client._build_request( + FinalRequestOptions( + method="get", + url="/files/a%2Fb?beta=true", + params={"limit": "10"}, + ) + ) + assert request.url.raw_path == b"/files/a%2Fb?beta=true&limit=10" - def test_request_extra_json(self) -> None: - request = self.client._build_request( + def test_request_extra_json(self, client: Increase) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1179,7 +1427,7 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": False} - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1190,7 +1438,7 @@ def test_request_extra_json(self) -> None: assert data == {"baz": False} # `extra_json` takes priority over `json_data` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1201,8 +1449,8 @@ def test_request_extra_json(self) -> None: data = json.loads(request.content.decode("utf-8")) assert data == {"foo": "bar", "baz": None} - def test_request_extra_headers(self) -> None: - request = self.client._build_request( + def test_request_extra_headers(self, client: Increase) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1212,7 +1460,7 @@ def test_request_extra_headers(self) -> None: assert request.headers.get("X-Foo") == "Foo" # `extra_headers` takes priority over `default_headers` when keys clash - request = self.client.with_options(default_headers={"X-Bar": "true"})._build_request( + request = client.with_options(default_headers={"X-Bar": "true"})._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1223,8 +1471,8 @@ def test_request_extra_headers(self) -> None: ) assert request.headers.get("X-Bar") == "false" - def test_request_extra_query(self) -> None: - request = self.client._build_request( + def test_request_extra_query(self, client: Increase) -> None: + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1237,7 +1485,7 @@ def test_request_extra_query(self) -> None: assert params == {"my_query_param": "Foo"} # if both `query` and `extra_query` are given, they are merged - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1251,7 +1499,7 @@ def test_request_extra_query(self) -> None: assert params == {"bar": "1", "foo": "2"} # `extra_query` takes priority over `query` when keys clash - request = self.client._build_request( + request = client._build_request( FinalRequestOptions( method="post", url="/foo", @@ -1267,7 +1515,7 @@ def test_request_extra_query(self) -> None: def test_multipart_repeating_array(self, async_client: AsyncIncrease) -> None: request = async_client._build_request( FinalRequestOptions.construct( - method="get", + method="post", url="/foo", headers={"Content-Type": "multipart/form-data; boundary=6b7ba517decee4a450543ea6ae821c82"}, json_data={"array": ["foo", "bar"]}, @@ -1294,7 +1542,73 @@ def test_multipart_repeating_array(self, async_client: AsyncIncrease) -> None: ] @pytest.mark.respx(base_url=base_url) - async def test_basic_union_response(self, respx_mock: MockRouter) -> None: + async def test_binary_content_upload(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + response = await async_client.post( + "/upload", + content=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + async def test_binary_content_upload_with_asynciterator(self) -> None: + file_content = b"Hello, this is a test file." + counter = Counter() + iterator = _make_async_iterator([file_content], counter=counter) + + async def mock_handler(request: httpx.Request) -> httpx.Response: + assert counter.value == 0, "the request body should not have been read" + return httpx.Response(200, content=await request.aread()) + + async with AsyncIncrease( + base_url=base_url, + api_key=api_key, + _strict_response_validation=True, + http_client=httpx.AsyncClient(transport=MockTransport(handler=mock_handler)), + ) as client: + response = await client.post( + "/upload", + content=iterator, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + assert counter.value == 1 + + @pytest.mark.respx(base_url=base_url) + async def test_binary_content_upload_with_body_is_deprecated( + self, respx_mock: MockRouter, async_client: AsyncIncrease + ) -> None: + respx_mock.post("/upload").mock(side_effect=mirror_request_content) + + file_content = b"Hello, this is a test file." + + with pytest.deprecated_call( + match="Passing raw bytes as `body` is deprecated and will be removed in a future version. Please pass raw bytes via the `content` parameter instead." + ): + response = await async_client.post( + "/upload", + body=file_content, + cast_to=httpx.Response, + options={"headers": {"Content-Type": "application/octet-stream"}}, + ) + + assert response.status_code == 200 + assert response.request.headers["Content-Type"] == "application/octet-stream" + assert response.content == file_content + + @pytest.mark.respx(base_url=base_url) + async def test_basic_union_response(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: class Model1(BaseModel): name: str @@ -1303,12 +1617,12 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" @pytest.mark.respx(base_url=base_url) - async def test_union_response_different_types(self, respx_mock: MockRouter) -> None: + async def test_union_response_different_types(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: """Union of objects with the same field name using a different type""" class Model1(BaseModel): @@ -1319,18 +1633,20 @@ class Model2(BaseModel): respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": "bar"})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model2) assert response.foo == "bar" respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": 1})) - response = await self.client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) + response = await async_client.get("/foo", cast_to=cast(Any, Union[Model1, Model2])) assert isinstance(response, Model1) assert response.foo == 1 @pytest.mark.respx(base_url=base_url) - async def test_non_application_json_content_type_for_json_data(self, respx_mock: MockRouter) -> None: + async def test_non_application_json_content_type_for_json_data( + self, respx_mock: MockRouter, async_client: AsyncIncrease + ) -> None: """ Response that sets Content-Type to something other than application/json but returns json data """ @@ -1346,29 +1662,29 @@ class Model(BaseModel): ) ) - response = await self.client.get("/foo", cast_to=Model) + response = await async_client.get("/foo", cast_to=Model) assert isinstance(response, Model) assert response.foo == 2 @pytest.mark.respx(base_url=base_url) - async def test_idempotency_header_options(self, respx_mock: MockRouter) -> None: + async def test_idempotency_header_options(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: respx_mock.post("/foo").mock(return_value=httpx.Response(200, json={})) - response = await self.client.post("/foo", cast_to=httpx.Response) + response = await async_client.post("/foo", cast_to=httpx.Response) header = response.request.headers.get("Idempotency-Key") assert header is not None assert header.startswith("stainless-python-retry") # explicit header - response = await self.client.post( + response = await async_client.post( "/foo", cast_to=httpx.Response, options=make_request_options(extra_headers={"Idempotency-Key": "custom-key"}), ) assert response.request.headers.get("Idempotency-Key") == "custom-key" - response = await self.client.post( + response = await async_client.post( "/foo", cast_to=httpx.Response, options=make_request_options(extra_headers={"idempotency-key": "custom-key"}), @@ -1376,12 +1692,12 @@ async def test_idempotency_header_options(self, respx_mock: MockRouter) -> None: assert response.request.headers.get("Idempotency-Key") == "custom-key" # custom argument - response = await self.client.post( + response = await async_client.post( "/foo", cast_to=httpx.Response, options=make_request_options(idempotency_key="custom-key") ) assert response.request.headers.get("Idempotency-Key") == "custom-key" - def test_base_url_setter(self) -> None: + async def test_base_url_setter(self) -> None: client = AsyncIncrease( base_url="https://example.com/from_init", api_key=api_key, _strict_response_validation=True ) @@ -1391,7 +1707,9 @@ def test_base_url_setter(self) -> None: assert client.base_url == "https://example.com/from_setter/" - def test_base_url_env(self) -> None: + await client.close() + + async def test_base_url_env(self) -> None: with update_env(INCREASE_BASE_URL="http://localhost:5000/from/env"): client = AsyncIncrease(api_key=api_key, _strict_response_validation=True) assert client.base_url == "http://localhost:5000/from/env/" @@ -1406,6 +1724,8 @@ def test_base_url_env(self) -> None: ) assert str(client.base_url).startswith("https://api.increase.com") + await client.close() + @pytest.mark.parametrize( "client", [ @@ -1421,7 +1741,7 @@ def test_base_url_env(self) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_trailing_slash(self, client: AsyncIncrease) -> None: + async def test_base_url_trailing_slash(self, client: AsyncIncrease) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1430,6 +1750,7 @@ def test_base_url_trailing_slash(self, client: AsyncIncrease) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1446,7 +1767,7 @@ def test_base_url_trailing_slash(self, client: AsyncIncrease) -> None: ], ids=["standard", "custom http client"], ) - def test_base_url_no_trailing_slash(self, client: AsyncIncrease) -> None: + async def test_base_url_no_trailing_slash(self, client: AsyncIncrease) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1455,6 +1776,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncIncrease) -> None: ), ) assert request.url == "http://localhost:5000/custom/path/foo" + await client.close() @pytest.mark.parametrize( "client", @@ -1471,7 +1793,7 @@ def test_base_url_no_trailing_slash(self, client: AsyncIncrease) -> None: ], ids=["standard", "custom http client"], ) - def test_absolute_request_url(self, client: AsyncIncrease) -> None: + async def test_absolute_request_url(self, client: AsyncIncrease) -> None: request = client._build_request( FinalRequestOptions( method="post", @@ -1480,137 +1802,47 @@ def test_absolute_request_url(self, client: AsyncIncrease) -> None: ), ) assert request.url == "https://myapi.com/foo" - - def test_transport_option_is_deprecated(self) -> None: - with pytest.warns( - DeprecationWarning, - match="The `transport` argument is deprecated. The `http_client` argument should be passed instead", - ): - transport = httpx.MockTransport( - lambda: None, # type: ignore - ) - - client = AsyncIncrease( - base_url=base_url, api_key=api_key, _strict_response_validation=True, transport=transport - ) - - assert client._client._transport is transport - - async def test_transport_option_mutually_exclusive_with_http_client(self) -> None: - async with httpx.AsyncClient() as http_client: - with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `transport`"): - with pytest.warns(DeprecationWarning): - AsyncIncrease( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - transport=httpx.MockTransport( - lambda: None, # type: ignore - ), - http_client=http_client, - ) - - def test_connection_pool_limits_option_is_deprecated(self) -> None: - with pytest.warns( - DeprecationWarning, - match="The `connection_pool_limits` argument is deprecated. The `http_client` argument should be passed instead", - ): - connection_pool_limits = httpx.Limits( - max_connections=101, max_keepalive_connections=76, keepalive_expiry=23 - ) - - client = AsyncIncrease( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - connection_pool_limits=connection_pool_limits, - ) - - assert isinstance(client._client._transport, httpx.AsyncHTTPTransport) - assert client._client._transport._pool._max_connections == 101 - assert client._client._transport._pool._max_keepalive_connections == 76 - assert client._client._transport._pool._keepalive_expiry == 23 - - async def test_connection_pool_limits_option_mutually_exclusive_with_http_client(self) -> None: - async with httpx.AsyncClient() as http_client: - with pytest.raises( - ValueError, match="The `http_client` argument is mutually exclusive with `connection_pool_limits`" - ): - with pytest.warns(DeprecationWarning): - AsyncIncrease( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - connection_pool_limits=httpx.Limits( - max_connections=101, max_keepalive_connections=76, keepalive_expiry=23 - ), - http_client=http_client, - ) - - def test_proxies_option_is_deprecated(self) -> None: - with pytest.warns( - DeprecationWarning, - match="The `proxies` argument is deprecated. The `http_client` argument should be passed instead", - ): - proxies = "https://www.example.com/proxy" - - client = AsyncIncrease( - base_url=base_url, api_key=api_key, _strict_response_validation=True, proxies=proxies - ) - - mounts = list(client._client._mounts.keys()) - assert len(mounts) == 1 - - pattern = mounts[0].pattern - assert pattern == "all://" - - async def test_proxies_option_mutually_exclusive_with_http_client(self) -> None: - async with httpx.AsyncClient() as http_client: - with pytest.raises(ValueError, match="The `http_client` argument is mutually exclusive with `proxies`"): - with pytest.warns(DeprecationWarning): - AsyncIncrease( - base_url=base_url, - api_key=api_key, - _strict_response_validation=True, - proxies="https://www.example.com/proxy", - http_client=http_client, - ) + await client.close() async def test_copied_client_does_not_close_http(self) -> None: - client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) - assert not client.is_closed() + test_client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) + assert not test_client.is_closed() - copied = client.copy() - assert copied is not client + copied = test_client.copy() + assert copied is not test_client del copied await asyncio.sleep(0.2) - assert not client.is_closed() + assert not test_client.is_closed() async def test_client_context_manager(self) -> None: - client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) - async with client as c2: - assert c2 is client + test_client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) + async with test_client as c2: + assert c2 is test_client assert not c2.is_closed() - assert not client.is_closed() - assert client.is_closed() + assert not test_client.is_closed() + assert test_client.is_closed() @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio - async def test_client_response_validation_error(self, respx_mock: MockRouter) -> None: + async def test_client_response_validation_error(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: class Model(BaseModel): foo: str respx_mock.get("/foo").mock(return_value=httpx.Response(200, json={"foo": {"invalid": True}})) with pytest.raises(APIResponseValidationError) as exc: - await self.client.get("/foo", cast_to=Model) + await async_client.get("/foo", cast_to=Model) assert isinstance(exc.value.__cause__, ValidationError) + async def test_client_max_retries_validation(self) -> None: + with pytest.raises(TypeError, match=r"max_retries cannot be None"): + AsyncIncrease( + base_url=base_url, api_key=api_key, _strict_response_validation=True, max_retries=cast(Any, None) + ) + @pytest.mark.respx(base_url=base_url) - @pytest.mark.asyncio async def test_received_text_for_expected_json(self, respx_mock: MockRouter) -> None: class Model(BaseModel): name: str @@ -1622,11 +1854,14 @@ class Model(BaseModel): with pytest.raises(APIResponseValidationError): await strict_client.get("/foo", cast_to=Model) - client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=False) + non_strict_client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=False) - response = await client.get("/foo", cast_to=Model) + response = await non_strict_client.get("/foo", cast_to=Model) assert isinstance(response, str) # type: ignore[unreachable] + await strict_client.close() + await non_strict_client.close() + @pytest.mark.parametrize( "remaining_retries,retry_after,timeout", [ @@ -1645,44 +1880,179 @@ class Model(BaseModel): [3, "", 0.5], [2, "", 0.5 * 2.0], [1, "", 0.5 * 4.0], + [-1100, "", 8], # test large number potentially overflowing ], ) @mock.patch("time.time", mock.MagicMock(return_value=1696004797)) - @pytest.mark.asyncio - async def test_parse_retry_after_header(self, remaining_retries: int, retry_after: str, timeout: float) -> None: - client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True) - + async def test_parse_retry_after_header( + self, remaining_retries: int, retry_after: str, timeout: float, async_client: AsyncIncrease + ) -> None: headers = httpx.Headers({"retry-after": retry_after}) options = FinalRequestOptions(method="get", url="/foo", max_retries=3) - calculated = client._calculate_retry_timeout(remaining_retries, options, headers) + calculated = async_client._calculate_retry_timeout(remaining_retries, options, headers) assert calculated == pytest.approx(timeout, 0.5 * 0.875) # pyright: ignore[reportUnknownMemberType] @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_timeout_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + async def test_retrying_timeout_errors_doesnt_leak( + self, respx_mock: MockRouter, async_client: AsyncIncrease + ) -> None: respx_mock.post("/accounts").mock(side_effect=httpx.TimeoutException("Test timeout error")) with pytest.raises(APITimeoutError): - await self.client.post( - "/accounts", - body=cast(object, dict(name="My First Increase Account")), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, - ) + await async_client.accounts.with_streaming_response.create(name="New Account!").__aenter__() - assert _get_open_connections(self.client) == 0 + assert _get_open_connections(async_client) == 0 @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) @pytest.mark.respx(base_url=base_url) - async def test_retrying_status_errors_doesnt_leak(self, respx_mock: MockRouter) -> None: + async def test_retrying_status_errors_doesnt_leak( + self, respx_mock: MockRouter, async_client: AsyncIncrease + ) -> None: respx_mock.post("/accounts").mock(return_value=httpx.Response(500)) with pytest.raises(APIStatusError): - await self.client.post( - "/accounts", - body=cast(object, dict(name="My First Increase Account")), - cast_to=httpx.Response, - options={"headers": {RAW_RESPONSE_HEADER: "stream"}}, + await async_client.accounts.with_streaming_response.create(name="New Account!").__aenter__() + assert _get_open_connections(async_client) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + @pytest.mark.parametrize("failure_mode", ["status", "exception"]) + async def test_retries_taken( + self, + async_client: AsyncIncrease, + failures_before_success: int, + failure_mode: Literal["status", "exception"], + respx_mock: MockRouter, + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + if failure_mode == "exception": + raise RuntimeError("oops") + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/accounts").mock(side_effect=retry_handler) + + response = await client.accounts.with_raw_response.create(name="New Account!") + + assert response.retries_taken == failures_before_success + assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_omit_retry_count_header( + self, async_client: AsyncIncrease, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/accounts").mock(side_effect=retry_handler) + + response = await client.accounts.with_raw_response.create( + name="New Account!", extra_headers={"x-stainless-retry-count": Omit()} + ) + + assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0 + + @pytest.mark.parametrize("failures_before_success", [0, 2, 4]) + @mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout) + @pytest.mark.respx(base_url=base_url) + async def test_overwrite_retry_count_header( + self, async_client: AsyncIncrease, failures_before_success: int, respx_mock: MockRouter + ) -> None: + client = async_client.with_options(max_retries=4) + + nb_retries = 0 + + def retry_handler(_request: httpx.Request) -> httpx.Response: + nonlocal nb_retries + if nb_retries < failures_before_success: + nb_retries += 1 + return httpx.Response(500) + return httpx.Response(200) + + respx_mock.post("/accounts").mock(side_effect=retry_handler) + + response = await client.accounts.with_raw_response.create( + name="New Account!", extra_headers={"x-stainless-retry-count": "42"} + ) + + assert response.http_request.headers.get("x-stainless-retry-count") == "42" + + async def test_get_platform(self) -> None: + platform = await asyncify(get_platform)() + assert isinstance(platform, (str, OtherPlatform)) + + async def test_proxy_environment_variables(self, monkeypatch: pytest.MonkeyPatch) -> None: + # Test that the proxy environment variables are set correctly + monkeypatch.setenv("HTTPS_PROXY", "https://example.org") + # Delete in case our environment has any proxy env vars set + monkeypatch.delenv("HTTP_PROXY", raising=False) + monkeypatch.delenv("ALL_PROXY", raising=False) + monkeypatch.delenv("NO_PROXY", raising=False) + monkeypatch.delenv("http_proxy", raising=False) + monkeypatch.delenv("https_proxy", raising=False) + monkeypatch.delenv("all_proxy", raising=False) + monkeypatch.delenv("no_proxy", raising=False) + + client = DefaultAsyncHttpxClient() + + mounts = tuple(client._mounts.items()) + assert len(mounts) == 1 + assert mounts[0][0].pattern == "https://" + + @pytest.mark.filterwarnings("ignore:.*deprecated.*:DeprecationWarning") + async def test_default_client_creation(self) -> None: + # Ensure that the client can be initialized without any exceptions + DefaultAsyncHttpxClient( + verify=True, + cert=None, + trust_env=True, + http1=True, + http2=False, + limits=httpx.Limits(max_connections=100, max_keepalive_connections=20), + ) + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: + # Test that the default follow_redirects=True allows following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + respx_mock.get("/redirected").mock(return_value=httpx.Response(200, json={"status": "ok"})) + + response = await async_client.post("/redirect", body={"key": "value"}, cast_to=httpx.Response) + assert response.status_code == 200 + assert response.json() == {"status": "ok"} + + @pytest.mark.respx(base_url=base_url) + async def test_follow_redirects_disabled(self, respx_mock: MockRouter, async_client: AsyncIncrease) -> None: + # Test that follow_redirects=False prevents following redirects + respx_mock.post("/redirect").mock( + return_value=httpx.Response(302, headers={"Location": f"{base_url}/redirected"}) + ) + + with pytest.raises(APIStatusError) as exc_info: + await async_client.post( + "/redirect", body={"key": "value"}, options={"follow_redirects": False}, cast_to=httpx.Response ) - assert _get_open_connections(self.client) == 0 + assert exc_info.value.response.status_code == 302 + assert exc_info.value.response.headers["Location"] == f"{base_url}/redirected" diff --git a/tests/test_deepcopy.py b/tests/test_deepcopy.py index 763770927..8ffa7c5f2 100644 --- a/tests/test_deepcopy.py +++ b/tests/test_deepcopy.py @@ -41,8 +41,7 @@ def test_nested_list() -> None: assert_different_identities(obj1[1], obj2[1]) -class MyObject: - ... +class MyObject: ... def test_ignores_other_types() -> None: diff --git a/tests/test_extract_files.py b/tests/test_extract_files.py index 6f7d0b073..46d64967e 100644 --- a/tests/test_extract_files.py +++ b/tests/test_extract_files.py @@ -35,6 +35,15 @@ def test_multiple_files() -> None: assert query == {"documents": [{}, {}]} +def test_top_level_file_array() -> None: + query = {"files": [b"file one", b"file two"], "title": "hello"} + assert extract_files(query, paths=[["files", ""]]) == [ + ("files[]", b"file one"), + ("files[]", b"file two"), + ] + assert query == {"title": "hello"} + + @pytest.mark.parametrize( "query,paths,expected", [ diff --git a/tests/test_legacy_response.py b/tests/test_legacy_response.py deleted file mode 100644 index f1199aa64..000000000 --- a/tests/test_legacy_response.py +++ /dev/null @@ -1,84 +0,0 @@ -import json -from typing import cast -from typing_extensions import Annotated - -import httpx -import pytest -import pydantic - -from increase import Increase, BaseModel -from increase._streaming import Stream -from increase._base_client import FinalRequestOptions -from increase._legacy_response import LegacyAPIResponse - - -class PydanticModel(pydantic.BaseModel): - ... - - -def test_response_parse_mismatched_basemodel(client: Increase) -> None: - response = LegacyAPIResponse( - raw=httpx.Response(200, content=b"foo"), - client=client, - stream=False, - stream_cls=None, - cast_to=str, - options=FinalRequestOptions.construct(method="get", url="/foo"), - ) - - with pytest.raises( - TypeError, - match="Pydantic models must subclass our base model type, e.g. `from increase import BaseModel`", - ): - response.parse(to=PydanticModel) - - -def test_response_parse_custom_stream(client: Increase) -> None: - response = LegacyAPIResponse( - raw=httpx.Response(200, content=b"foo"), - client=client, - stream=True, - stream_cls=None, - cast_to=str, - options=FinalRequestOptions.construct(method="get", url="/foo"), - ) - - stream = response.parse(to=Stream[int]) - assert stream._cast_to == int - - -class CustomModel(BaseModel): - foo: str - bar: int - - -def test_response_parse_custom_model(client: Increase) -> None: - response = LegacyAPIResponse( - raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), - client=client, - stream=False, - stream_cls=None, - cast_to=str, - options=FinalRequestOptions.construct(method="get", url="/foo"), - ) - - obj = response.parse(to=CustomModel) - assert obj.foo == "hello!" - assert obj.bar == 2 - - -def test_response_parse_annotated_type(client: Increase) -> None: - response = LegacyAPIResponse( - raw=httpx.Response(200, content=json.dumps({"foo": "hello!", "bar": 2})), - client=client, - stream=False, - stream_cls=None, - cast_to=str, - options=FinalRequestOptions.construct(method="get", url="/foo"), - ) - - obj = response.parse( - to=cast("type[CustomModel]", Annotated[CustomModel, "random metadata"]), - ) - assert obj.foo == "hello!" - assert obj.bar == 2 diff --git a/tests/test_models.py b/tests/test_models.py index 00dd71bcd..7cc1f2b9f 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,15 +1,15 @@ import json -from typing import Any, Dict, List, Union, Optional, cast +from typing import TYPE_CHECKING, Any, Dict, List, Union, Optional, cast from datetime import datetime, timezone -from typing_extensions import Literal, Annotated +from typing_extensions import Literal, Annotated, TypeAliasType import pytest import pydantic from pydantic import Field from increase._utils import PropertyInfo -from increase._compat import PYDANTIC_V2, parse_obj, model_dump, model_json -from increase._models import BaseModel, construct_type +from increase._compat import PYDANTIC_V1, parse_obj, model_dump, model_json +from increase._models import DISCRIMINATOR_CACHE, BaseModel, construct_type class BasicModel(BaseModel): @@ -31,7 +31,7 @@ class NestedModel(BaseModel): # mismatched types m = NestedModel.construct(nested="hello!") - assert m.nested == "hello!" + assert cast(Any, m.nested) == "hello!" def test_optional_nested_model() -> None: @@ -48,7 +48,7 @@ class NestedModel(BaseModel): # mismatched types m3 = NestedModel.construct(nested={"foo"}) assert isinstance(cast(Any, m3.nested), set) - assert m3.nested == {"foo"} + assert cast(Any, m3.nested) == {"foo"} def test_list_nested_model() -> None: @@ -245,7 +245,7 @@ class Model(BaseModel): assert m.foo is True m = Model.construct(foo="CARD_HOLDER") - assert m.foo is "CARD_HOLDER" + assert m.foo == "CARD_HOLDER" m = Model.construct(foo={"bar": False}) assert isinstance(m.foo, Submodel1) @@ -294,12 +294,12 @@ class Model(BaseModel): assert cast(bool, m.foo) is True m = Model.construct(foo={"name": 3}) - if PYDANTIC_V2: - assert isinstance(m.foo, Submodel1) - assert m.foo.name == 3 # type: ignore - else: + if PYDANTIC_V1: assert isinstance(m.foo, Submodel2) assert m.foo.name == "3" + else: + assert isinstance(m.foo, Submodel1) + assert m.foo.name == 3 # type: ignore def test_list_of_unions() -> None: @@ -323,7 +323,7 @@ class Model(BaseModel): assert len(m.items) == 2 assert isinstance(m.items[0], Submodel1) assert m.items[0].level == -1 - assert m.items[1] == 156 + assert cast(Any, m.items[1]) == 156 def test_union_of_lists() -> None: @@ -355,7 +355,7 @@ class Model(BaseModel): assert len(m.items) == 2 assert isinstance(m.items[0], SubModel1) assert m.items[0].level == -1 - assert m.items[1] == 156 + assert cast(Any, m.items[1]) == 156 def test_dict_of_union() -> None: @@ -426,10 +426,10 @@ class Model(BaseModel): expected = datetime(2019, 12, 27, 18, 11, 19, 117000, tzinfo=timezone.utc) - if PYDANTIC_V2: - expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' - else: + if PYDANTIC_V1: expected_json = '{"created_at": "2019-12-27T18:11:19.117000+00:00"}' + else: + expected_json = '{"created_at":"2019-12-27T18:11:19.117000Z"}' model = Model.construct(created_at="2019-12-27T18:11:19.117Z") assert model.created_at == expected @@ -492,15 +492,50 @@ class Model(BaseModel): resource_id: Optional[str] = None m = Model.construct() + assert m.resource_id is None assert "resource_id" not in m.model_fields_set m = Model.construct(resource_id=None) + assert m.resource_id is None assert "resource_id" in m.model_fields_set m = Model.construct(resource_id="foo") + assert m.resource_id == "foo" assert "resource_id" in m.model_fields_set +def test_to_dict() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert m.to_dict() == {"FOO": "hello"} + assert m.to_dict(use_api_names=False) == {"foo": "hello"} + + m2 = Model() + assert m2.to_dict() == {} + assert m2.to_dict(exclude_unset=False) == {"FOO": None} + assert m2.to_dict(exclude_unset=False, exclude_none=True) == {} + assert m2.to_dict(exclude_unset=False, exclude_defaults=True) == {} + + m3 = Model(FOO=None) + assert m3.to_dict() == {"FOO": None} + assert m3.to_dict(exclude_none=True) == {} + assert m3.to_dict(exclude_defaults=True) == {} + + class Model2(BaseModel): + created_at: datetime + + time_str = "2024-03-21T11:39:01.275859" + m4 = Model2.construct(created_at=time_str) + assert m4.to_dict(mode="python") == {"created_at": datetime.fromisoformat(time_str)} + assert m4.to_dict(mode="json") == {"created_at": time_str} + + if PYDANTIC_V1: + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_dict(warnings=False) + + def test_forwards_compat_model_dump_method() -> None: class Model(BaseModel): foo: Optional[str] = Field(alias="FOO", default=None) @@ -521,10 +556,7 @@ class Model(BaseModel): assert m3.model_dump() == {"foo": None} assert m3.model_dump(exclude_none=True) == {} - if not PYDANTIC_V2: - with pytest.raises(ValueError, match="mode is only supported in Pydantic v2"): - m.model_dump(mode="json") - + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump(round_trip=True) @@ -532,6 +564,42 @@ class Model(BaseModel): m.model_dump(warnings=False) +def test_compat_method_no_error_for_warnings() -> None: + class Model(BaseModel): + foo: Optional[str] + + m = Model(foo="hello") + assert isinstance(model_dump(m, warnings=False), dict) + + +def test_to_json() -> None: + class Model(BaseModel): + foo: Optional[str] = Field(alias="FOO", default=None) + + m = Model(FOO="hello") + assert json.loads(m.to_json()) == {"FOO": "hello"} + assert json.loads(m.to_json(use_api_names=False)) == {"foo": "hello"} + + if PYDANTIC_V1: + assert m.to_json(indent=None) == '{"FOO": "hello"}' + else: + assert m.to_json(indent=None) == '{"FOO":"hello"}' + + m2 = Model() + assert json.loads(m2.to_json()) == {} + assert json.loads(m2.to_json(exclude_unset=False)) == {"FOO": None} + assert json.loads(m2.to_json(exclude_unset=False, exclude_none=True)) == {} + assert json.loads(m2.to_json(exclude_unset=False, exclude_defaults=True)) == {} + + m3 = Model(FOO=None) + assert json.loads(m3.to_json()) == {"FOO": None} + assert json.loads(m3.to_json(exclude_none=True)) == {} + + if PYDANTIC_V1: + with pytest.raises(ValueError, match="warnings is only supported in Pydantic v2"): + m.to_json(warnings=False) + + def test_forwards_compat_model_dump_json_method() -> None: class Model(BaseModel): foo: Optional[str] = Field(alias="FOO", default=None) @@ -554,7 +622,7 @@ class Model(BaseModel): assert json.loads(m3.model_dump_json()) == {"foo": None} assert json.loads(m3.model_dump_json(exclude_none=True)) == {} - if not PYDANTIC_V2: + if PYDANTIC_V1: with pytest.raises(ValueError, match="round_trip is only supported in Pydantic v2"): m.model_dump_json(round_trip=True) @@ -611,12 +679,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_unknown_variant() -> None: @@ -700,12 +768,12 @@ class B(BaseModel): ) assert isinstance(m, A) assert m.foo_type == "a" - if PYDANTIC_V2: - assert m.data == 100 # type: ignore[comparison-overlap] - else: + if PYDANTIC_V1: # pydantic v1 automatically converts inputs to strings # if the expected type is a str assert m.data == "100" + else: + assert m.data == 100 # type: ignore[comparison-overlap] def test_discriminated_unions_overlapping_discriminators_invalid_data() -> None: @@ -741,7 +809,7 @@ class B(BaseModel): UnionType = cast(Any, Union[A, B]) - assert not hasattr(UnionType, "__discriminator__") + assert not DISCRIMINATOR_CACHE.get(UnionType) m = construct_type( value={"type": "b", "data": "foo"}, type_=cast(Any, Annotated[UnionType, PropertyInfo(discriminator="type")]) @@ -750,7 +818,7 @@ class B(BaseModel): assert m.type == "b" assert m.data == "foo" # type: ignore[comparison-overlap] - discriminator = UnionType.__discriminator__ + discriminator = DISCRIMINATOR_CACHE.get(UnionType) assert discriminator is not None m = construct_type( @@ -762,4 +830,134 @@ class B(BaseModel): # if the discriminator details object stays the same between invocations then # we hit the cache - assert UnionType.__discriminator__ is discriminator + assert DISCRIMINATOR_CACHE.get(UnionType) is discriminator + + +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") +def test_type_alias_type() -> None: + Alias = TypeAliasType("Alias", str) # pyright: ignore + + class Model(BaseModel): + alias: Alias + union: Union[int, Alias] + + m = construct_type(value={"alias": "foo", "union": "bar"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.alias, str) + assert m.alias == "foo" + assert isinstance(m.union, str) + assert m.union == "bar" + + +@pytest.mark.skipif(PYDANTIC_V1, reason="TypeAliasType is not supported in Pydantic v1") +def test_field_named_cls() -> None: + class Model(BaseModel): + cls: str + + m = construct_type(value={"cls": "foo"}, type_=Model) + assert isinstance(m, Model) + assert isinstance(m.cls, str) + + +def test_discriminated_union_case() -> None: + class A(BaseModel): + type: Literal["a"] + + data: bool + + class B(BaseModel): + type: Literal["b"] + + data: List[Union[A, object]] + + class ModelA(BaseModel): + type: Literal["modelA"] + + data: int + + class ModelB(BaseModel): + type: Literal["modelB"] + + required: str + + data: Union[A, B] + + # when constructing ModelA | ModelB, value data doesn't match ModelB exactly - missing `required` + m = construct_type( + value={"type": "modelB", "data": {"type": "a", "data": True}}, + type_=cast(Any, Annotated[Union[ModelA, ModelB], PropertyInfo(discriminator="type")]), + ) + + assert isinstance(m, ModelB) + + +def test_nested_discriminated_union() -> None: + class InnerType1(BaseModel): + type: Literal["type_1"] + + class InnerModel(BaseModel): + inner_value: str + + class InnerType2(BaseModel): + type: Literal["type_2"] + some_inner_model: InnerModel + + class Type1(BaseModel): + base_type: Literal["base_type_1"] + value: Annotated[ + Union[ + InnerType1, + InnerType2, + ], + PropertyInfo(discriminator="type"), + ] + + class Type2(BaseModel): + base_type: Literal["base_type_2"] + + T = Annotated[ + Union[ + Type1, + Type2, + ], + PropertyInfo(discriminator="base_type"), + ] + + model = construct_type( + type_=T, + value={ + "base_type": "base_type_1", + "value": { + "type": "type_2", + }, + }, + ) + assert isinstance(model, Type1) + assert isinstance(model.value, InnerType2) + + +@pytest.mark.skipif(PYDANTIC_V1, reason="this is only supported in pydantic v2 for now") +def test_extra_properties() -> None: + class Item(BaseModel): + prop: int + + class Model(BaseModel): + __pydantic_extra__: Dict[str, Item] = Field(init=False) # pyright: ignore[reportIncompatibleVariableOverride] + + other: str + + if TYPE_CHECKING: + + def __getattr__(self, attr: str) -> Item: ... + + model = construct_type( + type_=Model, + value={ + "a": {"prop": 1}, + "other": "foo", + }, + ) + assert isinstance(model, Model) + assert model.a.prop == 1 + assert isinstance(model.a, Item) + assert model.other == "foo" diff --git a/tests/test_response.py b/tests/test_response.py index 7da95c19c..4d7f6e009 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -1,5 +1,5 @@ import json -from typing import List, cast +from typing import Any, List, Union, cast from typing_extensions import Annotated import httpx @@ -19,16 +19,13 @@ from increase._base_client import FinalRequestOptions -class ConcreteBaseAPIResponse(APIResponse[bytes]): - ... +class ConcreteBaseAPIResponse(APIResponse[bytes]): ... -class ConcreteAPIResponse(APIResponse[List[str]]): - ... +class ConcreteAPIResponse(APIResponse[List[str]]): ... -class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): - ... +class ConcreteAsyncAPIResponse(APIResponse[httpx.Response]): ... def test_extract_response_type_direct_classes() -> None: @@ -56,8 +53,7 @@ def test_extract_response_type_binary_response() -> None: assert extract_response_type(AsyncBinaryAPIResponse) == bytes -class PydanticModel(pydantic.BaseModel): - ... +class PydanticModel(pydantic.BaseModel): ... def test_response_parse_mismatched_basemodel(client: Increase) -> None: @@ -192,3 +188,90 @@ async def test_async_response_parse_annotated_type(async_client: AsyncIncrease) ) assert obj.foo == "hello!" assert obj.bar == 2 + + +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +def test_response_parse_bool(client: Increase, content: str, expected: bool) -> None: + response = APIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = response.parse(to=bool) + assert result is expected + + +@pytest.mark.parametrize( + "content, expected", + [ + ("false", False), + ("true", True), + ("False", False), + ("True", True), + ("TrUe", True), + ("FalSe", False), + ], +) +async def test_async_response_parse_bool(client: AsyncIncrease, content: str, expected: bool) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=content), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + result = await response.parse(to=bool) + assert result is expected + + +class OtherModel(BaseModel): + a: str + + +@pytest.mark.parametrize("client", [False], indirect=True) # loose validation +def test_response_parse_expect_model_union_non_json_content(client: Increase) -> None: + response = APIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" + + +@pytest.mark.asyncio +@pytest.mark.parametrize("async_client", [False], indirect=True) # loose validation +async def test_async_response_parse_expect_model_union_non_json_content(async_client: AsyncIncrease) -> None: + response = AsyncAPIResponse( + raw=httpx.Response(200, content=b"foo", headers={"Content-Type": "application/text"}), + client=async_client, + stream=False, + stream_cls=None, + cast_to=str, + options=FinalRequestOptions.construct(method="get", url="/foo"), + ) + + obj = await response.parse(to=cast(Any, Union[CustomModel, OtherModel])) + assert isinstance(obj, str) + assert obj == "foo" diff --git a/tests/test_streaming.py b/tests/test_streaming.py index dca908dd3..4dd59699e 100644 --- a/tests/test_streaming.py +++ b/tests/test_streaming.py @@ -1,104 +1,248 @@ +from __future__ import annotations + from typing import Iterator, AsyncIterator +import httpx import pytest -from increase._streaming import SSEDecoder +from increase import Increase, AsyncIncrease +from increase._streaming import Stream, AsyncStream, ServerSentEvent @pytest.mark.asyncio -async def test_basic_async() -> None: - async def body() -> AsyncIterator[str]: - yield "event: completion" - yield 'data: {"foo":true}' - yield "" - - async for sse in SSEDecoder().aiter(body()): - assert sse.event == "completion" - assert sse.json() == {"foo": True} +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_basic(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b"event: completion\n" + yield b'data: {"foo":true}\n' + yield b"\n" + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) -def test_basic() -> None: - def body() -> Iterator[str]: - yield "event: completion" - yield 'data: {"foo":true}' - yield "" - - it = SSEDecoder().iter(body()) - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "completion" assert sse.json() == {"foo": True} - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) -def test_data_missing_event() -> None: - def body() -> Iterator[str]: - yield 'data: {"foo":true}' - yield "" +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_missing_event(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"foo":true}\n' + yield b"\n" - it = SSEDecoder().iter(body()) - sse = next(it) + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) assert sse.event is None assert sse.json() == {"foo": True} - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_event_missing_data(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" -def test_event_missing_data() -> None: - def body() -> Iterator[str]: - yield "event: ping" - yield "" + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) - it = SSEDecoder().iter(body()) - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "ping" assert sse.data == "" - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) -def test_multiple_events() -> None: - def body() -> Iterator[str]: - yield "event: ping" - yield "" - yield "event: completion" - yield "" +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"\n" + yield b"event: completion\n" + yield b"\n" - it = SSEDecoder().iter(body()) + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "ping" assert sse.data == "" - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "completion" assert sse.data == "" - with pytest.raises(StopIteration): - next(it) - - -def test_multiple_events_with_data() -> None: - def body() -> Iterator[str]: - yield "event: ping" - yield 'data: {"foo":true}' - yield "" - yield "event: completion" - yield 'data: {"bar":false}' - yield "" + await assert_empty_iter(iterator) - it = SSEDecoder().iter(body()) - sse = next(it) +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_events_with_data(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo":true}\n' + yield b"\n" + yield b"event: completion\n" + yield b'data: {"bar":false}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) assert sse.event == "ping" assert sse.json() == {"foo": True} - sse = next(it) + sse = await iter_next(iterator) assert sse.event == "completion" assert sse.json() == {"bar": False} - with pytest.raises(StopIteration): - next(it) + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines_with_empty_line(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: \n" + yield b"data:\n" + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + assert sse.data == '{\n"foo":\n\n\ntrue}' + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_data_json_escaped_double_new_line(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b'data: {"foo": "my long\\n\\ncontent"}' + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": "my long\n\ncontent"} + + await assert_empty_iter(iterator) + + +@pytest.mark.asyncio +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multiple_data_lines(sync: bool, client: Increase, async_client: AsyncIncrease) -> None: + def body() -> Iterator[bytes]: + yield b"event: ping\n" + yield b"data: {\n" + yield b'data: "foo":\n' + yield b"data: true}\n" + yield b"\n\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event == "ping" + assert sse.json() == {"foo": True} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_special_new_line_character( + sync: bool, + client: Increase, + async_client: AsyncIncrease, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":" culpa"}\n' + yield b"\n" + yield b'data: {"content":" \xe2\x80\xa8"}\n' + yield b"\n" + yield b'data: {"content":"foo"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " culpa"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": " 
"} + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "foo"} + + await assert_empty_iter(iterator) + + +@pytest.mark.parametrize("sync", [True, False], ids=["sync", "async"]) +async def test_multi_byte_character_multiple_chunks( + sync: bool, + client: Increase, + async_client: AsyncIncrease, +) -> None: + def body() -> Iterator[bytes]: + yield b'data: {"content":"' + # bytes taken from the string 'известни' and arbitrarily split + # so that some multi-byte characters span multiple chunks + yield b"\xd0" + yield b"\xb8\xd0\xb7\xd0" + yield b"\xb2\xd0\xb5\xd1\x81\xd1\x82\xd0\xbd\xd0\xb8" + yield b'"}\n' + yield b"\n" + + iterator = make_event_iterator(content=body(), sync=sync, client=client, async_client=async_client) + + sse = await iter_next(iterator) + assert sse.event is None + assert sse.json() == {"content": "известни"} + + +async def to_aiter(iter: Iterator[bytes]) -> AsyncIterator[bytes]: + for chunk in iter: + yield chunk + + +async def iter_next(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> ServerSentEvent: + if isinstance(iter, AsyncIterator): + return await iter.__anext__() + + return next(iter) + + +async def assert_empty_iter(iter: Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]) -> None: + with pytest.raises((StopAsyncIteration, RuntimeError)): + await iter_next(iter) + + +def make_event_iterator( + content: Iterator[bytes], + *, + sync: bool, + client: Increase, + async_client: AsyncIncrease, +) -> Iterator[ServerSentEvent] | AsyncIterator[ServerSentEvent]: + if sync: + return Stream(cast_to=object, client=client, response=httpx.Response(200, content=content))._iter_events() + + return AsyncStream( + cast_to=object, client=async_client, response=httpx.Response(200, content=to_aiter(content)) + )._iter_events() diff --git a/tests/test_transform.py b/tests/test_transform.py index 866780653..0631bbd09 100644 --- a/tests/test_transform.py +++ b/tests/test_transform.py @@ -2,20 +2,20 @@ import io import pathlib -from typing import Any, List, Union, TypeVar, Iterable, Optional, cast +from typing import Any, Dict, List, Union, TypeVar, Iterable, Optional, cast from datetime import date, datetime from typing_extensions import Required, Annotated, TypedDict import pytest -from increase._types import Base64FileInput +from increase._types import Base64FileInput, omit, not_given from increase._utils import ( PropertyInfo, transform as _transform, parse_datetime, async_transform as _async_transform, ) -from increase._compat import PYDANTIC_V2 +from increase._compat import PYDANTIC_V1 from increase._models import BaseModel _T = TypeVar("_T") @@ -177,17 +177,32 @@ class DateDict(TypedDict, total=False): foo: Annotated[date, PropertyInfo(format="iso8601")] +class DatetimeModel(BaseModel): + foo: datetime + + +class DateModel(BaseModel): + foo: Optional[date] + + @parametrize @pytest.mark.asyncio async def test_iso8601_format(use_async: bool) -> None: dt = datetime.fromisoformat("2023-02-23T14:16:36.337692+00:00") + tz = "+00:00" if PYDANTIC_V1 else "Z" assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692+00:00"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692" + tz} # type: ignore[comparison-overlap] dt = dt.replace(tzinfo=None) assert await transform({"foo": dt}, DatetimeDict, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] + assert await transform(DatetimeModel(foo=dt), Any, use_async) == {"foo": "2023-02-23T14:16:36.337692"} # type: ignore[comparison-overlap] assert await transform({"foo": None}, DateDict, use_async) == {"foo": None} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=None), Any, use_async) == {"foo": None} # type: ignore assert await transform({"foo": date.fromisoformat("2023-02-23")}, DateDict, use_async) == {"foo": "2023-02-23"} # type: ignore[comparison-overlap] + assert await transform(DateModel(foo=date.fromisoformat("2023-02-23")), DateDict, use_async) == { + "foo": "2023-02-23" + } # type: ignore[comparison-overlap] @parametrize @@ -260,44 +275,46 @@ class MyModel(BaseModel): @parametrize @pytest.mark.asyncio async def test_pydantic_model_to_dictionary(use_async: bool) -> None: - assert await transform(MyModel(foo="hi!"), Any, use_async) == {"foo": "hi!"} - assert await transform(MyModel.construct(foo="hi!"), Any, use_async) == {"foo": "hi!"} + assert cast(Any, await transform(MyModel(foo="hi!"), Any, use_async)) == {"foo": "hi!"} + assert cast(Any, await transform(MyModel.construct(foo="hi!"), Any, use_async)) == {"foo": "hi!"} @parametrize @pytest.mark.asyncio async def test_pydantic_empty_model(use_async: bool) -> None: - assert await transform(MyModel.construct(), Any, use_async) == {} + assert cast(Any, await transform(MyModel.construct(), Any, use_async)) == {} @parametrize @pytest.mark.asyncio async def test_pydantic_unknown_field(use_async: bool) -> None: - assert await transform(MyModel.construct(my_untyped_field=True), Any, use_async) == {"my_untyped_field": True} + assert cast(Any, await transform(MyModel.construct(my_untyped_field=True), Any, use_async)) == { + "my_untyped_field": True + } @parametrize @pytest.mark.asyncio async def test_pydantic_mismatched_types(use_async: bool) -> None: model = MyModel.construct(foo=True) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) - assert params == {"foo": True} + assert cast(Any, params) == {"foo": True} @parametrize @pytest.mark.asyncio async def test_pydantic_mismatched_object_type(use_async: bool) -> None: model = MyModel.construct(foo=MyModel.construct(hello="world")) - if PYDANTIC_V2: + if PYDANTIC_V1: + params = await transform(model, Any, use_async) + else: with pytest.warns(UserWarning): params = await transform(model, Any, use_async) - else: - params = await transform(model, Any, use_async) - assert params == {"foo": {"hello": "world"}} + assert cast(Any, params) == {"foo": {"hello": "world"}} class ModelNestedObjects(BaseModel): @@ -309,7 +326,7 @@ class ModelNestedObjects(BaseModel): async def test_pydantic_nested_objects(use_async: bool) -> None: model = ModelNestedObjects.construct(nested={"foo": "stainless"}) assert isinstance(model.nested, MyModel) - assert await transform(model, Any, use_async) == {"nested": {"foo": "stainless"}} + assert cast(Any, await transform(model, Any, use_async)) == {"nested": {"foo": "stainless"}} class ModelWithDefaultField(BaseModel): @@ -325,19 +342,19 @@ async def test_pydantic_default_field(use_async: bool) -> None: model = ModelWithDefaultField.construct() assert model.with_none_default is None assert model.with_str_default == "foo" - assert await transform(model, Any, use_async) == {} + assert cast(Any, await transform(model, Any, use_async)) == {} # should be included when the default value is explicitly given model = ModelWithDefaultField.construct(with_none_default=None, with_str_default="foo") assert model.with_none_default is None assert model.with_str_default == "foo" - assert await transform(model, Any, use_async) == {"with_none_default": None, "with_str_default": "foo"} + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": None, "with_str_default": "foo"} # should be included when a non-default value is explicitly given model = ModelWithDefaultField.construct(with_none_default="bar", with_str_default="baz") assert model.with_none_default == "bar" assert model.with_str_default == "baz" - assert await transform(model, Any, use_async) == {"with_none_default": "bar", "with_str_default": "baz"} + assert cast(Any, await transform(model, Any, use_async)) == {"with_none_default": "bar", "with_str_default": "baz"} class TypedDictIterableUnion(TypedDict): @@ -371,6 +388,15 @@ def my_iter() -> Iterable[Baz8]: } +@parametrize +@pytest.mark.asyncio +async def test_dictionary_items(use_async: bool) -> None: + class DictItems(TypedDict): + foo_baz: Annotated[str, PropertyInfo(alias="fooBaz")] + + assert await transform({"foo": {"foo_baz": "bar"}}, Dict[str, DictItems], use_async) == {"foo": {"fooBaz": "bar"}} + + class TypedDictIterableUnionStr(TypedDict): foo: Annotated[Union[str, Iterable[Baz8]], PropertyInfo(alias="FOO")] @@ -406,3 +432,29 @@ async def test_base64_file_input(use_async: bool) -> None: assert await transform({"foo": io.BytesIO(b"Hello, world!")}, TypedDictBase64Input, use_async) == { "foo": "SGVsbG8sIHdvcmxkIQ==" } # type: ignore[comparison-overlap] + + +@parametrize +@pytest.mark.asyncio +async def test_transform_skipping(use_async: bool) -> None: + # lists of ints are left as-is + data = [1, 2, 3] + assert await transform(data, List[int], use_async) is data + + # iterables of ints are converted to a list + data = iter([1, 2, 3]) + assert await transform(data, Iterable[int], use_async) == [1, 2, 3] + + +@parametrize +@pytest.mark.asyncio +async def test_strips_notgiven(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": not_given}, Foo1, use_async) == {} + + +@parametrize +@pytest.mark.asyncio +async def test_strips_omit(use_async: bool) -> None: + assert await transform({"foo_bar": "bar"}, Foo1, use_async) == {"fooBar": "bar"} + assert await transform({"foo_bar": omit}, Foo1, use_async) == {} diff --git a/tests/test_utils/test_datetime_parse.py b/tests/test_utils/test_datetime_parse.py new file mode 100644 index 000000000..5f4461227 --- /dev/null +++ b/tests/test_utils/test_datetime_parse.py @@ -0,0 +1,110 @@ +""" +Copied from https://github.com/pydantic/pydantic/blob/v1.10.22/tests/test_datetime_parse.py +with modifications so it works without pydantic v1 imports. +""" + +from typing import Type, Union +from datetime import date, datetime, timezone, timedelta + +import pytest + +from increase._utils import parse_date, parse_datetime + + +def create_tz(minutes: int) -> timezone: + return timezone(timedelta(minutes=minutes)) + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + ("1494012444.883309", date(2017, 5, 5)), + (b"1494012444.883309", date(2017, 5, 5)), + (1_494_012_444.883_309, date(2017, 5, 5)), + ("1494012444", date(2017, 5, 5)), + (1_494_012_444, date(2017, 5, 5)), + (0, date(1970, 1, 1)), + ("2012-04-23", date(2012, 4, 23)), + (b"2012-04-23", date(2012, 4, 23)), + ("2012-4-9", date(2012, 4, 9)), + (date(2012, 4, 9), date(2012, 4, 9)), + (datetime(2012, 4, 9, 12, 15), date(2012, 4, 9)), + # Invalid inputs + ("x20120423", ValueError), + ("2012-04-56", ValueError), + (19_999_999_999, date(2603, 10, 11)), # just before watershed + (20_000_000_001, date(1970, 8, 20)), # just after watershed + (1_549_316_052, date(2019, 2, 4)), # nowish in s + (1_549_316_052_104, date(2019, 2, 4)), # nowish in ms + (1_549_316_052_104_324, date(2019, 2, 4)), # nowish in μs + (1_549_316_052_104_324_096, date(2019, 2, 4)), # nowish in ns + ("infinity", date(9999, 12, 31)), + ("inf", date(9999, 12, 31)), + (float("inf"), date(9999, 12, 31)), + ("infinity ", date(9999, 12, 31)), + (int("1" + "0" * 100), date(9999, 12, 31)), + (1e1000, date(9999, 12, 31)), + ("-infinity", date(1, 1, 1)), + ("-inf", date(1, 1, 1)), + ("nan", ValueError), + ], +) +def test_date_parsing(value: Union[str, bytes, int, float], result: Union[date, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_date(value) + else: + assert parse_date(value) == result + + +@pytest.mark.parametrize( + "value,result", + [ + # Valid inputs + # values in seconds + ("1494012444.883309", datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + (1_494_012_444.883_309, datetime(2017, 5, 5, 19, 27, 24, 883_309, tzinfo=timezone.utc)), + ("1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (b"1494012444", datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + (1_494_012_444, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + # values in ms + ("1494012444000.883309", datetime(2017, 5, 5, 19, 27, 24, 883, tzinfo=timezone.utc)), + ("-1494012444000.883309", datetime(1922, 8, 29, 4, 32, 35, 999117, tzinfo=timezone.utc)), + (1_494_012_444_000, datetime(2017, 5, 5, 19, 27, 24, tzinfo=timezone.utc)), + ("2012-04-23T09:15:00", datetime(2012, 4, 23, 9, 15)), + ("2012-4-9 4:8:16", datetime(2012, 4, 9, 4, 8, 16)), + ("2012-04-23T09:15:00Z", datetime(2012, 4, 23, 9, 15, 0, 0, timezone.utc)), + ("2012-4-9 4:8:16-0320", datetime(2012, 4, 9, 4, 8, 16, 0, create_tz(-200))), + ("2012-04-23T10:20:30.400+02:30", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(150))), + ("2012-04-23T10:20:30.400+02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(120))), + ("2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (b"2012-04-23T10:20:30.400-02", datetime(2012, 4, 23, 10, 20, 30, 400_000, create_tz(-120))), + (datetime(2017, 5, 5), datetime(2017, 5, 5)), + (0, datetime(1970, 1, 1, 0, 0, 0, tzinfo=timezone.utc)), + # Invalid inputs + ("x20120423091500", ValueError), + ("2012-04-56T09:15:90", ValueError), + ("2012-04-23T11:05:00-25:00", ValueError), + (19_999_999_999, datetime(2603, 10, 11, 11, 33, 19, tzinfo=timezone.utc)), # just before watershed + (20_000_000_001, datetime(1970, 8, 20, 11, 33, 20, 1000, tzinfo=timezone.utc)), # just after watershed + (1_549_316_052, datetime(2019, 2, 4, 21, 34, 12, 0, tzinfo=timezone.utc)), # nowish in s + (1_549_316_052_104, datetime(2019, 2, 4, 21, 34, 12, 104_000, tzinfo=timezone.utc)), # nowish in ms + (1_549_316_052_104_324, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in μs + (1_549_316_052_104_324_096, datetime(2019, 2, 4, 21, 34, 12, 104_324, tzinfo=timezone.utc)), # nowish in ns + ("infinity", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf", datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("inf ", datetime(9999, 12, 31, 23, 59, 59, 999999)), + (1e50, datetime(9999, 12, 31, 23, 59, 59, 999999)), + (float("inf"), datetime(9999, 12, 31, 23, 59, 59, 999999)), + ("-infinity", datetime(1, 1, 1, 0, 0)), + ("-inf", datetime(1, 1, 1, 0, 0)), + ("nan", ValueError), + ], +) +def test_datetime_parsing(value: Union[str, bytes, int, float], result: Union[datetime, Type[Exception]]) -> None: + if type(result) == type and issubclass(result, Exception): # pyright: ignore[reportUnnecessaryIsInstance] + with pytest.raises(result): + parse_datetime(value) + else: + assert parse_datetime(value) == result diff --git a/tests/test_utils/test_json.py b/tests/test_utils/test_json.py new file mode 100644 index 000000000..30acb42bc --- /dev/null +++ b/tests/test_utils/test_json.py @@ -0,0 +1,126 @@ +from __future__ import annotations + +import datetime +from typing import Union + +import pydantic + +from increase import _compat +from increase._utils._json import openapi_dumps + + +class TestOpenapiDumps: + def test_basic(self) -> None: + data = {"key": "value", "number": 42} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"key":"value","number":42}' + + def test_datetime_serialization(self) -> None: + dt = datetime.datetime(2023, 1, 1, 12, 0, 0) + data = {"datetime": dt} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"datetime":"2023-01-01T12:00:00"}' + + def test_pydantic_model_serialization(self) -> None: + class User(pydantic.BaseModel): + first_name: str + last_name: str + age: int + + model_instance = User(first_name="John", last_name="Kramer", age=83) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"first_name":"John","last_name":"Kramer","age":83}}' + + def test_pydantic_model_with_default_values(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + score: int = 0 + + model_instance = User(name="Alice") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Alice"}}' + + def test_pydantic_model_with_default_values_overridden(self) -> None: + class User(pydantic.BaseModel): + name: str + role: str = "user" + active: bool = True + + model_instance = User(name="Bob", role="admin", active=False) + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Bob","role":"admin","active":false}}' + + def test_pydantic_model_with_alias(self) -> None: + class User(pydantic.BaseModel): + first_name: str = pydantic.Field(alias="firstName") + last_name: str = pydantic.Field(alias="lastName") + + model_instance = User(firstName="John", lastName="Doe") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"firstName":"John","lastName":"Doe"}}' + + def test_pydantic_model_with_alias_and_default(self) -> None: + class User(pydantic.BaseModel): + user_name: str = pydantic.Field(alias="userName") + user_role: str = pydantic.Field(default="member", alias="userRole") + is_active: bool = pydantic.Field(default=True, alias="isActive") + + model_instance = User(userName="charlie") + data = {"model": model_instance} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"charlie"}}' + + model_with_overrides = User(userName="diana", userRole="admin", isActive=False) + data = {"model": model_with_overrides} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"userName":"diana","userRole":"admin","isActive":false}}' + + def test_pydantic_model_with_nested_models_and_defaults(self) -> None: + class Address(pydantic.BaseModel): + street: str + city: str = "Unknown" + + class User(pydantic.BaseModel): + name: str + address: Address + verified: bool = False + + if _compat.PYDANTIC_V1: + # to handle forward references in Pydantic v1 + User.update_forward_refs(**locals()) # type: ignore[reportDeprecated] + + address = Address(street="123 Main St") + user = User(name="Diana", address=address) + data = {"user": user} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"user":{"name":"Diana","address":{"street":"123 Main St"}}}' + + address_with_city = Address(street="456 Oak Ave", city="Boston") + user_verified = User(name="Eve", address=address_with_city, verified=True) + data = {"user": user_verified} + json_bytes = openapi_dumps(data) + assert ( + json_bytes == b'{"user":{"name":"Eve","address":{"street":"456 Oak Ave","city":"Boston"},"verified":true}}' + ) + + def test_pydantic_model_with_optional_fields(self) -> None: + class User(pydantic.BaseModel): + name: str + email: Union[str, None] + phone: Union[str, None] + + model_with_none = User(name="Eve", email=None, phone=None) + data = {"model": model_with_none} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Eve","email":null,"phone":null}}' + + model_with_values = User(name="Frank", email="frank@example.com", phone=None) + data = {"model": model_with_values} + json_bytes = openapi_dumps(data) + assert json_bytes == b'{"model":{"name":"Frank","email":"frank@example.com","phone":null}}' diff --git a/tests/test_utils/test_path.py b/tests/test_utils/test_path.py new file mode 100644 index 000000000..a98e77c6a --- /dev/null +++ b/tests/test_utils/test_path.py @@ -0,0 +1,89 @@ +from __future__ import annotations + +from typing import Any + +import pytest + +from increase._utils._path import path_template + + +@pytest.mark.parametrize( + "template, kwargs, expected", + [ + ("/v1/{id}", dict(id="abc"), "/v1/abc"), + ("/v1/{a}/{b}", dict(a="x", b="y"), "/v1/x/y"), + ("/v1/{a}{b}/path/{c}?val={d}#{e}", dict(a="x", b="y", c="z", d="u", e="v"), "/v1/xy/path/z?val=u#v"), + ("/{w}/{w}", dict(w="echo"), "/echo/echo"), + ("/v1/static", {}, "/v1/static"), + ("", {}, ""), + ("/v1/?q={n}&count=10", dict(n=42), "/v1/?q=42&count=10"), + ("/v1/{v}", dict(v=None), "/v1/null"), + ("/v1/{v}", dict(v=True), "/v1/true"), + ("/v1/{v}", dict(v=False), "/v1/false"), + ("/v1/{v}", dict(v=".hidden"), "/v1/.hidden"), # dot prefix ok + ("/v1/{v}", dict(v="file.txt"), "/v1/file.txt"), # dot in middle ok + ("/v1/{v}", dict(v="..."), "/v1/..."), # triple dot ok + ("/v1/{a}{b}", dict(a=".", b="txt"), "/v1/.txt"), # dot var combining with adjacent to be ok + ("/items?q={v}#{f}", dict(v=".", f=".."), "/items?q=.#.."), # dots in query/fragment are fine + ( + "/v1/{a}?query={b}", + dict(a="../../other/endpoint", b="a&bad=true"), + "/v1/..%2F..%2Fother%2Fendpoint?query=a%26bad%3Dtrue", + ), + ("/v1/{val}", dict(val="a/b/c"), "/v1/a%2Fb%2Fc"), + ("/v1/{val}", dict(val="a/b/c?query=value"), "/v1/a%2Fb%2Fc%3Fquery=value"), + ("/v1/{val}", dict(val="a/b/c?query=value&bad=true"), "/v1/a%2Fb%2Fc%3Fquery=value&bad=true"), + ("/v1/{val}", dict(val="%20"), "/v1/%2520"), # escapes escape sequences in input + # Query: slash and ? are safe, # is not + ("/items?q={v}", dict(v="a/b"), "/items?q=a/b"), + ("/items?q={v}", dict(v="a?b"), "/items?q=a?b"), + ("/items?q={v}", dict(v="a#b"), "/items?q=a%23b"), + ("/items?q={v}", dict(v="a b"), "/items?q=a%20b"), + # Fragment: slash and ? are safe + ("/docs#{v}", dict(v="a/b"), "/docs#a/b"), + ("/docs#{v}", dict(v="a?b"), "/docs#a?b"), + # Path: slash, ? and # are all encoded + ("/v1/{v}", dict(v="a/b"), "/v1/a%2Fb"), + ("/v1/{v}", dict(v="a?b"), "/v1/a%3Fb"), + ("/v1/{v}", dict(v="a#b"), "/v1/a%23b"), + # same var encoded differently by component + ( + "/v1/{v}?q={v}#{v}", + dict(v="a/b?c#d"), + "/v1/a%2Fb%3Fc%23d?q=a/b?c%23d#a/b?c%23d", + ), + ("/v1/{val}", dict(val="x?admin=true"), "/v1/x%3Fadmin=true"), # query injection + ("/v1/{val}", dict(val="x#admin"), "/v1/x%23admin"), # fragment injection + ], +) +def test_interpolation(template: str, kwargs: dict[str, Any], expected: str) -> None: + assert path_template(template, **kwargs) == expected + + +def test_missing_kwarg_raises_key_error() -> None: + with pytest.raises(KeyError, match="org_id"): + path_template("/v1/{org_id}") + + +@pytest.mark.parametrize( + "template, kwargs", + [ + ("{a}/path", dict(a=".")), + ("{a}/path", dict(a="..")), + ("/v1/{a}", dict(a=".")), + ("/v1/{a}", dict(a="..")), + ("/v1/{a}/path", dict(a=".")), + ("/v1/{a}/path", dict(a="..")), + ("/v1/{a}{b}", dict(a=".", b=".")), # adjacent vars → ".." + ("/v1/{a}.", dict(a=".")), # var + static → ".." + ("/v1/{a}{b}", dict(a="", b=".")), # empty + dot → "." + ("/v1/%2e/{x}", dict(x="ok")), # encoded dot in static text + ("/v1/%2e./{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/.%2E/{x}", dict(x="ok")), # mixed encoded ".." in static + ("/v1/{v}?q=1", dict(v="..")), + ("/v1/{v}#frag", dict(v="..")), + ], +) +def test_dot_segment_rejected(template: str, kwargs: dict[str, Any]) -> None: + with pytest.raises(ValueError, match="dot-segment"): + path_template(template, **kwargs) diff --git a/tests/test_utils/test_proxy.py b/tests/test_utils/test_proxy.py index 537cfb99a..5ee455b19 100644 --- a/tests/test_utils/test_proxy.py +++ b/tests/test_utils/test_proxy.py @@ -21,3 +21,14 @@ def test_recursive_proxy() -> None: assert dir(proxy) == [] assert type(proxy).__name__ == "RecursiveLazyProxy" assert type(operator.attrgetter("name.foo.bar.baz")(proxy)).__name__ == "RecursiveLazyProxy" + + +def test_isinstance_does_not_error() -> None: + class AlwaysErrorProxy(LazyProxy[Any]): + @override + def __load__(self) -> Any: + raise RuntimeError("Mocking missing dependency") + + proxy = AlwaysErrorProxy() + assert not isinstance(proxy, dict) + assert isinstance(proxy, LazyProxy) diff --git a/tests/test_utils/test_typing.py b/tests/test_utils/test_typing.py index 87da876f5..ada58338f 100644 --- a/tests/test_utils/test_typing.py +++ b/tests/test_utils/test_typing.py @@ -9,24 +9,19 @@ _T3 = TypeVar("_T3") -class BaseGeneric(Generic[_T]): - ... +class BaseGeneric(Generic[_T]): ... -class SubclassGeneric(BaseGeneric[_T]): - ... +class SubclassGeneric(BaseGeneric[_T]): ... -class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): - ... +class BaseGenericMultipleTypeArgs(Generic[_T, _T2, _T3]): ... -class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): - ... +class SubclassGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T, _T2, _T3]): ... -class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): - ... +class SubclassDifferentOrderGenericMultipleTypeArgs(BaseGenericMultipleTypeArgs[_T2, _T, _T3]): ... def test_extract_type_var() -> None: diff --git a/tests/utils.py b/tests/utils.py index 13184e3e0..6bd357c17 100644 --- a/tests/utils.py +++ b/tests/utils.py @@ -4,20 +4,22 @@ import inspect import traceback import contextlib -from typing import Any, TypeVar, Iterator, cast +from typing import Any, TypeVar, Iterator, Sequence, cast from datetime import date, datetime from typing_extensions import Literal, get_args, get_origin, assert_type -from increase._types import NoneType +from increase._types import Omit, NoneType from increase._utils import ( is_dict, is_list, is_list_type, is_union_type, extract_type_arg, + is_sequence_type, is_annotated_type, + is_type_alias_type, ) -from increase._compat import PYDANTIC_V2, field_outer_type, get_model_fields +from increase._compat import PYDANTIC_V1, field_outer_type, get_model_fields from increase._models import BaseModel BaseModelT = TypeVar("BaseModelT", bound=BaseModel) @@ -26,12 +28,12 @@ def assert_matches_model(model: type[BaseModelT], value: BaseModelT, *, path: list[str]) -> bool: for name, field in get_model_fields(model).items(): field_value = getattr(value, name) - if PYDANTIC_V2: - allow_none = False - else: + if PYDANTIC_V1: # in v1 nullability was structured differently # https://docs.pydantic.dev/2.0/migration/#required-optional-and-nullable-fields allow_none = getattr(field, "allow_none", False) + else: + allow_none = False assert_matches_type( field_outer_type(field), @@ -51,6 +53,9 @@ def assert_matches_type( path: list[str], allow_none: bool = False, ) -> None: + if is_type_alias_type(type_): + type_ = type_.__value__ + # unwrap `Annotated[T, ...]` -> `T` if is_annotated_type(type_): type_ = extract_type_arg(type_, 0) @@ -67,6 +72,13 @@ def assert_matches_type( if is_list_type(type_): return _assert_list_type(type_, value) + if is_sequence_type(type_): + assert isinstance(value, Sequence) + inner_type = get_args(type_)[0] + for entry in value: # type: ignore + assert_type(inner_type, entry) # type: ignore + return + if origin == str: assert isinstance(value, str) elif origin == int: @@ -97,7 +109,22 @@ def assert_matches_type( assert_matches_type(key_type, key, path=[*path, ""]) assert_matches_type(items_type, item, path=[*path, ""]) elif is_union_type(type_): - for i, variant in enumerate(get_args(type_)): + variants = get_args(type_) + + try: + none_index = variants.index(type(None)) + except ValueError: + pass + else: + # special case Optional[T] for better error messages + if len(variants) == 2: + if value is None: + # valid + return + + return assert_matches_type(type_=variants[not none_index], value=value, path=path) + + for i, variant in enumerate(variants): try: assert_matches_type(variant, value, path=[*path, f"variant {i}"]) return @@ -124,11 +151,15 @@ def _assert_list_type(type_: type[object], value: object) -> None: @contextlib.contextmanager -def update_env(**new_env: str) -> Iterator[None]: +def update_env(**new_env: str | Omit) -> Iterator[None]: old = os.environ.copy() try: - os.environ.update(new_env) + for name, value in new_env.items(): + if isinstance(value, Omit): + os.environ.pop(name, None) + else: + os.environ[name] = value yield None finally: