diff --git a/.release-please-manifest.json b/.release-please-manifest.json index d260e00d..878ea368 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.435.0" + ".": "0.436.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c29f1d48..89d1fa6c 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ configured_endpoints: 236 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-4d9e8a8a1909ef7c96fe28293ab07720938ce09be84687c57e3cf95890a78205.yml -openapi_spec_hash: 4b3867a81a8429bf6ab119f910e72865 -config_hash: e73b1147c039cb3d6a2c56ae5926bca8 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-5c95dd79214af830e2e7fb34ab05f98bde9213311d5e2d59f9a816a8e0369b85.yml +openapi_spec_hash: ec66c2961a8b90e06ea57f934d8d75db +config_hash: 25d7d7aa4882db6189b4b53e8e249e80 diff --git a/CHANGELOG.md b/CHANGELOG.md index 90ee33dd..e2472f78 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # Changelog +## 0.436.0 (2026-03-12) + +Full Changelog: [v0.435.0...v0.436.0](https://github.com/Increase/increase-python/compare/v0.435.0...v0.436.0) + +### Features + +* **api:** api update ([910abf5](https://github.com/Increase/increase-python/commit/910abf5ad3122dceeed4114fb355bb4864275522)) +* **api:** api update ([39c3fac](https://github.com/Increase/increase-python/commit/39c3faca288ac586ef500a6e2fb1615c156dfdb4)) + ## 0.435.0 (2026-03-12) Full Changelog: [v0.434.0...v0.435.0](https://github.com/Increase/increase-python/compare/v0.434.0...v0.435.0) diff --git a/api.md b/api.md index 59ec1bac..0d68ea18 100644 --- a/api.md +++ b/api.md @@ -501,7 +501,6 @@ Methods: - client.entities.update(entity_id, \*\*params) -> Entity - client.entities.list(\*\*params) -> SyncPage[Entity] - client.entities.archive(entity_id) -> Entity -- client.entities.create_beneficial_owner(entity_id, \*\*params) -> Entity # BeneficialOwners @@ -513,6 +512,7 @@ from increase.types import EntityBeneficialOwner Methods: +- 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] diff --git a/pyproject.toml b/pyproject.toml index c0463bc1..02c59830 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "increase" -version = "0.435.0" +version = "0.436.0" description = "The official Python library for the increase API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/increase/_version.py b/src/increase/_version.py index c5b62955..80b67182 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.435.0" # x-release-please-version +__version__ = "0.436.0" # x-release-please-version diff --git a/src/increase/resources/beneficial_owners.py b/src/increase/resources/beneficial_owners.py index 0ad56c1c..c5117b76 100644 --- a/src/increase/resources/beneficial_owners.py +++ b/src/increase/resources/beneficial_owners.py @@ -2,9 +2,12 @@ from __future__ import annotations +from typing import List +from typing_extensions import Literal + import httpx -from ..types import beneficial_owner_list_params, beneficial_owner_update_params +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 maybe_transform, async_maybe_transform from .._compat import cached_property @@ -42,6 +45,66 @@ def with_streaming_response(self) -> BeneficialOwnersResourceWithStreamingRespon """ 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, @@ -273,6 +336,66 @@ def with_streaming_response(self) -> AsyncBeneficialOwnersResourceWithStreamingR """ 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, @@ -488,6 +611,9 @@ 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, ) @@ -506,6 +632,9 @@ 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, ) @@ -524,6 +653,9 @@ 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, ) @@ -542,6 +674,9 @@ 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, ) diff --git a/src/increase/resources/entities.py b/src/increase/resources/entities.py index 3d535c6f..b5b0808c 100644 --- a/src/increase/resources/entities.py +++ b/src/increase/resources/entities.py @@ -8,12 +8,7 @@ import httpx -from ..types import ( - entity_list_params, - entity_create_params, - entity_update_params, - entity_create_beneficial_owner_params, -) +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 maybe_transform, async_maybe_transform from .._compat import cached_property @@ -376,56 +371,6 @@ def archive( cast_to=Entity, ) - def create_beneficial_owner( - self, - entity_id: str, - *, - beneficial_owner: entity_create_beneficial_owner_params.BeneficialOwner, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this 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: - entity_id: The identifier of the Entity to associate with the new Beneficial Owner. - - beneficial_owner: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - 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}/create_beneficial_owner", - body=maybe_transform( - {"beneficial_owner": beneficial_owner}, - entity_create_beneficial_owner_params.EntityCreateBeneficialOwnerParams, - ), - 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 AsyncEntitiesResource(AsyncAPIResource): @cached_property @@ -772,56 +717,6 @@ async def archive( cast_to=Entity, ) - async def create_beneficial_owner( - self, - entity_id: str, - *, - beneficial_owner: entity_create_beneficial_owner_params.BeneficialOwner, - # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. - # The extra values given here take precedence over values defined on the client or passed to this 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: - entity_id: The identifier of the Entity to associate with the new Beneficial Owner. - - beneficial_owner: The identifying details of anyone controlling or owning 25% or more of the - corporation. - - 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}/create_beneficial_owner", - body=await async_maybe_transform( - {"beneficial_owner": beneficial_owner}, - entity_create_beneficial_owner_params.EntityCreateBeneficialOwnerParams, - ), - 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 EntitiesResourceWithRawResponse: def __init__(self, entities: EntitiesResource) -> None: @@ -842,9 +737,6 @@ def __init__(self, entities: EntitiesResource) -> None: self.archive = to_raw_response_wrapper( entities.archive, ) - self.create_beneficial_owner = to_raw_response_wrapper( - entities.create_beneficial_owner, - ) class AsyncEntitiesResourceWithRawResponse: @@ -866,9 +758,6 @@ def __init__(self, entities: AsyncEntitiesResource) -> None: self.archive = async_to_raw_response_wrapper( entities.archive, ) - self.create_beneficial_owner = async_to_raw_response_wrapper( - entities.create_beneficial_owner, - ) class EntitiesResourceWithStreamingResponse: @@ -890,9 +779,6 @@ def __init__(self, entities: EntitiesResource) -> None: self.archive = to_streamed_response_wrapper( entities.archive, ) - self.create_beneficial_owner = to_streamed_response_wrapper( - entities.create_beneficial_owner, - ) class AsyncEntitiesResourceWithStreamingResponse: @@ -914,6 +800,3 @@ def __init__(self, entities: AsyncEntitiesResource) -> None: self.archive = async_to_streamed_response_wrapper( entities.archive, ) - self.create_beneficial_owner = async_to_streamed_response_wrapper( - entities.create_beneficial_owner, - ) diff --git a/src/increase/types/__init__.py b/src/increase/types/__init__.py index 8543aee3..994a8c3d 100644 --- a/src/increase/types/__init__.py +++ b/src/increase/types/__init__.py @@ -123,6 +123,7 @@ 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 @@ -167,9 +168,6 @@ from .wire_drawdown_request_create_params import WireDrawdownRequestCreateParams as WireDrawdownRequestCreateParams from .card_purchase_supplement_list_params import CardPurchaseSupplementListParams as CardPurchaseSupplementListParams from .inbound_wire_transfer_reverse_params import InboundWireTransferReverseParams as InboundWireTransferReverseParams -from .entity_create_beneficial_owner_params import ( - EntityCreateBeneficialOwnerParams as EntityCreateBeneficialOwnerParams, -) from .intrafi_account_enrollment_list_params import ( IntrafiAccountEnrollmentListParams as IntrafiAccountEnrollmentListParams, ) diff --git a/src/increase/types/entity_create_beneficial_owner_params.py b/src/increase/types/beneficial_owner_create_params.py similarity index 76% rename from src/increase/types/entity_create_beneficial_owner_params.py rename to src/increase/types/beneficial_owner_create_params.py index e3091081..36ed82d9 100644 --- a/src/increase/types/entity_create_beneficial_owner_params.py +++ b/src/increase/types/beneficial_owner_create_params.py @@ -9,26 +9,35 @@ from .._utils import PropertyInfo __all__ = [ - "EntityCreateBeneficialOwnerParams", - "BeneficialOwner", - "BeneficialOwnerIndividual", - "BeneficialOwnerIndividualAddress", - "BeneficialOwnerIndividualIdentification", - "BeneficialOwnerIndividualIdentificationDriversLicense", - "BeneficialOwnerIndividualIdentificationOther", - "BeneficialOwnerIndividualIdentificationPassport", + "BeneficialOwnerCreateParams", + "Individual", + "IndividualAddress", + "IndividualIdentification", + "IndividualIdentificationDriversLicense", + "IndividualIdentificationOther", + "IndividualIdentificationPassport", ] -class EntityCreateBeneficialOwnerParams(TypedDict, total=False): - beneficial_owner: Required[BeneficialOwner] - """ - The identifying details of anyone controlling or owning 25% or more of the - corporation. +class BeneficialOwnerCreateParams(TypedDict, total=False): + 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 BeneficialOwnerIndividualAddress(TypedDict, total=False): + +class IndividualAddress(TypedDict, total=False): """The individual's physical address. Mail receiving locations like PO Boxes and PMB's are disallowed. @@ -56,7 +65,7 @@ class BeneficialOwnerIndividualAddress(TypedDict, total=False): """The ZIP or postal code of the address. Required in certain countries.""" -class BeneficialOwnerIndividualIdentificationDriversLicense(TypedDict, total=False): +class IndividualIdentificationDriversLicense(TypedDict, total=False): """Information about the United States driver's license used for identification. Required if `method` is equal to `drivers_license`. @@ -75,7 +84,7 @@ 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`. @@ -103,7 +112,7 @@ 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`. @@ -122,7 +131,7 @@ class BeneficialOwnerIndividualIdentificationPassport(TypedDict, total=False): """The identifier of the File containing the passport.""" -class BeneficialOwnerIndividualIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] +class IndividualIdentification(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] """A means of verifying the person's identity.""" method: Required[ @@ -150,29 +159,29 @@ class BeneficialOwnerIndividualIdentification(TypedDict, total=False, extra_item 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): +class Individual(TypedDict, total=False): """Personal details for the beneficial owner.""" - address: Required[BeneficialOwnerIndividualAddress] + address: Required[IndividualAddress] """The individual's physical address. Mail receiving locations like PO Boxes and PMB's are disallowed. @@ -181,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] @@ -194,22 +203,3 @@ class BeneficialOwnerIndividual(TypedDict, total=False): tax id (either a Social Security Number or Individual Taxpayer Identification Number). """ - - -class BeneficialOwner(TypedDict, total=False, extra_items=object): # type: ignore[call-arg] - """ - The identifying details of anyone controlling or owning 25% or more of the corporation. - """ - - 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/entity_beneficial_owner.py b/src/increase/types/entity_beneficial_owner.py index 1fc813c1..d16d5cf1 100644 --- a/src/increase/types/entity_beneficial_owner.py +++ b/src/increase/types/entity_beneficial_owner.py @@ -104,6 +104,14 @@ class EntityBeneficialOwner(BaseModel): Beneficial Owner 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). + """ + individual: Individual """Personal details for the beneficial owner.""" diff --git a/tests/api_resources/test_beneficial_owners.py b/tests/api_resources/test_beneficial_owners.py index 4e58345c..7ab7279d 100644 --- a/tests/api_resources/test_beneficial_owners.py +++ b/tests/api_resources/test_beneficial_owners.py @@ -9,7 +9,9 @@ from increase import Increase, AsyncIncrease from tests.utils import assert_matches_type -from increase.types import EntityBeneficialOwner +from increase.types import ( + EntityBeneficialOwner, +) from increase._utils import parse_date from increase.pagination import SyncPage, AsyncPage @@ -19,6 +21,123 @@ 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( @@ -225,6 +344,123 @@ class TestAsyncBeneficialOwners: "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( diff --git a/tests/api_resources/test_entities.py b/tests/api_resources/test_entities.py index d26d5046..e71fa561 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 @@ -521,154 +519,6 @@ def test_path_params_archive(self, client: Increase) -> None: "", ) - @parametrize - def test_method_create_beneficial_owner(self, client: Increase) -> None: - entity = client.entities.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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(Entity, entity, path=["response"]) - - @parametrize - def test_method_create_beneficial_owner_with_all_params(self, client: Increase) -> None: - entity = client.entities.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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(Entity, entity, path=["response"]) - - @parametrize - def test_raw_response_create_beneficial_owner(self, client: Increase) -> None: - response = client.entities.with_raw_response.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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" - entity = response.parse() - assert_matches_type(Entity, entity, path=["response"]) - - @parametrize - def test_streaming_response_create_beneficial_owner(self, client: Increase) -> None: - with client.entities.with_streaming_response.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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" - - entity = response.parse() - assert_matches_type(Entity, entity, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - def test_path_params_create_beneficial_owner(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.create_beneficial_owner( - entity_id="", - beneficial_owner={ - "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"], - }, - ) - class TestAsyncEntities: parametrize = pytest.mark.parametrize( @@ -1174,151 +1024,3 @@ async def test_path_params_archive(self, async_client: AsyncIncrease) -> None: await async_client.entities.with_raw_response.archive( "", ) - - @parametrize - async def test_method_create_beneficial_owner(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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(Entity, entity, path=["response"]) - - @parametrize - async def test_method_create_beneficial_owner_with_all_params(self, async_client: AsyncIncrease) -> None: - entity = await async_client.entities.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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(Entity, entity, path=["response"]) - - @parametrize - async def test_raw_response_create_beneficial_owner(self, async_client: AsyncIncrease) -> None: - response = await async_client.entities.with_raw_response.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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" - entity = await response.parse() - assert_matches_type(Entity, entity, path=["response"]) - - @parametrize - async def test_streaming_response_create_beneficial_owner(self, async_client: AsyncIncrease) -> None: - async with async_client.entities.with_streaming_response.create_beneficial_owner( - entity_id="entity_n8y8tnk2p9339ti393yi", - beneficial_owner={ - "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" - - entity = await response.parse() - assert_matches_type(Entity, entity, path=["response"]) - - assert cast(Any, response.is_closed) is True - - @parametrize - async def test_path_params_create_beneficial_owner(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.create_beneficial_owner( - entity_id="", - beneficial_owner={ - "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"], - }, - )