Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.122.0"
".": "0.123.0"
}
2 changes: 1 addition & 1 deletion .stats.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
configured_endpoints: 198
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-73be645955d77ba5b31f8c3899a9f8cec80eef184489d8801cfeccadc1cb539f.yml
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/increase%2Fincrease-f97d2c69aece2a0496b5171b00ae67b051f240faccdb4b401852def96fea5faa.yml
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
# Changelog

## 0.123.0 (2024-10-02)

Full Changelog: [v0.122.0...v0.123.0](https://github.com/Increase/increase-python/compare/v0.122.0...v0.123.0)

### Features

* **api:** OpenAPI spec update via Stainless API ([#704](https://github.com/Increase/increase-python/issues/704)) ([2f0d7ae](https://github.com/Increase/increase-python/commit/2f0d7aea05b92277d12ec53e909c9c1309e8064d))


### Chores

* **internal:** codegen related update ([#701](https://github.com/Increase/increase-python/issues/701)) ([8430214](https://github.com/Increase/increase-python/commit/8430214ebb6c3d2c28adabd2c5b23e1cc45f247e))

## 0.122.0 (2024-09-26)

Full Changelog: [v0.121.0...v0.122.0](https://github.com/Increase/increase-python/compare/v0.121.0...v0.122.0)
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "increase"
version = "0.122.0"
version = "0.123.0"
description = "The official Python library for the increase API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
5 changes: 4 additions & 1 deletion src/increase/_base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,10 @@ def _build_headers(self, options: FinalRequestOptions, *, retries_taken: int = 0
if idempotency_header and options.method.lower() != "get" and idempotency_header not in headers:
headers[idempotency_header] = options.idempotency_key or self._idempotency_key()

headers.setdefault("x-stainless-retry-count", str(retries_taken))
# Don't set the retry count header if it was already set or removed by the caller. We check
# `custom_headers`, which can contain `Omit()`, instead of `headers` to account for the removal case.
if "x-stainless-retry-count" not in (header.lower() for header in custom_headers):
headers["x-stainless-retry-count"] = str(retries_taken)

return headers

Expand Down
2 changes: 1 addition & 1 deletion src/increase/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

__title__ = "increase"
__version__ = "0.122.0" # x-release-please-version
__version__ = "0.123.0" # x-release-please-version
28 changes: 26 additions & 2 deletions src/increase/types/inbound_check_deposit.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,30 @@
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.

from typing import Optional
from typing import List, Optional
from datetime import datetime
from typing_extensions import Literal

from .._models import BaseModel

__all__ = ["InboundCheckDeposit", "DepositReturn"]
__all__ = ["InboundCheckDeposit", "Adjustment", "DepositReturn"]


class Adjustment(BaseModel):
adjusted_at: datetime
"""The time at which the return adjustment was received."""

amount: int
"""The amount of the adjustment."""

reason: Literal["late_return"]
"""The reason for the adjustment.

- `late_return` - The return was initiated too late and the receiving
institution has responded with a Late Return Claim.
"""

transaction_id: str
"""The id of the transaction for the adjustment."""


class DepositReturn(BaseModel):
Expand Down Expand Up @@ -50,6 +68,12 @@ class InboundCheckDeposit(BaseModel):
account_number_id: Optional[str] = None
"""The Account Number the check is being deposited against."""

adjustments: List[Adjustment]
"""
If the deposit or the return was adjusted by the sending institution, this will
contain details of the adjustments.
"""

amount: int
"""The deposited amount in the minor unit of the destination account currency.

Expand Down
3 changes: 3 additions & 0 deletions src/increase/types/transaction.py
Original file line number Diff line number Diff line change
Expand Up @@ -2266,6 +2266,7 @@ class Source(BaseModel):
"inbound_ach_transfer",
"inbound_ach_transfer_return_intention",
"inbound_check_deposit_return_intention",
"inbound_check_adjustment",
"inbound_real_time_payments_transfer_confirmation",
"inbound_real_time_payments_transfer_decline",
"inbound_wire_reversal",
Expand Down Expand Up @@ -2317,6 +2318,8 @@ class Source(BaseModel):
- `inbound_check_deposit_return_intention` - Inbound Check Deposit Return
Intention: details will be under the `inbound_check_deposit_return_intention`
object.
- `inbound_check_adjustment` - Inbound Check Adjustment: details will be under
the `inbound_check_adjustment` object.
- `inbound_real_time_payments_transfer_confirmation` - Inbound Real-Time
Payments Transfer Confirmation: details will be under the
`inbound_real_time_payments_transfer_confirmation` object.
Expand Down
1 change: 1 addition & 0 deletions src/increase/types/transaction_list_params.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class TransactionListParams(TypedDict, total=False):
"inbound_ach_transfer",
"inbound_ach_transfer_return_intention",
"inbound_check_deposit_return_intention",
"inbound_check_adjustment",
"inbound_real_time_payments_transfer_confirmation",
"inbound_real_time_payments_transfer_decline",
"inbound_wire_reversal",
Expand Down
102 changes: 102 additions & 0 deletions tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,56 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:
assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_omit_retry_count_header(
self, client: Increase, failures_before_success: int, respx_mock: MockRouter
) -> None:
client = client.with_options(max_retries=4)

nb_retries = 0

def retry_handler(_request: httpx.Request) -> httpx.Response:
nonlocal nb_retries
if nb_retries < failures_before_success:
nb_retries += 1
return httpx.Response(500)
return httpx.Response(200)

respx_mock.post("/accounts").mock(side_effect=retry_handler)

response = client.accounts.with_raw_response.create(
name="New Account!", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
def test_overwrite_retry_count_header(
self, client: Increase, failures_before_success: int, respx_mock: MockRouter
) -> None:
client = client.with_options(max_retries=4)

nb_retries = 0

def retry_handler(_request: httpx.Request) -> httpx.Response:
nonlocal nb_retries
if nb_retries < failures_before_success:
nb_retries += 1
return httpx.Response(500)
return httpx.Response(200)

respx_mock.post("/accounts").mock(side_effect=retry_handler)

response = client.accounts.with_raw_response.create(
name="New Account!", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"


class TestAsyncIncrease:
client = AsyncIncrease(base_url=base_url, api_key=api_key, _strict_response_validation=True)
Expand Down Expand Up @@ -1587,3 +1637,55 @@ def retry_handler(_request: httpx.Request) -> httpx.Response:

assert response.retries_taken == failures_before_success
assert int(response.http_request.headers.get("x-stainless-retry-count")) == failures_before_success

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
@pytest.mark.asyncio
async def test_omit_retry_count_header(
self, async_client: AsyncIncrease, failures_before_success: int, respx_mock: MockRouter
) -> None:
client = async_client.with_options(max_retries=4)

nb_retries = 0

def retry_handler(_request: httpx.Request) -> httpx.Response:
nonlocal nb_retries
if nb_retries < failures_before_success:
nb_retries += 1
return httpx.Response(500)
return httpx.Response(200)

respx_mock.post("/accounts").mock(side_effect=retry_handler)

response = await client.accounts.with_raw_response.create(
name="New Account!", extra_headers={"x-stainless-retry-count": Omit()}
)

assert len(response.http_request.headers.get_list("x-stainless-retry-count")) == 0

@pytest.mark.parametrize("failures_before_success", [0, 2, 4])
@mock.patch("increase._base_client.BaseClient._calculate_retry_timeout", _low_retry_timeout)
@pytest.mark.respx(base_url=base_url)
@pytest.mark.asyncio
async def test_overwrite_retry_count_header(
self, async_client: AsyncIncrease, failures_before_success: int, respx_mock: MockRouter
) -> None:
client = async_client.with_options(max_retries=4)

nb_retries = 0

def retry_handler(_request: httpx.Request) -> httpx.Response:
nonlocal nb_retries
if nb_retries < failures_before_success:
nb_retries += 1
return httpx.Response(500)
return httpx.Response(200)

respx_mock.post("/accounts").mock(side_effect=retry_handler)

response = await client.accounts.with_raw_response.create(
name="New Account!", extra_headers={"x-stainless-retry-count": "42"}
)

assert response.http_request.headers.get("x-stainless-retry-count") == "42"