Skip to content
Closed
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
9 changes: 7 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,12 @@ disable_error_code = [
"arg-type",
]

[tool.pylint]
max-line-length = 79

[tool.pylint."MESSAGE CONTROL"]
disable = [
"C0114",
"C0301",
"C0301", # line-too-long
"C0411",
"C0415",
"C2801",
Expand All @@ -93,6 +95,9 @@ disable = [
"W1514",
]

[tool.ruff]
line-length = 79

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

Attributes
----------
dependencies (Optional[Dict]): A dictionary of dependencies to be used by the decorator.
dependencies (Optional[Dict]): A dictionary of dependencies to be
used by the decorator.

"""

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

Parameters
----------
dependencies (dict): A dictionary of dependencies to be used by the decorator, by default {}.
dependencies (dict): A dictionary of dependencies to be used
by the decorator, by default {}.

"""
self.dependencies = dependencies if dependencies is not None else {}
Expand All @@ -42,7 +44,8 @@ def adapt_checkout_options(

Parameters
----------
checkout_options (Optional[dict]): A dictionary containing checkout options, by default None.
checkout_options (Optional[dict]): A dictionary containing
checkout options, by default None.

Returns
-------
Expand Down Expand Up @@ -89,7 +92,8 @@ def adapt_custom_info(

Parameters
----------
custom_info (Optional[dict]): A dictionary containing custom information, by default None.
custom_info (Optional[dict]): A dictionary containing custom
information, by default None.

Returns
-------
Expand All @@ -114,7 +118,8 @@ def adapt_customer(

Parameters
----------
customer (Optional[dict]): A dictionary containing customer information, by default None.
customer (Optional[dict]): A dictionary containing customer
information, by default None.

Returns
-------
Expand All @@ -137,7 +142,8 @@ def adapt_order_adjustment(

Parameters
----------
order_adjustment (Optional[dict]): A dictionary containing order adjustment information, by default None.
order_adjustment (Optional[dict]): A dictionary containing
order adjustment information, by default None.

Returns
-------
Expand All @@ -164,7 +170,8 @@ def adapt_payment_details(

Parameters
----------
payment_details (Optional[dict]): A dictionary containing payment details, by default None.
payment_details (Optional[dict]): A dictionary containing
payment details, by default None.

Returns
-------
Expand All @@ -191,7 +198,8 @@ def adapt_payment_methods(

Parameters
----------
payment_methods (Optional[dict]): A dictionary containing payment methods, by default None.
payment_methods (Optional[dict]): A dictionary containing
payment methods, by default None.

Returns
-------
Expand All @@ -216,7 +224,8 @@ def adapt_shopping_cart(

Parameters
----------
shopping_cart (Optional[dict]): A dictionary containing shopping cart information, by default None.
shopping_cart (Optional[dict]): A dictionary containing
shopping cart information, by default None.

Returns
-------
Expand All @@ -240,7 +249,8 @@ def adapt_related_transactions(

Parameters
----------
related_transactions (Optional[dict]): A dictionary containing related transactions, by default None.
related_transactions (Optional[dict]): A dictionary containing
related transactions, by default None.

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

Parameters
----------
apps (Optional[dict]): A dictionary containing app information, by default None.
apps (Optional[dict]): A dictionary containing app information,
by default None.

Returns
-------
Expand All @@ -289,7 +300,8 @@ def adapt_brands(

Parameters
----------
brands (Optional[List[Optional[dict]]]): A list of dictionaries containing brand information, by default None.
brands (Optional[List[Optional[dict]]]): A list of
dictionaries containing brand information, by default None.

Returns
-------
Expand All @@ -315,7 +327,8 @@ def adapt_icon_urls(

Parameters
----------
icon_urls (Optional[dict]): A dictionary containing icon URL information, by default None.
icon_urls (Optional[dict]): A dictionary containing icon URL
information, by default None.

Returns
-------
Expand All @@ -340,7 +353,8 @@ def adapt_tokenization(

Parameters
----------
tokenization: (dict, optional) A dictionary containing tokenization information, by default None.
tokenization: (dict, optional) A dictionary containing
tokenization information, by default None.

Returns
-------
Expand All @@ -367,7 +381,8 @@ def adapt_allowed_amount(

Parameters
----------
allowed_amount (Optional[dict]): A dictionary containing allowed amount information, by default None.
allowed_amount (Optional[dict]): A dictionary containing
allowed amount information, by default None.

Returns
-------
Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/api/paths/orders/request/order_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,5 +570,5 @@ def validate_amount(self: "OrderRequest") -> "OrderRequest":
OrderRequest: The validated OrderRequest object.

"""
validate = validate_total_amount(self.dict())
validate_total_amount(self.dict())
return self
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Payment method response components for detailed payment method configurations."""
"""Payment method response components and configurations."""
2 changes: 1 addition & 1 deletion src/multisafepay/api/shared/cart/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Shopping cart components for handling cart items and shopping cart operations."""
"""Shopping cart components for cart items and operations."""
2 changes: 1 addition & 1 deletion src/multisafepay/api/shared/checkout/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
"""Checkout components for handling checkout options, tax rules, and payment configuration."""
"""Checkout components: options, tax rules, and configuration."""
2 changes: 1 addition & 1 deletion src/multisafepay/api/shared/checkout/tax_rule.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# See the DISCLAIMER.md file for disclaimer details.

"""Tax rule model for defining taxation rules and rates in checkout processing."""
"""Tax rule model for taxation rules and rates."""

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

Expand Down
2 changes: 1 addition & 1 deletion src/multisafepay/api/shared/costs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# See the DISCLAIMER.md file for disclaimer details.

"""Transaction costs model for handling fees and charges in payment processing."""
"""Transaction costs model for fees and charges."""

from typing import Optional

Expand Down
3 changes: 2 additions & 1 deletion src/multisafepay/api/shared/customer.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,8 @@ def from_dict(d: dict) -> Optional["Customer"]:

Returns
-------
Optional[Customer]: A Customer instance if the dictionary is not None, otherwise None.
Optional[Customer]: A Customer instance if the dictionary is
not None, otherwise None.

"""
if d is None:
Expand Down
3 changes: 2 additions & 1 deletion src/multisafepay/api/shared/delivery.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,8 @@ def from_dict(d: Optional[dict]) -> Optional["Delivery"]:

Returns
-------
Optional[Delivery]: A Delivery instance if the dictionary is not None, otherwise None.
Optional[Delivery]: A Delivery instance if the dictionary is
not None, otherwise None.

"""
if d is None:
Expand Down
8 changes: 5 additions & 3 deletions src/multisafepay/model/api_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,21 @@ class Config:
Attributes
----------
extra (str):
Specifies how to handle extra fields. Set to "allow" to include extra fields.
Specifies how to handle extra fields. Set to "allow" to
include extra fields.

"""

extra = "allow"

def to_dict(self: "ApiModel") -> dict:
"""
Convert the model to a dictionary, removing null values recursively.
Convert the model to a dictionary, removing null values.

Returns
-------
dict: The dictionary representation of the model with null values removed.
dict: The dictionary representation of the model with null
values removed.

"""
return remove_null_recursive(self.dict())
Expand Down
3 changes: 2 additions & 1 deletion src/multisafepay/model/extra_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class Config:
Attributes
----------
extra (str):
Specifies how to handle extra fields. Set to "allow" to include extra fields.
Specifies how to handle extra fields. Set to "allow" to
include extra fields.

"""

Expand Down
6 changes: 4 additions & 2 deletions src/multisafepay/model/inmutable_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ class InmutableModel(BaseModel):
"""
A base model class that extends Pydantic's BaseModel.

This class is immutable, meaning its attributes cannot be changed after initialization.
This class is immutable, meaning its attributes cannot be
changed after initialization.
"""

class Config:
Expand All @@ -24,7 +25,8 @@ class Config:
Attributes
----------
allow_mutation (bool):
Specifies whether mutation of model attributes is allowed. Set to False to make the model immutable.
Specifies whether mutation of model attributes is allowed.
Set to False to make the model immutable.

"""

Expand Down
5 changes: 3 additions & 2 deletions src/multisafepay/model/request_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,12 @@ class Config:

def to_dict(self: "RequestModel") -> dict:
"""
Convert the model to a dictionary, removing null values recursively.
Convert the model to a dictionary, removing null values.

Returns
-------
dict: The dictionary representation of the model with null values removed.
dict: The dictionary representation of the model with null
values removed.

"""
return remove_null_recursive(input_data=self.dict())
17 changes: 11 additions & 6 deletions src/multisafepay/model/response_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@

class ResponseModel(BaseModel):
"""
A base model class for response models that extends Pydantic's BaseModel.
A base model class for response models that extends Pydantic's
BaseModel.

This class is immutable and allows extra fields to be included in the model.
This class is immutable and allows extra fields to be included
in the model.

"""

Expand All @@ -27,9 +29,11 @@ class Config:

Attributes
----------
allow_mutation (bool): Specifies whether mutation of model attributes is allowed.
Set to False to make the model immutable.
extra (str): Specifies how to handle extra fields. Set to "allow" to include extra fields.
allow_mutation (bool): Specifies whether mutation of model
attributes is allowed. Set to False to make the model
immutable.
extra (str): Specifies how to handle extra fields. Set to
"allow" to include extra fields.

"""

Expand All @@ -48,6 +52,7 @@ def from_dict(d: dict) -> Optional["ResponseModel"]:

Returns
-------
Optional[ResponseModel]: The created model instance or None if the dictionary is invalid.
Optional[ResponseModel]: The created model instance or None
if the dictionary is invalid.

"""
4 changes: 2 additions & 2 deletions src/multisafepay/sdk.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class Sdk:
"""
SDK class for interacting with the MultiSafePay API.

This class provides methods to manage various resources such as transactions,
gateways, payment methods, issuers, orders, and more.
This class provides methods to manage various resources such as
transactions, gateways, payment methods, issuers, orders, etc.
"""

def __init__(
Expand Down
6 changes: 4 additions & 2 deletions src/multisafepay/value_object/creditcard/cvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,13 @@ def validate(cls: "Cvc", cvc: str) -> str:

Returns
-------
bool: True if the CVC is valid, raises InvalidArgumentException otherwise.
bool: True if the CVC is valid, raises
InvalidArgumentException otherwise.

Raises
------
InvalidArgumentException: If the CVC does not have 3 digits or is not numeric.
InvalidArgumentException: If the CVC does not have 3 digits
or is not numeric.

"""
cvc = cvc.replace(" ", "")
Expand Down
3 changes: 2 additions & 1 deletion src/multisafepay/value_object/date.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def get(self: "Date", date_format: str = "%Y-%m-%d") -> str:

Parameters
----------
date_format Optional[str]: The format to return the date in (default is "%Y-%m-%d").
date_format Optional[str]: The format to return the date in
(default is "%Y-%m-%d").

Returns
-------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,6 @@ def test_capture_reservation_cancel(sdk: Sdk):

assert isinstance(capture_reservation_cancel_response, CustomApiResponse)
assert capture_reservation_cancel_response.get_status_code() == 200
assert capture_reservation_cancel_response.get_body_success() == True
assert capture_reservation_cancel_response.get_body_success() is True
capture_reservation = capture_reservation_cancel_response.get_data()
assert isinstance(capture_reservation, CancelReservation)
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,4 @@ def test_recurring(sdk: Sdk):
assert isinstance(delete_response, CustomApiResponse)
delete_data_response = delete_response.get_body_data()
assert isinstance(delete_data_response, dict)
assert delete_data_response.get("removed") == True
assert delete_data_response.get("removed") is True
Loading