diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 182fd7857..eaf24516e 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.285.0" + ".": "0.286.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index c3a436da3..28ec9075a 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 202 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-06c4af41ee358cc77681ee9eb3e3997fb985c94baa60639f3b21bba1a73dd990.yml -openapi_spec_hash: 636b35479a21d9be089b2d9b95646ba9 -config_hash: a185e9a72778cc4658ea73fb3a7f1354 +configured_endpoints: 214 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-a7861b46606a5a2d849c4403583805c1074983cffaf7acfe0a4d7bafa38c5efd.yml +openapi_spec_hash: a1cad356ebe1b02a67dbafbde7d7f1d4 +config_hash: b0b366d8c705ea0efe62093bae953e5a diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e8aea86..6e22e87da 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.286.0 (2025-08-14) + +Full Changelog: [v0.285.0...v0.286.0](https://github.com/Increase/increase-python/compare/v0.285.0...v0.286.0) + +### Features + +* **api:** api update ([6ae81b4](https://github.com/Increase/increase-python/commit/6ae81b456c518acd3ca79e973cfe7d408acb5426)) + ## 0.285.0 (2025-08-14) Full Changelog: [v0.284.0...v0.285.0](https://github.com/Increase/increase-python/compare/v0.284.0...v0.285.0) diff --git a/api.md b/api.md index bc0abaf01..f9248a7cb 100644 --- a/api.md +++ b/api.md @@ -732,6 +732,50 @@ Methods: - client.webhooks.unwrap(\*args) -> object - client.webhooks.verify_signature(\*args) -> None +# CardTokens + +Types: + +```python +from increase.types import CardToken, CardTokenCapabilities +``` + +Methods: + +- client.card_tokens.retrieve(card_token_id) -> CardToken +- client.card_tokens.list(\*\*params) -> SyncPage[CardToken] +- client.card_tokens.capabilities(card_token_id) -> CardTokenCapabilities + +# CardPushTransfers + +Types: + +```python +from increase.types import CardPushTransfer +``` + +Methods: + +- 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 + +# CardValidations + +Types: + +```python +from increase.types import CardValidation +``` + +Methods: + +- client.card_validations.create(\*\*params) -> CardValidation +- client.card_validations.retrieve(card_validation_id) -> CardValidation +- client.card_validations.list(\*\*params) -> SyncPage[CardValidation] + # Simulations ## InterestPayments @@ -927,3 +971,9 @@ Methods: Methods: - client.simulations.documents.create(\*\*params) -> Document + +## CardTokens + +Methods: + +- client.simulations.card_tokens.create(\*\*params) -> CardToken diff --git a/pyproject.toml b/pyproject.toml index b12e5035c..12d510d99 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "increase" -version = "0.285.0" +version = "0.286.0" description = "The official Python library for the increase API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/increase/_client.py b/src/increase/_client.py index bd5c59abd..9e7401e83 100644 --- a/src/increase/_client.py +++ b/src/increase/_client.py @@ -38,6 +38,7 @@ documents, lockboxes, file_links, + card_tokens, oauth_tokens, transactions, ach_transfers, @@ -49,6 +50,7 @@ account_numbers, check_transfers, routing_numbers, + card_validations, intrafi_balances, account_transfers, external_accounts, @@ -58,6 +60,7 @@ intrafi_exclusions, oauth_applications, bookkeeping_entries, + card_push_transfers, event_subscriptions, real_time_decisions, ach_prenotifications, @@ -158,6 +161,9 @@ class Increase(SyncAPIClient): intrafi_account_enrollments: intrafi_account_enrollments.IntrafiAccountEnrollmentsResource intrafi_balances: intrafi_balances.IntrafiBalancesResource intrafi_exclusions: intrafi_exclusions.IntrafiExclusionsResource + card_tokens: card_tokens.CardTokensResource + card_push_transfers: card_push_transfers.CardPushTransfersResource + card_validations: card_validations.CardValidationsResource simulations: simulations.SimulationsResource webhooks: webhooks.Webhooks with_raw_response: IncreaseWithRawResponse @@ -304,6 +310,9 @@ def __init__( self.intrafi_account_enrollments = intrafi_account_enrollments.IntrafiAccountEnrollmentsResource(self) self.intrafi_balances = intrafi_balances.IntrafiBalancesResource(self) self.intrafi_exclusions = intrafi_exclusions.IntrafiExclusionsResource(self) + self.card_tokens = card_tokens.CardTokensResource(self) + self.card_push_transfers = card_push_transfers.CardPushTransfersResource(self) + self.card_validations = card_validations.CardValidationsResource(self) self.simulations = simulations.SimulationsResource(self) self.webhooks = webhooks.Webhooks(self) self.with_raw_response = IncreaseWithRawResponse(self) @@ -517,6 +526,9 @@ class AsyncIncrease(AsyncAPIClient): intrafi_account_enrollments: intrafi_account_enrollments.AsyncIntrafiAccountEnrollmentsResource intrafi_balances: intrafi_balances.AsyncIntrafiBalancesResource intrafi_exclusions: intrafi_exclusions.AsyncIntrafiExclusionsResource + card_tokens: card_tokens.AsyncCardTokensResource + card_push_transfers: card_push_transfers.AsyncCardPushTransfersResource + card_validations: card_validations.AsyncCardValidationsResource simulations: simulations.AsyncSimulationsResource webhooks: webhooks.AsyncWebhooks with_raw_response: AsyncIncreaseWithRawResponse @@ -665,6 +677,9 @@ def __init__( self.intrafi_account_enrollments = intrafi_account_enrollments.AsyncIntrafiAccountEnrollmentsResource(self) self.intrafi_balances = intrafi_balances.AsyncIntrafiBalancesResource(self) self.intrafi_exclusions = intrafi_exclusions.AsyncIntrafiExclusionsResource(self) + self.card_tokens = card_tokens.AsyncCardTokensResource(self) + self.card_push_transfers = card_push_transfers.AsyncCardPushTransfersResource(self) + self.card_validations = card_validations.AsyncCardValidationsResource(self) self.simulations = simulations.AsyncSimulationsResource(self) self.webhooks = webhooks.AsyncWebhooks(self) self.with_raw_response = AsyncIncreaseWithRawResponse(self) @@ -925,6 +940,11 @@ def __init__(self, client: Increase) -> None: ) self.intrafi_balances = intrafi_balances.IntrafiBalancesResourceWithRawResponse(client.intrafi_balances) self.intrafi_exclusions = intrafi_exclusions.IntrafiExclusionsResourceWithRawResponse(client.intrafi_exclusions) + self.card_tokens = card_tokens.CardTokensResourceWithRawResponse(client.card_tokens) + self.card_push_transfers = card_push_transfers.CardPushTransfersResourceWithRawResponse( + client.card_push_transfers + ) + self.card_validations = card_validations.CardValidationsResourceWithRawResponse(client.card_validations) self.simulations = simulations.SimulationsResourceWithRawResponse(client.simulations) @@ -1045,6 +1065,11 @@ def __init__(self, client: AsyncIncrease) -> None: self.intrafi_exclusions = intrafi_exclusions.AsyncIntrafiExclusionsResourceWithRawResponse( client.intrafi_exclusions ) + self.card_tokens = card_tokens.AsyncCardTokensResourceWithRawResponse(client.card_tokens) + self.card_push_transfers = card_push_transfers.AsyncCardPushTransfersResourceWithRawResponse( + client.card_push_transfers + ) + self.card_validations = card_validations.AsyncCardValidationsResourceWithRawResponse(client.card_validations) self.simulations = simulations.AsyncSimulationsResourceWithRawResponse(client.simulations) @@ -1165,6 +1190,11 @@ def __init__(self, client: Increase) -> None: self.intrafi_exclusions = intrafi_exclusions.IntrafiExclusionsResourceWithStreamingResponse( client.intrafi_exclusions ) + self.card_tokens = card_tokens.CardTokensResourceWithStreamingResponse(client.card_tokens) + self.card_push_transfers = card_push_transfers.CardPushTransfersResourceWithStreamingResponse( + client.card_push_transfers + ) + self.card_validations = card_validations.CardValidationsResourceWithStreamingResponse(client.card_validations) self.simulations = simulations.SimulationsResourceWithStreamingResponse(client.simulations) @@ -1289,6 +1319,13 @@ def __init__(self, client: AsyncIncrease) -> None: self.intrafi_exclusions = intrafi_exclusions.AsyncIntrafiExclusionsResourceWithStreamingResponse( client.intrafi_exclusions ) + self.card_tokens = card_tokens.AsyncCardTokensResourceWithStreamingResponse(client.card_tokens) + self.card_push_transfers = card_push_transfers.AsyncCardPushTransfersResourceWithStreamingResponse( + client.card_push_transfers + ) + self.card_validations = card_validations.AsyncCardValidationsResourceWithStreamingResponse( + client.card_validations + ) self.simulations = simulations.AsyncSimulationsResourceWithStreamingResponse(client.simulations) diff --git a/src/increase/_version.py b/src/increase/_version.py index 136fbbeb9..0a35013b0 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.285.0" # x-release-please-version +__version__ = "0.286.0" # x-release-please-version diff --git a/src/increase/resources/__init__.py b/src/increase/resources/__init__.py index 15f9c74d9..aff330664 100644 --- a/src/increase/resources/__init__.py +++ b/src/increase/resources/__init__.py @@ -89,6 +89,14 @@ FileLinksResourceWithStreamingResponse, AsyncFileLinksResourceWithStreamingResponse, ) +from .card_tokens import ( + CardTokensResource, + AsyncCardTokensResource, + CardTokensResourceWithRawResponse, + AsyncCardTokensResourceWithRawResponse, + CardTokensResourceWithStreamingResponse, + AsyncCardTokensResourceWithStreamingResponse, +) from .simulations import ( SimulationsResource, AsyncSimulationsResource, @@ -185,6 +193,14 @@ RoutingNumbersResourceWithStreamingResponse, AsyncRoutingNumbersResourceWithStreamingResponse, ) +from .card_validations import ( + CardValidationsResource, + AsyncCardValidationsResource, + CardValidationsResourceWithRawResponse, + AsyncCardValidationsResourceWithRawResponse, + CardValidationsResourceWithStreamingResponse, + AsyncCardValidationsResourceWithStreamingResponse, +) from .intrafi_balances import ( IntrafiBalancesResource, AsyncIntrafiBalancesResource, @@ -257,6 +273,14 @@ BookkeepingEntriesResourceWithStreamingResponse, AsyncBookkeepingEntriesResourceWithStreamingResponse, ) +from .card_push_transfers import ( + CardPushTransfersResource, + AsyncCardPushTransfersResource, + CardPushTransfersResourceWithRawResponse, + AsyncCardPushTransfersResourceWithRawResponse, + CardPushTransfersResourceWithStreamingResponse, + AsyncCardPushTransfersResourceWithStreamingResponse, +) from .event_subscriptions import ( EventSubscriptionsResource, AsyncEventSubscriptionsResource, @@ -727,6 +751,24 @@ "AsyncIntrafiExclusionsResourceWithRawResponse", "IntrafiExclusionsResourceWithStreamingResponse", "AsyncIntrafiExclusionsResourceWithStreamingResponse", + "CardTokensResource", + "AsyncCardTokensResource", + "CardTokensResourceWithRawResponse", + "AsyncCardTokensResourceWithRawResponse", + "CardTokensResourceWithStreamingResponse", + "AsyncCardTokensResourceWithStreamingResponse", + "CardPushTransfersResource", + "AsyncCardPushTransfersResource", + "CardPushTransfersResourceWithRawResponse", + "AsyncCardPushTransfersResourceWithRawResponse", + "CardPushTransfersResourceWithStreamingResponse", + "AsyncCardPushTransfersResourceWithStreamingResponse", + "CardValidationsResource", + "AsyncCardValidationsResource", + "CardValidationsResourceWithRawResponse", + "AsyncCardValidationsResourceWithRawResponse", + "CardValidationsResourceWithStreamingResponse", + "AsyncCardValidationsResourceWithStreamingResponse", "SimulationsResource", "AsyncSimulationsResource", "SimulationsResourceWithRawResponse", diff --git a/src/increase/resources/card_push_transfers.py b/src/increase/resources/card_push_transfers.py new file mode 100644 index 000000000..c28035cef --- /dev/null +++ b/src/increase/resources/card_push_transfers.py @@ -0,0 +1,826 @@ +# 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 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_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, + *, + amount: int, + 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, + 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, + require_approval: bool | 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, + ) -> CardPushTransfer: + """Create a Card Push Transfer + + Args: + amount: The transfer amount in USD cents. + + For Card Push transfers, must be positive. + + 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. + + 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. + + 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( + { + "amount": amount, + "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, + "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, + "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( + f"/card_push_transfers/{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 | NotGiven = NOT_GIVEN, + created_at: card_push_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + idempotency_key: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + status: card_push_transfer_list_params.Status | 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[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( + f"/card_push_transfers/{card_push_transfer_id}/approve", + 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( + f"/card_push_transfers/{card_push_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=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, + *, + amount: int, + 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, + 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, + require_approval: bool | 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, + ) -> CardPushTransfer: + """Create a Card Push Transfer + + Args: + amount: The transfer amount in USD cents. + + For Card Push transfers, must be positive. + + 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. + + 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. + + 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( + { + "amount": amount, + "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, + "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, + "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( + f"/card_push_transfers/{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 | NotGiven = NOT_GIVEN, + created_at: card_push_transfer_list_params.CreatedAt | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + idempotency_key: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + status: card_push_transfer_list_params.Status | 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[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( + f"/card_push_transfers/{card_push_transfer_id}/approve", + 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( + f"/card_push_transfers/{card_push_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=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..37fbd236e --- /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 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_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( + f"/card_tokens/{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 | 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[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( + f"/card_tokens/{card_token_id}/capabilities", + 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( + f"/card_tokens/{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 | 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[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( + f"/card_tokens/{card_token_id}/capabilities", + 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..d1a94f6a6 --- /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 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_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 | NotGiven = NOT_GIVEN, + cardholder_last_name: str | NotGiven = NOT_GIVEN, + cardholder_middle_name: str | NotGiven = NOT_GIVEN, + cardholder_postal_code: str | NotGiven = NOT_GIVEN, + cardholder_street_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, + ) -> 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( + f"/card_validations/{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 | NotGiven = NOT_GIVEN, + created_at: card_validation_list_params.CreatedAt | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + idempotency_key: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + status: card_validation_list_params.Status | 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[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 | NotGiven = NOT_GIVEN, + cardholder_last_name: str | NotGiven = NOT_GIVEN, + cardholder_middle_name: str | NotGiven = NOT_GIVEN, + cardholder_postal_code: str | NotGiven = NOT_GIVEN, + cardholder_street_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, + ) -> 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( + f"/card_validations/{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 | NotGiven = NOT_GIVEN, + created_at: card_validation_list_params.CreatedAt | NotGiven = NOT_GIVEN, + cursor: str | NotGiven = NOT_GIVEN, + idempotency_key: str | NotGiven = NOT_GIVEN, + limit: int | NotGiven = NOT_GIVEN, + status: card_validation_list_params.Status | 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[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/simulations/__init__.py b/src/increase/resources/simulations/__init__.py index 262890320..fc5a02d8c 100644 --- a/src/increase/resources/simulations/__init__.py +++ b/src/increase/resources/simulations/__init__.py @@ -16,6 +16,14 @@ DocumentsResourceWithStreamingResponse, AsyncDocumentsResourceWithStreamingResponse, ) +from .card_tokens import ( + CardTokensResource, + AsyncCardTokensResource, + CardTokensResourceWithRawResponse, + AsyncCardTokensResourceWithRawResponse, + CardTokensResourceWithStreamingResponse, + AsyncCardTokensResourceWithStreamingResponse, +) from .simulations import ( SimulationsResource, AsyncSimulationsResource, @@ -402,6 +410,12 @@ "AsyncDocumentsResourceWithRawResponse", "DocumentsResourceWithStreamingResponse", "AsyncDocumentsResourceWithStreamingResponse", + "CardTokensResource", + "AsyncCardTokensResource", + "CardTokensResourceWithRawResponse", + "AsyncCardTokensResourceWithRawResponse", + "CardTokensResourceWithStreamingResponse", + "AsyncCardTokensResourceWithStreamingResponse", "SimulationsResource", "AsyncSimulationsResource", "SimulationsResourceWithRawResponse", diff --git a/src/increase/resources/simulations/card_tokens.py b/src/increase/resources/simulations/card_tokens.py new file mode 100644 index 000000000..950073777 --- /dev/null +++ b/src/increase/resources/simulations/card_tokens.py @@ -0,0 +1,226 @@ +# 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 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_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] | NotGiven = NOT_GIVEN, + expiration: Union[str, date] | NotGiven = NOT_GIVEN, + last4: str | NotGiven = NOT_GIVEN, + prefix: str | NotGiven = NOT_GIVEN, + primary_account_number_length: 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, + ) -> 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. + + 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, + "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] | NotGiven = NOT_GIVEN, + expiration: Union[str, date] | NotGiven = NOT_GIVEN, + last4: str | NotGiven = NOT_GIVEN, + prefix: str | NotGiven = NOT_GIVEN, + primary_account_number_length: 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, + ) -> 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. + + 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, + "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/simulations.py b/src/increase/resources/simulations/simulations.py index d91595500..2dd37a337 100644 --- a/src/increase/resources/simulations/simulations.py +++ b/src/increase/resources/simulations/simulations.py @@ -20,6 +20,14 @@ AsyncDocumentsResourceWithStreamingResponse, ) from ..._resource import SyncAPIResource, AsyncAPIResource +from .card_tokens import ( + CardTokensResource, + AsyncCardTokensResource, + CardTokensResourceWithRawResponse, + AsyncCardTokensResourceWithRawResponse, + CardTokensResourceWithStreamingResponse, + AsyncCardTokensResourceWithStreamingResponse, +) from .card_refunds import ( CardRefundsResource, AsyncCardRefundsResource, @@ -345,6 +353,10 @@ def account_statements(self) -> AccountStatementsResource: def documents(self) -> DocumentsResource: return DocumentsResource(self._client) + @cached_property + def card_tokens(self) -> CardTokensResource: + return CardTokensResource(self._client) + @cached_property def with_raw_response(self) -> SimulationsResourceWithRawResponse: """ @@ -478,6 +490,10 @@ def account_statements(self) -> AsyncAccountStatementsResource: def documents(self) -> AsyncDocumentsResource: return AsyncDocumentsResource(self._client) + @cached_property + def card_tokens(self) -> AsyncCardTokensResource: + return AsyncCardTokensResource(self._client) + @cached_property def with_raw_response(self) -> AsyncSimulationsResourceWithRawResponse: """ @@ -616,6 +632,10 @@ def account_statements(self) -> AccountStatementsResourceWithRawResponse: def documents(self) -> DocumentsResourceWithRawResponse: return DocumentsResourceWithRawResponse(self._simulations.documents) + @cached_property + def card_tokens(self) -> CardTokensResourceWithRawResponse: + return CardTokensResourceWithRawResponse(self._simulations.card_tokens) + class AsyncSimulationsResourceWithRawResponse: def __init__(self, simulations: AsyncSimulationsResource) -> None: @@ -737,6 +757,10 @@ def account_statements(self) -> AsyncAccountStatementsResourceWithRawResponse: def documents(self) -> AsyncDocumentsResourceWithRawResponse: return AsyncDocumentsResourceWithRawResponse(self._simulations.documents) + @cached_property + def card_tokens(self) -> AsyncCardTokensResourceWithRawResponse: + return AsyncCardTokensResourceWithRawResponse(self._simulations.card_tokens) + class SimulationsResourceWithStreamingResponse: def __init__(self, simulations: SimulationsResource) -> None: @@ -860,6 +884,10 @@ def account_statements(self) -> AccountStatementsResourceWithStreamingResponse: def documents(self) -> DocumentsResourceWithStreamingResponse: return DocumentsResourceWithStreamingResponse(self._simulations.documents) + @cached_property + def card_tokens(self) -> CardTokensResourceWithStreamingResponse: + return CardTokensResourceWithStreamingResponse(self._simulations.card_tokens) + class AsyncSimulationsResourceWithStreamingResponse: def __init__(self, simulations: AsyncSimulationsResource) -> None: @@ -988,3 +1016,7 @@ def account_statements(self) -> AsyncAccountStatementsResourceWithStreamingRespo @cached_property def documents(self) -> AsyncDocumentsResourceWithStreamingResponse: return AsyncDocumentsResourceWithStreamingResponse(self._simulations.documents) + + @cached_property + def card_tokens(self) -> AsyncCardTokensResourceWithStreamingResponse: + return AsyncCardTokensResourceWithStreamingResponse(self._simulations.card_tokens) diff --git a/src/increase/types/__init__.py b/src/increase/types/__init__.py index 82f6cda1a..3e4272dc6 100644 --- a/src/increase/types/__init__.py +++ b/src/increase/types/__init__.py @@ -13,6 +13,7 @@ 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 @@ -25,6 +26,7 @@ from .account_number import AccountNumber as AccountNumber from .balance_lookup import BalanceLookup as BalanceLookup from .check_transfer import CheckTransfer as CheckTransfer +from .card_validation import CardValidation as CardValidation from .intrafi_balance import IntrafiBalance as IntrafiBalance from .account_transfer import AccountTransfer as AccountTransfer from .card_list_params import CardListParams as CardListParams @@ -38,6 +40,7 @@ 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 @@ -68,7 +71,9 @@ 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 .document_create_params import DocumentCreateParams as DocumentCreateParams +from .card_token_capabilities import CardTokenCapabilities as CardTokenCapabilities from .file_link_create_params import FileLinkCreateParams as FileLinkCreateParams from .transaction_list_params import TransactionListParams as TransactionListParams from .ach_transfer_list_params import ACHTransferListParams as ACHTransferListParams @@ -86,6 +91,7 @@ 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 .card_validation_list_params import CardValidationListParams as CardValidationListParams from .check_deposit_create_params import CheckDepositCreateParams as CheckDepositCreateParams from .physical_card_create_params import PhysicalCardCreateParams as PhysicalCardCreateParams from .physical_card_update_params import PhysicalCardUpdateParams as PhysicalCardUpdateParams @@ -102,11 +108,13 @@ from .routing_number_list_response import RoutingNumberListResponse as RoutingNumberListResponse 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 .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 .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 @@ -114,6 +122,7 @@ from .bookkeeping_account_list_params import BookkeepingAccountListParams as BookkeepingAccountListParams 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 diff --git a/src/increase/types/card_push_transfer.py b/src/increase/types/card_push_transfer.py new file mode 100644 index 000000000..d659da368 --- /dev/null +++ b/src/increase/types/card_push_transfer.py @@ -0,0 +1,451 @@ +# 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__ = [ + "CardPushTransfer", + "Acceptance", + "Approval", + "Cancellation", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "Decline", + "Submission", +] + + +class Acceptance(BaseModel): + 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.""" + + +class Approval(BaseModel): + 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): + 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): + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + 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. + """ + + 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): + 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", + "suspected_fraud", + "activity_amount_limit_exceeded", + "restricted_card", + "security_violation", + "transaction_does_not_fulfill_anti_money_laundering_requirement", + "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", + ] + """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. + - `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_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. + """ + + +class Submission(BaseModel): + 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 card network. + """ + + trace_number: str + """ + A 6-digit trace number that identifies the transfer within a small window of + time. + """ + + +class CardPushTransfer(BaseModel): + 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.""" + + amount: int + """The transfer amount in USD cents.""" + + 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. + """ + + 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.""" + + currency: Literal["CAD", "CHF", "EUR", "GBP", "JPY", "USD"] + """ + 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) + """ + + 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.""" + + recipient_name: str + """The name of the funds recipient.""" + + 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`. + """ 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..9fae1c4e9 --- /dev/null +++ b/src/increase/types/card_push_transfer_create_params.py @@ -0,0 +1,111 @@ +# 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"] + + +class CardPushTransferCreateParams(TypedDict, total=False): + amount: Required[int] + """The transfer amount in USD cents. For Card Push transfers, must be positive.""" + + 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.""" + + 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.""" + + require_approval: bool + """Whether the transfer requires explicit approval via the dashboard or API.""" 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..b7f1b4a09 --- /dev/null +++ b/src/increase/types/card_token.py @@ -0,0 +1,40 @@ +# 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): + 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..0b2543b60 --- /dev/null +++ b/src/increase/types/card_token_capabilities.py @@ -0,0 +1,42 @@ +# 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. + """ + + route: Literal["visa", "mastercard"] + """The card network route the capabilities apply to. + + - `visa` - Visa and Interlink + - `mastercard` - Mastercard and Maestro + """ + + +class CardTokenCapabilities(BaseModel): + 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/card_token_list_params.py b/src/increase/types/card_token_list_params.py new file mode 100644 index 000000000..68c5a04db --- /dev/null +++ b/src/increase/types/card_token_list_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 import Union +from datetime import datetime +from typing_extensions import Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = ["CardTokenListParams", "CreatedAt"] + + +class CardTokenListParams(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. + """ + + +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/card_validation.py b/src/increase/types/card_validation.py new file mode 100644 index 000000000..595ebdc4e --- /dev/null +++ b/src/increase/types/card_validation.py @@ -0,0 +1,379 @@ +# 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__ = [ + "CardValidation", + "Acceptance", + "CreatedBy", + "CreatedByAPIKey", + "CreatedByOAuthApplication", + "CreatedByUser", + "Decline", + "Submission", +] + + +class Acceptance(BaseModel): + 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): + description: Optional[str] = None + """The description set for the API key when it was created.""" + + +class CreatedByOAuthApplication(BaseModel): + name: str + """The name of the OAuth Application.""" + + +class CreatedByUser(BaseModel): + email: str + """The email address of the User.""" + + +class CreatedBy(BaseModel): + api_key: Optional[CreatedByAPIKey] = None + """If present, details about the API key that created the transfer.""" + + 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. + """ + + 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): + 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", + "suspected_fraud", + "activity_amount_limit_exceeded", + "restricted_card", + "security_violation", + "transaction_does_not_fulfill_anti_money_laundering_requirement", + "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", + ] + """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. + - `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_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. + """ + + +class Submission(BaseModel): + 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): + 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.""" + + 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.""" + + 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`. + """ 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/simulations/__init__.py b/src/increase/types/simulations/__init__.py index 94a8ed827..f7a621737 100644 --- a/src/increase/types/simulations/__init__.py +++ b/src/increase/types/simulations/__init__.py @@ -4,6 +4,7 @@ from .program_create_params import ProgramCreateParams as ProgramCreateParams 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 .card_dispute_action_params import CardDisputeActionParams as CardDisputeActionParams 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..f1272e9a6 --- /dev/null +++ b/src/increase/types/simulations/card_token_create_params.py @@ -0,0 +1,51 @@ +# 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"] + + +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.""" + + 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 + """ 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..9294cf3e1 --- /dev/null +++ b/tests/api_resources/simulations/test_card_tokens.py @@ -0,0 +1,109 @@ +# 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", + 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", + 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/test_card_push_transfers.py b/tests/api_resources/test_card_push_transfers.py new file mode 100644 index 000000000..aeaff762b --- /dev/null +++ b/tests/api_resources/test_card_push_transfers.py @@ -0,0 +1,536 @@ +# 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( + amount=100, + 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", + 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( + amount=100, + 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", + 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", + 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( + amount=100, + 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", + 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( + amount=100, + 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", + 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( + "card_push_transfer_id", + ) + 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( + "card_push_transfer_id", + ) + + 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( + "card_push_transfer_id", + ) 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( + "card_push_transfer_id", + ) + 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( + "card_push_transfer_id", + ) + + 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( + "card_push_transfer_id", + ) 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( + "card_push_transfer_id", + ) + 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( + "card_push_transfer_id", + ) + + 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( + "card_push_transfer_id", + ) 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( + amount=100, + 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", + 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( + amount=100, + 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", + 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", + 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( + amount=100, + 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", + 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( + amount=100, + 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", + 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( + "card_push_transfer_id", + ) + 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( + "card_push_transfer_id", + ) + + 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( + "card_push_transfer_id", + ) 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( + "card_push_transfer_id", + ) + 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( + "card_push_transfer_id", + ) + + 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( + "card_push_transfer_id", + ) 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( + "card_push_transfer_id", + ) + 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( + "card_push_transfer_id", + ) + + 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( + "card_push_transfer_id", + ) 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..18d7ad665 --- /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( + "card_token_id", + ) + 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( + "card_token_id", + ) + + 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( + "card_token_id", + ) 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( + "card_token_id", + ) + 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( + "card_token_id", + ) + + 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( + "card_token_id", + ) 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( + "card_token_id", + ) + 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( + "card_token_id", + ) + + 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( + "card_token_id", + ) 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( + "card_token_id", + ) + 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( + "card_token_id", + ) + + 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( + "card_token_id", + ) 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..bc23df5ad --- /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( + "card_validation_id", + ) + 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( + "card_validation_id", + ) + + 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( + "card_validation_id", + ) 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( + "card_validation_id", + ) + 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( + "card_validation_id", + ) + + 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( + "card_validation_id", + ) 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