From c6367b1c23492f204782cbe74e82bea0beec8070 Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 01:33:46 +0000 Subject: [PATCH 1/2] feat(api): api update --- .stats.yml | 8 +- api.md | 6 + .../resources/simulations/__init__.py | 14 + .../simulations/card_balance_inquiries.py | 425 ++++++++++++++++++ .../resources/simulations/simulations.py | 32 ++ src/increase/types/simulations/__init__.py | 1 + .../card_balance_inquiry_create_params.py | 167 +++++++ .../test_card_balance_inquiries.py | 116 +++++ 8 files changed, 765 insertions(+), 4 deletions(-) create mode 100644 src/increase/resources/simulations/card_balance_inquiries.py create mode 100644 src/increase/types/simulations/card_balance_inquiry_create_params.py create mode 100644 tests/api_resources/simulations/test_card_balance_inquiries.py diff --git a/.stats.yml b/.stats.yml index f5d26caa7..f4cd30496 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 229 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-79f55910f087930ab5447372ef856ab63fe18f08d2151c59b8aebcccd6f41700.yml -openapi_spec_hash: 5b6d915106e3361863168d9b084a570c -config_hash: b6f365add90e618b2174634df140826e +configured_endpoints: 230 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-6f7d8729d517e528b4a2bad402f49122fdf982be7b2df213c393e0d692cef7e7.yml +openapi_spec_hash: bd048174c7a122d23818810434e7881d +config_hash: dd86da070cc89eb6d3868bf23764c847 diff --git a/api.md b/api.md index e519813a0..ce4aecba3 100644 --- a/api.md +++ b/api.md @@ -837,6 +837,12 @@ Methods: - client.simulations.card_authorizations.create(\*\*params) -> CardAuthorizationCreateResponse +## CardBalanceInquiries + +Methods: + +- client.simulations.card_balance_inquiries.create(\*\*params) -> CardPayment + ## CardAuthorizationExpirations Methods: diff --git a/src/increase/resources/simulations/__init__.py b/src/increase/resources/simulations/__init__.py index 27f9585d1..5366a0c9c 100644 --- a/src/increase/resources/simulations/__init__.py +++ b/src/increase/resources/simulations/__init__.py @@ -168,6 +168,14 @@ InboundACHTransfersResourceWithStreamingResponse, AsyncInboundACHTransfersResourceWithStreamingResponse, ) +from .card_balance_inquiries import ( + CardBalanceInquiriesResource, + AsyncCardBalanceInquiriesResource, + CardBalanceInquiriesResourceWithRawResponse, + AsyncCardBalanceInquiriesResourceWithRawResponse, + CardBalanceInquiriesResourceWithStreamingResponse, + AsyncCardBalanceInquiriesResourceWithStreamingResponse, +) from .inbound_check_deposits import ( InboundCheckDepositsResource, AsyncInboundCheckDepositsResource, @@ -268,6 +276,12 @@ "AsyncCardAuthorizationsResourceWithRawResponse", "CardAuthorizationsResourceWithStreamingResponse", "AsyncCardAuthorizationsResourceWithStreamingResponse", + "CardBalanceInquiriesResource", + "AsyncCardBalanceInquiriesResource", + "CardBalanceInquiriesResourceWithRawResponse", + "AsyncCardBalanceInquiriesResourceWithRawResponse", + "CardBalanceInquiriesResourceWithStreamingResponse", + "AsyncCardBalanceInquiriesResourceWithStreamingResponse", "CardAuthorizationExpirationsResource", "AsyncCardAuthorizationExpirationsResource", "CardAuthorizationExpirationsResourceWithRawResponse", diff --git a/src/increase/resources/simulations/card_balance_inquiries.py b/src/increase/resources/simulations/card_balance_inquiries.py new file mode 100644 index 000000000..adfd37367 --- /dev/null +++ b/src/increase/resources/simulations/card_balance_inquiries.py @@ -0,0 +1,425 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal + +import httpx + +from ..._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from ..._utils import maybe_transform, async_maybe_transform +from ..._compat import cached_property +from ..._resource import SyncAPIResource, AsyncAPIResource +from ..._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..._base_client import make_request_options +from ...types.simulations import card_balance_inquiry_create_params +from ...types.card_payment import CardPayment + +__all__ = ["CardBalanceInquiriesResource", "AsyncCardBalanceInquiriesResource"] + + +class CardBalanceInquiriesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardBalanceInquiriesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardBalanceInquiriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardBalanceInquiriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardBalanceInquiriesResourceWithStreamingResponse(self) + + def create( + self, + *, + balance: int | Omit = omit, + card_id: str | Omit = omit, + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + | Omit = omit, + digital_wallet_token_id: str | Omit = omit, + event_subscription_id: str | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_city: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_descriptor: str | Omit = omit, + merchant_state: str | Omit = omit, + network_details: card_balance_inquiry_create_params.NetworkDetails | Omit = omit, + network_risk_score: int | Omit = omit, + physical_card_id: str | Omit = omit, + terminal_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates a balance inquiry on a [Card](#cards). + + Args: + balance: The balance amount in cents. The account balance will be used if not provided. + + card_id: The identifier of the Card to be authorized. + + decline_reason: Forces a card decline with a specific reason. No real time decision will be + sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV, dCVV, or + authorization request cryptogram. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + + digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_city: The city the merchant resides in. + + merchant_country: The country the merchant resides in. + + merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. + + merchant_state: The state the merchant resides in. + + network_details: Fields specific to a given card network. + + network_risk_score: The risk score generated by the card network. For Visa this is the Visa Advanced + Authorization risk score, from 0 to 99, where 99 is the riskiest. + + physical_card_id: The identifier of the Physical Card to be authorized. + + terminal_id: The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/simulations/card_balance_inquiries", + body=maybe_transform( + { + "balance": balance, + "card_id": card_id, + "decline_reason": decline_reason, + "digital_wallet_token_id": digital_wallet_token_id, + "event_subscription_id": event_subscription_id, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_city": merchant_city, + "merchant_country": merchant_country, + "merchant_descriptor": merchant_descriptor, + "merchant_state": merchant_state, + "network_details": network_details, + "network_risk_score": network_risk_score, + "physical_card_id": physical_card_id, + "terminal_id": terminal_id, + }, + card_balance_inquiry_create_params.CardBalanceInquiryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class AsyncCardBalanceInquiriesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardBalanceInquiriesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardBalanceInquiriesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardBalanceInquiriesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardBalanceInquiriesResourceWithStreamingResponse(self) + + async def create( + self, + *, + balance: int | Omit = omit, + card_id: str | Omit = omit, + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + | Omit = omit, + digital_wallet_token_id: str | Omit = omit, + event_subscription_id: str | Omit = omit, + merchant_acceptor_id: str | Omit = omit, + merchant_category_code: str | Omit = omit, + merchant_city: str | Omit = omit, + merchant_country: str | Omit = omit, + merchant_descriptor: str | Omit = omit, + merchant_state: str | Omit = omit, + network_details: card_balance_inquiry_create_params.NetworkDetails | Omit = omit, + network_risk_score: int | Omit = omit, + physical_card_id: str | Omit = omit, + terminal_id: str | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardPayment: + """ + Simulates a balance inquiry on a [Card](#cards). + + Args: + balance: The balance amount in cents. The account balance will be used if not provided. + + card_id: The identifier of the Card to be authorized. + + decline_reason: Forces a card decline with a specific reason. No real time decision will be + sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV, dCVV, or + authorization request cryptogram. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + + digital_wallet_token_id: The identifier of the Digital Wallet Token to be authorized. + + event_subscription_id: The identifier of the Event Subscription to use. If provided, will override the + default real time event subscription. Because you can only create one real time + decision event subscription, you can use this field to route events to any + specified event subscription for testing purposes. + + merchant_acceptor_id: The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + + merchant_category_code: The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + + merchant_city: The city the merchant resides in. + + merchant_country: The country the merchant resides in. + + merchant_descriptor: The merchant descriptor of the merchant the card is transacting with. + + merchant_state: The state the merchant resides in. + + network_details: Fields specific to a given card network. + + network_risk_score: The risk score generated by the card network. For Visa this is the Visa Advanced + Authorization risk score, from 0 to 99, where 99 is the riskiest. + + physical_card_id: The identifier of the Physical Card to be authorized. + + terminal_id: The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/simulations/card_balance_inquiries", + body=await async_maybe_transform( + { + "balance": balance, + "card_id": card_id, + "decline_reason": decline_reason, + "digital_wallet_token_id": digital_wallet_token_id, + "event_subscription_id": event_subscription_id, + "merchant_acceptor_id": merchant_acceptor_id, + "merchant_category_code": merchant_category_code, + "merchant_city": merchant_city, + "merchant_country": merchant_country, + "merchant_descriptor": merchant_descriptor, + "merchant_state": merchant_state, + "network_details": network_details, + "network_risk_score": network_risk_score, + "physical_card_id": physical_card_id, + "terminal_id": terminal_id, + }, + card_balance_inquiry_create_params.CardBalanceInquiryCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardPayment, + ) + + +class CardBalanceInquiriesResourceWithRawResponse: + def __init__(self, card_balance_inquiries: CardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = to_raw_response_wrapper( + card_balance_inquiries.create, + ) + + +class AsyncCardBalanceInquiriesResourceWithRawResponse: + def __init__(self, card_balance_inquiries: AsyncCardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = async_to_raw_response_wrapper( + card_balance_inquiries.create, + ) + + +class CardBalanceInquiriesResourceWithStreamingResponse: + def __init__(self, card_balance_inquiries: CardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = to_streamed_response_wrapper( + card_balance_inquiries.create, + ) + + +class AsyncCardBalanceInquiriesResourceWithStreamingResponse: + def __init__(self, card_balance_inquiries: AsyncCardBalanceInquiriesResource) -> None: + self._card_balance_inquiries = card_balance_inquiries + + self.create = async_to_streamed_response_wrapper( + card_balance_inquiries.create, + ) diff --git a/src/increase/resources/simulations/simulations.py b/src/increase/resources/simulations/simulations.py index 4dda2f035..f02536d09 100644 --- a/src/increase/resources/simulations/simulations.py +++ b/src/increase/resources/simulations/simulations.py @@ -164,6 +164,14 @@ InboundACHTransfersResourceWithStreamingResponse, AsyncInboundACHTransfersResourceWithStreamingResponse, ) +from .card_balance_inquiries import ( + CardBalanceInquiriesResource, + AsyncCardBalanceInquiriesResource, + CardBalanceInquiriesResourceWithRawResponse, + AsyncCardBalanceInquiriesResourceWithRawResponse, + CardBalanceInquiriesResourceWithStreamingResponse, + AsyncCardBalanceInquiriesResourceWithStreamingResponse, +) from .inbound_check_deposits import ( InboundCheckDepositsResource, AsyncInboundCheckDepositsResource, @@ -261,6 +269,10 @@ def account_transfers(self) -> AccountTransfersResource: def card_authorizations(self) -> CardAuthorizationsResource: return CardAuthorizationsResource(self._client) + @cached_property + def card_balance_inquiries(self) -> CardBalanceInquiriesResource: + return CardBalanceInquiriesResource(self._client) + @cached_property def card_authorization_expirations(self) -> CardAuthorizationExpirationsResource: return CardAuthorizationExpirationsResource(self._client) @@ -402,6 +414,10 @@ def account_transfers(self) -> AsyncAccountTransfersResource: def card_authorizations(self) -> AsyncCardAuthorizationsResource: return AsyncCardAuthorizationsResource(self._client) + @cached_property + def card_balance_inquiries(self) -> AsyncCardBalanceInquiriesResource: + return AsyncCardBalanceInquiriesResource(self._client) + @cached_property def card_authorization_expirations(self) -> AsyncCardAuthorizationExpirationsResource: return AsyncCardAuthorizationExpirationsResource(self._client) @@ -546,6 +562,10 @@ def account_transfers(self) -> AccountTransfersResourceWithRawResponse: def card_authorizations(self) -> CardAuthorizationsResourceWithRawResponse: return CardAuthorizationsResourceWithRawResponse(self._simulations.card_authorizations) + @cached_property + def card_balance_inquiries(self) -> CardBalanceInquiriesResourceWithRawResponse: + return CardBalanceInquiriesResourceWithRawResponse(self._simulations.card_balance_inquiries) + @cached_property def card_authorization_expirations(self) -> CardAuthorizationExpirationsResourceWithRawResponse: return CardAuthorizationExpirationsResourceWithRawResponse(self._simulations.card_authorization_expirations) @@ -673,6 +693,10 @@ def account_transfers(self) -> AsyncAccountTransfersResourceWithRawResponse: def card_authorizations(self) -> AsyncCardAuthorizationsResourceWithRawResponse: return AsyncCardAuthorizationsResourceWithRawResponse(self._simulations.card_authorizations) + @cached_property + def card_balance_inquiries(self) -> AsyncCardBalanceInquiriesResourceWithRawResponse: + return AsyncCardBalanceInquiriesResourceWithRawResponse(self._simulations.card_balance_inquiries) + @cached_property def card_authorization_expirations(self) -> AsyncCardAuthorizationExpirationsResourceWithRawResponse: return AsyncCardAuthorizationExpirationsResourceWithRawResponse( @@ -802,6 +826,10 @@ def account_transfers(self) -> AccountTransfersResourceWithStreamingResponse: def card_authorizations(self) -> CardAuthorizationsResourceWithStreamingResponse: return CardAuthorizationsResourceWithStreamingResponse(self._simulations.card_authorizations) + @cached_property + def card_balance_inquiries(self) -> CardBalanceInquiriesResourceWithStreamingResponse: + return CardBalanceInquiriesResourceWithStreamingResponse(self._simulations.card_balance_inquiries) + @cached_property def card_authorization_expirations(self) -> CardAuthorizationExpirationsResourceWithStreamingResponse: return CardAuthorizationExpirationsResourceWithStreamingResponse( @@ -933,6 +961,10 @@ def account_transfers(self) -> AsyncAccountTransfersResourceWithStreamingRespons def card_authorizations(self) -> AsyncCardAuthorizationsResourceWithStreamingResponse: return AsyncCardAuthorizationsResourceWithStreamingResponse(self._simulations.card_authorizations) + @cached_property + def card_balance_inquiries(self) -> AsyncCardBalanceInquiriesResourceWithStreamingResponse: + return AsyncCardBalanceInquiriesResourceWithStreamingResponse(self._simulations.card_balance_inquiries) + @cached_property def card_authorization_expirations(self) -> AsyncCardAuthorizationExpirationsResourceWithStreamingResponse: return AsyncCardAuthorizationExpirationsResourceWithStreamingResponse( diff --git a/src/increase/types/simulations/__init__.py b/src/increase/types/simulations/__init__.py index 1b04cffc6..318e54366 100644 --- a/src/increase/types/simulations/__init__.py +++ b/src/increase/types/simulations/__init__.py @@ -18,6 +18,7 @@ from .inbound_mail_item_create_params import InboundMailItemCreateParams as InboundMailItemCreateParams from .card_authorization_create_params import CardAuthorizationCreateParams as CardAuthorizationCreateParams from .card_authorization_create_response import CardAuthorizationCreateResponse as CardAuthorizationCreateResponse +from .card_balance_inquiry_create_params import CardBalanceInquiryCreateParams as CardBalanceInquiryCreateParams from .inbound_ach_transfer_create_params import InboundACHTransferCreateParams as InboundACHTransferCreateParams from .inbound_check_deposit_create_params import InboundCheckDepositCreateParams as InboundCheckDepositCreateParams from .inbound_wire_transfer_create_params import InboundWireTransferCreateParams as InboundWireTransferCreateParams diff --git a/src/increase/types/simulations/card_balance_inquiry_create_params.py b/src/increase/types/simulations/card_balance_inquiry_create_params.py new file mode 100644 index 000000000..8ce3cf2b3 --- /dev/null +++ b/src/increase/types/simulations/card_balance_inquiry_create_params.py @@ -0,0 +1,167 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing_extensions import Literal, Required, TypedDict + +__all__ = ["CardBalanceInquiryCreateParams", "NetworkDetails", "NetworkDetailsVisa"] + + +class CardBalanceInquiryCreateParams(TypedDict, total=False): + balance: int + """The balance amount in cents. The account balance will be used if not provided.""" + + card_id: str + """The identifier of the Card to be authorized.""" + + decline_reason: Literal[ + "account_closed", + "card_not_active", + "card_canceled", + "physical_card_not_active", + "entity_not_active", + "group_locked", + "insufficient_funds", + "cvv2_mismatch", + "pin_mismatch", + "card_expiration_mismatch", + "transaction_not_allowed", + "breaches_limit", + "webhook_declined", + "webhook_timed_out", + "declined_by_stand_in_processing", + "invalid_physical_card", + "missing_original_authorization", + "failed_3ds_authentication", + "suspected_card_testing", + "suspected_fraud", + ] + """Forces a card decline with a specific reason. + + No real time decision will be sent. + + - `account_closed` - The account has been closed. + - `card_not_active` - The Card was not active. + - `card_canceled` - The Card has been canceled. + - `physical_card_not_active` - The Physical Card was not active. + - `entity_not_active` - The account's entity was not active. + - `group_locked` - The account was inactive. + - `insufficient_funds` - The Card's Account did not have a sufficient available + balance. + - `cvv2_mismatch` - The given CVV2 did not match the card's value. + - `pin_mismatch` - The given PIN did not match the card's value. + - `card_expiration_mismatch` - The given expiration date did not match the + card's value. Only applies when a CVV2 is present. + - `transaction_not_allowed` - The attempted card transaction is not allowed per + Increase's terms. + - `breaches_limit` - The transaction was blocked by a Limit. + - `webhook_declined` - Your application declined the transaction via webhook. + - `webhook_timed_out` - Your application webhook did not respond without the + required timeout. + - `declined_by_stand_in_processing` - Declined by stand-in processing. + - `invalid_physical_card` - The card read had an invalid CVV, dCVV, or + authorization request cryptogram. + - `missing_original_authorization` - The original card authorization for this + incremental authorization does not exist. + - `failed_3ds_authentication` - The transaction was declined because the 3DS + authentication failed. + - `suspected_card_testing` - The transaction was suspected to be used by a card + tester to test for valid card numbers. + - `suspected_fraud` - The transaction was suspected to be fraudulent. Please + reach out to support@increase.com for more information. + """ + + digital_wallet_token_id: str + """The identifier of the Digital Wallet Token to be authorized.""" + + event_subscription_id: str + """The identifier of the Event Subscription to use. + + If provided, will override the default real time event subscription. Because you + can only create one real time decision event subscription, you can use this + field to route events to any specified event subscription for testing purposes. + """ + + merchant_acceptor_id: str + """ + The merchant identifier (commonly abbreviated as MID) of the merchant the card + is transacting with. + """ + + merchant_category_code: str + """ + The Merchant Category Code (commonly abbreviated as MCC) of the merchant the + card is transacting with. + """ + + merchant_city: str + """The city the merchant resides in.""" + + merchant_country: str + """The country the merchant resides in.""" + + merchant_descriptor: str + """The merchant descriptor of the merchant the card is transacting with.""" + + merchant_state: str + """The state the merchant resides in.""" + + network_details: NetworkDetails + """Fields specific to a given card network.""" + + network_risk_score: int + """The risk score generated by the card network. + + For Visa this is the Visa Advanced Authorization risk score, from 0 to 99, where + 99 is the riskiest. + """ + + physical_card_id: str + """The identifier of the Physical Card to be authorized.""" + + terminal_id: str + """ + The terminal identifier (commonly abbreviated as TID) of the terminal the card + is transacting with. + """ + + +class NetworkDetailsVisa(TypedDict, total=False): + """Fields specific to the Visa network.""" + + stand_in_processing_reason: Literal[ + "issuer_error", + "invalid_physical_card", + "invalid_cardholder_authentication_verification_value", + "internal_visa_error", + "merchant_transaction_advisory_service_authentication_required", + "payment_fraud_disruption_acquirer_block", + "other", + ] + """The reason code for the stand-in processing. + + - `issuer_error` - Increase failed to process the authorization in a timely + manner. + - `invalid_physical_card` - The physical card read had an invalid CVV, dCVV, or + authorization request cryptogram. + - `invalid_cardholder_authentication_verification_value` - The 3DS cardholder + authentication verification value was invalid. + - `internal_visa_error` - An internal Visa error occurred. Visa uses this reason + code for certain expected occurrences as well, such as Application Transaction + Counter (ATC) replays. + - `merchant_transaction_advisory_service_authentication_required` - The merchant + has enabled Visa's Transaction Advisory Service and requires further + authentication to perform the transaction. In practice this is often utilized + at fuel pumps to tell the cardholder to see the cashier. + - `payment_fraud_disruption_acquirer_block` - The transaction was blocked by + Visa's Payment Fraud Disruption service due to fraudulent Acquirer behavior, + such as card testing. + - `other` - An unspecific reason for stand-in processing. + """ + + +class NetworkDetails(TypedDict, total=False): + """Fields specific to a given card network.""" + + visa: Required[NetworkDetailsVisa] + """Fields specific to the Visa network.""" diff --git a/tests/api_resources/simulations/test_card_balance_inquiries.py b/tests/api_resources/simulations/test_card_balance_inquiries.py new file mode 100644 index 000000000..afdcbd4fa --- /dev/null +++ b/tests/api_resources/simulations/test_card_balance_inquiries.py @@ -0,0 +1,116 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +import os +from typing import Any, cast + +import pytest + +from increase import Increase, AsyncIncrease +from tests.utils import assert_matches_type +from increase.types import CardPayment + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardBalanceInquiries: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_balance_inquiry = client.simulations.card_balance_inquiries.create() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_balance_inquiry = client.simulations.card_balance_inquiries.create( + balance=1000000, + card_id="card_oubs0hwk5rn6knuecxg2", + decline_reason="account_closed", + digital_wallet_token_id="digital_wallet_token_id", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_city="New York", + merchant_country="US", + merchant_descriptor="CITIBANK", + merchant_state="NY", + network_details={"visa": {"stand_in_processing_reason": "issuer_error"}}, + network_risk_score=0, + physical_card_id="physical_card_id", + terminal_id="x", + ) + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.simulations.card_balance_inquiries.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_balance_inquiry = response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.simulations.card_balance_inquiries.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_balance_inquiry = response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + assert cast(Any, response.is_closed) is True + + +class TestAsyncCardBalanceInquiries: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_balance_inquiry = await async_client.simulations.card_balance_inquiries.create() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_balance_inquiry = await async_client.simulations.card_balance_inquiries.create( + balance=1000000, + card_id="card_oubs0hwk5rn6knuecxg2", + decline_reason="account_closed", + digital_wallet_token_id="digital_wallet_token_id", + event_subscription_id="event_subscription_001dzz0r20rcdxgb013zqb8m04g", + merchant_acceptor_id="5665270011000168", + merchant_category_code="5734", + merchant_city="New York", + merchant_country="US", + merchant_descriptor="CITIBANK", + merchant_state="NY", + network_details={"visa": {"stand_in_processing_reason": "issuer_error"}}, + network_risk_score=0, + physical_card_id="physical_card_id", + terminal_id="x", + ) + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_balance_inquiries.with_raw_response.create() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_balance_inquiry = await response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_balance_inquiries.with_streaming_response.create() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_balance_inquiry = await response.parse() + assert_matches_type(CardPayment, card_balance_inquiry, path=["response"]) + + assert cast(Any, response.is_closed) is True From 555d97e383fe2d5da6b92b28596c0b855d0b4abf Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Tue, 9 Dec 2025 01:34:07 +0000 Subject: [PATCH 2/2] release: 0.410.0 --- .release-please-manifest.json | 2 +- CHANGELOG.md | 8 ++++++++ pyproject.toml | 2 +- src/increase/_version.py | 2 +- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index bfd4e4464..79c939347 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.409.0" + ".": "0.410.0" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 5bb2f2342..69860f4e1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.410.0 (2025-12-09) + +Full Changelog: [v0.409.0...v0.410.0](https://github.com/Increase/increase-python/compare/v0.409.0...v0.410.0) + +### Features + +* **api:** api update ([c6367b1](https://github.com/Increase/increase-python/commit/c6367b1c23492f204782cbe74e82bea0beec8070)) + ## 0.409.0 (2025-12-08) Full Changelog: [v0.408.0...v0.409.0](https://github.com/Increase/increase-python/compare/v0.408.0...v0.409.0) diff --git a/pyproject.toml b/pyproject.toml index edf35f866..8483839e5 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "increase" -version = "0.409.0" +version = "0.410.0" description = "The official Python library for the increase API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/increase/_version.py b/src/increase/_version.py index e1141bd6c..0ba71bbe2 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.409.0" # x-release-please-version +__version__ = "0.410.0" # x-release-please-version