Skip to content
Open
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
32 changes: 16 additions & 16 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ urllib3 = ">=2.5.0"
[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
mypy = "^1.10.0"
pylint = "^3.2.2"
pylint = "^3.3.0"
pytest = "^8.2.1"
pytest-cov = "^5.0.0"
ruff = "^0.4.4"
Expand Down Expand Up @@ -93,6 +93,9 @@ disable = [
"W1514",
]

[tool.ruff]
target-version = "py39"

[tool.ruff.lint]
extend-safe-fixes = [
"D400", # docstrings should end with a period
Expand Down
36 changes: 18 additions & 18 deletions src/multisafepay/api/base/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""Decorator class for response model transformations and dependencies."""

from typing import Any, Dict, List, Optional
from typing import Any, Optional


class Decorator:
Expand All @@ -20,9 +20,9 @@ class Decorator:

"""

dependencies: Optional[Dict]
dependencies: Optional[dict]

def __init__(self: "Decorator", dependencies: Dict = None) -> None:
def __init__(self: "Decorator", dependencies: dict = None) -> None:
"""
Initialize the Decorator with optional dependencies.

Expand All @@ -35,7 +35,7 @@ def __init__(self: "Decorator", dependencies: Dict = None) -> None:

def adapt_checkout_options(
self: "Decorator",
checkout_options: Optional[Dict],
checkout_options: Optional[dict],
) -> "Decorator":
"""
Adapt the checkout options and update the dependencies.
Expand All @@ -59,7 +59,7 @@ def adapt_checkout_options(
)
return self

def adapt_costs(self: "Decorator", costs: Optional[Dict]) -> "Decorator":
def adapt_costs(self: "Decorator", costs: Optional[dict]) -> "Decorator":
"""
Adapt the costs and update the dependencies.

Expand All @@ -82,7 +82,7 @@ def adapt_costs(self: "Decorator", costs: Optional[Dict]) -> "Decorator":

def adapt_custom_info(
self: "Decorator",
custom_info: Optional[Dict],
custom_info: Optional[dict],
) -> "Decorator":
"""
Adapt the custom information and update the dependencies.
Expand All @@ -107,7 +107,7 @@ def adapt_custom_info(

def adapt_customer(
self: "Decorator",
customer: Optional[Dict],
customer: Optional[dict],
) -> "Decorator":
"""
Adapt the customer information and update the dependencies.
Expand All @@ -130,7 +130,7 @@ def adapt_customer(

def adapt_order_adjustment(
self: "Decorator",
order_adjustment: Optional[Dict],
order_adjustment: Optional[dict],
) -> "Decorator":
"""
Adapt the order adjustment and update the dependencies.
Expand All @@ -157,7 +157,7 @@ def adapt_order_adjustment(

def adapt_payment_details(
self: "Decorator",
payment_details: Optional[Dict],
payment_details: Optional[dict],
) -> "Decorator":
"""
Adapt the payment details and update the dependencies.
Expand All @@ -184,7 +184,7 @@ def adapt_payment_details(

def adapt_payment_methods(
self: "Decorator",
payment_methods: Optional[Dict],
payment_methods: Optional[dict],
) -> "Decorator":
"""
Adapt the payment methods and update the dependencies.
Expand All @@ -209,7 +209,7 @@ def adapt_payment_methods(

def adapt_shopping_cart(
self: "Decorator",
shopping_cart: Optional[Dict],
shopping_cart: Optional[dict],
) -> "Decorator":
"""
Adapt the shopping cart and update the dependencies.
Expand All @@ -233,7 +233,7 @@ def adapt_shopping_cart(

def adapt_related_transactions(
self: "Decorator",
related_transactions: Optional[Dict],
related_transactions: Optional[dict],
) -> "Decorator":
"""
Adapt the related transactions and update the dependencies.
Expand All @@ -258,7 +258,7 @@ def adapt_related_transactions(
]
return self

def adapt_apps(self: "Decorator", apps: Optional[Dict]) -> "Decorator":
def adapt_apps(self: "Decorator", apps: Optional[dict]) -> "Decorator":
"""
Adapt the apps and update the dependencies.

Expand All @@ -282,7 +282,7 @@ def adapt_apps(self: "Decorator", apps: Optional[Dict]) -> "Decorator":

def adapt_brands(
self: "Decorator",
brands: Optional[List[Optional[Dict]]],
brands: Optional[list[Optional[dict]]],
) -> "Decorator":
"""
Adapt the brands and update the dependencies.
Expand All @@ -308,7 +308,7 @@ def adapt_brands(

def adapt_icon_urls(
self: "Decorator",
icon_urls: Optional[Dict],
icon_urls: Optional[dict],
) -> "Decorator":
"""
Adapt the icon URLs and update the dependencies.
Expand All @@ -333,7 +333,7 @@ def adapt_icon_urls(

def adapt_tokenization(
self: "Decorator",
tokenization: Optional[Dict],
tokenization: Optional[dict],
) -> "Decorator":
"""
Adapt the tokenization and update the dependencies.
Expand All @@ -360,7 +360,7 @@ def adapt_tokenization(

def adapt_allowed_amount(
self: "Decorator",
allowed_amount: Optional[Dict],
allowed_amount: Optional[dict],
) -> "Decorator":
"""
Adapt the allowed amount and update the dependencies.
Expand All @@ -384,7 +384,7 @@ def adapt_allowed_amount(
)
return self

def get_dependencies(self: "Decorator") -> Dict[str, Any]:
def get_dependencies(self: "Decorator") -> dict[str, Any]:
"""
Get the current dependencies.

Expand Down
13 changes: 7 additions & 6 deletions src/multisafepay/api/base/listings/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@

"""Generic listing container for API response collections."""

from typing import Any, Dict, Generic, Iterator, List, TypeVar
from collections.abc import Iterator
from typing import Any, Generic, TypeVar

from pydantic.main import BaseModel

Expand All @@ -24,13 +25,13 @@ class Listing(Generic[T], BaseModel):

"""

data: List[T]
data: list[T]

def __init__(
self: "Listing",
data: List[Any],
data: list[Any],
class_type: type,
**kwargs: Dict[str, Any],
**kwargs: dict[str, Any],
) -> None:
"""
Initialize the Listing with data and a class type.
Expand All @@ -42,7 +43,7 @@ def __init__(
**kwargs: Additional keyword arguments to pass to the class type constructor.

"""
elements: List[T] = []
elements: list[T] = []
if data:
for item_data in data:
if item_data:
Expand Down Expand Up @@ -92,7 +93,7 @@ def __len__(self: "Listing") -> int:
"""
return len(self.data)

def get_data(self: "Listing") -> List[T]:
def get_data(self: "Listing") -> list[T]:
"""
Get the list of items in the listing.

Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/api/base/response/custom_api_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""Custom API response class with generic typing support for flexible response handling."""

from typing import Any, Dict, Optional, Union
from typing import Any, Optional, Union

from multisafepay.api.base.response.api_response import ApiResponse

Expand All @@ -27,7 +27,7 @@ class CustomApiResponse(ApiResponse):
def __init__(
self: "CustomApiResponse",
data: Optional[Union[dict, list]],
**kwargs: Dict[str, Any],
**kwargs: dict[str, Any],
) -> None:
"""
Initialize the CustomApiResponse with optional data and additional keyword arguments.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""Checkout data model for refund request checkout information and configuration."""

from typing import List, Optional
from typing import Optional

from multisafepay.api.shared.cart.cart_item import CartItem
from multisafepay.api.shared.cart.shopping_cart import ShoppingCart
Expand All @@ -25,11 +25,11 @@ class CheckoutData(RequestModel):

"""

items: Optional[List[CartItem]]
items: Optional[list[CartItem]]

def add_items(
self: "CheckoutData",
items: Optional[List[CartItem]] = None,
items: Optional[list[CartItem]] = None,
) -> "CheckoutData":
"""
Adds multiple items to the checkout data.
Expand Down Expand Up @@ -74,7 +74,7 @@ def add_item(
self.items.append(item)
return self

def get_items(self: "CheckoutData") -> Optional[List[CartItem]]:
def get_items(self: "CheckoutData") -> Optional[list[CartItem]]:
"""
Retrieves all items from the checkout data.

Expand Down
8 changes: 4 additions & 4 deletions src/multisafepay/api/paths/orders/response/order_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""Order response models for handling order API responses and data structures."""

from typing import List, Optional
from typing import Optional

from multisafepay.api.base.decorator import Decorator
from multisafepay.api.paths.orders.response.components.order_adjustment import (
Expand Down Expand Up @@ -74,7 +74,7 @@ class Order(ResponseModel):
amount: Optional[int]
amount_refunded: Optional[int]
checkout_options: Optional[CheckoutOptions]
costs: Optional[List[Costs]]
costs: Optional[list[Costs]]
created: Optional[str]
modified: Optional[str]
currency: Optional[str]
Expand All @@ -88,10 +88,10 @@ class Order(ResponseModel):
order_id: Optional[str]
order_total: Optional[float]
payment_details: Optional[PaymentDetails]
payment_methods: Optional[List[PaymentMethod]]
payment_methods: Optional[list[PaymentMethod]]
reason: Optional[str]
reason_code: Optional[str]
related_transactions: Optional[List[Transaction]]
related_transactions: Optional[list[Transaction]]
shopping_cart: Optional[ShoppingCart]
status: Optional[str]
transaction_id: Optional[str]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

"""Brand model for payment method branding information and display settings."""

from typing import List, Optional
from typing import Optional

from multisafepay.api.paths.payment_methods.response.components.icon_urls import (
IconUrls,
Expand All @@ -28,7 +28,7 @@ class Brand(ResponseModel):

"""

allowed_countries: Optional[List[str]]
allowed_countries: Optional[list[str]]
icon_urls: Optional[IconUrls]
id: Optional[str]
name: Optional[str]
Expand Down
Loading