diff --git a/payments/core.py b/payments/core.py index 6fce7725d..16e371e26 100644 --- a/payments/core.py +++ b/payments/core.py @@ -1,7 +1,6 @@ from __future__ import annotations import re -from importlib import import_module from typing import TYPE_CHECKING from urllib.parse import urlencode from urllib.parse import urljoin @@ -167,9 +166,7 @@ def _default_provider_factory(variant: str, payment: BasePayment | None = None): if not handler: raise ValueError(f"Payment variant does not exist: {variant}") if variant not in PROVIDER_CACHE: - module_path, class_name = handler.rsplit(".", 1) - module = import_module(module_path) - class_ = getattr(module, class_name) + class_ = import_string(handler) PROVIDER_CACHE[variant] = class_(**config) return PROVIDER_CACHE[variant]