feat: enable payment provider for admin only
This commit is contained in:
@@ -27,6 +27,7 @@ from .base import (
|
||||
ServiceFactoryContext,
|
||||
WebAppPaymentContext,
|
||||
provider_env_file,
|
||||
provider_runtime_enabled,
|
||||
)
|
||||
from .shared import (
|
||||
HttpClientMixin,
|
||||
@@ -241,7 +242,7 @@ class HeleketService(HttpClientMixin):
|
||||
# ``False`` state from startup and the button would never appear.
|
||||
@property
|
||||
def configured(self) -> bool:
|
||||
return bool(self.config.ENABLED and self.merchant_id and self.api_key)
|
||||
return bool(provider_runtime_enabled(self.config) and self.merchant_id and self.api_key)
|
||||
|
||||
@property
|
||||
def base_url(self) -> str:
|
||||
@@ -546,6 +547,14 @@ async def pay_heleket_callback_handler(
|
||||
await notify_callback_parse_error(callback, translator)
|
||||
return
|
||||
|
||||
if not SPEC.is_available_to_user(
|
||||
settings,
|
||||
user_id=callback.from_user.id,
|
||||
require_configured=False,
|
||||
):
|
||||
await notify_service_unavailable(callback, translator)
|
||||
return
|
||||
|
||||
if not heleket_service or not heleket_service.configured:
|
||||
logging.error("Heleket service is not configured or unavailable.")
|
||||
await notify_service_unavailable(callback, translator)
|
||||
|
||||
Reference in New Issue
Block a user