diff --git a/payments/core.py b/payments/core.py index 294bcb326..1c02dd1af 100644 --- a/payments/core.py +++ b/payments/core.py @@ -1,5 +1,4 @@ import re -from importlib import import_module from typing import TYPE_CHECKING from typing import Dict from typing import Optional @@ -155,9 +154,7 @@ def _default_provider_factory(variant: str, payment: Optional["BasePayment"] = N if not handler: raise ValueError("Payment variant does not exist: {}".format(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]