|
5 | 5 |
|
6 | 6 | # See the DISCLAIMER.md file for disclaimer details. |
7 | 7 |
|
8 | | - |
9 | 8 | import json |
10 | 9 | from typing import Union |
11 | 10 |
|
|
41 | 40 | from multisafepay.util.message import MessageList, gen_could_not_created_msg |
42 | 41 | from multisafepay.value_object.amount import Amount |
43 | 42 | from multisafepay.value_object.currency import Currency |
| 43 | +from pydantic import ValidationError |
44 | 44 |
|
45 | 45 |
|
46 | 46 | class OrderManager(AbstractManager): |
@@ -82,7 +82,7 @@ def __custom_api_response(response: ApiResponse) -> CustomApiResponse: |
82 | 82 | args["data"] = Order.from_dict( |
83 | 83 | d=response.get_body_data().copy(), |
84 | 84 | ) |
85 | | - except Exception: |
| 85 | + except ValidationError: |
86 | 86 | args["warnings"] = MessageList().add_message( |
87 | 87 | gen_could_not_created_msg("Order"), |
88 | 88 | ) |
@@ -198,7 +198,7 @@ def capture( |
198 | 198 | args["data"] = OrderCapture.from_dict( |
199 | 199 | d=response.get_body_data().copy(), |
200 | 200 | ) |
201 | | - except Exception: |
| 201 | + except ValidationError: |
202 | 202 | args["warnings"] = MessageList().add_message( |
203 | 203 | gen_could_not_created_msg("OrderCapture"), |
204 | 204 | ) |
@@ -238,7 +238,7 @@ def refund( |
238 | 238 | args["data"] = OrderRefund.from_dict( |
239 | 239 | d=response.get_body_data().copy(), |
240 | 240 | ) |
241 | | - except Exception: |
| 241 | + except ValidationError: |
242 | 242 | args["warnings"] = MessageList().add_message( |
243 | 243 | gen_could_not_created_msg("OrderRefund"), |
244 | 244 | ) |
|
0 commit comments