Some checks failed
build-images / web (push) Has been cancelled
vision2026-ci / Python SDK resource tests (push) Has been cancelled
build-images / api (push) Has been cancelled
build-images / worker-gpu (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (comfy-workflow-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (effects-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (eventbus-types) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (growth-analytics) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (provider-adapter-kit) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (publishing-connectors) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (render-core) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (shot-template-schema) (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (trends-schema) (push) Has been cancelled
vision2026-ci / Desktop engine crates (test + clippy + fmt) (push) Has been cancelled
codeql / Analyze (javascript-typescript) (push) Has been cancelled
codeql / Analyze (python) (push) Has been cancelled
perf / API hot-path micro-smoke (budgeted) (push) Has been cancelled
perf / Desktop engine crates (release build check) (push) Has been cancelled
vision2026-ci / API phase modules (ruff + pytest) (push) Has been cancelled
vision2026-ci / Alembic upgrade + drift check (push) Has been cancelled
vision2026-ci / Shared packages (TS≡Python golden parity) (caption-engine) (push) Has been cancelled
Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
"""HTTP-facing paid-access guard for paid creator actions.
|
|
|
|
Delegates to :func:`app.services.user_entitlements.require_paid_access`, so a
|
|
web monthly plan (Dodo or Creem), a credit pack or mobile RevenueCat Pro all
|
|
unlock the same actions (download, share, publish, editor export, winner loop).
|
|
"""
|
|
|
|
from loguru import logger
|
|
|
|
from app.models.exception import HttpException
|
|
from app.services import user_entitlements
|
|
|
|
|
|
def require_pro_action(user_id: str, request_id: str, *, action: str) -> None:
|
|
"""Require paid access, mapping the outcome to API errors.
|
|
|
|
Denied access is a payment-required response. When no source grants and a
|
|
source could not be verified the answer is 503, so a temporary billing or
|
|
RevenueCat problem can never expose a paid export or distribution action.
|
|
"""
|
|
try:
|
|
user_entitlements.require_paid_access(user_id)
|
|
except user_entitlements.PaidAccessDenied as exc:
|
|
raise HttpException(
|
|
task_id=request_id,
|
|
status_code=402,
|
|
message=f"{request_id}: a paid plan, credit pack or Pro subscription is required",
|
|
) from exc
|
|
except user_entitlements.PaidAccessUnavailable as exc:
|
|
logger.error(f"paid access for {action} unverifiable, request_id: {request_id}")
|
|
raise HttpException(
|
|
task_id=request_id,
|
|
status_code=503,
|
|
message=f"{request_id}: paid access verification is unavailable",
|
|
) from exc
|