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
18 changes: 9 additions & 9 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
- next
branches-ignore:
- 'generated'
- 'codegen/**'
- 'integrated/**'
- 'stl-preview-head/**'
- 'stl-preview-base/**'

jobs:
lint:
timeout-minutes: 10
name: lint
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/lithic-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

Expand All @@ -33,7 +33,7 @@ jobs:
test:
timeout-minutes: 10
name: test
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/lithic-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@v4

Expand All @@ -54,7 +54,7 @@ jobs:
examples:
timeout-minutes: 10
name: examples
runs-on: ubuntu-latest
runs-on: ${{ github.repository == 'stainless-sdks/lithic-python' && 'depot-ubuntu-24.04' || 'ubuntu-latest' }}
if: github.repository == 'lithic-com/lithic-python'

steps:
Expand Down
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.90.3"
".": "0.91.0"
}
4 changes: 2 additions & 2 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 156
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-569e7dcb415398515370989172038db711642cd3b0bd7559bfd2b94e325a6086.yml
openapi_spec_hash: ce1dae8c6eb50d4490e75357c5e520a7
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/lithic%2Flithic-d44845cfc597e545a51450a62b2185d7a1ce76a3f9ac71145c3e74f99397d42a.yml
openapi_spec_hash: 3339f9fd912f2eb8ba5efc3c73f5d030
config_hash: e9de93b19060a153a852f7c03f235162
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 0.91.0 (2025-04-29)

