File tree Expand file tree Collapse file tree 3 files changed +8
-8
lines changed
src/simcore_service_payments/services Expand file tree Collapse file tree 3 files changed +8
-8
lines changed Original file line number Diff line number Diff line change 1414from models_library .rabbitmq_basic_types import RPCMethodName
1515from models_library .rabbitmq_messages import WalletCreditsMessage
1616from models_library .wallets import WalletID
17- from pydantic import parse_obj_as , parse_raw_as
17+ from pydantic import TypeAdapter , parse_obj_as
1818from simcore_service_payments .db .auto_recharge_repo import AutoRechargeRepo
1919from simcore_service_payments .db .payments_methods_repo import PaymentsMethodsRepo
2020from simcore_service_payments .db .payments_transactions_repo import (
3636
3737
3838async def process_message (app : FastAPI , data : bytes ) -> bool :
39- rabbit_message = parse_raw_as (WalletCreditsMessage , data )
39+ rabbit_message = TypeAdapter (WalletCreditsMessage ). validate_json ( data )
4040 _logger .debug ("Process msg: %s" , rabbit_message )
4141
4242 settings : ApplicationSettings = app .state .settings
Original file line number Diff line number Diff line change 1616from fastapi .encoders import jsonable_encoder
1717from httpx import URL , HTTPStatusError
1818from models_library .api_schemas_webserver .wallets import PaymentID , PaymentMethodID
19- from pydantic import ValidationError , parse_raw_as
20- from pydantic . errors import PydanticErrorMixin
19+ from models_library . error_classes import OsparcErrorMixin
20+ from pydantic import TypeAdapter , ValidationError
2121from servicelib .fastapi .app_state import SingletonInAppStateMixin
2222from servicelib .fastapi .http_client import (
2323 AttachLifespanMixin ,
4848def _parse_raw_as_or_none (cls : type , text : str | None ):
4949 if text :
5050 with suppress (ValidationError ):
51- return parse_raw_as (cls , text )
51+ return TypeAdapter (cls ). validate_json ( text )
5252 return None
5353
5454
55- class PaymentsGatewayError (PydanticErrorMixin , ValueError ):
55+ class PaymentsGatewayError (OsparcErrorMixin , ValueError ):
5656 msg_template = "{operation_id} error {status_code}: {reason}"
5757
5858 @classmethod
Original file line number Diff line number Diff line change 1010import simcore_service_payments
1111from faker import Faker
1212from models_library .users import GroupID
13- from pydantic import parse_obj_as
13+ from pydantic import TypeAdapter
1414from pytest_simcore .helpers .monkeypatch_envs import setenvs_from_dict
1515from pytest_simcore .helpers .typing_env import EnvVarsDict
1616from servicelib .utils_secrets import generate_token_secret_key
@@ -89,4 +89,4 @@ def app_environment(
8989
9090@pytest .fixture
9191def user_primary_group_id (faker : Faker ) -> GroupID :
92- return parse_obj_as (GroupID , faker .pyint ())
92+ return TypeAdapter (GroupID ). validate_python ( faker .pyint ())
You can’t perform that action at this time.
0 commit comments