diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 1a931c1e0..18dbf0405 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.348.0" + ".": "0.349.0" } \ No newline at end of file diff --git a/.stats.yml b/.stats.yml index d2b407e60..9aa42589f 100644 --- a/.stats.yml +++ b/.stats.yml @@ -1,4 +1,4 @@ -configured_endpoints: 214 -openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-1084eee4a06751b960309c5854bc2af4d20e8022359fda84882ea67495bdce1b.yml -openapi_spec_hash: 90bed8cf565ade10b60b33d5ca70e6d0 -config_hash: a143293c5450ae8f52acad08f3102575 +configured_endpoints: 220 +openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-dc0a89abaae59dd7fc23cc5463a412d79b5c8c042eb144b05e97823d11a76b2b.yml +openapi_spec_hash: 24ce07f273cf90d08b3fa22958316846 +config_hash: f0b80170c2ea09811aeae3f1e94bc422 diff --git a/CHANGELOG.md b/CHANGELOG.md index fbabc0699..5fe45ea08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.349.0 (2025-10-01) + +Full Changelog: [v0.348.0...v0.349.0](https://github.com/Increase/increase-python/compare/v0.348.0...v0.349.0) + +### Features + +* **api:** api update ([3163858](https://github.com/Increase/increase-python/commit/3163858a029ed4daa518f89b3ebe6a45c7865b06)) + ## 0.348.0 (2025-10-01) Full Changelog: [v0.347.0...v0.348.0](https://github.com/Increase/increase-python/compare/v0.347.0...v0.348.0) diff --git a/api.md b/api.md index bdeb9a9ba..7af830e22 100644 --- a/api.md +++ b/api.md @@ -90,6 +90,22 @@ Methods: - client.card_purchase_supplements.retrieve(card_purchase_supplement_id) -> CardPurchaseSupplement - client.card_purchase_supplements.list(\*\*params) -> SyncPage[CardPurchaseSupplement] +# CardDisputes + +Types: + +```python +from increase.types import CardDispute +``` + +Methods: + +- client.card_disputes.create(\*\*params) -> CardDispute +- client.card_disputes.retrieve(card_dispute_id) -> CardDispute +- client.card_disputes.list(\*\*params) -> SyncPage[CardDispute] +- client.card_disputes.submit_user_submission(card_dispute_id, \*\*params) -> CardDispute +- client.card_disputes.withdraw(card_dispute_id) -> CardDispute + # PhysicalCards Types: @@ -827,6 +843,12 @@ Methods: - client.simulations.card_refunds.create(\*\*params) -> Transaction +## CardDisputes + +Methods: + +- client.simulations.card_disputes.action(card_dispute_id, \*\*params) -> CardDispute + ## PhysicalCards Methods: diff --git a/pyproject.toml b/pyproject.toml index e99cef4ec..131460488 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "increase" -version = "0.348.0" +version = "0.349.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 acbde35b9..78d8ae88e 100644 --- a/src/increase/_client.py +++ b/src/increase/_client.py @@ -42,6 +42,7 @@ oauth_tokens, transactions, ach_transfers, + card_disputes, card_payments, check_deposits, physical_cards, @@ -115,6 +116,7 @@ class Increase(SyncAPIClient): cards: cards.CardsResource card_payments: card_payments.CardPaymentsResource card_purchase_supplements: card_purchase_supplements.CardPurchaseSupplementsResource + card_disputes: card_disputes.CardDisputesResource physical_cards: physical_cards.PhysicalCardsResource digital_card_profiles: digital_card_profiles.DigitalCardProfilesResource physical_card_profiles: physical_card_profiles.PhysicalCardProfilesResource @@ -261,6 +263,7 @@ def __init__( self.cards = cards.CardsResource(self) self.card_payments = card_payments.CardPaymentsResource(self) self.card_purchase_supplements = card_purchase_supplements.CardPurchaseSupplementsResource(self) + self.card_disputes = card_disputes.CardDisputesResource(self) self.physical_cards = physical_cards.PhysicalCardsResource(self) self.digital_card_profiles = digital_card_profiles.DigitalCardProfilesResource(self) self.physical_card_profiles = physical_card_profiles.PhysicalCardProfilesResource(self) @@ -476,6 +479,7 @@ class AsyncIncrease(AsyncAPIClient): cards: cards.AsyncCardsResource card_payments: card_payments.AsyncCardPaymentsResource card_purchase_supplements: card_purchase_supplements.AsyncCardPurchaseSupplementsResource + card_disputes: card_disputes.AsyncCardDisputesResource physical_cards: physical_cards.AsyncPhysicalCardsResource digital_card_profiles: digital_card_profiles.AsyncDigitalCardProfilesResource physical_card_profiles: physical_card_profiles.AsyncPhysicalCardProfilesResource @@ -624,6 +628,7 @@ def __init__( self.cards = cards.AsyncCardsResource(self) self.card_payments = card_payments.AsyncCardPaymentsResource(self) self.card_purchase_supplements = card_purchase_supplements.AsyncCardPurchaseSupplementsResource(self) + self.card_disputes = card_disputes.AsyncCardDisputesResource(self) self.physical_cards = physical_cards.AsyncPhysicalCardsResource(self) self.digital_card_profiles = digital_card_profiles.AsyncDigitalCardProfilesResource(self) self.physical_card_profiles = physical_card_profiles.AsyncPhysicalCardProfilesResource(self) @@ -844,6 +849,7 @@ def __init__(self, client: Increase) -> None: self.card_purchase_supplements = card_purchase_supplements.CardPurchaseSupplementsResourceWithRawResponse( client.card_purchase_supplements ) + self.card_disputes = card_disputes.CardDisputesResourceWithRawResponse(client.card_disputes) self.physical_cards = physical_cards.PhysicalCardsResourceWithRawResponse(client.physical_cards) self.digital_card_profiles = digital_card_profiles.DigitalCardProfilesResourceWithRawResponse( client.digital_card_profiles @@ -954,6 +960,7 @@ def __init__(self, client: AsyncIncrease) -> None: self.card_purchase_supplements = card_purchase_supplements.AsyncCardPurchaseSupplementsResourceWithRawResponse( client.card_purchase_supplements ) + self.card_disputes = card_disputes.AsyncCardDisputesResourceWithRawResponse(client.card_disputes) self.physical_cards = physical_cards.AsyncPhysicalCardsResourceWithRawResponse(client.physical_cards) self.digital_card_profiles = digital_card_profiles.AsyncDigitalCardProfilesResourceWithRawResponse( client.digital_card_profiles @@ -1078,6 +1085,7 @@ def __init__(self, client: Increase) -> None: self.card_purchase_supplements = card_purchase_supplements.CardPurchaseSupplementsResourceWithStreamingResponse( client.card_purchase_supplements ) + self.card_disputes = card_disputes.CardDisputesResourceWithStreamingResponse(client.card_disputes) self.physical_cards = physical_cards.PhysicalCardsResourceWithStreamingResponse(client.physical_cards) self.digital_card_profiles = digital_card_profiles.DigitalCardProfilesResourceWithStreamingResponse( client.digital_card_profiles @@ -1204,6 +1212,7 @@ def __init__(self, client: AsyncIncrease) -> None: client.card_purchase_supplements ) ) + self.card_disputes = card_disputes.AsyncCardDisputesResourceWithStreamingResponse(client.card_disputes) self.physical_cards = physical_cards.AsyncPhysicalCardsResourceWithStreamingResponse(client.physical_cards) self.digital_card_profiles = digital_card_profiles.AsyncDigitalCardProfilesResourceWithStreamingResponse( client.digital_card_profiles diff --git a/src/increase/_version.py b/src/increase/_version.py index 1d9fc60b2..2d0bac4cf 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.348.0" # x-release-please-version +__version__ = "0.349.0" # x-release-please-version diff --git a/src/increase/resources/__init__.py b/src/increase/resources/__init__.py index 64fc78c87..d00f033c3 100644 --- a/src/increase/resources/__init__.py +++ b/src/increase/resources/__init__.py @@ -129,6 +129,14 @@ ACHTransfersResourceWithStreamingResponse, AsyncACHTransfersResourceWithStreamingResponse, ) +from .card_disputes import ( + CardDisputesResource, + AsyncCardDisputesResource, + CardDisputesResourceWithRawResponse, + AsyncCardDisputesResourceWithRawResponse, + CardDisputesResourceWithStreamingResponse, + AsyncCardDisputesResourceWithStreamingResponse, +) from .card_payments import ( CardPaymentsResource, AsyncCardPaymentsResource, @@ -471,6 +479,12 @@ "AsyncCardPurchaseSupplementsResourceWithRawResponse", "CardPurchaseSupplementsResourceWithStreamingResponse", "AsyncCardPurchaseSupplementsResourceWithStreamingResponse", + "CardDisputesResource", + "AsyncCardDisputesResource", + "CardDisputesResourceWithRawResponse", + "AsyncCardDisputesResourceWithRawResponse", + "CardDisputesResourceWithStreamingResponse", + "AsyncCardDisputesResourceWithStreamingResponse", "PhysicalCardsResource", "AsyncPhysicalCardsResource", "PhysicalCardsResourceWithRawResponse", diff --git a/src/increase/resources/card_disputes.py b/src/increase/resources/card_disputes.py new file mode 100644 index 000000000..2ef4e6958 --- /dev/null +++ b/src/increase/resources/card_disputes.py @@ -0,0 +1,703 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Iterable +from typing_extensions import Literal + +import httpx + +from ..types import card_dispute_list_params, card_dispute_create_params, card_dispute_submit_user_submission_params +from .._types import Body, Omit, Query, Headers, NotGiven, omit, not_given +from .._utils import maybe_transform, async_maybe_transform +from .._compat import cached_property +from .._resource import SyncAPIResource, AsyncAPIResource +from .._response import ( + to_raw_response_wrapper, + to_streamed_response_wrapper, + async_to_raw_response_wrapper, + async_to_streamed_response_wrapper, +) +from ..pagination import SyncPage, AsyncPage +from .._base_client import AsyncPaginator, make_request_options +from ..types.card_dispute import CardDispute + +__all__ = ["CardDisputesResource", "AsyncCardDisputesResource"] + + +class CardDisputesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardDisputesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardDisputesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardDisputesResourceWithStreamingResponse(self) + + def create( + self, + *, + disputed_transaction_id: str, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_create_params.AttachmentFile] | Omit = omit, + visa: card_dispute_create_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Create a Card Dispute + + Args: + disputed_transaction_id: The Transaction you wish to dispute. This Transaction must have a `source_type` + of `card_settlement`. + + network: The network of the disputed transaction. Details specific to the network are + required under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The monetary amount of the part of the transaction that is being disputed. This + is optional and will default to the full amount of the transaction if not + provided. If provided, the amount must be less than or equal to the amount of + the transaction. + + attachment_files: The files to be attached to the initial dispute submission. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + return self._post( + "/card_disputes", + body=maybe_transform( + { + "disputed_transaction_id": disputed_transaction_id, + "network": network, + "amount": amount, + "attachment_files": attachment_files, + "visa": visa, + }, + card_dispute_create_params.CardDisputeCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + def retrieve( + self, + card_dispute_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, + ) -> CardDispute: + """ + Retrieve a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return self._get( + f"/card_disputes/{card_dispute_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardDispute, + ) + + def list( + self, + *, + created_at: card_dispute_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_dispute_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> SyncPage[CardDispute]: + """ + List Card Disputes + + Args: + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/card_disputes", + page=SyncPage[CardDispute], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + card_dispute_list_params.CardDisputeListParams, + ), + ), + model=CardDispute, + ) + + def submit_user_submission( + self, + card_dispute_id: str, + *, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_submit_user_submission_params.AttachmentFile] | Omit = omit, + visa: card_dispute_submit_user_submission_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Submit a User Submission for a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to submit a user submission for. + + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The adjusted monetary amount of the part of the transaction that is being + disputed. This is optional and will default to the most recent amount provided. + If provided, the amount must be less than or equal to the amount of the + transaction. + + attachment_files: The files to be attached to the user submission. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return self._post( + f"/card_disputes/{card_dispute_id}/submit_user_submission", + body=maybe_transform( + { + "network": network, + "amount": amount, + "attachment_files": attachment_files, + "visa": visa, + }, + card_dispute_submit_user_submission_params.CardDisputeSubmitUserSubmissionParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + def withdraw( + self, + card_dispute_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Withdraw a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to withdraw. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return self._post( + f"/card_disputes/{card_dispute_id}/withdraw", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + +class AsyncCardDisputesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardDisputesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardDisputesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardDisputesResourceWithStreamingResponse(self) + + async def create( + self, + *, + disputed_transaction_id: str, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_create_params.AttachmentFile] | Omit = omit, + visa: card_dispute_create_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Create a Card Dispute + + Args: + disputed_transaction_id: The Transaction you wish to dispute. This Transaction must have a `source_type` + of `card_settlement`. + + network: The network of the disputed transaction. Details specific to the network are + required under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The monetary amount of the part of the transaction that is being disputed. This + is optional and will default to the full amount of the transaction if not + provided. If provided, the amount must be less than or equal to the amount of + the transaction. + + attachment_files: The files to be attached to the initial dispute submission. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + return await self._post( + "/card_disputes", + body=await async_maybe_transform( + { + "disputed_transaction_id": disputed_transaction_id, + "network": network, + "amount": amount, + "attachment_files": attachment_files, + "visa": visa, + }, + card_dispute_create_params.CardDisputeCreateParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + async def retrieve( + self, + card_dispute_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, + ) -> CardDispute: + """ + Retrieve a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return await self._get( + f"/card_disputes/{card_dispute_id}", + options=make_request_options( + extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout + ), + cast_to=CardDispute, + ) + + def list( + self, + *, + created_at: card_dispute_list_params.CreatedAt | Omit = omit, + cursor: str | Omit = omit, + idempotency_key: str | Omit = omit, + limit: int | Omit = omit, + status: card_dispute_list_params.Status | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + ) -> AsyncPaginator[CardDispute, AsyncPage[CardDispute]]: + """ + List Card Disputes + + Args: + cursor: Return the page of entries after this one. + + idempotency_key: Filter records to the one with the specified `idempotency_key` you chose for + that object. This value is unique across Increase and is used to ensure that a + request is only processed once. Learn more about + [idempotency](https://increase.com/documentation/idempotency-keys). + + limit: Limit the size of the list that is returned. The default (and maximum) is 100 + objects. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + """ + return self._get_api_list( + "/card_disputes", + page=AsyncPage[CardDispute], + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + query=maybe_transform( + { + "created_at": created_at, + "cursor": cursor, + "idempotency_key": idempotency_key, + "limit": limit, + "status": status, + }, + card_dispute_list_params.CardDisputeListParams, + ), + ), + model=CardDispute, + ) + + async def submit_user_submission( + self, + card_dispute_id: str, + *, + network: Literal["visa"], + amount: int | Omit = omit, + attachment_files: Iterable[card_dispute_submit_user_submission_params.AttachmentFile] | Omit = omit, + visa: card_dispute_submit_user_submission_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Submit a User Submission for a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to submit a user submission for. + + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. + + - `visa` - Visa + + amount: The adjusted monetary amount of the part of the transaction that is being + disputed. This is optional and will default to the most recent amount provided. + If provided, the amount must be less than or equal to the amount of the + transaction. + + attachment_files: The files to be attached to the user submission. + + visa: The Visa-specific parameters for the dispute. Required if and only if `network` + is `visa`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return await self._post( + f"/card_disputes/{card_dispute_id}/submit_user_submission", + body=await async_maybe_transform( + { + "network": network, + "amount": amount, + "attachment_files": attachment_files, + "visa": visa, + }, + card_dispute_submit_user_submission_params.CardDisputeSubmitUserSubmissionParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + async def withdraw( + self, + card_dispute_id: str, + *, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + Withdraw a Card Dispute + + Args: + card_dispute_id: The identifier of the Card Dispute to withdraw. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return await self._post( + f"/card_disputes/{card_dispute_id}/withdraw", + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + +class CardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.create = to_raw_response_wrapper( + card_disputes.create, + ) + self.retrieve = to_raw_response_wrapper( + card_disputes.retrieve, + ) + self.list = to_raw_response_wrapper( + card_disputes.list, + ) + self.submit_user_submission = to_raw_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = to_raw_response_wrapper( + card_disputes.withdraw, + ) + + +class AsyncCardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.create = async_to_raw_response_wrapper( + card_disputes.create, + ) + self.retrieve = async_to_raw_response_wrapper( + card_disputes.retrieve, + ) + self.list = async_to_raw_response_wrapper( + card_disputes.list, + ) + self.submit_user_submission = async_to_raw_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = async_to_raw_response_wrapper( + card_disputes.withdraw, + ) + + +class CardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.create = to_streamed_response_wrapper( + card_disputes.create, + ) + self.retrieve = to_streamed_response_wrapper( + card_disputes.retrieve, + ) + self.list = to_streamed_response_wrapper( + card_disputes.list, + ) + self.submit_user_submission = to_streamed_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = to_streamed_response_wrapper( + card_disputes.withdraw, + ) + + +class AsyncCardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.create = async_to_streamed_response_wrapper( + card_disputes.create, + ) + self.retrieve = async_to_streamed_response_wrapper( + card_disputes.retrieve, + ) + self.list = async_to_streamed_response_wrapper( + card_disputes.list, + ) + self.submit_user_submission = async_to_streamed_response_wrapper( + card_disputes.submit_user_submission, + ) + self.withdraw = async_to_streamed_response_wrapper( + card_disputes.withdraw, + ) diff --git a/src/increase/resources/simulations/__init__.py b/src/increase/resources/simulations/__init__.py index a9f636a2b..c1a47a541 100644 --- a/src/increase/resources/simulations/__init__.py +++ b/src/increase/resources/simulations/__init__.py @@ -48,6 +48,14 @@ ACHTransfersResourceWithStreamingResponse, AsyncACHTransfersResourceWithStreamingResponse, ) +from .card_disputes import ( + CardDisputesResource, + AsyncCardDisputesResource, + CardDisputesResourceWithRawResponse, + AsyncCardDisputesResourceWithRawResponse, + CardDisputesResourceWithStreamingResponse, + AsyncCardDisputesResourceWithStreamingResponse, +) from .card_reversals import ( CardReversalsResource, AsyncCardReversalsResource, @@ -288,6 +296,12 @@ "AsyncCardRefundsResourceWithRawResponse", "CardRefundsResourceWithStreamingResponse", "AsyncCardRefundsResourceWithStreamingResponse", + "CardDisputesResource", + "AsyncCardDisputesResource", + "CardDisputesResourceWithRawResponse", + "AsyncCardDisputesResourceWithRawResponse", + "CardDisputesResourceWithStreamingResponse", + "AsyncCardDisputesResourceWithStreamingResponse", "PhysicalCardsResource", "AsyncPhysicalCardsResource", "PhysicalCardsResourceWithRawResponse", diff --git a/src/increase/resources/simulations/card_disputes.py b/src/increase/resources/simulations/card_disputes.py new file mode 100644 index 000000000..a0fc9cb87 --- /dev/null +++ b/src/increase/resources/simulations/card_disputes.py @@ -0,0 +1,225 @@ +# 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_dispute_action_params +from ...types.card_dispute import CardDispute + +__all__ = ["CardDisputesResource", "AsyncCardDisputesResource"] + + +class CardDisputesResource(SyncAPIResource): + @cached_property + def with_raw_response(self) -> CardDisputesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return CardDisputesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> CardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return CardDisputesResourceWithStreamingResponse(self) + + def action( + self, + card_dispute_id: str, + *, + network: Literal["visa"], + visa: card_dispute_action_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + After a [Card Dispute](#card-disputes) is created in production, the dispute + will initially be in a `pending_user_submission_reviewing` state. Since no + review or further action happens in sandbox, this endpoint simulates moving a + Card Dispute through its various states. + + Args: + card_dispute_id: The dispute you would like to action. + + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. + + - `visa` - Visa + + visa: The Visa-specific parameters for the taking action on the dispute. Required if + and only if `network` is `visa`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return self._post( + f"/simulations/card_disputes/{card_dispute_id}/action", + body=maybe_transform( + { + "network": network, + "visa": visa, + }, + card_dispute_action_params.CardDisputeActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + +class AsyncCardDisputesResource(AsyncAPIResource): + @cached_property + def with_raw_response(self) -> AsyncCardDisputesResourceWithRawResponse: + """ + This property can be used as a prefix for any HTTP method call to return + the raw response object instead of the parsed content. + + For more information, see https://www.github.com/Increase/increase-python#accessing-raw-response-data-eg-headers + """ + return AsyncCardDisputesResourceWithRawResponse(self) + + @cached_property + def with_streaming_response(self) -> AsyncCardDisputesResourceWithStreamingResponse: + """ + An alternative to `.with_raw_response` that doesn't eagerly read the response body. + + For more information, see https://www.github.com/Increase/increase-python#with_streaming_response + """ + return AsyncCardDisputesResourceWithStreamingResponse(self) + + async def action( + self, + card_dispute_id: str, + *, + network: Literal["visa"], + visa: card_dispute_action_params.Visa | Omit = omit, + # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs. + # The extra values given here take precedence over values defined on the client or passed to this method. + extra_headers: Headers | None = None, + extra_query: Query | None = None, + extra_body: Body | None = None, + timeout: float | httpx.Timeout | None | NotGiven = not_given, + idempotency_key: str | None = None, + ) -> CardDispute: + """ + After a [Card Dispute](#card-disputes) is created in production, the dispute + will initially be in a `pending_user_submission_reviewing` state. Since no + review or further action happens in sandbox, this endpoint simulates moving a + Card Dispute through its various states. + + Args: + card_dispute_id: The dispute you would like to action. + + network: The network of the Card Dispute. Details specific to the network are required + under the sub-object with the same identifier as the network. + + - `visa` - Visa + + visa: The Visa-specific parameters for the taking action on the dispute. Required if + and only if `network` is `visa`. + + extra_headers: Send extra headers + + extra_query: Add additional query parameters to the request + + extra_body: Add additional JSON properties to the request + + timeout: Override the client-level default timeout for this request, in seconds + + idempotency_key: Specify a custom idempotency key for this request + """ + if not card_dispute_id: + raise ValueError(f"Expected a non-empty value for `card_dispute_id` but received {card_dispute_id!r}") + return await self._post( + f"/simulations/card_disputes/{card_dispute_id}/action", + body=await async_maybe_transform( + { + "network": network, + "visa": visa, + }, + card_dispute_action_params.CardDisputeActionParams, + ), + options=make_request_options( + extra_headers=extra_headers, + extra_query=extra_query, + extra_body=extra_body, + timeout=timeout, + idempotency_key=idempotency_key, + ), + cast_to=CardDispute, + ) + + +class CardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.action = to_raw_response_wrapper( + card_disputes.action, + ) + + +class AsyncCardDisputesResourceWithRawResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.action = async_to_raw_response_wrapper( + card_disputes.action, + ) + + +class CardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: CardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.action = to_streamed_response_wrapper( + card_disputes.action, + ) + + +class AsyncCardDisputesResourceWithStreamingResponse: + def __init__(self, card_disputes: AsyncCardDisputesResource) -> None: + self._card_disputes = card_disputes + + self.action = async_to_streamed_response_wrapper( + card_disputes.action, + ) diff --git a/src/increase/resources/simulations/simulations.py b/src/increase/resources/simulations/simulations.py index ebc3636c4..4b1ea1a12 100644 --- a/src/increase/resources/simulations/simulations.py +++ b/src/increase/resources/simulations/simulations.py @@ -44,6 +44,14 @@ ACHTransfersResourceWithStreamingResponse, AsyncACHTransfersResourceWithStreamingResponse, ) +from .card_disputes import ( + CardDisputesResource, + AsyncCardDisputesResource, + CardDisputesResourceWithRawResponse, + AsyncCardDisputesResourceWithRawResponse, + CardDisputesResourceWithStreamingResponse, + AsyncCardDisputesResourceWithStreamingResponse, +) from .card_reversals import ( CardReversalsResource, AsyncCardReversalsResource, @@ -269,6 +277,10 @@ def card_fuel_confirmations(self) -> CardFuelConfirmationsResource: def card_refunds(self) -> CardRefundsResource: return CardRefundsResource(self._client) + @cached_property + def card_disputes(self) -> CardDisputesResource: + return CardDisputesResource(self._client) + @cached_property def physical_cards(self) -> PhysicalCardsResource: return PhysicalCardsResource(self._client) @@ -402,6 +414,10 @@ def card_fuel_confirmations(self) -> AsyncCardFuelConfirmationsResource: def card_refunds(self) -> AsyncCardRefundsResource: return AsyncCardRefundsResource(self._client) + @cached_property + def card_disputes(self) -> AsyncCardDisputesResource: + return AsyncCardDisputesResource(self._client) + @cached_property def physical_cards(self) -> AsyncPhysicalCardsResource: return AsyncPhysicalCardsResource(self._client) @@ -538,6 +554,10 @@ def card_fuel_confirmations(self) -> CardFuelConfirmationsResourceWithRawRespons def card_refunds(self) -> CardRefundsResourceWithRawResponse: return CardRefundsResourceWithRawResponse(self._simulations.card_refunds) + @cached_property + def card_disputes(self) -> CardDisputesResourceWithRawResponse: + return CardDisputesResourceWithRawResponse(self._simulations.card_disputes) + @cached_property def physical_cards(self) -> PhysicalCardsResourceWithRawResponse: return PhysicalCardsResourceWithRawResponse(self._simulations.physical_cards) @@ -659,6 +679,10 @@ def card_fuel_confirmations(self) -> AsyncCardFuelConfirmationsResourceWithRawRe def card_refunds(self) -> AsyncCardRefundsResourceWithRawResponse: return AsyncCardRefundsResourceWithRawResponse(self._simulations.card_refunds) + @cached_property + def card_disputes(self) -> AsyncCardDisputesResourceWithRawResponse: + return AsyncCardDisputesResourceWithRawResponse(self._simulations.card_disputes) + @cached_property def physical_cards(self) -> AsyncPhysicalCardsResourceWithRawResponse: return AsyncPhysicalCardsResourceWithRawResponse(self._simulations.physical_cards) @@ -780,6 +804,10 @@ def card_fuel_confirmations(self) -> CardFuelConfirmationsResourceWithStreamingR def card_refunds(self) -> CardRefundsResourceWithStreamingResponse: return CardRefundsResourceWithStreamingResponse(self._simulations.card_refunds) + @cached_property + def card_disputes(self) -> CardDisputesResourceWithStreamingResponse: + return CardDisputesResourceWithStreamingResponse(self._simulations.card_disputes) + @cached_property def physical_cards(self) -> PhysicalCardsResourceWithStreamingResponse: return PhysicalCardsResourceWithStreamingResponse(self._simulations.physical_cards) @@ -903,6 +931,10 @@ def card_fuel_confirmations(self) -> AsyncCardFuelConfirmationsResourceWithStrea def card_refunds(self) -> AsyncCardRefundsResourceWithStreamingResponse: return AsyncCardRefundsResourceWithStreamingResponse(self._simulations.card_refunds) + @cached_property + def card_disputes(self) -> AsyncCardDisputesResourceWithStreamingResponse: + return AsyncCardDisputesResourceWithStreamingResponse(self._simulations.card_disputes) + @cached_property def physical_cards(self) -> AsyncPhysicalCardsResourceWithStreamingResponse: return AsyncPhysicalCardsResourceWithStreamingResponse(self._simulations.physical_cards) diff --git a/src/increase/types/__init__.py b/src/increase/types/__init__.py index 73a9288f4..7c32ee8e1 100644 --- a/src/increase/types/__init__.py +++ b/src/increase/types/__init__.py @@ -18,6 +18,7 @@ from .transaction import Transaction as Transaction from .ach_transfer import ACHTransfer as ACHTransfer from .card_details import CardDetails as CardDetails +from .card_dispute import CardDispute as CardDispute from .card_payment import CardPayment as CardPayment from .check_deposit import CheckDeposit as CheckDeposit from .physical_card import PhysicalCard as PhysicalCard @@ -79,6 +80,7 @@ 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 +from .card_dispute_list_params import CardDisputeListParams as CardDisputeListParams from .card_payment_list_params import CardPaymentListParams as CardPaymentListParams from .card_purchase_supplement import CardPurchaseSupplement as CardPurchaseSupplement from .check_deposit_list_params import CheckDepositListParams as CheckDepositListParams @@ -88,6 +90,7 @@ from .account_number_list_params import AccountNumberListParams as AccountNumberListParams from .ach_transfer_create_params import ACHTransferCreateParams as ACHTransferCreateParams from .bookkeeping_balance_lookup import BookkeepingBalanceLookup as BookkeepingBalanceLookup +from .card_dispute_create_params import CardDisputeCreateParams as CardDisputeCreateParams from .check_transfer_list_params import CheckTransferListParams as CheckTransferListParams from .intrafi_account_enrollment import IntrafiAccountEnrollment as IntrafiAccountEnrollment from .routing_number_list_params import RoutingNumberListParams as RoutingNumberListParams @@ -177,6 +180,9 @@ from .real_time_payments_transfer_create_params import ( RealTimePaymentsTransferCreateParams as RealTimePaymentsTransferCreateParams, ) +from .card_dispute_submit_user_submission_params import ( + CardDisputeSubmitUserSubmissionParams as CardDisputeSubmitUserSubmissionParams, +) from .inbound_ach_transfer_transfer_return_params import ( InboundACHTransferTransferReturnParams as InboundACHTransferTransferReturnParams, ) diff --git a/src/increase/types/card_dispute.py b/src/increase/types/card_dispute.py new file mode 100644 index 000000000..2ae7f8075 --- /dev/null +++ b/src/increase/types/card_dispute.py @@ -0,0 +1,2220 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from typing import List, Optional +from datetime import date, datetime +from typing_extensions import Literal + +from .._models import BaseModel + +__all__ = [ + "CardDispute", + "Loss", + "Visa", + "VisaNetworkEvent", + "VisaNetworkEventAttachmentFile", + "VisaNetworkEventMerchantPrearbitrationReceived", + "VisaNetworkEventMerchantPrearbitrationReceivedCardholderNoLongerDisputes", + "VisaNetworkEventMerchantPrearbitrationReceivedCompellingEvidence", + "VisaNetworkEventMerchantPrearbitrationReceivedCreditOrReversalProcessed", + "VisaNetworkEventMerchantPrearbitrationReceivedDelayedChargeTransaction", + "VisaNetworkEventMerchantPrearbitrationReceivedEvidenceOfImprint", + "VisaNetworkEventMerchantPrearbitrationReceivedInvalidDispute", + "VisaNetworkEventMerchantPrearbitrationReceivedNonFiatCurrencyOrNonFungibleTokenReceived", + "VisaNetworkEventMerchantPrearbitrationReceivedPriorUndisputedNonFraudTransactions", + "VisaNetworkEventRepresented", + "VisaNetworkEventRepresentedCardholderNoLongerDisputes", + "VisaNetworkEventRepresentedCreditOrReversalProcessed", + "VisaNetworkEventRepresentedInvalidDispute", + "VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenReceived", + "VisaNetworkEventRepresentedProofOfCashDisbursement", + "VisaNetworkEventRepresentedReversalIssued", + "VisaUserSubmission", + "VisaUserSubmissionAttachmentFile", + "VisaUserSubmissionChargeback", + "VisaUserSubmissionChargebackAuthorization", + "VisaUserSubmissionChargebackConsumerCanceledMerchandise", + "VisaUserSubmissionChargebackConsumerCanceledMerchandiseCardholderCancellation", + "VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturnAttempted", + "VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturned", + "VisaUserSubmissionChargebackConsumerCanceledRecurringTransaction", + "VisaUserSubmissionChargebackConsumerCanceledRecurringTransactionMerchantContactMethods", + "VisaUserSubmissionChargebackConsumerCanceledServices", + "VisaUserSubmissionChargebackConsumerCanceledServicesCardholderCancellation", + "VisaUserSubmissionChargebackConsumerCanceledServicesGuaranteedReservation", + "VisaUserSubmissionChargebackConsumerCounterfeitMerchandise", + "VisaUserSubmissionChargebackConsumerCreditNotProcessed", + "VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandise", + "VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted", + "VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentation", + "VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturnAttempted", + "VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribed", + "VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturnAttempted", + "VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceived", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayed", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturned", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation", + "VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedMerchantCancellation", + "VisaUserSubmissionChargebackConsumerOriginalCreditTransactionNotAccepted", + "VisaUserSubmissionChargebackConsumerQualityMerchandise", + "VisaUserSubmissionChargebackConsumerQualityMerchandiseOngoingNegotiations", + "VisaUserSubmissionChargebackConsumerQualityMerchandiseReturnAttempted", + "VisaUserSubmissionChargebackConsumerQualityMerchandiseReturned", + "VisaUserSubmissionChargebackConsumerQualityServices", + "VisaUserSubmissionChargebackConsumerQualityServicesCardholderCancellation", + "VisaUserSubmissionChargebackConsumerQualityServicesOngoingNegotiations", + "VisaUserSubmissionChargebackConsumerServicesMisrepresentation", + "VisaUserSubmissionChargebackConsumerServicesMisrepresentationCardholderCancellation", + "VisaUserSubmissionChargebackConsumerServicesNotAsDescribed", + "VisaUserSubmissionChargebackConsumerServicesNotAsDescribedCardholderCancellation", + "VisaUserSubmissionChargebackConsumerServicesNotReceived", + "VisaUserSubmissionChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaUserSubmissionChargebackConsumerServicesNotReceivedMerchantCancellation", + "VisaUserSubmissionChargebackFraud", + "VisaUserSubmissionChargebackProcessingError", + "VisaUserSubmissionChargebackProcessingErrorDuplicateTransaction", + "VisaUserSubmissionChargebackProcessingErrorIncorrectAmount", + "VisaUserSubmissionChargebackProcessingErrorPaidByOtherMeans", + "VisaUserSubmissionMerchantPrearbitrationDecline", + "VisaUserSubmissionUserPrearbitration", + "VisaUserSubmissionUserPrearbitrationCategoryChange", + "Win", +] + + +class Loss(BaseModel): + lost_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Card Dispute was lost. + """ + + reason: Literal["user_withdrawn", "loss"] + """The reason the Card Dispute was lost. + + - `user_withdrawn` - The user withdrew the Card Dispute. + - `loss` - The Card Dispute was lost according to network rules. + """ + + +class VisaNetworkEventAttachmentFile(BaseModel): + file_id: str + """The ID of the file attached to the Card Dispute.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedCardholderNoLongerDisputes(BaseModel): + explanation: Optional[str] = None + """ + Explanation for why the merchant believes the cardholder no longer disputes the + transaction. + """ + + +class VisaNetworkEventMerchantPrearbitrationReceivedCompellingEvidence(BaseModel): + category: Literal[ + "authorized_signer", + "delivery", + "delivery_at_place_of_employment", + "digital_goods_download", + "dynamic_currency_conversion_actively_chosen", + "flight_manifest_and_purchase_itinerary", + "household_member_signer", + "legitimate_spend_across_payment_types_for_same_merchandise", + "merchandise_use", + "passenger_transport_ticket_use", + "recurring_transaction_with_binding_contract_or_previous_undisputed_transaction", + "signed_delivery_or_pickup_form", + "signed_mail_order_phone_order_form", + "travel_and_expense_loyalty_transaction", + "travel_and_expense_subsequent_purchase", + ] + """The category of compelling evidence provided by the merchant. + + - `authorized_signer` - Authorized signer known by the cardholder. + - `delivery` - Proof of delivery. + - `delivery_at_place_of_employment` - Proof of delivery to cardholder at place + of employment. + - `digital_goods_download` - Proof of digital goods download. + - `dynamic_currency_conversion_actively_chosen` - Dynamic Currency Conversion + actively chosen by cardholder. + - `flight_manifest_and_purchase_itinerary` - Flight manifest with corresponding + purchase itinerary record. + - `household_member_signer` - Signer is member of cardholder's household. + - `legitimate_spend_across_payment_types_for_same_merchandise` - Legitimate + spend across multiple payment types for same merchandise. + - `merchandise_use` - Documentation to prove the cardholder is in possession of + and/or using the merchandise. + - `passenger_transport_ticket_use` - Passenger transport: proof ticket was + received, scanned at gate or other transaction related to original (for + example, frequent flyer miles.) + - `recurring_transaction_with_binding_contract_or_previous_undisputed_transaction` - + Recurring transaction with binding contract or previous undisputed recurring + transactions and proof the cardholder is using the merchandise or service. + - `signed_delivery_or_pickup_form` - Signed delivery form, or copy of/details of + identification from cardholder as proof goods were picked up at merchant + location. + - `signed_mail_order_phone_order_form` - Signed Mail Order/Phone Order form. + - `travel_and_expense_loyalty_transaction` - Travel & Expense: loyalty + transactions related to purchase. + - `travel_and_expense_subsequent_purchase` - Travel & Expense: subsequent + purchases made throughout service period. + """ + + explanation: Optional[str] = None + """Explanation of the compelling evidence provided by the merchant.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedCreditOrReversalProcessed(BaseModel): + amount: int + """The amount of the credit or reversal in the minor unit of its currency. + + For dollars, for example, this is cents. + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the credit or + reversal's currency. + """ + + explanation: Optional[str] = None + """Explanation for why the merchant believes the credit or reversal was processed.""" + + processed_at: date + """The date the credit or reversal was processed.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedDelayedChargeTransaction(BaseModel): + explanation: Optional[str] = None + """Additional details about the delayed charge transaction.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedEvidenceOfImprint(BaseModel): + explanation: Optional[str] = None + """Explanation of the evidence of imprint.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedInvalidDispute(BaseModel): + explanation: Optional[str] = None + """Explanation for why the dispute is considered invalid by the merchant.""" + + reason: Literal["other", "special_authorization_procedures_followed"] + """The reason a merchant considers the dispute invalid. + + - `other` - Other. + - `special_authorization_procedures_followed` - Special authorization procedures + followed. + """ + + +class VisaNetworkEventMerchantPrearbitrationReceivedNonFiatCurrencyOrNonFungibleTokenReceived(BaseModel): + blockchain_transaction_hash: str + """Blockchain transaction hash.""" + + destination_wallet_address: str + """Destination wallet address.""" + + prior_approved_transactions: Optional[str] = None + """Prior approved transactions.""" + + +class VisaNetworkEventMerchantPrearbitrationReceivedPriorUndisputedNonFraudTransactions(BaseModel): + explanation: Optional[str] = None + """ + Explanation of the prior undisputed non-fraud transactions provided by the + merchant. + """ + + +class VisaNetworkEventMerchantPrearbitrationReceived(BaseModel): + cardholder_no_longer_disputes: Optional[ + VisaNetworkEventMerchantPrearbitrationReceivedCardholderNoLongerDisputes + ] = None + """Cardholder no longer disputes details. + + Present if and only if `reason` is `cardholder_no_longer_disputes`. + """ + + compelling_evidence: Optional[VisaNetworkEventMerchantPrearbitrationReceivedCompellingEvidence] = None + """Compelling evidence details. + + Present if and only if `reason` is `compelling_evidence`. + """ + + credit_or_reversal_processed: Optional[VisaNetworkEventMerchantPrearbitrationReceivedCreditOrReversalProcessed] = ( + None + ) + """Credit or reversal processed details. + + Present if and only if `reason` is `credit_or_reversal_processed`. + """ + + delayed_charge_transaction: Optional[VisaNetworkEventMerchantPrearbitrationReceivedDelayedChargeTransaction] = None + """Delayed charge transaction details. + + Present if and only if `reason` is `delayed_charge_transaction`. + """ + + evidence_of_imprint: Optional[VisaNetworkEventMerchantPrearbitrationReceivedEvidenceOfImprint] = None + """Evidence of imprint details. + + Present if and only if `reason` is `evidence_of_imprint`. + """ + + invalid_dispute: Optional[VisaNetworkEventMerchantPrearbitrationReceivedInvalidDispute] = None + """Invalid dispute details. Present if and only if `reason` is `invalid_dispute`.""" + + non_fiat_currency_or_non_fungible_token_received: Optional[ + VisaNetworkEventMerchantPrearbitrationReceivedNonFiatCurrencyOrNonFungibleTokenReceived + ] = None + """Non-fiat currency or non-fungible token received details. + + Present if and only if `reason` is + `non_fiat_currency_or_non_fungible_token_received`. + """ + + prior_undisputed_non_fraud_transactions: Optional[ + VisaNetworkEventMerchantPrearbitrationReceivedPriorUndisputedNonFraudTransactions + ] = None + """Prior undisputed non-fraud transactions details. + + Present if and only if `reason` is `prior_undisputed_non_fraud_transactions`. + """ + + reason: Literal[ + "cardholder_no_longer_disputes", + "compelling_evidence", + "credit_or_reversal_processed", + "delayed_charge_transaction", + "evidence_of_imprint", + "invalid_dispute", + "non_fiat_currency_or_non_fungible_token_received", + "prior_undisputed_non_fraud_transactions", + ] + """The reason the merchant re-presented the dispute. + + - `cardholder_no_longer_disputes` - Cardholder no longer disputes the + transaction. + - `compelling_evidence` - Compelling evidence. + - `credit_or_reversal_processed` - Credit or reversal was processed. + - `delayed_charge_transaction` - Delayed charge transaction. + - `evidence_of_imprint` - Evidence of imprint. + - `invalid_dispute` - Invalid dispute. + - `non_fiat_currency_or_non_fungible_token_received` - Non-fiat currency or + non-fungible token was received by the cardholder. + - `prior_undisputed_non_fraud_transactions` - Prior undisputed non-fraud + transactions. + """ + + +class VisaNetworkEventRepresentedCardholderNoLongerDisputes(BaseModel): + explanation: Optional[str] = None + """ + Explanation for why the merchant believes the cardholder no longer disputes the + transaction. + """ + + +class VisaNetworkEventRepresentedCreditOrReversalProcessed(BaseModel): + amount: int + """The amount of the credit or reversal in the minor unit of its currency. + + For dollars, for example, this is cents. + """ + + currency: str + """ + The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) code for the credit or + reversal's currency. + """ + + explanation: Optional[str] = None + """Explanation for why the merchant believes the credit or reversal was processed.""" + + processed_at: date + """The date the credit or reversal was processed.""" + + +class VisaNetworkEventRepresentedInvalidDispute(BaseModel): + explanation: Optional[str] = None + """Explanation for why the dispute is considered invalid by the merchant.""" + + reason: Literal[ + "automatic_teller_machine_transaction_proof_provided", + "balance_of_partial_prepayment_not_paid", + "cardholder_canceled_before_expected_merchandise_receipt_date", + "cardholder_canceled_before_expected_services_receipt_date", + "cardholder_canceled_different_date", + "cardholder_did_not_cancel_according_to_policy", + "cardholder_received_merchandise", + "country_code_correct", + "credit_processed_correctly", + "currency_correct", + "dispute_is_for_quality", + "dispute_is_for_visa_cash_back_transaction_portion", + "disputed_amount_is_value_added_tax", + "disputed_amount_is_value_added_tax_no_credit_receipt_provided", + "limited_return_or_cancellation_policy_properly_disclosed", + "merchandise_held_at_cardholder_customs_agency", + "merchandise_matches_description", + "merchandise_not_counterfeit", + "merchandise_not_damaged", + "merchandise_not_defective", + "merchandise_provided_prior_to_cancellation_date", + "merchandise_quality_matches_description", + "merchandise_return_not_attempted", + "merchant_not_notified_of_closed_account", + "name_on_flight_manifest_matches_purchase", + "no_credit_receipt_provided", + "other", + "processing_error_incorrect", + "returned_mechandise_held_at_customs_agency_outside_merchant_country", + "services_match_description", + "services_provided_prior_to_cancellation_date", + "services_used_after_cancellation_date", + "terms_of_service_not_misrepresented", + "transaction_code_correct", + ] + """The reason a merchant considers the dispute invalid. + + - `automatic_teller_machine_transaction_proof_provided` - Automatic Teller + Machine (ATM) transaction proof provided. + - `balance_of_partial_prepayment_not_paid` - Balance of partial prepayment not + paid. + - `cardholder_canceled_before_expected_merchandise_receipt_date` - Cardholder + canceled before expected receipt date of the merchandise. + - `cardholder_canceled_before_expected_services_receipt_date` - Cardholder + canceled before expected receipt date of the services. + - `cardholder_canceled_different_date` - Cardholder canceled on a different date + than claimed. + - `cardholder_did_not_cancel_according_to_policy` - Cardholder received did not + cancel according to policy. + - `cardholder_received_merchandise` - Cardholder received the merchandise. + - `country_code_correct` - Country code is correct. + - `credit_processed_correctly` - Credit was processed correctly. + - `currency_correct` - Currency is correct. + - `dispute_is_for_quality` - Dispute is for quality. + - `dispute_is_for_visa_cash_back_transaction_portion` - Dispute is for Visa Cash + Back transaction portion. + - `disputed_amount_is_value_added_tax` - Disputed amount is Value Added Tax + (VAT). + - `disputed_amount_is_value_added_tax_no_credit_receipt_provided` - Disputed + amount is Value Added Tax (VAT) but no credit receipt was provided by the + cardholder. + - `limited_return_or_cancellation_policy_properly_disclosed` - Limited return or + cancellation policy was properly disclosed. + - `merchandise_held_at_cardholder_customs_agency` - Merchandise held at + cardholder customs agency. + - `merchandise_matches_description` - Merchandise matches the merchant's + description. + - `merchandise_not_counterfeit` - Merchandise is not counterfeit. + - `merchandise_not_damaged` - Merchandise is not damaged. + - `merchandise_not_defective` - Merchandise is not defective. + - `merchandise_provided_prior_to_cancellation_date` - Merchandise was provided + prior to the cancellation date. + - `merchandise_quality_matches_description` - Merchandise quality matches the + merchant's description. + - `merchandise_return_not_attempted` - Merchandise was not attempted returned to + the merchant. + - `merchant_not_notified_of_closed_account` - Merchant was not notified of the + closed account. + - `name_on_flight_manifest_matches_purchase` - Name on manifest of departed + flight matches name on purchased itinerary. + - `no_credit_receipt_provided` - No credit receipt was provided by the + cardholder. + - `other` - Other. + - `processing_error_incorrect` - The claimed processing error did not occur. + - `returned_mechandise_held_at_customs_agency_outside_merchant_country` - + Returned merchandise held at customs agency outside the merchant's country. + - `services_match_description` - Services match the merchant's description. + - `services_provided_prior_to_cancellation_date` - Services were provided prior + to the cancellation date. + - `services_used_after_cancellation_date` - Services were used after the + cancellation date and prior to the dispute submission date. + - `terms_of_service_not_misrepresented` - Terms of service were not + misrepresented. + - `transaction_code_correct` - Transaction code is correct. + """ + + +class VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenReceived(BaseModel): + blockchain_transaction_hash: str + """Blockchain transaction hash.""" + + destination_wallet_address: str + """Destination wallet address.""" + + prior_approved_transactions: Optional[str] = None + """Prior approved transactions.""" + + +class VisaNetworkEventRepresentedProofOfCashDisbursement(BaseModel): + explanation: Optional[str] = None + """ + Explanation for why the merchant believes the evidence provides proof of cash + disbursement. + """ + + +class VisaNetworkEventRepresentedReversalIssued(BaseModel): + explanation: Optional[str] = None + """Explanation of the reversal issued by the merchant.""" + + +class VisaNetworkEventRepresented(BaseModel): + cardholder_no_longer_disputes: Optional[VisaNetworkEventRepresentedCardholderNoLongerDisputes] = None + """Cardholder no longer disputes details. + + Present if and only if `reason` is `cardholder_no_longer_disputes`. + """ + + credit_or_reversal_processed: Optional[VisaNetworkEventRepresentedCreditOrReversalProcessed] = None + """Credit or reversal processed details. + + Present if and only if `reason` is `credit_or_reversal_processed`. + """ + + invalid_dispute: Optional[VisaNetworkEventRepresentedInvalidDispute] = None + """Invalid dispute details. Present if and only if `reason` is `invalid_dispute`.""" + + non_fiat_currency_or_non_fungible_token_as_described: Optional[object] = None + """Non-fiat currency or non-fungible token as described details. + + Present if and only if `reason` is + `non_fiat_currency_or_non_fungible_token_as_described`. + """ + + non_fiat_currency_or_non_fungible_token_received: Optional[ + VisaNetworkEventRepresentedNonFiatCurrencyOrNonFungibleTokenReceived + ] = None + """Non-fiat currency or non-fungible token received details. + + Present if and only if `reason` is + `non_fiat_currency_or_non_fungible_token_received`. + """ + + proof_of_cash_disbursement: Optional[VisaNetworkEventRepresentedProofOfCashDisbursement] = None + """Proof of cash disbursement details. + + Present if and only if `reason` is `proof_of_cash_disbursement`. + """ + + reason: Literal[ + "cardholder_no_longer_disputes", + "credit_or_reversal_processed", + "invalid_dispute", + "non_fiat_currency_or_non_fungible_token_as_described", + "non_fiat_currency_or_non_fungible_token_received", + "proof_of_cash_disbursement", + "reversal_issued", + ] + """The reason the merchant re-presented the dispute. + + - `cardholder_no_longer_disputes` - Cardholder no longer disputes the + transaction. + - `credit_or_reversal_processed` - Credit or reversal was processed. + - `invalid_dispute` - Invalid dispute. + - `non_fiat_currency_or_non_fungible_token_as_described` - Non-fiat currency or + non-fungible token is as described by the merchant. + - `non_fiat_currency_or_non_fungible_token_received` - Non-fiat currency or + non-fungible token was received by the cardholder. + - `proof_of_cash_disbursement` - Proof of cash disbursement provided. + - `reversal_issued` - Reversal issued by merchant. + """ + + reversal_issued: Optional[VisaNetworkEventRepresentedReversalIssued] = None + """Reversal issued by merchant details. + + Present if and only if `reason` is `reversal_issued`. + """ + + +class VisaNetworkEvent(BaseModel): + attachment_files: List[VisaNetworkEventAttachmentFile] + """The files attached to the Visa Card Dispute User Submission.""" + + category: Literal[ + "chargeback_accepted", + "chargeback_submitted", + "chargeback_timed_out", + "merchant_prearbitration_decline_submitted", + "merchant_prearbitration_received", + "merchant_prearbitration_timed_out", + "represented", + "representment_timed_out", + "user_prearbitration_accepted", + "user_prearbitration_declined", + "user_prearbitration_submitted", + "user_prearbitration_timed_out", + "user_withdrawal_submitted", + ] + """The category of the user submission. + + We may add additional possible values for this enum over time; your application + should be able to handle such additions gracefully. + + - `chargeback_accepted` - Card Dispute Chargeback Accepted Visa Network Event: + details will be under the `chargeback_accepted` object. + - `chargeback_submitted` - Card Dispute Chargeback Submitted Visa Network Event: + details will be under the `chargeback_submitted` object. + - `chargeback_timed_out` - Card Dispute Chargeback Timed Out Visa Network Event: + details will be under the `chargeback_timed_out` object. + - `merchant_prearbitration_decline_submitted` - Card Dispute Merchant + Pre-Arbitration Decline Submitted Visa Network Event: details will be under + the `merchant_prearbitration_decline_submitted` object. + - `merchant_prearbitration_received` - Card Dispute Merchant Pre-Arbitration + Received Visa Network Event: details will be under the + `merchant_prearbitration_received` object. + - `merchant_prearbitration_timed_out` - Card Dispute Merchant Pre-Arbitration + Timed Out Visa Network Event: details will be under the + `merchant_prearbitration_timed_out` object. + - `represented` - Card Dispute Re-presented Visa Network Event: details will be + under the `represented` object. + - `representment_timed_out` - Card Dispute Re-presentment Timed Out Visa Network + Event: details will be under the `representment_timed_out` object. + - `user_prearbitration_accepted` - Card Dispute User Pre-Arbitration Accepted + Visa Network Event: details will be under the `user_prearbitration_accepted` + object. + - `user_prearbitration_declined` - Card Dispute User Pre-Arbitration Declined + Visa Network Event: details will be under the `user_prearbitration_declined` + object. + - `user_prearbitration_submitted` - Card Dispute User Pre-Arbitration Submitted + Visa Network Event: details will be under the `user_prearbitration_submitted` + object. + - `user_prearbitration_timed_out` - Card Dispute User Pre-Arbitration Timed Out + Visa Network Event: details will be under the `user_prearbitration_timed_out` + object. + - `user_withdrawal_submitted` - Card Dispute User Withdrawal Submitted Visa + Network Event: details will be under the `user_withdrawal_submitted` object. + """ + + chargeback_accepted: Optional[object] = None + """A Card Dispute Chargeback Accepted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback_accepted`. Contains the details specific to a chargeback + accepted Visa Card Dispute Network Event, which represents that a chargeback has + been accepted by the merchant. + """ + + chargeback_submitted: Optional[object] = None + """A Card Dispute Chargeback Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback_submitted`. Contains the details specific to a chargeback + submitted Visa Card Dispute Network Event, which represents that a chargeback + has been submitted to the network. + """ + + chargeback_timed_out: Optional[object] = None + """A Card Dispute Chargeback Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback_timed_out`. Contains the details specific to a chargeback + timed out Visa Card Dispute Network Event, which represents that the chargeback + has timed out in the user's favor. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Visa Card Dispute Network Event was created. + """ + + dispute_financial_transaction_id: Optional[str] = None + """The dispute financial transaction that resulted from the network event, if any.""" + + merchant_prearbitration_decline_submitted: Optional[object] = None + """ + A Card Dispute Merchant Pre-Arbitration Decline Submitted Visa Network Event + object. This field will be present in the JSON response if and only if + `category` is equal to `merchant_prearbitration_decline_submitted`. Contains the + details specific to a merchant prearbitration decline submitted Visa Card + Dispute Network Event, which represents that the user has declined the + merchant's request for a prearbitration request decision in their favor. + """ + + merchant_prearbitration_received: Optional[VisaNetworkEventMerchantPrearbitrationReceived] = None + """A Card Dispute Merchant Pre-Arbitration Received Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `merchant_prearbitration_received`. Contains the details specific to a + merchant prearbitration received Visa Card Dispute Network Event, which + represents that the merchant has issued a prearbitration request in the user's + favor. + """ + + merchant_prearbitration_timed_out: Optional[object] = None + """A Card Dispute Merchant Pre-Arbitration Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `merchant_prearbitration_timed_out`. Contains the details specific to a + merchant prearbitration timed out Visa Card Dispute Network Event, which + represents that the user has timed out responding to the merchant's + prearbitration request. + """ + + represented: Optional[VisaNetworkEventRepresented] = None + """A Card Dispute Re-presented Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `represented`. Contains the details specific to a re-presented Visa + Card Dispute Network Event, which represents that the merchant has declined the + user's chargeback and has re-presented the payment. + """ + + representment_timed_out: Optional[object] = None + """A Card Dispute Re-presentment Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `representment_timed_out`. Contains the details specific to a + re-presentment time-out Visa Card Dispute Network Event, which represents that + the user did not respond to the re-presentment by the merchant within the time + limit. + """ + + user_prearbitration_accepted: Optional[object] = None + """A Card Dispute User Pre-Arbitration Accepted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_accepted`. Contains the details specific to a user + prearbitration accepted Visa Card Dispute Network Event, which represents that + the merchant has accepted the user's prearbitration request in the user's favor. + """ + + user_prearbitration_declined: Optional[object] = None + """A Card Dispute User Pre-Arbitration Declined Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_declined`. Contains the details specific to a user + prearbitration declined Visa Card Dispute Network Event, which represents that + the merchant has declined the user's prearbitration request. + """ + + user_prearbitration_submitted: Optional[object] = None + """A Card Dispute User Pre-Arbitration Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_submitted`. Contains the details specific to a + user prearbitration submitted Visa Card Dispute Network Event, which represents + that the user's request for prearbitration has been submitted to the network. + """ + + user_prearbitration_timed_out: Optional[object] = None + """A Card Dispute User Pre-Arbitration Timed Out Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration_timed_out`. Contains the details specific to a + user prearbitration timed out Visa Card Dispute Network Event, which represents + that the merchant has timed out responding to the user's prearbitration request. + """ + + user_withdrawal_submitted: Optional[object] = None + """A Card Dispute User Withdrawal Submitted Visa Network Event object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_withdrawal_submitted`. Contains the details specific to a user + withdrawal submitted Visa Card Dispute Network Event, which represents that the + user's request to withdraw the dispute has been submitted to the network. + """ + + +class VisaUserSubmissionAttachmentFile(BaseModel): + file_id: str + """The ID of the file attached to the Card Dispute.""" + + +class VisaUserSubmissionChargebackAuthorization(BaseModel): + account_status: Literal["account_closed", "credit_problem", "fraud"] + """Account status. + + - `account_closed` - Account closed. + - `credit_problem` - Credit problem. + - `fraud` - Fraud. + """ + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandiseCardholderCancellation(BaseModel): + canceled_at: date + """Canceled at.""" + + canceled_prior_to_ship_date: Literal["canceled_prior_to_ship_date", "not_canceled_prior_to_ship_date"] + """Canceled prior to ship date. + + - `canceled_prior_to_ship_date` - Canceled prior to ship date. + - `not_canceled_prior_to_ship_date` - Not canceled prior to ship date. + """ + + cancellation_policy_provided: Literal["not_provided", "provided"] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturnAttempted(BaseModel): + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturned(BaseModel): + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerCanceledMerchandise(BaseModel): + cardholder_cancellation: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandiseCardholderCancellation] = ( + None + ) + """Cardholder cancellation.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + not_returned: Optional[object] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + purchase_explanation: str + """Purchase explanation.""" + + received_or_expected_at: date + """Received or expected at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandiseReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerCanceledRecurringTransactionMerchantContactMethods(BaseModel): + application_name: Optional[str] = None + """Application name.""" + + call_center_phone_number: Optional[str] = None + """Call center phone number.""" + + email_address: Optional[str] = None + """Email address.""" + + in_person_address: Optional[str] = None + """In person address.""" + + mailing_address: Optional[str] = None + """Mailing address.""" + + text_phone_number: Optional[str] = None + """Text phone number.""" + + +class VisaUserSubmissionChargebackConsumerCanceledRecurringTransaction(BaseModel): + cancellation_target: Literal["account", "transaction"] + """Cancellation target. + + - `account` - Account. + - `transaction` - Transaction. + """ + + merchant_contact_methods: VisaUserSubmissionChargebackConsumerCanceledRecurringTransactionMerchantContactMethods + """Merchant contact methods.""" + + other_form_of_payment_explanation: Optional[str] = None + """Other form of payment explanation.""" + + transaction_or_account_canceled_at: date + """Transaction or account canceled at.""" + + +class VisaUserSubmissionChargebackConsumerCanceledServicesCardholderCancellation(BaseModel): + canceled_at: date + """Canceled at.""" + + cancellation_policy_provided: Literal["not_provided", "provided"] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerCanceledServicesGuaranteedReservation(BaseModel): + explanation: Literal[ + "cardholder_canceled_prior_to_service", + "cardholder_cancellation_attempt_within_24_hours_of_confirmation", + "merchant_billed_no_show", + ] + """Explanation. + + - `cardholder_canceled_prior_to_service` - Cardholder canceled prior to service. + - `cardholder_cancellation_attempt_within_24_hours_of_confirmation` - Cardholder + cancellation attempt within 24 hours of confirmation. + - `merchant_billed_no_show` - Merchant billed for no-show. + """ + + +class VisaUserSubmissionChargebackConsumerCanceledServices(BaseModel): + cardholder_cancellation: VisaUserSubmissionChargebackConsumerCanceledServicesCardholderCancellation + """Cardholder cancellation.""" + + contracted_at: date + """Contracted at.""" + + guaranteed_reservation: Optional[VisaUserSubmissionChargebackConsumerCanceledServicesGuaranteedReservation] = None + """Guaranteed reservation explanation. + + Present if and only if `service_type` is `guaranteed_reservation`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + other: Optional[object] = None + """Other service type explanation. + + Present if and only if `service_type` is `other`. + """ + + purchase_explanation: str + """Purchase explanation.""" + + service_type: Literal["guaranteed_reservation", "other", "timeshare"] + """Service type. + + - `guaranteed_reservation` - Guaranteed reservation. + - `other` - Other. + - `timeshare` - Timeshare. + """ + + timeshare: Optional[object] = None + """Timeshare explanation. Present if and only if `service_type` is `timeshare`.""" + + +class VisaUserSubmissionChargebackConsumerCounterfeitMerchandise(BaseModel): + counterfeit_explanation: str + """Counterfeit explanation.""" + + disposition_explanation: str + """Disposition explanation.""" + + order_explanation: str + """Order explanation.""" + + received_at: date + """Received at.""" + + +class VisaUserSubmissionChargebackConsumerCreditNotProcessed(BaseModel): + canceled_or_returned_at: Optional[date] = None + """Canceled or returned at.""" + + credit_expected_at: Optional[date] = None + """Credit expected at.""" + + +class VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted(BaseModel): + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturned(BaseModel): + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandise(BaseModel): + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + not_returned: Optional[object] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + order_and_issue_explanation: str + """Order and issue explanation.""" + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandiseReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturnAttempted(BaseModel): + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturned(BaseModel): + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentation(BaseModel): + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: str + """Misrepresentation explanation.""" + + not_returned: Optional[object] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + purchase_explanation: str + """Purchase explanation.""" + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentationReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturnAttempted(BaseModel): + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturned(BaseModel): + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribed(BaseModel): + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["returned", "return_attempted"] + """Return outcome. + + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribedReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt(BaseModel): + canceled_at: date + """Canceled at.""" + + reason: Optional[str] = None + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted(BaseModel): + attempted_at: date + """Attempted at.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturned(BaseModel): + merchant_received_return_at: date + """Merchant received return at.""" + + returned_at: date + """Returned at.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayed(BaseModel): + explanation: str + """Explanation.""" + + not_returned: Optional[object] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayedReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation(BaseModel): + agreed_location: str + """Agreed location.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedMerchantCancellation(BaseModel): + canceled_at: date + """Canceled at.""" + + +class VisaUserSubmissionChargebackConsumerMerchandiseNotReceived(BaseModel): + cancellation_outcome: Literal[ + "cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation" + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + cardholder_cancellation_prior_to_expected_receipt: Optional[ + VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt + ] = None + """Cardholder cancellation prior to expected receipt. + + Present if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + delayed: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDelayed] = None + """Delayed. Present if and only if `delivery_issue` is `delayed`.""" + + delivered_to_wrong_location: Optional[ + VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation + ] = None + """Delivered to wrong location. + + Present if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + delivery_issue: Literal["delayed", "delivered_to_wrong_location"] + """Delivery issue. + + - `delayed` - Delayed. + - `delivered_to_wrong_location` - Delivered to wrong location. + """ + + last_expected_receipt_at: date + """Last expected receipt at.""" + + merchant_cancellation: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceivedMerchantCancellation] = ( + None + ) + """Merchant cancellation. + + Present if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + no_cancellation: Optional[object] = None + """No cancellation. + + Present if and only if `cancellation_outcome` is `no_cancellation`. + """ + + purchase_info_and_explanation: str + """Purchase information and explanation.""" + + +class VisaUserSubmissionChargebackConsumerOriginalCreditTransactionNotAccepted(BaseModel): + explanation: str + """Explanation.""" + + reason: Literal["prohibited_by_local_laws_or_regulation", "recipient_refused"] + """Reason. + + - `prohibited_by_local_laws_or_regulation` - Prohibited by local laws or + regulation. + - `recipient_refused` - Recipient refused. + """ + + +class VisaUserSubmissionChargebackConsumerQualityMerchandiseOngoingNegotiations(BaseModel): + explanation: str + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: date + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: date + """Started at.""" + + +class VisaUserSubmissionChargebackConsumerQualityMerchandiseReturnAttempted(BaseModel): + attempt_explanation: str + """Attempt explanation.""" + + attempt_reason: Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: date + """Attempted at.""" + + merchandise_disposition: str + """Merchandise disposition.""" + + +class VisaUserSubmissionChargebackConsumerQualityMerchandiseReturned(BaseModel): + merchant_received_return_at: Optional[date] = None + """Merchant received return at.""" + + other_explanation: Optional[str] = None + """Other explanation. Required if and only if the return method is `other`.""" + + return_method: Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: date + """Returned at.""" + + tracking_number: Optional[str] = None + """Tracking number.""" + + +class VisaUserSubmissionChargebackConsumerQualityMerchandise(BaseModel): + expected_at: date + """Expected at.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + not_returned: Optional[object] = None + """Not returned. Present if and only if `return_outcome` is `not_returned`.""" + + ongoing_negotiations: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandiseOngoingNegotiations] = None + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + purchase_info_and_quality_issue: str + """Purchase information and quality issue.""" + + received_at: date + """Received at.""" + + return_attempted: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandiseReturnAttempted] = None + """Return attempted. + + Present if and only if `return_outcome` is `return_attempted`. + """ + + return_outcome: Literal["not_returned", "returned", "return_attempted"] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + returned: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandiseReturned] = None + """Returned. Present if and only if `return_outcome` is `returned`.""" + + +class VisaUserSubmissionChargebackConsumerQualityServicesCardholderCancellation(BaseModel): + accepted_by_merchant: Literal["accepted", "not_accepted"] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: date + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerQualityServicesOngoingNegotiations(BaseModel): + explanation: str + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: date + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: date + """Started at.""" + + +class VisaUserSubmissionChargebackConsumerQualityServices(BaseModel): + cardholder_cancellation: VisaUserSubmissionChargebackConsumerQualityServicesCardholderCancellation + """Cardholder cancellation.""" + + cardholder_paid_to_have_work_redone: Optional[ + Literal["did_not_pay_to_have_work_redone", "paid_to_have_work_redone"] + ] = None + """Cardholder paid to have work redone. + + - `did_not_pay_to_have_work_redone` - Cardholder did not pay to have work + redone. + - `paid_to_have_work_redone` - Cardholder paid to have work redone. + """ + + non_fiat_currency_or_non_fungible_token_related_and_not_matching_description: Literal["not_related", "related"] + """Non-fiat currency or non-fungible token related and not matching description. + + - `not_related` - Not related. + - `related` - Related. + """ + + ongoing_negotiations: Optional[VisaUserSubmissionChargebackConsumerQualityServicesOngoingNegotiations] = None + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + purchase_info_and_quality_issue: str + """Purchase information and quality issue.""" + + restaurant_food_related: Optional[Literal["not_related", "related"]] = None + """ + Whether the dispute is related to the quality of food from an eating place or + restaurant. Must be provided when Merchant Category Code (MCC) is 5812, 5813 + or 5814. + + - `not_related` - Not related. + - `related` - Related. + """ + + services_received_at: date + """Services received at.""" + + +class VisaUserSubmissionChargebackConsumerServicesMisrepresentationCardholderCancellation(BaseModel): + accepted_by_merchant: Literal["accepted", "not_accepted"] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: date + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerServicesMisrepresentation(BaseModel): + cardholder_cancellation: VisaUserSubmissionChargebackConsumerServicesMisrepresentationCardholderCancellation + """Cardholder cancellation.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: str + """Misrepresentation explanation.""" + + purchase_explanation: str + """Purchase explanation.""" + + received_at: date + """Received at.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotAsDescribedCardholderCancellation(BaseModel): + accepted_by_merchant: Literal["accepted", "not_accepted"] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: date + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotAsDescribed(BaseModel): + cardholder_cancellation: VisaUserSubmissionChargebackConsumerServicesNotAsDescribedCardholderCancellation + """Cardholder cancellation.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: date + """Received at.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt(BaseModel): + canceled_at: date + """Canceled at.""" + + reason: Optional[str] = None + """Reason.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotReceivedMerchantCancellation(BaseModel): + canceled_at: date + """Canceled at.""" + + +class VisaUserSubmissionChargebackConsumerServicesNotReceived(BaseModel): + cancellation_outcome: Literal[ + "cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation" + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + cardholder_cancellation_prior_to_expected_receipt: Optional[ + VisaUserSubmissionChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt + ] = None + """Cardholder cancellation prior to expected receipt. + + Present if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + last_expected_receipt_at: date + """Last expected receipt at.""" + + merchant_cancellation: Optional[VisaUserSubmissionChargebackConsumerServicesNotReceivedMerchantCancellation] = None + """Merchant cancellation. + + Present if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + no_cancellation: Optional[object] = None + """No cancellation. + + Present if and only if `cancellation_outcome` is `no_cancellation`. + """ + + purchase_info_and_explanation: str + """Purchase information and explanation.""" + + +class VisaUserSubmissionChargebackFraud(BaseModel): + fraud_type: Literal[ + "account_or_credentials_takeover", + "card_not_received_as_issued", + "fraudulent_application", + "fraudulent_use_of_account_number", + "incorrect_processing", + "issuer_reported_counterfeit", + "lost", + "manipulation_of_account_holder", + "merchant_misrepresentation", + "miscellaneous", + "stolen", + ] + """Fraud type. + + - `account_or_credentials_takeover` - Account or credentials takeover. + - `card_not_received_as_issued` - Card not received as issued. + - `fraudulent_application` - Fraudulent application. + - `fraudulent_use_of_account_number` - Fraudulent use of account number. + - `incorrect_processing` - Incorrect processing. + - `issuer_reported_counterfeit` - Issuer reported counterfeit. + - `lost` - Lost. + - `manipulation_of_account_holder` - Manipulation of account holder. + - `merchant_misrepresentation` - Merchant misrepresentation. + - `miscellaneous` - Miscellaneous. + - `stolen` - Stolen. + """ + + +class VisaUserSubmissionChargebackProcessingErrorDuplicateTransaction(BaseModel): + other_transaction_id: str + """Other transaction ID.""" + + +class VisaUserSubmissionChargebackProcessingErrorIncorrectAmount(BaseModel): + expected_amount: int + """Expected amount.""" + + +class VisaUserSubmissionChargebackProcessingErrorPaidByOtherMeans(BaseModel): + other_form_of_payment_evidence: Literal[ + "canceled_check", "card_transaction", "cash_receipt", "other", "statement", "voucher" + ] + """Other form of payment evidence. + + - `canceled_check` - Canceled check. + - `card_transaction` - Card transaction. + - `cash_receipt` - Cash receipt. + - `other` - Other. + - `statement` - Statement. + - `voucher` - Voucher. + """ + + other_transaction_id: Optional[str] = None + """Other transaction ID.""" + + +class VisaUserSubmissionChargebackProcessingError(BaseModel): + duplicate_transaction: Optional[VisaUserSubmissionChargebackProcessingErrorDuplicateTransaction] = None + """Duplicate transaction. + + Present if and only if `error_reason` is `duplicate_transaction`. + """ + + error_reason: Literal["duplicate_transaction", "incorrect_amount", "paid_by_other_means"] + """Error reason. + + - `duplicate_transaction` - Duplicate transaction. + - `incorrect_amount` - Incorrect amount. + - `paid_by_other_means` - Paid by other means. + """ + + incorrect_amount: Optional[VisaUserSubmissionChargebackProcessingErrorIncorrectAmount] = None + """Incorrect amount. Present if and only if `error_reason` is `incorrect_amount`.""" + + merchant_resolution_attempted: Literal["attempted", "prohibited_by_local_law"] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + paid_by_other_means: Optional[VisaUserSubmissionChargebackProcessingErrorPaidByOtherMeans] = None + """Paid by other means. + + Present if and only if `error_reason` is `paid_by_other_means`. + """ + + +class VisaUserSubmissionChargeback(BaseModel): + authorization: Optional[VisaUserSubmissionChargebackAuthorization] = None + """Authorization. Present if and only if `category` is `authorization`.""" + + category: Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + """Category. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + consumer_canceled_merchandise: Optional[VisaUserSubmissionChargebackConsumerCanceledMerchandise] = None + """Canceled merchandise. + + Present if and only if `category` is `consumer_canceled_merchandise`. + """ + + consumer_canceled_recurring_transaction: Optional[ + VisaUserSubmissionChargebackConsumerCanceledRecurringTransaction + ] = None + """Canceled recurring transaction. + + Present if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + consumer_canceled_services: Optional[VisaUserSubmissionChargebackConsumerCanceledServices] = None + """Canceled services. + + Present if and only if `category` is `consumer_canceled_services`. + """ + + consumer_counterfeit_merchandise: Optional[VisaUserSubmissionChargebackConsumerCounterfeitMerchandise] = None + """Counterfeit merchandise. + + Present if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + consumer_credit_not_processed: Optional[VisaUserSubmissionChargebackConsumerCreditNotProcessed] = None + """Credit not processed. + + Present if and only if `category` is `consumer_credit_not_processed`. + """ + + consumer_damaged_or_defective_merchandise: Optional[ + VisaUserSubmissionChargebackConsumerDamagedOrDefectiveMerchandise + ] = None + """Damaged or defective merchandise. + + Present if and only if `category` is + `consumer_damaged_or_defective_merchandise`. + """ + + consumer_merchandise_misrepresentation: Optional[ + VisaUserSubmissionChargebackConsumerMerchandiseMisrepresentation + ] = None + """Merchandise misrepresentation. + + Present if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + consumer_merchandise_not_as_described: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotAsDescribed] = ( + None + ) + """Merchandise not as described. + + Present if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + consumer_merchandise_not_received: Optional[VisaUserSubmissionChargebackConsumerMerchandiseNotReceived] = None + """Merchandise not received. + + Present if and only if `category` is `consumer_merchandise_not_received`. + """ + + consumer_non_receipt_of_cash: Optional[object] = None + """Non-receipt of cash. + + Present if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + consumer_original_credit_transaction_not_accepted: Optional[ + VisaUserSubmissionChargebackConsumerOriginalCreditTransactionNotAccepted + ] = None + """Original Credit Transaction (OCT) not accepted. + + Present if and only if `category` is + `consumer_original_credit_transaction_not_accepted`. + """ + + consumer_quality_merchandise: Optional[VisaUserSubmissionChargebackConsumerQualityMerchandise] = None + """Merchandise quality issue. + + Present if and only if `category` is `consumer_quality_merchandise`. + """ + + consumer_quality_services: Optional[VisaUserSubmissionChargebackConsumerQualityServices] = None + """Services quality issue. + + Present if and only if `category` is `consumer_quality_services`. + """ + + consumer_services_misrepresentation: Optional[VisaUserSubmissionChargebackConsumerServicesMisrepresentation] = None + """Services misrepresentation. + + Present if and only if `category` is `consumer_services_misrepresentation`. + """ + + consumer_services_not_as_described: Optional[VisaUserSubmissionChargebackConsumerServicesNotAsDescribed] = None + """Services not as described. + + Present if and only if `category` is `consumer_services_not_as_described`. + """ + + consumer_services_not_received: Optional[VisaUserSubmissionChargebackConsumerServicesNotReceived] = None + """Services not received. + + Present if and only if `category` is `consumer_services_not_received`. + """ + + fraud: Optional[VisaUserSubmissionChargebackFraud] = None + """Fraud. Present if and only if `category` is `fraud`.""" + + processing_error: Optional[VisaUserSubmissionChargebackProcessingError] = None + """Processing error. Present if and only if `category` is `processing_error`.""" + + +class VisaUserSubmissionMerchantPrearbitrationDecline(BaseModel): + reason: str + """ + The reason the user declined the merchant's request for pre-arbitration in their + favor. + """ + + +class VisaUserSubmissionUserPrearbitrationCategoryChange(BaseModel): + category: Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + """The category the dispute is being changed to. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + reason: str + """The reason for the pre-arbitration request.""" + + +class VisaUserSubmissionUserPrearbitration(BaseModel): + category_change: Optional[VisaUserSubmissionUserPrearbitrationCategoryChange] = None + """Category change details for the pre-arbitration request, if requested.""" + + reason: str + """The reason for the pre-arbitration request.""" + + +class VisaUserSubmission(BaseModel): + accepted_at: Optional[datetime] = None + """ + The date and time at which the Visa Card Dispute User Submission was reviewed + and accepted. + """ + + amount: Optional[int] = None + """ + The amount of the dispute if it is different from the amount of a prior user + submission or the disputed transaction. + """ + + attachment_files: List[VisaUserSubmissionAttachmentFile] + """The files attached to the Visa Card Dispute User Submission.""" + + category: Literal["chargeback", "merchant_prearbitration_decline", "user_prearbitration"] + """The category of the user submission. + + We may add additional possible values for this enum over time; your application + should be able to handle such additions gracefully. + + - `chargeback` - Visa Card Dispute Chargeback User Submission Chargeback + Details: details will be under the `chargeback` object. + - `merchant_prearbitration_decline` - Visa Card Dispute Merchant Pre-Arbitration + Decline User Submission: details will be under the + `merchant_prearbitration_decline` object. + - `user_prearbitration` - Visa Card Dispute User-Initiated Pre-Arbitration User + Submission: details will be under the `user_prearbitration` object. + """ + + chargeback: Optional[VisaUserSubmissionChargeback] = None + """A Visa Card Dispute Chargeback User Submission Chargeback Details object. + + This field will be present in the JSON response if and only if `category` is + equal to `chargeback`. Contains the details specific to a Visa chargeback User + Submission for a Card Dispute. + """ + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Visa Card Dispute User Submission was created. + """ + + further_information_requested_at: Optional[datetime] = None + """ + The date and time at which Increase requested further information from the user + for the Visa Card Dispute. + """ + + further_information_requested_reason: Optional[str] = None + """ + The reason for Increase requesting further information from the user for the + Visa Card Dispute. + """ + + merchant_prearbitration_decline: Optional[VisaUserSubmissionMerchantPrearbitrationDecline] = None + """A Visa Card Dispute Merchant Pre-Arbitration Decline User Submission object. + + This field will be present in the JSON response if and only if `category` is + equal to `merchant_prearbitration_decline`. Contains the details specific to a + merchant prearbitration decline Visa Card Dispute User Submission. + """ + + status: Literal["abandoned", "accepted", "further_information_requested", "pending_reviewing"] + """The status of the Visa Card Dispute User Submission. + + - `abandoned` - The User Submission was abandoned. + - `accepted` - The User Submission was accepted. + - `further_information_requested` - Further information is requested, please + resubmit with the requested information. + - `pending_reviewing` - The User Submission is pending review. + """ + + updated_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Visa Card Dispute User Submission was updated. + """ + + user_prearbitration: Optional[VisaUserSubmissionUserPrearbitration] = None + """A Visa Card Dispute User-Initiated Pre-Arbitration User Submission object. + + This field will be present in the JSON response if and only if `category` is + equal to `user_prearbitration`. Contains the details specific to a + user-initiated pre-arbitration Visa Card Dispute User Submission. + """ + + +class Visa(BaseModel): + network_events: List[VisaNetworkEvent] + """The network events for the Card Dispute.""" + + required_user_submission_category: Optional[ + Literal["chargeback", "merchant_prearbitration_decline", "user_prearbitration"] + ] = None + """ + The category of the currently required user submission if the user wishes to + proceed with the dispute. Present if and only if status is + `user_submission_required`. Otherwise, this will be `nil`. + + - `chargeback` - A Chargeback User Submission is required. + - `merchant_prearbitration_decline` - A Merchant Pre Arbitration Decline User + Submission is required. + - `user_prearbitration` - A User Initiated Pre Arbitration User Submission is + required. + """ + + user_submissions: List[VisaUserSubmission] + """The user submissions for the Card Dispute.""" + + +class Win(BaseModel): + won_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Card Dispute was won. + """ + + +class CardDispute(BaseModel): + id: str + """The Card Dispute identifier.""" + + amount: int + """The amount of the dispute.""" + + card_id: str + """The Card that the Card Dispute is associated with.""" + + created_at: datetime + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the Card Dispute was created. + """ + + disputed_transaction_id: str + """The identifier of the Transaction that was disputed.""" + + 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). + """ + + loss: Optional[Loss] = None + """ + If the Card Dispute's status is `lost`, this will contain details of the lost + dispute. + """ + + network: Literal["visa"] + """The network that the Card Dispute is associated with. + + - `visa` - Visa: details will be under the `visa` object. + """ + + status: Literal[ + "user_submission_required", + "pending_user_submission_reviewing", + "pending_user_submission_submitting", + "pending_user_withdrawal_submitting", + "pending_response", + "lost", + "won", + ] + """The status of the Card Dispute. + + - `user_submission_required` - A User Submission is required to continue with + the Card Dispute. + - `pending_user_submission_reviewing` - The most recent User Submission is being + reviewed. + - `pending_user_submission_submitting` - The most recent User Submission is + being submitted to the network. + - `pending_user_withdrawal_submitting` - The user's withdrawal of the Card + Dispute is being submitted to the network. + - `pending_response` - The Card Dispute is pending a response from the network. + - `lost` - The Card Dispute has been lost and funds previously credited from the + acceptance have been debited. + - `won` - The Card Dispute has been won and no further action can be taken. + """ + + type: Literal["card_dispute"] + """A constant representing the object's type. + + For this resource it will always be `card_dispute`. + """ + + user_submission_required_by: Optional[datetime] = None + """ + The [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date and time at which + the user submission is required by. Present only if status is + `user_submission_required` and a user submission is required by a certain time. + Otherwise, this will be `nil`. + """ + + visa: Optional[Visa] = None + """Card Dispute information for card payments processed over Visa's network. + + This field will be present in the JSON response if and only if `network` is + equal to `visa`. + """ + + win: Optional[Win] = None + """ + If the Card Dispute's status is `won`, this will contain details of the won + dispute. + """ diff --git a/src/increase/types/card_dispute_create_params.py b/src/increase/types/card_dispute_create_params.py new file mode 100644 index 000000000..1f1cc43f7 --- /dev/null +++ b/src/increase/types/card_dispute_create_params.py @@ -0,0 +1,1314 @@ +# 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__ = [ + "CardDisputeCreateParams", + "AttachmentFile", + "Visa", + "VisaAuthorization", + "VisaConsumerCanceledMerchandise", + "VisaConsumerCanceledMerchandiseCardholderCancellation", + "VisaConsumerCanceledMerchandiseReturnAttempted", + "VisaConsumerCanceledMerchandiseReturned", + "VisaConsumerCanceledRecurringTransaction", + "VisaConsumerCanceledRecurringTransactionMerchantContactMethods", + "VisaConsumerCanceledServices", + "VisaConsumerCanceledServicesCardholderCancellation", + "VisaConsumerCanceledServicesGuaranteedReservation", + "VisaConsumerCounterfeitMerchandise", + "VisaConsumerCreditNotProcessed", + "VisaConsumerDamagedOrDefectiveMerchandise", + "VisaConsumerDamagedOrDefectiveMerchandiseReturnAttempted", + "VisaConsumerDamagedOrDefectiveMerchandiseReturned", + "VisaConsumerMerchandiseMisrepresentation", + "VisaConsumerMerchandiseMisrepresentationReturnAttempted", + "VisaConsumerMerchandiseMisrepresentationReturned", + "VisaConsumerMerchandiseNotAsDescribed", + "VisaConsumerMerchandiseNotAsDescribedReturnAttempted", + "VisaConsumerMerchandiseNotAsDescribedReturned", + "VisaConsumerMerchandiseNotReceived", + "VisaConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaConsumerMerchandiseNotReceivedDelayed", + "VisaConsumerMerchandiseNotReceivedDelayedReturnAttempted", + "VisaConsumerMerchandiseNotReceivedDelayedReturned", + "VisaConsumerMerchandiseNotReceivedDeliveredToWrongLocation", + "VisaConsumerMerchandiseNotReceivedMerchantCancellation", + "VisaConsumerOriginalCreditTransactionNotAccepted", + "VisaConsumerQualityMerchandise", + "VisaConsumerQualityMerchandiseOngoingNegotiations", + "VisaConsumerQualityMerchandiseReturnAttempted", + "VisaConsumerQualityMerchandiseReturned", + "VisaConsumerQualityServices", + "VisaConsumerQualityServicesCardholderCancellation", + "VisaConsumerQualityServicesOngoingNegotiations", + "VisaConsumerServicesMisrepresentation", + "VisaConsumerServicesMisrepresentationCardholderCancellation", + "VisaConsumerServicesNotAsDescribed", + "VisaConsumerServicesNotAsDescribedCardholderCancellation", + "VisaConsumerServicesNotReceived", + "VisaConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaConsumerServicesNotReceivedMerchantCancellation", + "VisaFraud", + "VisaProcessingError", + "VisaProcessingErrorDuplicateTransaction", + "VisaProcessingErrorIncorrectAmount", + "VisaProcessingErrorPaidByOtherMeans", +] + + +class CardDisputeCreateParams(TypedDict, total=False): + disputed_transaction_id: Required[str] + """The Transaction you wish to dispute. + + This Transaction must have a `source_type` of `card_settlement`. + """ + + network: Required[Literal["visa"]] + """The network of the disputed transaction. + + Details specific to the network are required under the sub-object with the same + identifier as the network. + + - `visa` - Visa + """ + + amount: int + """The monetary amount of the part of the transaction that is being disputed. + + This is optional and will default to the full amount of the transaction if not + provided. If provided, the amount must be less than or equal to the amount of + the transaction. + """ + + attachment_files: Iterable[AttachmentFile] + """The files to be attached to the initial dispute submission.""" + + visa: Visa + """The Visa-specific parameters for the dispute. + + Required if and only if `network` is `visa`. + """ + + +class AttachmentFile(TypedDict, total=False): + file_id: Required[str] + """The ID of the file to be attached. + + The file must have a `purpose` of `card_dispute_attachment`. + """ + + +class VisaAuthorization(TypedDict, total=False): + account_status: Required[Literal["account_closed", "credit_problem", "fraud"]] + """Account status. + + - `account_closed` - Account closed. + - `credit_problem` - Credit problem. + - `fraud` - Fraud. + """ + + +class VisaConsumerCanceledMerchandiseCardholderCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + canceled_prior_to_ship_date: Required[Literal["canceled_prior_to_ship_date", "not_canceled_prior_to_ship_date"]] + """Canceled prior to ship date. + + - `canceled_prior_to_ship_date` - Canceled prior to ship date. + - `not_canceled_prior_to_ship_date` - Not canceled prior to ship date. + """ + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaConsumerCanceledMerchandiseReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerCanceledMerchandiseReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerCanceledMerchandise(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_or_expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received or expected at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + cardholder_cancellation: VisaConsumerCanceledMerchandiseCardholderCancellation + """Cardholder cancellation.""" + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerCanceledMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerCanceledMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerCanceledRecurringTransactionMerchantContactMethods(TypedDict, total=False): + application_name: str + """Application name.""" + + call_center_phone_number: str + """Call center phone number.""" + + email_address: str + """Email address.""" + + in_person_address: str + """In person address.""" + + mailing_address: str + """Mailing address.""" + + text_phone_number: str + """Text phone number.""" + + +class VisaConsumerCanceledRecurringTransaction(TypedDict, total=False): + cancellation_target: Required[Literal["account", "transaction"]] + """Cancellation target. + + - `account` - Account. + - `transaction` - Transaction. + """ + + merchant_contact_methods: Required[VisaConsumerCanceledRecurringTransactionMerchantContactMethods] + """Merchant contact methods.""" + + transaction_or_account_canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Transaction or account canceled at.""" + + other_form_of_payment_explanation: str + """Other form of payment explanation.""" + + +class VisaConsumerCanceledServicesCardholderCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaConsumerCanceledServicesGuaranteedReservation(TypedDict, total=False): + explanation: Required[ + Literal[ + "cardholder_canceled_prior_to_service", + "cardholder_cancellation_attempt_within_24_hours_of_confirmation", + "merchant_billed_no_show", + ] + ] + """Explanation. + + - `cardholder_canceled_prior_to_service` - Cardholder canceled prior to service. + - `cardholder_cancellation_attempt_within_24_hours_of_confirmation` - Cardholder + cancellation attempt within 24 hours of confirmation. + - `merchant_billed_no_show` - Merchant billed for no-show. + """ + + +class VisaConsumerCanceledServices(TypedDict, total=False): + cardholder_cancellation: Required[VisaConsumerCanceledServicesCardholderCancellation] + """Cardholder cancellation.""" + + contracted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Contracted at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + service_type: Required[Literal["guaranteed_reservation", "other", "timeshare"]] + """Service type. + + - `guaranteed_reservation` - Guaranteed reservation. + - `other` - Other. + - `timeshare` - Timeshare. + """ + + guaranteed_reservation: VisaConsumerCanceledServicesGuaranteedReservation + """Guaranteed reservation explanation. + + Required if and only if `service_type` is `guaranteed_reservation`. + """ + + other: object + """Other service type explanation. + + Required if and only if `service_type` is `other`. + """ + + timeshare: object + """Timeshare explanation. Required if and only if `service_type` is `timeshare`.""" + + +class VisaConsumerCounterfeitMerchandise(TypedDict, total=False): + counterfeit_explanation: Required[str] + """Counterfeit explanation.""" + + disposition_explanation: Required[str] + """Disposition explanation.""" + + order_explanation: Required[str] + """Order explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaConsumerCreditNotProcessed(TypedDict, total=False): + canceled_or_returned_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Canceled or returned at.""" + + credit_expected_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Credit expected at.""" + + +class VisaConsumerDamagedOrDefectiveMerchandiseReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerDamagedOrDefectiveMerchandiseReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerDamagedOrDefectiveMerchandise(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + order_and_issue_explanation: Required[str] + """Order and issue explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerDamagedOrDefectiveMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerDamagedOrDefectiveMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseMisrepresentationReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerMerchandiseMisrepresentationReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerMerchandiseMisrepresentation(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerMerchandiseMisrepresentationReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerMerchandiseMisrepresentationReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseNotAsDescribedReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerMerchandiseNotAsDescribedReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerMerchandiseNotAsDescribed(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["returned", "return_attempted"]] + """Return outcome. + + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + return_attempted: VisaConsumerMerchandiseNotAsDescribedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerMerchandiseNotAsDescribedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaConsumerMerchandiseNotReceivedDelayedReturnAttempted(TypedDict, total=False): + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + +class VisaConsumerMerchandiseNotReceivedDelayedReturned(TypedDict, total=False): + merchant_received_return_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Merchant received return at.""" + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + +class VisaConsumerMerchandiseNotReceivedDelayed(TypedDict, total=False): + explanation: Required[str] + """Explanation.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaConsumerMerchandiseNotReceivedDelayedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerMerchandiseNotReceivedDelayedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerMerchandiseNotReceivedDeliveredToWrongLocation(TypedDict, total=False): + agreed_location: Required[str] + """Agreed location.""" + + +class VisaConsumerMerchandiseNotReceivedMerchantCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaConsumerMerchandiseNotReceived(TypedDict, total=False): + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + delivery_issue: Required[Literal["delayed", "delivered_to_wrong_location"]] + """Delivery issue. + + - `delayed` - Delayed. + - `delivered_to_wrong_location` - Delivered to wrong location. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + delayed: VisaConsumerMerchandiseNotReceivedDelayed + """Delayed. Required if and only if `delivery_issue` is `delayed`.""" + + delivered_to_wrong_location: VisaConsumerMerchandiseNotReceivedDeliveredToWrongLocation + """Delivered to wrong location. + + Required if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + merchant_cancellation: VisaConsumerMerchandiseNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: object + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaConsumerOriginalCreditTransactionNotAccepted(TypedDict, total=False): + explanation: Required[str] + """Explanation.""" + + reason: Required[Literal["prohibited_by_local_laws_or_regulation", "recipient_refused"]] + """Reason. + + - `prohibited_by_local_laws_or_regulation` - Prohibited by local laws or + regulation. + - `recipient_refused` - Recipient refused. + """ + + +class VisaConsumerQualityMerchandiseOngoingNegotiations(TypedDict, total=False): + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaConsumerQualityMerchandiseReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaConsumerQualityMerchandiseReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaConsumerQualityMerchandise(TypedDict, total=False): + expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Expected at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + ongoing_negotiations: VisaConsumerQualityMerchandiseOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + return_attempted: VisaConsumerQualityMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaConsumerQualityMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaConsumerQualityServicesCardholderCancellation(TypedDict, total=False): + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaConsumerQualityServicesOngoingNegotiations(TypedDict, total=False): + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaConsumerQualityServices(TypedDict, total=False): + cardholder_cancellation: Required[VisaConsumerQualityServicesCardholderCancellation] + """Cardholder cancellation.""" + + non_fiat_currency_or_non_fungible_token_related_and_not_matching_description: Required[ + Literal["not_related", "related"] + ] + """Non-fiat currency or non-fungible token related and not matching description. + + - `not_related` - Not related. + - `related` - Related. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + services_received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Services received at.""" + + cardholder_paid_to_have_work_redone: Literal["did_not_pay_to_have_work_redone", "paid_to_have_work_redone"] + """Cardholder paid to have work redone. + + - `did_not_pay_to_have_work_redone` - Cardholder did not pay to have work + redone. + - `paid_to_have_work_redone` - Cardholder paid to have work redone. + """ + + ongoing_negotiations: VisaConsumerQualityServicesOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + restaurant_food_related: Literal["not_related", "related"] + """ + Whether the dispute is related to the quality of food from an eating place or + restaurant. Must be provided when Merchant Category Code (MCC) is 5812, 5813 + or 5814. + + - `not_related` - Not related. + - `related` - Related. + """ + + +class VisaConsumerServicesMisrepresentationCardholderCancellation(TypedDict, total=False): + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaConsumerServicesMisrepresentation(TypedDict, total=False): + cardholder_cancellation: Required[VisaConsumerServicesMisrepresentationCardholderCancellation] + """Cardholder cancellation.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaConsumerServicesNotAsDescribedCardholderCancellation(TypedDict, total=False): + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaConsumerServicesNotAsDescribed(TypedDict, total=False): + cardholder_cancellation: Required[VisaConsumerServicesNotAsDescribedCardholderCancellation] + """Cardholder cancellation.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaConsumerServicesNotReceivedMerchantCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaConsumerServicesNotReceived(TypedDict, total=False): + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + merchant_cancellation: VisaConsumerServicesNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: object + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaFraud(TypedDict, total=False): + fraud_type: Required[ + Literal[ + "account_or_credentials_takeover", + "card_not_received_as_issued", + "fraudulent_application", + "fraudulent_use_of_account_number", + "incorrect_processing", + "issuer_reported_counterfeit", + "lost", + "manipulation_of_account_holder", + "merchant_misrepresentation", + "miscellaneous", + "stolen", + ] + ] + """Fraud type. + + - `account_or_credentials_takeover` - Account or credentials takeover. + - `card_not_received_as_issued` - Card not received as issued. + - `fraudulent_application` - Fraudulent application. + - `fraudulent_use_of_account_number` - Fraudulent use of account number. + - `incorrect_processing` - Incorrect processing. + - `issuer_reported_counterfeit` - Issuer reported counterfeit. + - `lost` - Lost. + - `manipulation_of_account_holder` - Manipulation of account holder. + - `merchant_misrepresentation` - Merchant misrepresentation. + - `miscellaneous` - Miscellaneous. + - `stolen` - Stolen. + """ + + +class VisaProcessingErrorDuplicateTransaction(TypedDict, total=False): + other_transaction_id: Required[str] + """Other transaction ID.""" + + +class VisaProcessingErrorIncorrectAmount(TypedDict, total=False): + expected_amount: Required[int] + """Expected amount.""" + + +class VisaProcessingErrorPaidByOtherMeans(TypedDict, total=False): + other_form_of_payment_evidence: Required[ + Literal["canceled_check", "card_transaction", "cash_receipt", "other", "statement", "voucher"] + ] + """Other form of payment evidence. + + - `canceled_check` - Canceled check. + - `card_transaction` - Card transaction. + - `cash_receipt` - Cash receipt. + - `other` - Other. + - `statement` - Statement. + - `voucher` - Voucher. + """ + + other_transaction_id: str + """Other transaction ID.""" + + +class VisaProcessingError(TypedDict, total=False): + error_reason: Required[Literal["duplicate_transaction", "incorrect_amount", "paid_by_other_means"]] + """Error reason. + + - `duplicate_transaction` - Duplicate transaction. + - `incorrect_amount` - Incorrect amount. + - `paid_by_other_means` - Paid by other means. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + duplicate_transaction: VisaProcessingErrorDuplicateTransaction + """Duplicate transaction. + + Required if and only if `error_reason` is `duplicate_transaction`. + """ + + incorrect_amount: VisaProcessingErrorIncorrectAmount + """Incorrect amount. Required if and only if `error_reason` is `incorrect_amount`.""" + + paid_by_other_means: VisaProcessingErrorPaidByOtherMeans + """Paid by other means. + + Required if and only if `error_reason` is `paid_by_other_means`. + """ + + +class Visa(TypedDict, total=False): + category: Required[ + Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + ] + """Category. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + authorization: VisaAuthorization + """Authorization. Required if and only if `category` is `authorization`.""" + + consumer_canceled_merchandise: VisaConsumerCanceledMerchandise + """Canceled merchandise. + + Required if and only if `category` is `consumer_canceled_merchandise`. + """ + + consumer_canceled_recurring_transaction: VisaConsumerCanceledRecurringTransaction + """Canceled recurring transaction. + + Required if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + consumer_canceled_services: VisaConsumerCanceledServices + """Canceled services. + + Required if and only if `category` is `consumer_canceled_services`. + """ + + consumer_counterfeit_merchandise: VisaConsumerCounterfeitMerchandise + """Counterfeit merchandise. + + Required if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + consumer_credit_not_processed: VisaConsumerCreditNotProcessed + """Credit not processed. + + Required if and only if `category` is `consumer_credit_not_processed`. + """ + + consumer_damaged_or_defective_merchandise: VisaConsumerDamagedOrDefectiveMerchandise + """Damaged or defective merchandise. + + Required if and only if `category` is + `consumer_damaged_or_defective_merchandise`. + """ + + consumer_merchandise_misrepresentation: VisaConsumerMerchandiseMisrepresentation + """Merchandise misrepresentation. + + Required if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + consumer_merchandise_not_as_described: VisaConsumerMerchandiseNotAsDescribed + """Merchandise not as described. + + Required if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + consumer_merchandise_not_received: VisaConsumerMerchandiseNotReceived + """Merchandise not received. + + Required if and only if `category` is `consumer_merchandise_not_received`. + """ + + consumer_non_receipt_of_cash: object + """Non-receipt of cash. + + Required if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + consumer_original_credit_transaction_not_accepted: VisaConsumerOriginalCreditTransactionNotAccepted + """Original Credit Transaction (OCT) not accepted. + + Required if and only if `category` is + `consumer_original_credit_transaction_not_accepted`. + """ + + consumer_quality_merchandise: VisaConsumerQualityMerchandise + """Merchandise quality issue. + + Required if and only if `category` is `consumer_quality_merchandise`. + """ + + consumer_quality_services: VisaConsumerQualityServices + """Services quality issue. + + Required if and only if `category` is `consumer_quality_services`. + """ + + consumer_services_misrepresentation: VisaConsumerServicesMisrepresentation + """Services misrepresentation. + + Required if and only if `category` is `consumer_services_misrepresentation`. + """ + + consumer_services_not_as_described: VisaConsumerServicesNotAsDescribed + """Services not as described. + + Required if and only if `category` is `consumer_services_not_as_described`. + """ + + consumer_services_not_received: VisaConsumerServicesNotReceived + """Services not received. + + Required if and only if `category` is `consumer_services_not_received`. + """ + + fraud: VisaFraud + """Fraud. Required if and only if `category` is `fraud`.""" + + processing_error: VisaProcessingError + """Processing error. Required if and only if `category` is `processing_error`.""" diff --git a/src/increase/types/card_dispute_list_params.py b/src/increase/types/card_dispute_list_params.py new file mode 100644 index 000000000..18cf4ff8d --- /dev/null +++ b/src/increase/types/card_dispute_list_params.py @@ -0,0 +1,83 @@ +# 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__ = ["CardDisputeListParams", "CreatedAt", "Status"] + + +class CardDisputeListParams(TypedDict, total=False): + 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[ + "user_submission_required", + "pending_user_submission_reviewing", + "pending_user_submission_submitting", + "pending_user_withdrawal_submitting", + "pending_response", + "lost", + "won", + ] + ], + }, + total=False, +) + + +class Status(_StatusReservedKeywords, total=False): + pass diff --git a/src/increase/types/card_dispute_submit_user_submission_params.py b/src/increase/types/card_dispute_submit_user_submission_params.py new file mode 100644 index 000000000..68927cb2f --- /dev/null +++ b/src/increase/types/card_dispute_submit_user_submission_params.py @@ -0,0 +1,1415 @@ +# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. + +from __future__ import annotations + +from typing import Union, Iterable +from datetime import date +from typing_extensions import Literal, Required, Annotated, TypedDict + +from .._utils import PropertyInfo + +__all__ = [ + "CardDisputeSubmitUserSubmissionParams", + "AttachmentFile", + "Visa", + "VisaChargeback", + "VisaChargebackAuthorization", + "VisaChargebackConsumerCanceledMerchandise", + "VisaChargebackConsumerCanceledMerchandiseCardholderCancellation", + "VisaChargebackConsumerCanceledMerchandiseReturnAttempted", + "VisaChargebackConsumerCanceledMerchandiseReturned", + "VisaChargebackConsumerCanceledRecurringTransaction", + "VisaChargebackConsumerCanceledRecurringTransactionMerchantContactMethods", + "VisaChargebackConsumerCanceledServices", + "VisaChargebackConsumerCanceledServicesCardholderCancellation", + "VisaChargebackConsumerCanceledServicesGuaranteedReservation", + "VisaChargebackConsumerCounterfeitMerchandise", + "VisaChargebackConsumerCreditNotProcessed", + "VisaChargebackConsumerDamagedOrDefectiveMerchandise", + "VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted", + "VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturned", + "VisaChargebackConsumerMerchandiseMisrepresentation", + "VisaChargebackConsumerMerchandiseMisrepresentationReturnAttempted", + "VisaChargebackConsumerMerchandiseMisrepresentationReturned", + "VisaChargebackConsumerMerchandiseNotAsDescribed", + "VisaChargebackConsumerMerchandiseNotAsDescribedReturnAttempted", + "VisaChargebackConsumerMerchandiseNotAsDescribedReturned", + "VisaChargebackConsumerMerchandiseNotReceived", + "VisaChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaChargebackConsumerMerchandiseNotReceivedDelayed", + "VisaChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted", + "VisaChargebackConsumerMerchandiseNotReceivedDelayedReturned", + "VisaChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation", + "VisaChargebackConsumerMerchandiseNotReceivedMerchantCancellation", + "VisaChargebackConsumerOriginalCreditTransactionNotAccepted", + "VisaChargebackConsumerQualityMerchandise", + "VisaChargebackConsumerQualityMerchandiseOngoingNegotiations", + "VisaChargebackConsumerQualityMerchandiseReturnAttempted", + "VisaChargebackConsumerQualityMerchandiseReturned", + "VisaChargebackConsumerQualityServices", + "VisaChargebackConsumerQualityServicesCardholderCancellation", + "VisaChargebackConsumerQualityServicesOngoingNegotiations", + "VisaChargebackConsumerServicesMisrepresentation", + "VisaChargebackConsumerServicesMisrepresentationCardholderCancellation", + "VisaChargebackConsumerServicesNotAsDescribed", + "VisaChargebackConsumerServicesNotAsDescribedCardholderCancellation", + "VisaChargebackConsumerServicesNotReceived", + "VisaChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt", + "VisaChargebackConsumerServicesNotReceivedMerchantCancellation", + "VisaChargebackFraud", + "VisaChargebackProcessingError", + "VisaChargebackProcessingErrorDuplicateTransaction", + "VisaChargebackProcessingErrorIncorrectAmount", + "VisaChargebackProcessingErrorPaidByOtherMeans", + "VisaMerchantPrearbitrationDecline", + "VisaUserPrearbitration", + "VisaUserPrearbitrationCategoryChange", +] + + +class CardDisputeSubmitUserSubmissionParams(TypedDict, total=False): + network: Required[Literal["visa"]] + """The network of the Card Dispute. + + Details specific to the network are required under the sub-object with the same + identifier as the network. + + - `visa` - Visa + """ + + amount: int + """ + The adjusted monetary amount of the part of the transaction that is being + disputed. This is optional and will default to the most recent amount provided. + If provided, the amount must be less than or equal to the amount of the + transaction. + """ + + attachment_files: Iterable[AttachmentFile] + """The files to be attached to the user submission.""" + + visa: Visa + """The Visa-specific parameters for the dispute. + + Required if and only if `network` is `visa`. + """ + + +class AttachmentFile(TypedDict, total=False): + file_id: Required[str] + """The ID of the file to be attached. + + The file must have a `purpose` of `card_dispute_attachment`. + """ + + +class VisaChargebackAuthorization(TypedDict, total=False): + account_status: Required[Literal["account_closed", "credit_problem", "fraud"]] + """Account status. + + - `account_closed` - Account closed. + - `credit_problem` - Credit problem. + - `fraud` - Fraud. + """ + + +class VisaChargebackConsumerCanceledMerchandiseCardholderCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + canceled_prior_to_ship_date: Required[Literal["canceled_prior_to_ship_date", "not_canceled_prior_to_ship_date"]] + """Canceled prior to ship date. + + - `canceled_prior_to_ship_date` - Canceled prior to ship date. + - `not_canceled_prior_to_ship_date` - Not canceled prior to ship date. + """ + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerCanceledMerchandiseReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerCanceledMerchandiseReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerCanceledMerchandise(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_or_expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received or expected at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + cardholder_cancellation: VisaChargebackConsumerCanceledMerchandiseCardholderCancellation + """Cardholder cancellation.""" + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerCanceledMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerCanceledMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerCanceledRecurringTransactionMerchantContactMethods(TypedDict, total=False): + application_name: str + """Application name.""" + + call_center_phone_number: str + """Call center phone number.""" + + email_address: str + """Email address.""" + + in_person_address: str + """In person address.""" + + mailing_address: str + """Mailing address.""" + + text_phone_number: str + """Text phone number.""" + + +class VisaChargebackConsumerCanceledRecurringTransaction(TypedDict, total=False): + cancellation_target: Required[Literal["account", "transaction"]] + """Cancellation target. + + - `account` - Account. + - `transaction` - Transaction. + """ + + merchant_contact_methods: Required[VisaChargebackConsumerCanceledRecurringTransactionMerchantContactMethods] + """Merchant contact methods.""" + + transaction_or_account_canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Transaction or account canceled at.""" + + other_form_of_payment_explanation: str + """Other form of payment explanation.""" + + +class VisaChargebackConsumerCanceledServicesCardholderCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + cancellation_policy_provided: Required[Literal["not_provided", "provided"]] + """Cancellation policy provided. + + - `not_provided` - Not provided. + - `provided` - Provided. + """ + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerCanceledServicesGuaranteedReservation(TypedDict, total=False): + explanation: Required[ + Literal[ + "cardholder_canceled_prior_to_service", + "cardholder_cancellation_attempt_within_24_hours_of_confirmation", + "merchant_billed_no_show", + ] + ] + """Explanation. + + - `cardholder_canceled_prior_to_service` - Cardholder canceled prior to service. + - `cardholder_cancellation_attempt_within_24_hours_of_confirmation` - Cardholder + cancellation attempt within 24 hours of confirmation. + - `merchant_billed_no_show` - Merchant billed for no-show. + """ + + +class VisaChargebackConsumerCanceledServices(TypedDict, total=False): + cardholder_cancellation: Required[VisaChargebackConsumerCanceledServicesCardholderCancellation] + """Cardholder cancellation.""" + + contracted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Contracted at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_explanation: Required[str] + """Purchase explanation.""" + + service_type: Required[Literal["guaranteed_reservation", "other", "timeshare"]] + """Service type. + + - `guaranteed_reservation` - Guaranteed reservation. + - `other` - Other. + - `timeshare` - Timeshare. + """ + + guaranteed_reservation: VisaChargebackConsumerCanceledServicesGuaranteedReservation + """Guaranteed reservation explanation. + + Required if and only if `service_type` is `guaranteed_reservation`. + """ + + other: object + """Other service type explanation. + + Required if and only if `service_type` is `other`. + """ + + timeshare: object + """Timeshare explanation. Required if and only if `service_type` is `timeshare`.""" + + +class VisaChargebackConsumerCounterfeitMerchandise(TypedDict, total=False): + counterfeit_explanation: Required[str] + """Counterfeit explanation.""" + + disposition_explanation: Required[str] + """Disposition explanation.""" + + order_explanation: Required[str] + """Order explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaChargebackConsumerCreditNotProcessed(TypedDict, total=False): + canceled_or_returned_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Canceled or returned at.""" + + credit_expected_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Credit expected at.""" + + +class VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerDamagedOrDefectiveMerchandise(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + order_and_issue_explanation: Required[str] + """Order and issue explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerDamagedOrDefectiveMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseMisrepresentationReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerMerchandiseMisrepresentationReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerMerchandiseMisrepresentation(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerMerchandiseMisrepresentationReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerMerchandiseMisrepresentationReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseNotAsDescribedReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerMerchandiseNotAsDescribedReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerMerchandiseNotAsDescribed(TypedDict, total=False): + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["returned", "return_attempted"]] + """Return outcome. + + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + return_attempted: VisaChargebackConsumerMerchandiseNotAsDescribedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerMerchandiseNotAsDescribedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted(TypedDict, total=False): + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDelayedReturned(TypedDict, total=False): + merchant_received_return_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Merchant received return at.""" + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDelayed(TypedDict, total=False): + explanation: Required[str] + """Explanation.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + return_attempted: VisaChargebackConsumerMerchandiseNotReceivedDelayedReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerMerchandiseNotReceivedDelayedReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation(TypedDict, total=False): + agreed_location: Required[str] + """Agreed location.""" + + +class VisaChargebackConsumerMerchandiseNotReceivedMerchantCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaChargebackConsumerMerchandiseNotReceived(TypedDict, total=False): + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + delivery_issue: Required[Literal["delayed", "delivered_to_wrong_location"]] + """Delivery issue. + + - `delayed` - Delayed. + - `delivered_to_wrong_location` - Delivered to wrong location. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaChargebackConsumerMerchandiseNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + delayed: VisaChargebackConsumerMerchandiseNotReceivedDelayed + """Delayed. Required if and only if `delivery_issue` is `delayed`.""" + + delivered_to_wrong_location: VisaChargebackConsumerMerchandiseNotReceivedDeliveredToWrongLocation + """Delivered to wrong location. + + Required if and only if `delivery_issue` is `delivered_to_wrong_location`. + """ + + merchant_cancellation: VisaChargebackConsumerMerchandiseNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: object + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaChargebackConsumerOriginalCreditTransactionNotAccepted(TypedDict, total=False): + explanation: Required[str] + """Explanation.""" + + reason: Required[Literal["prohibited_by_local_laws_or_regulation", "recipient_refused"]] + """Reason. + + - `prohibited_by_local_laws_or_regulation` - Prohibited by local laws or + regulation. + - `recipient_refused` - Recipient refused. + """ + + +class VisaChargebackConsumerQualityMerchandiseOngoingNegotiations(TypedDict, total=False): + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaChargebackConsumerQualityMerchandiseReturnAttempted(TypedDict, total=False): + attempt_explanation: Required[str] + """Attempt explanation.""" + + attempt_reason: Required[ + Literal[ + "merchant_not_responding", + "no_return_authorization_provided", + "no_return_instructions", + "requested_not_to_return", + "return_not_accepted", + ] + ] + """Attempt reason. + + - `merchant_not_responding` - Merchant not responding. + - `no_return_authorization_provided` - No return authorization provided. + - `no_return_instructions` - No return instructions. + - `requested_not_to_return` - Requested not to return. + - `return_not_accepted` - Return not accepted. + """ + + attempted_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Attempted at.""" + + merchandise_disposition: Required[str] + """Merchandise disposition.""" + + +class VisaChargebackConsumerQualityMerchandiseReturned(TypedDict, total=False): + return_method: Required[Literal["dhl", "face_to_face", "fedex", "other", "postal_service", "ups"]] + """Return method. + + - `dhl` - DHL. + - `face_to_face` - Face-to-face. + - `fedex` - FedEx. + - `other` - Other. + - `postal_service` - Postal service. + - `ups` - UPS. + """ + + returned_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Returned at.""" + + merchant_received_return_at: Annotated[Union[str, date], PropertyInfo(format="iso8601")] + """Merchant received return at.""" + + other_explanation: str + """Other explanation. Required if and only if the return method is `other`.""" + + tracking_number: str + """Tracking number.""" + + +class VisaChargebackConsumerQualityMerchandise(TypedDict, total=False): + expected_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Expected at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + return_outcome: Required[Literal["not_returned", "returned", "return_attempted"]] + """Return outcome. + + - `not_returned` - Not returned. + - `returned` - Returned. + - `return_attempted` - Return attempted. + """ + + not_returned: object + """Not returned. Required if and only if `return_outcome` is `not_returned`.""" + + ongoing_negotiations: VisaChargebackConsumerQualityMerchandiseOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + return_attempted: VisaChargebackConsumerQualityMerchandiseReturnAttempted + """Return attempted. + + Required if and only if `return_outcome` is `return_attempted`. + """ + + returned: VisaChargebackConsumerQualityMerchandiseReturned + """Returned. Required if and only if `return_outcome` is `returned`.""" + + +class VisaChargebackConsumerQualityServicesCardholderCancellation(TypedDict, total=False): + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerQualityServicesOngoingNegotiations(TypedDict, total=False): + explanation: Required[str] + """ + Explanation of the previous ongoing negotiations between the cardholder and + merchant. + """ + + issuer_first_notified_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Date the cardholder first notified the issuer of the dispute.""" + + started_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Started at.""" + + +class VisaChargebackConsumerQualityServices(TypedDict, total=False): + cardholder_cancellation: Required[VisaChargebackConsumerQualityServicesCardholderCancellation] + """Cardholder cancellation.""" + + non_fiat_currency_or_non_fungible_token_related_and_not_matching_description: Required[ + Literal["not_related", "related"] + ] + """Non-fiat currency or non-fungible token related and not matching description. + + - `not_related` - Not related. + - `related` - Related. + """ + + purchase_info_and_quality_issue: Required[str] + """Purchase information and quality issue.""" + + services_received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Services received at.""" + + cardholder_paid_to_have_work_redone: Literal["did_not_pay_to_have_work_redone", "paid_to_have_work_redone"] + """Cardholder paid to have work redone. + + - `did_not_pay_to_have_work_redone` - Cardholder did not pay to have work + redone. + - `paid_to_have_work_redone` - Cardholder paid to have work redone. + """ + + ongoing_negotiations: VisaChargebackConsumerQualityServicesOngoingNegotiations + """Ongoing negotiations. Exclude if there is no evidence of ongoing negotiations.""" + + restaurant_food_related: Literal["not_related", "related"] + """ + Whether the dispute is related to the quality of food from an eating place or + restaurant. Must be provided when Merchant Category Code (MCC) is 5812, 5813 + or 5814. + + - `not_related` - Not related. + - `related` - Related. + """ + + +class VisaChargebackConsumerServicesMisrepresentationCardholderCancellation(TypedDict, total=False): + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerServicesMisrepresentation(TypedDict, total=False): + cardholder_cancellation: Required[VisaChargebackConsumerServicesMisrepresentationCardholderCancellation] + """Cardholder cancellation.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + misrepresentation_explanation: Required[str] + """Misrepresentation explanation.""" + + purchase_explanation: Required[str] + """Purchase explanation.""" + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaChargebackConsumerServicesNotAsDescribedCardholderCancellation(TypedDict, total=False): + accepted_by_merchant: Required[Literal["accepted", "not_accepted"]] + """Accepted by merchant. + + - `accepted` - Accepted. + - `not_accepted` - Not accepted. + """ + + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: Required[str] + """Reason.""" + + +class VisaChargebackConsumerServicesNotAsDescribed(TypedDict, total=False): + cardholder_cancellation: Required[VisaChargebackConsumerServicesNotAsDescribedCardholderCancellation] + """Cardholder cancellation.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + received_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Received at.""" + + +class VisaChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + reason: str + """Reason.""" + + +class VisaChargebackConsumerServicesNotReceivedMerchantCancellation(TypedDict, total=False): + canceled_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Canceled at.""" + + +class VisaChargebackConsumerServicesNotReceived(TypedDict, total=False): + cancellation_outcome: Required[ + Literal["cardholder_cancellation_prior_to_expected_receipt", "merchant_cancellation", "no_cancellation"] + ] + """Cancellation outcome. + + - `cardholder_cancellation_prior_to_expected_receipt` - Cardholder cancellation + prior to expected receipt. + - `merchant_cancellation` - Merchant cancellation. + - `no_cancellation` - No cancellation. + """ + + last_expected_receipt_at: Required[Annotated[Union[str, date], PropertyInfo(format="iso8601")]] + """Last expected receipt at.""" + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + purchase_info_and_explanation: Required[str] + """Purchase information and explanation.""" + + cardholder_cancellation_prior_to_expected_receipt: ( + VisaChargebackConsumerServicesNotReceivedCardholderCancellationPriorToExpectedReceipt + ) + """Cardholder cancellation prior to expected receipt. + + Required if and only if `cancellation_outcome` is + `cardholder_cancellation_prior_to_expected_receipt`. + """ + + merchant_cancellation: VisaChargebackConsumerServicesNotReceivedMerchantCancellation + """Merchant cancellation. + + Required if and only if `cancellation_outcome` is `merchant_cancellation`. + """ + + no_cancellation: object + """No cancellation. + + Required if and only if `cancellation_outcome` is `no_cancellation`. + """ + + +class VisaChargebackFraud(TypedDict, total=False): + fraud_type: Required[ + Literal[ + "account_or_credentials_takeover", + "card_not_received_as_issued", + "fraudulent_application", + "fraudulent_use_of_account_number", + "incorrect_processing", + "issuer_reported_counterfeit", + "lost", + "manipulation_of_account_holder", + "merchant_misrepresentation", + "miscellaneous", + "stolen", + ] + ] + """Fraud type. + + - `account_or_credentials_takeover` - Account or credentials takeover. + - `card_not_received_as_issued` - Card not received as issued. + - `fraudulent_application` - Fraudulent application. + - `fraudulent_use_of_account_number` - Fraudulent use of account number. + - `incorrect_processing` - Incorrect processing. + - `issuer_reported_counterfeit` - Issuer reported counterfeit. + - `lost` - Lost. + - `manipulation_of_account_holder` - Manipulation of account holder. + - `merchant_misrepresentation` - Merchant misrepresentation. + - `miscellaneous` - Miscellaneous. + - `stolen` - Stolen. + """ + + +class VisaChargebackProcessingErrorDuplicateTransaction(TypedDict, total=False): + other_transaction_id: Required[str] + """Other transaction ID.""" + + +class VisaChargebackProcessingErrorIncorrectAmount(TypedDict, total=False): + expected_amount: Required[int] + """Expected amount.""" + + +class VisaChargebackProcessingErrorPaidByOtherMeans(TypedDict, total=False): + other_form_of_payment_evidence: Required[ + Literal["canceled_check", "card_transaction", "cash_receipt", "other", "statement", "voucher"] + ] + """Other form of payment evidence. + + - `canceled_check` - Canceled check. + - `card_transaction` - Card transaction. + - `cash_receipt` - Cash receipt. + - `other` - Other. + - `statement` - Statement. + - `voucher` - Voucher. + """ + + other_transaction_id: str + """Other transaction ID.""" + + +class VisaChargebackProcessingError(TypedDict, total=False): + error_reason: Required[Literal["duplicate_transaction", "incorrect_amount", "paid_by_other_means"]] + """Error reason. + + - `duplicate_transaction` - Duplicate transaction. + - `incorrect_amount` - Incorrect amount. + - `paid_by_other_means` - Paid by other means. + """ + + merchant_resolution_attempted: Required[Literal["attempted", "prohibited_by_local_law"]] + """Merchant resolution attempted. + + - `attempted` - Attempted. + - `prohibited_by_local_law` - Prohibited by local law. + """ + + duplicate_transaction: VisaChargebackProcessingErrorDuplicateTransaction + """Duplicate transaction. + + Required if and only if `error_reason` is `duplicate_transaction`. + """ + + incorrect_amount: VisaChargebackProcessingErrorIncorrectAmount + """Incorrect amount. Required if and only if `error_reason` is `incorrect_amount`.""" + + paid_by_other_means: VisaChargebackProcessingErrorPaidByOtherMeans + """Paid by other means. + + Required if and only if `error_reason` is `paid_by_other_means`. + """ + + +class VisaChargeback(TypedDict, total=False): + category: Required[ + Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + ] + """Category. + + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + authorization: VisaChargebackAuthorization + """Authorization. Required if and only if `category` is `authorization`.""" + + consumer_canceled_merchandise: VisaChargebackConsumerCanceledMerchandise + """Canceled merchandise. + + Required if and only if `category` is `consumer_canceled_merchandise`. + """ + + consumer_canceled_recurring_transaction: VisaChargebackConsumerCanceledRecurringTransaction + """Canceled recurring transaction. + + Required if and only if `category` is `consumer_canceled_recurring_transaction`. + """ + + consumer_canceled_services: VisaChargebackConsumerCanceledServices + """Canceled services. + + Required if and only if `category` is `consumer_canceled_services`. + """ + + consumer_counterfeit_merchandise: VisaChargebackConsumerCounterfeitMerchandise + """Counterfeit merchandise. + + Required if and only if `category` is `consumer_counterfeit_merchandise`. + """ + + consumer_credit_not_processed: VisaChargebackConsumerCreditNotProcessed + """Credit not processed. + + Required if and only if `category` is `consumer_credit_not_processed`. + """ + + consumer_damaged_or_defective_merchandise: VisaChargebackConsumerDamagedOrDefectiveMerchandise + """Damaged or defective merchandise. + + Required if and only if `category` is + `consumer_damaged_or_defective_merchandise`. + """ + + consumer_merchandise_misrepresentation: VisaChargebackConsumerMerchandiseMisrepresentation + """Merchandise misrepresentation. + + Required if and only if `category` is `consumer_merchandise_misrepresentation`. + """ + + consumer_merchandise_not_as_described: VisaChargebackConsumerMerchandiseNotAsDescribed + """Merchandise not as described. + + Required if and only if `category` is `consumer_merchandise_not_as_described`. + """ + + consumer_merchandise_not_received: VisaChargebackConsumerMerchandiseNotReceived + """Merchandise not received. + + Required if and only if `category` is `consumer_merchandise_not_received`. + """ + + consumer_non_receipt_of_cash: object + """Non-receipt of cash. + + Required if and only if `category` is `consumer_non_receipt_of_cash`. + """ + + consumer_original_credit_transaction_not_accepted: VisaChargebackConsumerOriginalCreditTransactionNotAccepted + """Original Credit Transaction (OCT) not accepted. + + Required if and only if `category` is + `consumer_original_credit_transaction_not_accepted`. + """ + + consumer_quality_merchandise: VisaChargebackConsumerQualityMerchandise + """Merchandise quality issue. + + Required if and only if `category` is `consumer_quality_merchandise`. + """ + + consumer_quality_services: VisaChargebackConsumerQualityServices + """Services quality issue. + + Required if and only if `category` is `consumer_quality_services`. + """ + + consumer_services_misrepresentation: VisaChargebackConsumerServicesMisrepresentation + """Services misrepresentation. + + Required if and only if `category` is `consumer_services_misrepresentation`. + """ + + consumer_services_not_as_described: VisaChargebackConsumerServicesNotAsDescribed + """Services not as described. + + Required if and only if `category` is `consumer_services_not_as_described`. + """ + + consumer_services_not_received: VisaChargebackConsumerServicesNotReceived + """Services not received. + + Required if and only if `category` is `consumer_services_not_received`. + """ + + fraud: VisaChargebackFraud + """Fraud. Required if and only if `category` is `fraud`.""" + + processing_error: VisaChargebackProcessingError + """Processing error. Required if and only if `category` is `processing_error`.""" + + +class VisaMerchantPrearbitrationDecline(TypedDict, total=False): + reason: Required[str] + """The reason for declining the merchant's pre-arbitration request.""" + + +class VisaUserPrearbitrationCategoryChange(TypedDict, total=False): + category: Required[ + Literal[ + "authorization", + "consumer_canceled_merchandise", + "consumer_canceled_recurring_transaction", + "consumer_canceled_services", + "consumer_counterfeit_merchandise", + "consumer_credit_not_processed", + "consumer_damaged_or_defective_merchandise", + "consumer_merchandise_misrepresentation", + "consumer_merchandise_not_as_described", + "consumer_merchandise_not_received", + "consumer_non_receipt_of_cash", + "consumer_original_credit_transaction_not_accepted", + "consumer_quality_merchandise", + "consumer_quality_services", + "consumer_services_misrepresentation", + "consumer_services_not_as_described", + "consumer_services_not_received", + "fraud", + "processing_error", + ] + ] + """ + - `authorization` - Authorization. + - `consumer_canceled_merchandise` - Consumer: canceled merchandise. + - `consumer_canceled_recurring_transaction` - Consumer: canceled recurring + transaction. + - `consumer_canceled_services` - Consumer: canceled services. + - `consumer_counterfeit_merchandise` - Consumer: counterfeit merchandise. + - `consumer_credit_not_processed` - Consumer: credit not processed. + - `consumer_damaged_or_defective_merchandise` - Consumer: damaged or defective + merchandise. + - `consumer_merchandise_misrepresentation` - Consumer: merchandise + misrepresentation. + - `consumer_merchandise_not_as_described` - Consumer: merchandise not as + described. + - `consumer_merchandise_not_received` - Consumer: merchandise not received. + - `consumer_non_receipt_of_cash` - Consumer: non-receipt of cash. + - `consumer_original_credit_transaction_not_accepted` - Consumer: Original + Credit Transaction (OCT) not accepted. + - `consumer_quality_merchandise` - Consumer: merchandise quality issue. + - `consumer_quality_services` - Consumer: services quality issue. + - `consumer_services_misrepresentation` - Consumer: services misrepresentation. + - `consumer_services_not_as_described` - Consumer: services not as described. + - `consumer_services_not_received` - Consumer: services not received. + - `fraud` - Fraud. + - `processing_error` - Processing error. + """ + + reason: Required[str] + """The reason for the category change.""" + + +class VisaUserPrearbitration(TypedDict, total=False): + reason: Required[str] + """The reason for the pre-arbitration request.""" + + category_change: VisaUserPrearbitrationCategoryChange + """Category change details for the pre-arbitration request. + + Should only be populated if the category of the dispute is being changed as part + of the pre-arbitration request. + """ + + +class Visa(TypedDict, total=False): + category: Required[Literal["chargeback", "merchant_prearbitration_decline", "user_prearbitration"]] + """The category of the user submission. + + Details specific to the category are required under the sub-object with the same + identifier as the category. + + - `chargeback` - Chargeback. + - `merchant_prearbitration_decline` - Merchant pre-arbitration decline. + - `user_prearbitration` - User pre-arbitration. + """ + + chargeback: VisaChargeback + """The chargeback details for the user submission. + + Required if and only if `category` is `chargeback`. + """ + + merchant_prearbitration_decline: VisaMerchantPrearbitrationDecline + """The merchant pre-arbitration decline details for the user submission. + + Required if and only if `category` is `merchant_prearbitration_decline`. + """ + + user_prearbitration: VisaUserPrearbitration + """The user pre-arbitration details for the user submission. + + Required if and only if `category` is `user_prearbitration`. + """ diff --git a/src/increase/types/simulations/__init__.py b/src/increase/types/simulations/__init__.py index 7adcf989d..083108fa5 100644 --- a/src/increase/types/simulations/__init__.py +++ b/src/increase/types/simulations/__init__.py @@ -8,6 +8,7 @@ from .card_refund_create_params import CardRefundCreateParams as CardRefundCreateParams from .ach_transfer_return_params import ACHTransferReturnParams as ACHTransferReturnParams from .ach_transfer_settle_params import ACHTransferSettleParams as ACHTransferSettleParams +from .card_dispute_action_params import CardDisputeActionParams as CardDisputeActionParams from .card_reversal_create_params import CardReversalCreateParams as CardReversalCreateParams from .physical_card_create_params import PhysicalCardCreateParams as PhysicalCardCreateParams from .card_increment_create_params import CardIncrementCreateParams as CardIncrementCreateParams diff --git a/src/increase/types/simulations/card_dispute_action_params.py b/src/increase/types/simulations/card_dispute_action_params.py new file mode 100644 index 000000000..558f23aaa --- /dev/null +++ b/src/increase/types/simulations/card_dispute_action_params.py @@ -0,0 +1,134 @@ +# 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__ = ["CardDisputeActionParams", "Visa", "VisaRequestFurtherInformation"] + + +class CardDisputeActionParams(TypedDict, total=False): + network: Required[Literal["visa"]] + """The network of the Card Dispute. + + Details specific to the network are required under the sub-object with the same + identifier as the network. + + - `visa` - Visa + """ + + visa: Visa + """The Visa-specific parameters for the taking action on the dispute. + + Required if and only if `network` is `visa`. + """ + + +class VisaRequestFurtherInformation(TypedDict, total=False): + reason: Required[str] + """The reason for requesting further information from the user.""" + + +class Visa(TypedDict, total=False): + action: Required[ + Literal[ + "accept_chargeback", + "accept_user_submission", + "decline_user_prearbitration", + "receive_merchant_prearbitration", + "represent", + "request_further_information", + "time_out_chargeback", + "time_out_merchant_prearbitration", + "time_out_representment", + "time_out_user_prearbitration", + ] + ] + """The action to take. + + Details specific to the action are required under the sub-object with the same + identifier as the action. + + - `accept_chargeback` - Simulate the merchant accepting the chargeback. This + will move the dispute to a `won` state. + - `accept_user_submission` - Accept the user's submission and transmit it to the + network. This will move the dispute to a `pending_response` state. + - `decline_user_prearbitration` - Simulate the merchant declining the user's + pre-arbitration. This will move the dispute to a `lost` state. + - `receive_merchant_prearbitration` - Simulate the merchant issuing + pre-arbitration. This will move the dispute to a `user_submission_required` + state. + - `represent` - Simulate the merchant re-presenting the dispute. This will move + the dispute to a `user_submission_required` state. + - `request_further_information` - Simulate further information being requested + from the user. This will move the dispute to a `user_submission_required` + state. + - `time_out_chargeback` - Simulate the merchant timing out responding to the + chargeback. This will move the dispute to a `won` state. + - `time_out_merchant_prearbitration` - Simulate the user timing out responding + to a merchant pre-arbitration. This will move the dispute to a `lost` state. + - `time_out_representment` - Simulate the user timing out responding to a + merchant re-presentment. This will move the dispute to a `lost` state. + - `time_out_user_prearbitration` - Simulate the merchant timing out responding + to a user pre-arbitration. This will move the dispute to a `win` state. + """ + + accept_chargeback: object + """The parameters for accepting the chargeback. + + Required if and only if `action` is `accept_chargeback`. + """ + + accept_user_submission: object + """The parameters for accepting the user submission. + + Required if and only if `action` is `accept_user_submission`. + """ + + decline_user_prearbitration: object + """The parameters for declining the prearbitration. + + Required if and only if `action` is `decline_user_prearbitration`. + """ + + receive_merchant_prearbitration: object + """The parameters for receiving the prearbitration. + + Required if and only if `action` is `receive_merchant_prearbitration`. + """ + + represent: object + """The parameters for re-presenting the dispute. + + Required if and only if `action` is `represent`. + """ + + request_further_information: VisaRequestFurtherInformation + """The parameters for requesting further information from the user. + + Required if and only if `action` is `request_further_information`. + """ + + time_out_chargeback: object + """The parameters for timing out the chargeback. + + Required if and only if `action` is `time_out_chargeback`. + """ + + time_out_merchant_prearbitration: object + """The parameters for timing out the merchant prearbitration. + + Required if and only if `action` is `time_out_merchant_prearbitration`. + """ + + time_out_representment: object + """The parameters for timing out the re-presentment. + + Required if and only if `action` is `time_out_representment`. + """ + + time_out_user_prearbitration: object + """The parameters for timing out the user prearbitration. + + Required if and only if `action` is `time_out_user_prearbitration`. + """ diff --git a/tests/api_resources/simulations/test_card_disputes.py b/tests/api_resources/simulations/test_card_disputes.py new file mode 100644 index 000000000..a3ec76146 --- /dev/null +++ b/tests/api_resources/simulations/test_card_disputes.py @@ -0,0 +1,150 @@ +# 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 CardDispute + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardDisputes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_action(self, client: Increase) -> None: + card_dispute = client.simulations.card_disputes.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_method_action_with_all_params(self, client: Increase) -> None: + card_dispute = client.simulations.card_disputes.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + visa={ + "action": "accept_user_submission", + "accept_chargeback": {}, + "accept_user_submission": {}, + "decline_user_prearbitration": {}, + "receive_merchant_prearbitration": {}, + "represent": {}, + "request_further_information": {"reason": "x"}, + "time_out_chargeback": {}, + "time_out_merchant_prearbitration": {}, + "time_out_representment": {}, + "time_out_user_prearbitration": {}, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_raw_response_action(self, client: Increase) -> None: + response = client.simulations.card_disputes.with_raw_response.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_action(self, client: Increase) -> None: + with client.simulations.card_disputes.with_streaming_response.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_action(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + client.simulations.card_disputes.with_raw_response.action( + card_dispute_id="", + network="visa", + ) + + +class TestAsyncCardDisputes: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_action(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.simulations.card_disputes.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_method_action_with_all_params(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.simulations.card_disputes.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + visa={ + "action": "accept_user_submission", + "accept_chargeback": {}, + "accept_user_submission": {}, + "decline_user_prearbitration": {}, + "receive_merchant_prearbitration": {}, + "represent": {}, + "request_further_information": {"reason": "x"}, + "time_out_chargeback": {}, + "time_out_merchant_prearbitration": {}, + "time_out_representment": {}, + "time_out_user_prearbitration": {}, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_action(self, async_client: AsyncIncrease) -> None: + response = await async_client.simulations.card_disputes.with_raw_response.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_action(self, async_client: AsyncIncrease) -> None: + async with async_client.simulations.card_disputes.with_streaming_response.action( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_action(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + await async_client.simulations.card_disputes.with_raw_response.action( + card_dispute_id="", + network="visa", + ) diff --git a/tests/api_resources/test_card_disputes.py b/tests/api_resources/test_card_disputes.py new file mode 100644 index 000000000..ac4e72977 --- /dev/null +++ b/tests/api_resources/test_card_disputes.py @@ -0,0 +1,1444 @@ +# 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 ( + CardDispute, +) +from increase._utils import parse_date, parse_datetime +from increase.pagination import SyncPage, AsyncPage + +base_url = os.environ.get("TEST_API_BASE_URL", "http://127.0.0.1:4010") + + +class TestCardDisputes: + parametrize = pytest.mark.parametrize("client", [False, True], indirect=True, ids=["loose", "strict"]) + + @parametrize + def test_method_create(self, client: Increase) -> None: + card_dispute = client.card_disputes.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_method_create_with_all_params(self, client: Increase) -> None: + card_dispute = client.card_disputes.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + amount=100, + attachment_files=[{"file_id": "file_id"}], + visa={ + "category": "fraud", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_raw_response_create(self, client: Increase) -> None: + response = client.card_disputes.with_raw_response.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_create(self, client: Increase) -> None: + with client.card_disputes.with_streaming_response.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_retrieve(self, client: Increase) -> None: + card_dispute = client.card_disputes.retrieve( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_raw_response_retrieve(self, client: Increase) -> None: + response = client.card_disputes.with_raw_response.retrieve( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_retrieve(self, client: Increase) -> None: + with client.card_disputes.with_streaming_response.retrieve( + "card_dispute_h9sc95nbl1cgltpp7men", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_retrieve(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + client.card_disputes.with_raw_response.retrieve( + "", + ) + + @parametrize + def test_method_list(self, client: Increase) -> None: + card_dispute = client.card_disputes.list() + assert_matches_type(SyncPage[CardDispute], card_dispute, path=["response"]) + + @parametrize + def test_method_list_with_all_params(self, client: Increase) -> None: + card_dispute = client.card_disputes.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["user_submission_required"]}, + ) + assert_matches_type(SyncPage[CardDispute], card_dispute, path=["response"]) + + @parametrize + def test_raw_response_list(self, client: Increase) -> None: + response = client.card_disputes.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(SyncPage[CardDispute], card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_list(self, client: Increase) -> None: + with client.card_disputes.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(SyncPage[CardDispute], card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_method_submit_user_submission(self, client: Increase) -> None: + card_dispute = client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_method_submit_user_submission_with_all_params(self, client: Increase) -> None: + card_dispute = client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + amount=1, + attachment_files=[{"file_id": "file_id"}], + visa={ + "category": "merchant_prearbitration_decline", + "chargeback": { + "category": "authorization", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, + "merchant_prearbitration_decline": { + "reason": "The pre-arbitration received from the merchantdoes not explain how they obtained permission to charge the card." + }, + "user_prearbitration": { + "reason": "x", + "category_change": { + "category": "authorization", + "reason": "x", + }, + }, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_raw_response_submit_user_submission(self, client: Increase) -> None: + response = client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_submit_user_submission(self, client: Increase) -> None: + with client.card_disputes.with_streaming_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_submit_user_submission(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="", + network="visa", + ) + + @parametrize + def test_method_withdraw(self, client: Increase) -> None: + card_dispute = client.card_disputes.withdraw( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_raw_response_withdraw(self, client: Increase) -> None: + response = client.card_disputes.with_raw_response.withdraw( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + def test_streaming_response_withdraw(self, client: Increase) -> None: + with client.card_disputes.with_streaming_response.withdraw( + "card_dispute_h9sc95nbl1cgltpp7men", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + def test_path_params_withdraw(self, client: Increase) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + client.card_disputes.with_raw_response.withdraw( + "", + ) + + +class TestAsyncCardDisputes: + parametrize = pytest.mark.parametrize( + "async_client", [False, True, {"http_client": "aiohttp"}], indirect=True, ids=["loose", "strict", "aiohttp"] + ) + + @parametrize + async def test_method_create(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_method_create_with_all_params(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + amount=100, + attachment_files=[{"file_id": "file_id"}], + visa={ + "category": "fraud", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_create(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_disputes.with_raw_response.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_create(self, async_client: AsyncIncrease) -> None: + async with async_client.card_disputes.with_streaming_response.create( + disputed_transaction_id="transaction_uyrp7fld2ium70oa7oi", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_retrieve(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.retrieve( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_retrieve(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_disputes.with_raw_response.retrieve( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_retrieve(self, async_client: AsyncIncrease) -> None: + async with async_client.card_disputes.with_streaming_response.retrieve( + "card_dispute_h9sc95nbl1cgltpp7men", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_retrieve(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + await async_client.card_disputes.with_raw_response.retrieve( + "", + ) + + @parametrize + async def test_method_list(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.list() + assert_matches_type(AsyncPage[CardDispute], card_dispute, path=["response"]) + + @parametrize + async def test_method_list_with_all_params(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.list( + created_at={ + "after": parse_datetime("2019-12-27T18:11:19.117Z"), + "before": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_after": parse_datetime("2019-12-27T18:11:19.117Z"), + "on_or_before": parse_datetime("2019-12-27T18:11:19.117Z"), + }, + cursor="cursor", + idempotency_key="x", + limit=1, + status={"in": ["user_submission_required"]}, + ) + assert_matches_type(AsyncPage[CardDispute], card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_list(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_disputes.with_raw_response.list() + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(AsyncPage[CardDispute], card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_list(self, async_client: AsyncIncrease) -> None: + async with async_client.card_disputes.with_streaming_response.list() as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(AsyncPage[CardDispute], card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_method_submit_user_submission(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_method_submit_user_submission_with_all_params(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + amount=1, + attachment_files=[{"file_id": "file_id"}], + visa={ + "category": "merchant_prearbitration_decline", + "chargeback": { + "category": "authorization", + "authorization": {"account_status": "account_closed"}, + "consumer_canceled_merchandise": { + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "received_or_expected_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "canceled_prior_to_ship_date": "canceled_prior_to_ship_date", + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_canceled_recurring_transaction": { + "cancellation_target": "account", + "merchant_contact_methods": { + "application_name": "x", + "call_center_phone_number": "x", + "email_address": "x", + "in_person_address": "x", + "mailing_address": "x", + "text_phone_number": "x", + }, + "transaction_or_account_canceled_at": parse_date("2019-12-27"), + "other_form_of_payment_explanation": "x", + }, + "consumer_canceled_services": { + "cardholder_cancellation": { + "canceled_at": parse_date("2019-12-27"), + "cancellation_policy_provided": "not_provided", + "reason": "x", + }, + "contracted_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_explanation": "x", + "service_type": "guaranteed_reservation", + "guaranteed_reservation": {"explanation": "cardholder_canceled_prior_to_service"}, + "other": {}, + "timeshare": {}, + }, + "consumer_counterfeit_merchandise": { + "counterfeit_explanation": "x", + "disposition_explanation": "x", + "order_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_credit_not_processed": { + "canceled_or_returned_at": parse_date("2019-12-27"), + "credit_expected_at": parse_date("2019-12-27"), + }, + "consumer_damaged_or_defective_merchandise": { + "merchant_resolution_attempted": "attempted", + "order_and_issue_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_misrepresentation": { + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_as_described": { + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + "return_outcome": "returned", + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_merchandise_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "delivery_issue": "delayed", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "delayed": { + "explanation": "x", + "return_outcome": "not_returned", + "not_returned": {}, + "return_attempted": {"attempted_at": parse_date("2019-12-27")}, + "returned": { + "merchant_received_return_at": parse_date("2019-12-27"), + "returned_at": parse_date("2019-12-27"), + }, + }, + "delivered_to_wrong_location": {"agreed_location": "x"}, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "consumer_non_receipt_of_cash": {}, + "consumer_original_credit_transaction_not_accepted": { + "explanation": "x", + "reason": "prohibited_by_local_laws_or_regulation", + }, + "consumer_quality_merchandise": { + "expected_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_quality_issue": "x", + "received_at": parse_date("2019-12-27"), + "return_outcome": "not_returned", + "not_returned": {}, + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "return_attempted": { + "attempt_explanation": "x", + "attempt_reason": "merchant_not_responding", + "attempted_at": parse_date("2019-12-27"), + "merchandise_disposition": "x", + }, + "returned": { + "return_method": "dhl", + "returned_at": parse_date("2019-12-27"), + "merchant_received_return_at": parse_date("2019-12-27"), + "other_explanation": "x", + "tracking_number": "x", + }, + }, + "consumer_quality_services": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "non_fiat_currency_or_non_fungible_token_related_and_not_matching_description": "not_related", + "purchase_info_and_quality_issue": "x", + "services_received_at": parse_date("2019-12-27"), + "cardholder_paid_to_have_work_redone": "did_not_pay_to_have_work_redone", + "ongoing_negotiations": { + "explanation": "x", + "issuer_first_notified_at": parse_date("2019-12-27"), + "started_at": parse_date("2019-12-27"), + }, + "restaurant_food_related": "not_related", + }, + "consumer_services_misrepresentation": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "misrepresentation_explanation": "x", + "purchase_explanation": "x", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_as_described": { + "cardholder_cancellation": { + "accepted_by_merchant": "accepted", + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_resolution_attempted": "attempted", + "received_at": parse_date("2019-12-27"), + }, + "consumer_services_not_received": { + "cancellation_outcome": "cardholder_cancellation_prior_to_expected_receipt", + "last_expected_receipt_at": parse_date("2019-12-27"), + "merchant_resolution_attempted": "attempted", + "purchase_info_and_explanation": "x", + "cardholder_cancellation_prior_to_expected_receipt": { + "canceled_at": parse_date("2019-12-27"), + "reason": "x", + }, + "merchant_cancellation": {"canceled_at": parse_date("2019-12-27")}, + "no_cancellation": {}, + }, + "fraud": {"fraud_type": "account_or_credentials_takeover"}, + "processing_error": { + "error_reason": "duplicate_transaction", + "merchant_resolution_attempted": "attempted", + "duplicate_transaction": {"other_transaction_id": "x"}, + "incorrect_amount": {"expected_amount": 0}, + "paid_by_other_means": { + "other_form_of_payment_evidence": "canceled_check", + "other_transaction_id": "x", + }, + }, + }, + "merchant_prearbitration_decline": { + "reason": "The pre-arbitration received from the merchantdoes not explain how they obtained permission to charge the card." + }, + "user_prearbitration": { + "reason": "x", + "category_change": { + "category": "authorization", + "reason": "x", + }, + }, + }, + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_submit_user_submission(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_submit_user_submission(self, async_client: AsyncIncrease) -> None: + async with async_client.card_disputes.with_streaming_response.submit_user_submission( + card_dispute_id="card_dispute_h9sc95nbl1cgltpp7men", + network="visa", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_submit_user_submission(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + await async_client.card_disputes.with_raw_response.submit_user_submission( + card_dispute_id="", + network="visa", + ) + + @parametrize + async def test_method_withdraw(self, async_client: AsyncIncrease) -> None: + card_dispute = await async_client.card_disputes.withdraw( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_raw_response_withdraw(self, async_client: AsyncIncrease) -> None: + response = await async_client.card_disputes.with_raw_response.withdraw( + "card_dispute_h9sc95nbl1cgltpp7men", + ) + + assert response.is_closed is True + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + @parametrize + async def test_streaming_response_withdraw(self, async_client: AsyncIncrease) -> None: + async with async_client.card_disputes.with_streaming_response.withdraw( + "card_dispute_h9sc95nbl1cgltpp7men", + ) as response: + assert not response.is_closed + assert response.http_request.headers.get("X-Stainless-Lang") == "python" + + card_dispute = await response.parse() + assert_matches_type(CardDispute, card_dispute, path=["response"]) + + assert cast(Any, response.is_closed) is True + + @parametrize + async def test_path_params_withdraw(self, async_client: AsyncIncrease) -> None: + with pytest.raises(ValueError, match=r"Expected a non-empty value for `card_dispute_id` but received ''"): + await async_client.card_disputes.with_raw_response.withdraw( + "", + )