Full Changelog: [v0.90.3...v0.91.0](https://github.com/lithic-com/lithic-python/compare/v0.90.3...v0.91.0)

### Features

* **api:** adds new merchant lock Auth Rule ([649c467](https://github.com/lithic-com/lithic-python/commit/649c467ede30d36ab20edb8df90afb7a9c69b8eb))


### Chores

* broadly detect json family of content-type headers ([0f14461](https://github.com/lithic-com/lithic-python/commit/0f144611e50f58ad31d3a8d7cc508f46be86c698))
* **ci:** only use depot for staging repos ([3c98e4a](https://github.com/lithic-com/lithic-python/commit/3c98e4af4ca05552fcfa4181917cdd7cd3f27b30))
* **ci:** run on more branches and use depot runners ([0e3086d](https://github.com/lithic-com/lithic-python/commit/0e3086d630295afedb1f2925cee8ef660ff90853))
* **internal:** minor formatting changes ([b8f48c2](https://github.com/lithic-com/lithic-python/commit/b8f48c2c07fc10aa924e5c7f729596312749fbe8))

## 0.90.3 (2025-04-22)

Full Changelog: [v0.90.2...v0.90.3](https://github.com/lithic-com/lithic-python/compare/v0.90.2...v0.90.3)
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 = "lithic"
version = "0.90.3"
version = "0.91.0"
description = "The official Python library for the lithic API"
dynamic = ["readme"]
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion src/lithic/_legacy_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
# split is required to handle cases where additional information is included
# in the response, e.g. application/json; charset=utf-8
content_type, *_ = response.headers.get("content-type", "*").split(";")
if content_type != "application/json":
if not content_type.endswith("json"):
if is_basemodel(cast_to):
try:
data = response.json()
Expand Down
2 changes: 1 addition & 1 deletion src/lithic/_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ def _parse(self, *, to: type[_T] | None = None) -> R | _T:
# split is required to handle cases where additional information is included
# in the response, e.g. application/json; charset=utf-8
content_type, *_ = response.headers.get("content-type", "*").split(";")
if content_type != "application/json":
if not content_type.endswith("json"):
if is_basemodel(cast_to):
try:
data = response.json()
Expand Down
2 changes: 1 addition & 1 deletion src/lithic/_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__ = "lithic"
__version__ = "0.90.3" # x-release-please-version
__version__ = "0.91.0" # x-release-please-version
24 changes: 16 additions & 8 deletions src/lithic/resources/auth_rules/v2/v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def create(
account_tokens: List[str],
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -104,7 +104,7 @@ def create(
card_tokens: List[str],
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -142,7 +142,7 @@ def create(
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -181,7 +181,7 @@ def create(
account_tokens: List[str] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
card_tokens: List[str] | NotGiven = NOT_GIVEN,
program_level: bool | NotGiven = NOT_GIVEN,
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -422,6 +422,7 @@ def list(
card_token: str | NotGiven = NOT_GIVEN,
ending_before: str | NotGiven = NOT_GIVEN,
page_size: int | NotGiven = NOT_GIVEN,
scope: Literal["PROGRAM", "ACCOUNT", "CARD"] | NotGiven = NOT_GIVEN,
starting_after: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -443,6 +444,8 @@ def list(

page_size: Page size (for pagination).

scope: Only return Authorization Rules that are bound to the provided scope;

starting_after: A cursor representing an item's token after which a page of results should
begin. Used to retrieve the next page of results after this item.

Expand All @@ -468,6 +471,7 @@ def list(
"card_token": card_token,
"ending_before": ending_before,
"page_size": page_size,
"scope": scope,
"starting_after": starting_after,
},
v2_list_params.V2ListParams,
Expand Down Expand Up @@ -832,7 +836,7 @@ async def create(
account_tokens: List[str],
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -869,7 +873,7 @@ async def create(
card_tokens: List[str],
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestCardTokensParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -907,7 +911,7 @@ async def create(
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestProgramLevelParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
extra_headers: Headers | None = None,
Expand Down Expand Up @@ -946,7 +950,7 @@ async def create(
account_tokens: List[str] | NotGiven = NOT_GIVEN,
name: Optional[str] | NotGiven = NOT_GIVEN,
parameters: v2_create_params.CreateAuthRuleRequestAccountTokensParameters | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"] | NotGiven = NOT_GIVEN,
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"] | NotGiven = NOT_GIVEN,
card_tokens: List[str] | NotGiven = NOT_GIVEN,
program_level: bool | NotGiven = NOT_GIVEN,
excluded_card_tokens: List[str] | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -1187,6 +1191,7 @@ def list(
card_token: str | NotGiven = NOT_GIVEN,
ending_before: str | NotGiven = NOT_GIVEN,
page_size: int | NotGiven = NOT_GIVEN,
scope: Literal["PROGRAM", "ACCOUNT", "CARD"] | NotGiven = NOT_GIVEN,
starting_after: str | NotGiven = NOT_GIVEN,
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
# The extra values given here take precedence over values defined on the client or passed to this method.
Expand All @@ -1208,6 +1213,8 @@ def list(

page_size: Page size (for pagination).

scope: Only return Authorization Rules that are bound to the provided scope;

starting_after: A cursor representing an item's token after which a page of results should
begin. Used to retrieve the next page of results after this item.

Expand All @@ -1233,6 +1240,7 @@ def list(
"card_token": card_token,
"ending_before": ending_before,
"page_size": page_size,
"scope": scope,
"starting_after": starting_after,
},
v2_list_params.V2ListParams,
Expand Down
2 changes: 2 additions & 0 deletions src/lithic/resources/book_transfers.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ def create(
"INACTIVITY_FEE_DOWN",
"PROVISIONAL_CREDIT",
"DISPUTE_WON",
"SERVICE",
"TRANSFER",
],
token: str | NotGiven = NOT_GIVEN,
Expand Down Expand Up @@ -368,6 +369,7 @@ async def create(
"INACTIVITY_FEE_DOWN",
"PROVISIONAL_CREDIT",
"DISPUTE_WON",
"SERVICE",
"TRANSFER",
],
token: str | NotGiven = NOT_GIVEN,
Expand Down
8 changes: 4 additions & 4 deletions src/lithic/resources/cards/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ def reissue(
card is
physically damaged). The PAN, expiry, and CVC2 will remain the same and the
original card can continue to be used until the new card is activated. Only
applies to cards of type `PHYSICAL`. A card can be replaced or renewed a total
applies to cards of type `PHYSICAL`. A card can be reissued or renewed a total
of 8 times.

Args:
Expand Down Expand Up @@ -918,7 +918,7 @@ def renew(
original card will keep working for card-present transactions until the new card
is activated. For card-not-present transactions, the original card details
(expiry, CVC2) will also keep working until the new card is activated. A
`PHYSICAL` card can be replaced or renewed a total of 8 times. For `VIRTUAL`,
`PHYSICAL` card can be reissued or renewed a total of 8 times. For `VIRTUAL`,
the card will retain the same card token and PAN and receive an updated expiry
and CVC2 code. `product_id`, `shipping_method`, `shipping_address`, `carrier`
are only relevant for renewing `PHYSICAL` cards.
Expand Down Expand Up @@ -1828,7 +1828,7 @@ async def reissue(
card is
physically damaged). The PAN, expiry, and CVC2 will remain the same and the
original card can continue to be used until the new card is activated. Only
applies to cards of type `PHYSICAL`. A card can be replaced or renewed a total
applies to cards of type `PHYSICAL`. A card can be reissued or renewed a total
of 8 times.

Args:
Expand Down Expand Up @@ -1905,7 +1905,7 @@ async def renew(
original card will keep working for card-present transactions until the new card
is activated. For card-not-present transactions, the original card details
(expiry, CVC2) will also keep working until the new card is activated. A
`PHYSICAL` card can be replaced or renewed a total of 8 times. For `VIRTUAL`,
`PHYSICAL` card can be reissued or renewed a total of 8 times. For `VIRTUAL`,
the card will retain the same card token and PAN and receive an updated expiry
and CVC2 code. `product_id`, `shipping_method`, `shipping_address`, `carrier`
are only relevant for renewing `PHYSICAL` cards.
Expand Down
83 changes: 79 additions & 4 deletions src/lithic/types/auth_rules/v2_apply_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,52 @@
from .velocity_limit_params import VelocityLimitParams
from .conditional_block_parameters import ConditionalBlockParameters

__all__ = ["V2ApplyResponse", "CurrentVersion", "CurrentVersionParameters", "DraftVersion", "DraftVersionParameters"]
__all__ = [
"V2ApplyResponse",
"CurrentVersion",
"CurrentVersionParameters",
"CurrentVersionParametersMerchantLockParameters",
"CurrentVersionParametersMerchantLockParametersMerchant",
"DraftVersion",
"DraftVersionParameters",
"DraftVersionParametersMerchantLockParameters",
"DraftVersionParametersMerchantLockParametersMerchant",
]


class CurrentVersionParametersMerchantLockParametersMerchant(BaseModel):
comment: Optional[str] = None
"""
A comment or explanation about the merchant, used internally for rule management
purposes.
"""

descriptor: Optional[str] = None
"""
Short description of the merchant, often used to provide more human-readable
context about the transaction merchant. This is typically the name or label
shown on transaction summaries.
"""

merchant_id: Optional[str] = None
"""Unique alphanumeric identifier for the payment card acceptor (merchant).

This attribute specifies the merchant entity that will be locked or referenced
for authorization rules.
"""


CurrentVersionParameters: TypeAlias = Union[ConditionalBlockParameters, VelocityLimitParams]
class CurrentVersionParametersMerchantLockParameters(BaseModel):
merchants: List[CurrentVersionParametersMerchantLockParametersMerchant]
"""
A list of merchant locks defining specific merchants or groups of merchants
(based on descriptors or IDs) that the lock applies to.
"""


CurrentVersionParameters: TypeAlias = Union[
ConditionalBlockParameters, VelocityLimitParams, CurrentVersionParametersMerchantLockParameters
]


class CurrentVersion(BaseModel):
Expand All @@ -23,7 +66,39 @@ class CurrentVersion(BaseModel):
"""


DraftVersionParameters: TypeAlias = Union[ConditionalBlockParameters, VelocityLimitParams]
class DraftVersionParametersMerchantLockParametersMerchant(BaseModel):
comment: Optional[str] = None
"""
A comment or explanation about the merchant, used internally for rule management
purposes.
"""

descriptor: Optional[str] = None
"""
Short description of the merchant, often used to provide more human-readable
context about the transaction merchant. This is typically the name or label
shown on transaction summaries.
"""

merchant_id: Optional[str] = None
"""Unique alphanumeric identifier for the payment card acceptor (merchant).

This attribute specifies the merchant entity that will be locked or referenced
for authorization rules.
"""


class DraftVersionParametersMerchantLockParameters(BaseModel):
merchants: List[DraftVersionParametersMerchantLockParametersMerchant]
"""
A list of merchant locks defining specific merchants or groups of merchants
(based on descriptors or IDs) that the lock applies to.
"""


DraftVersionParameters: TypeAlias = Union[
ConditionalBlockParameters, VelocityLimitParams, DraftVersionParametersMerchantLockParameters
]


class DraftVersion(BaseModel):
Expand Down Expand Up @@ -60,7 +135,7 @@ class V2ApplyResponse(BaseModel):
state: Literal["ACTIVE", "INACTIVE"]
"""The state of the Auth Rule"""

type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT"]
type: Literal["CONDITIONAL_BLOCK", "VELOCITY_LIMIT", "MERCHANT_LOCK"]
"""The type of Auth Rule"""

excluded_card_tokens: Optional[List[str]] = None
Expand Down
Loading