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
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ extend-safe-fixes = [
"D415", # docstrings should end with a period, question mark, or exclamation point
]
ignore = [
"ANN201",
"ANN204",
"ANN401",
"ARG002",
Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/api/base/listings/listing.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def get_data(self: "Listing") -> List[T]:
"""
return self.data

def append(self: "Listing", item: T):
def append(self: "Listing", item: T) -> None:
"""
Append an item to the listing.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/api/base/response/custom_api_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(
for key, value in kwargs.items():
setattr(self, key, value)

def get_data(self: "CustomApiResponse"):
def get_data(self: "CustomApiResponse") -> Optional[Any]:
"""
Get the data contained in the response.

Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/api/paths/capture/request/capture_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CaptureRequest(RequestModel):
status: Optional[str]
reason: Optional[str]

def add_status(self: "CaptureRequest", status: str):
def add_status(self: "CaptureRequest", status: str) -> "CaptureRequest":
"""
Add a status to the capture request.

Expand All @@ -41,7 +41,7 @@ def add_status(self: "CaptureRequest", status: str):
self.status = status
return self

def add_reason(self: "CaptureRequest", reason: str):
def add_reason(self: "CaptureRequest", reason: str) -> "CaptureRequest":
"""
Add a reason to the capture request.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class CheckoutData(RequestModel):

items: Optional[List[CartItem]]

def add_items(self: "CheckoutData", items: List[CartItem] = ()):
def add_items(
self: "CheckoutData",
items: List[CartItem] = (),
) -> "CheckoutData":
"""
Adds multiple items to the checkout data.

Expand All @@ -45,7 +48,7 @@ def add_items(self: "CheckoutData", items: List[CartItem] = ()):
self.add_item(item)
return self

def add_item(self: "CheckoutData", item: CartItem):
def add_item(self: "CheckoutData", item: CartItem) -> "CheckoutData":
"""
Adds a single item to the checkout data.

Expand All @@ -63,7 +66,7 @@ def add_item(self: "CheckoutData", item: CartItem):
self.items.append(item)
return self

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

Expand All @@ -74,7 +77,7 @@ def get_items(self: "CheckoutData"):
"""
return self.items

def get_item(self: "CheckoutData", index: int):
def get_item(self: "CheckoutData", index: int) -> CartItem:
"""
Retrieves an item by its index from the checkout data.

Expand All @@ -93,7 +96,7 @@ def generate_from_shopping_cart(
self: "CheckoutData",
shopping_cart: ShoppingCart,
tax_table_selector: str = "",
):
) -> None:
"""
Generates checkout data from a shopping cart.

Expand All @@ -114,7 +117,7 @@ def refund_by_merchant_item_id(
self: "CheckoutData",
merchant_item_id: str,
quantity: int = 0,
):
) -> None:
"""
Processes a refund by merchant item ID.

Expand Down Expand Up @@ -146,7 +149,7 @@ def refund_by_merchant_item_id(
def get_item_by_merchant_item_id(
self: "CheckoutData",
merchant_item_id: str,
):
) -> CartItem:
"""
Retrieves an item by its merchant item ID.

Expand Down
7 changes: 5 additions & 2 deletions src/multisafepay/api/shared/cart/shopping_cart.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ def get_items(self: "ShoppingCart") -> List[CartItem]:
"""
return self.items

def add_items(self: "ShoppingCart", items: List[CartItem]):
def add_items(
self: "ShoppingCart",
items: List[CartItem],
) -> "ShoppingCart":
"""
Add multiple items to the shopping cart.

Expand All @@ -50,7 +53,7 @@ def add_items(self: "ShoppingCart", items: List[CartItem]):
self.items = items
return self

def add_item(self: "ShoppingCart", item: CartItem):
def add_item(self: "ShoppingCart", item: CartItem) -> "ShoppingCart":
"""
Add a single item to the shopping cart.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/client/api_key.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class ApiKey(BaseModel):
api_key: str

@validator("api_key")
def validate_api_key(cls: "ApiKey", api_key: str):
def validate_api_key(cls: "ApiKey", api_key: str) -> str:
"""
Validate the API key.

Expand Down
3 changes: 2 additions & 1 deletion src/multisafepay/exception/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@


import json
from typing import Any


class ApiException(Exception):
Expand Down Expand Up @@ -110,7 +111,7 @@ def get_context_as_array(self: "ApiException") -> list:
lines.append(f"{context_name}: {debug_value}")
return lines

def get_context_value(self: "ApiException", name: str):
def get_context_value(self: "ApiException", name: str) -> Any:
"""
Get a specific context value by name.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/util/dict_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
from typing import Any, Optional


def merge_recursive(dict1: dict, dict2: dict):
def merge_recursive(dict1: dict, dict2: dict) -> dict:
"""
Recursively merge two dictionaries.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/util/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def get_plugin_version(self: "Version") -> str:
"""
return self.plugin_version

def set_plugin_version(self: "Version", version: Optional[str]):
def set_plugin_version(self: "Version", version: Optional[str]) -> None:
"""
Set the plugin version.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/value_object/country.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Country(BaseModel):
code: str

@validator("code")
def validate_country(cls: "Country", value: str):
def validate_country(cls: "Country", value: str) -> str:
"""
Validate the country code.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/value_object/currency.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class Currency(InmutableModel):
currency: str

@validator("currency")
def validate_currency(cls: "Currency", value: str):
def validate_currency(cls: "Currency", value: str) -> str:
"""
Validate the currency code.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/value_object/email_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class EmailAddress(InmutableModel):
email_address: str

@validator("email_address")
def validate_email_address(cls: "EmailAddress", value: str):
def validate_email_address(cls: "EmailAddress", value: str) -> str:
"""
Validate the email address value.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/value_object/gender.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class Gender(InmutableModel):
gender: str

@validator("gender")
def validate_ip_address(cls: "Gender", value: str):
def validate_ip_address(cls: "Gender", value: str) -> str:
"""
Validate the gender value.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/value_object/iban_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class IbanNumber(InmutableModel):
iban_number: str

@validator("iban_number")
def validate(cls: "IbanNumber", value: str):
def validate(cls: "IbanNumber", value: str) -> str:
"""
Validate the IBAN number.

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/value_object/ip_address.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class IpAddress(InmutableModel):
ip_address: str

@validator("ip_address")
def validate(cls: "IpAddress", value: str):
def validate(cls: "IpAddress", value: str) -> str:
"""
Validate the IP address.

Expand Down
Loading