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 @@ -99,7 +99,6 @@ extend-safe-fixes = [
"D415", # docstrings should end with a period, question mark, or exclamation point
]
ignore = [
"BLE001",
"D100",
"D101",
"D103",
Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/api/paths/auth/auth_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


from multisafepay.api.base.abstract_manager import AbstractManager
from multisafepay.api.base.response.api_response import ApiResponse
from multisafepay.api.base.response.custom_api_response import (
Expand All @@ -15,6 +14,7 @@
from multisafepay.client.client import Client
from multisafepay.util.dict_utils import dict_empty
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError


class AuthManager(AbstractManager):
Expand Down Expand Up @@ -57,7 +57,7 @@ def get_api_token(self: "AuthManager") -> CustomApiResponse:
if not dict_empty(response.get_body_data()):
try:
args["data"] = ApiToken(**response.get_body_data().copy())
except Exception as e:
except ValidationError as e:
args["warnings"] = (
MessageList()
.add_message(str(e))
Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/api/paths/capture/capture_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


import json

from multisafepay.api.base.abstract_manager import AbstractManager
Expand All @@ -19,6 +18,7 @@
from multisafepay.client.client import Client
from multisafepay.util.dict_utils import dict_empty
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError


class CaptureManager(AbstractManager):
Expand Down Expand Up @@ -73,7 +73,7 @@ def capture_reservation_cancel(
args["data"] = CancelReservation(
**response.get_body_data().copy(),
)
except Exception as e:
except ValidationError as e:
args["warnings"] = (
MessageList()
.add_message(str(e))
Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/api/paths/categories/category_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

# See the DISCLAIMER.md file for disclaimer details.


from multisafepay.api.base.abstract_manager import AbstractManager
from multisafepay.api.base.response.custom_api_response import (
CustomApiResponse,
)
from multisafepay.api.paths.categories.response.category import Category
from multisafepay.client.client import Client
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError


class CategoryManager(AbstractManager):
Expand Down Expand Up @@ -56,7 +56,7 @@ def get_categories(self: "CategoryManager") -> CustomApiResponse:
Category.from_dict(category)
for category in response.get_body_data().copy()
]
except Exception as e:
except ValidationError as e:
args["warnings"] = (
MessageList()
.add_message(str(e))
Expand Down
6 changes: 3 additions & 3 deletions src/multisafepay/api/paths/gateways/gateway_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


from multisafepay.api.base.abstract_manager import AbstractManager
from multisafepay.api.base.response.custom_api_response import (
CustomApiResponse,
Expand All @@ -14,6 +13,7 @@
from multisafepay.client.client import Client
from multisafepay.util.dict_utils import dict_empty
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError

ALLOWED_OPTIONS = {
"country": "",
Expand Down Expand Up @@ -70,7 +70,7 @@ def get_gateways(
Gateway.from_dict(gateway)
for gateway in response.get_body_data().copy()
]
except Exception as e:
except ValidationError as e:
args["warnings"] = (
MessageList()
.add_message(str(e))
Expand Down Expand Up @@ -115,7 +115,7 @@ def get_by_code(
if not dict_empty(response.get_body_data()):
try:
args["data"] = Gateway(**response.get_body_data().copy())
except Exception as e:
except ValidationError as e:
args["warnings"] = (
MessageList()
.add_message(str(e))
Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/api/paths/issuers/issuer_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


from multisafepay.api.base.abstract_manager import AbstractManager
from multisafepay.api.base.response.custom_api_response import (
CustomApiResponse,
Expand All @@ -17,6 +16,7 @@
from multisafepay.client.client import Client
from multisafepay.exception.invalid_argument import InvalidArgumentException
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError


class IssuerManager(AbstractManager):
Expand Down Expand Up @@ -73,7 +73,7 @@ def get_issuers_by_gateway_code(
Issuer.from_dict(issuer)
for issuer in response.get_body_data().copy()
]
except Exception as e:
except ValidationError as e:
print(e)
args["warnings"] = (
MessageList()
Expand Down
4 changes: 2 additions & 2 deletions src/multisafepay/api/paths/me/me_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


from multisafepay.api.base.abstract_manager import AbstractManager
from multisafepay.api.base.response.custom_api_response import (
CustomApiResponse,
Expand All @@ -14,6 +13,7 @@
from multisafepay.client.client import Client
from multisafepay.util.dict_utils import dict_empty
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError


class MeManager(AbstractManager):
Expand Down Expand Up @@ -52,7 +52,7 @@ def get(self: "MeManager") -> CustomApiResponse:
if not dict_empty(response.get_body_data()):
try:
args["data"] = Me(**response.get_body_data().copy())
except Exception as e:
except ValidationError as e:
args["warnings"] = (
MessageList()
.add_message(str(e))
Expand Down
8 changes: 4 additions & 4 deletions src/multisafepay/api/paths/orders/order_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


import json
from typing import Union

Expand Down Expand Up @@ -41,6 +40,7 @@
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from multisafepay.value_object.amount import Amount
from multisafepay.value_object.currency import Currency
from pydantic import ValidationError


class OrderManager(AbstractManager):
Expand Down Expand Up @@ -82,7 +82,7 @@ def __custom_api_response(response: ApiResponse) -> CustomApiResponse:
args["data"] = Order.from_dict(
d=response.get_body_data().copy(),
)
except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("Order"),
)
Expand Down Expand Up @@ -198,7 +198,7 @@ def capture(
args["data"] = OrderCapture.from_dict(
d=response.get_body_data().copy(),
)
except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("OrderCapture"),
)
Expand Down Expand Up @@ -238,7 +238,7 @@ def refund(
args["data"] = OrderRefund.from_dict(
d=response.get_body_data().copy(),
)
except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("OrderRefund"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


from multisafepay.api.base.abstract_manager import AbstractManager
from multisafepay.api.base.response.custom_api_response import (
CustomApiResponse,
Expand All @@ -16,6 +15,7 @@
from multisafepay.client.client import ApiResponse, Client
from multisafepay.util.dict_utils import dict_empty
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError

ALLOWED_OPTIONS = {
"country": "",
Expand Down Expand Up @@ -98,7 +98,7 @@ def get_payment_methods(
PaymentMethod.from_dict(payment_method)
for payment_method in response.get_body_data().copy()
]
except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("Listing Payment Method"),
)
Expand Down Expand Up @@ -140,7 +140,7 @@ def get_by_gateway_code(
args["data"] = PaymentMethod.from_dict(
d=response.get_body_data().copy(),
)
except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("Payment Method"),
)
Expand Down
5 changes: 3 additions & 2 deletions src/multisafepay/api/paths/recurring/recurring_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from multisafepay.client.client import Client
from multisafepay.util.dict_utils import dict_empty
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError


class RecurringManager(AbstractManager):
Expand Down Expand Up @@ -85,7 +86,7 @@ def get_list(
if tokens["tokens"]
]

except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("Listing Tokens"),
)
Expand Down Expand Up @@ -122,7 +123,7 @@ def get(
if not dict_empty(response.get_body_data()):
try:
args["data"] = Token(**response.get_body_data().copy())
except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("Listing Tokens"),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

# See the DISCLAIMER.md file for disclaimer details.


from multisafepay.api.base.abstract_manager import AbstractManager
from multisafepay.api.base.listings.listing_pager import ListingPager
from multisafepay.api.base.listings.pager import Pager
Expand All @@ -18,6 +17,7 @@
)
from multisafepay.client.client import Client
from multisafepay.util.message import MessageList, gen_could_not_created_msg
from pydantic import ValidationError

ALLOWED_OPTIONS = {
"site_id": "",
Expand Down Expand Up @@ -87,7 +87,7 @@ def get_transactions(
pager=Pager.from_dict(response.get_pager().copy()),
class_type=Transaction,
)
except Exception:
except ValidationError:
args["warnings"] = MessageList().add_message(
gen_could_not_created_msg("Listing Transaction"),
)
Expand Down