Skip to content

Commit 47b980d

Browse files
author
Neo
committed
refactor: strip iOS-only concerns from backend
Stripe subscriptions moved to MTRX iOS (Apple IAP). Backend no longer handles user billing. Removed: - runtime/subscriptions/ (stripe client, tiers, feature gate, usage tracker, revenue reporter, audit/conversion services, metered billing) - runtime/referrals/ (tied to subscription tiers) - scripts/stripe_setup.py - tests/test_subscriptions.py, tests/test_metered_billing.py - web/pricing.html - /subscription/* endpoints from gateway - /referral/* endpoints from gateway - /metered/* endpoints from gateway - /pricing page handler - APNs push registration endpoint (/bridge/v1/push/register) from bridge Added: - Procfile for Heroku/Railway deployment - railway.toml with Dockerfile build + /health check - setup_telegram.py — standalone CLI to configure Telegram bot after initial setup. Auto-discovers chat ID by waiting for the first message, sends a test message, persists to config and .env. - PORT env var support (Railway convention) in gateway/server.py Updated: - .env.example: removed Stripe vars, added PORT note - openmatrix.config.json.example: removed subscriptions block
1 parent 09ffdd5 commit 47b980d

22 files changed

Lines changed: 278 additions & 4818 deletions

.env.example

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
# OPENMATRIX_API_KEY=
88
# OPENMATRIX_HOST=0.0.0.0
99
# OPENMATRIX_PORT=18790
10+
# PORT= # Railway/Heroku assign this automatically; takes precedence
1011

1112
# ── Model providers ──
1213
# OPENAI_API_KEY=
@@ -21,12 +22,6 @@
2122
# TELEGRAM_BOT_TOKEN=
2223
# OWNER_TELEGRAM_ID= # Your Telegram user ID — used by the bridge approval gate
2324

24-
# ── Stripe (subscription payments) ──
25-
# STRIPE_SECRET_KEY=
26-
# STRIPE_WEBHOOK_SECRET=
27-
# STRIPE_PRO_PRICE_ID=
28-
# STRIPE_ENTERPRISE_PRICE_ID=
29-
3025
# ── Social media ──
3126
# TWITTER_API_KEY=
3227
# TWITTER_API_SECRET=

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: python -m gateway.server

gateway/bridge.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,6 @@ def __init__(self, config: dict, gateway_server):
494494
self._config = config
495495
self._server = gateway_server
496496
self._linked_wallets: dict[str, dict] = {} # session_id → wallet info
497-
self._push_tokens: dict[str, str] = {} # session_id → APNs token
498497
self._web3_manager = None # lazy; built on first balance lookup
499498

500499
def _get_web3_manager(self):
@@ -548,9 +547,6 @@ def register_routes(self, app: web.Application) -> None:
548547
app.router.add_get("/bridge/v1/config", self.get_config)
549548
app.router.add_get("/bridge/v1/services", self.get_services)
550549

551-
# Push notifications
552-
app.router.add_post("/bridge/v1/push/register", self.register_push)
553-
554550
# Dashboard (aggregated data for iOS home screen)
555551
app.router.add_get("/bridge/v1/dashboard", self.get_dashboard)
556552

@@ -881,24 +877,6 @@ async def get_components_manifest(self, request: web.Request) -> web.Response:
881877
logger.error(f"Bridge get_components_manifest error: {e}", exc_info=True)
882878
return MobileResponse.error(str(e), 500)
883879

884-
# ─── Push Notifications ───────────────────────────────────────────────
885-
886-
async def register_push(self, request: web.Request) -> web.Response:
887-
"""Register APNs push token for a session."""
888-
try:
889-
body = await request.json()
890-
except Exception:
891-
return MobileResponse.error("Invalid JSON")
892-
893-
session_id = body.get("session_id", "")
894-
token = body.get("push_token", "")
895-
896-
if not session_id or not token:
897-
return MobileResponse.error("session_id and push_token required")
898-
899-
self._push_tokens[session_id] = token
900-
return MobileResponse.ok({"registered": True})
901-
902880
# ─── Dashboard ────────────────────────────────────────────────────────
903881

904882
async def get_dashboard(self, request: web.Request) -> web.Response:

gateway/server.py

Lines changed: 17 additions & 211 deletions
Large diffs are not rendered by default.

openmatrix.config.json.example

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -311,12 +311,6 @@
311311
"block_on_critical": true,
312312
"block_on_high": false
313313
},
314-
"subscriptions": {
315-
"trial_days": 3,
316-
"stripe_webhook_secret": "YOUR_STRIPE_WEBHOOK_SECRET",
317-
"stripe_pro_price_id": "YOUR_STRIPE_PRO_PRICE_ID",
318-
"stripe_enterprise_price_id": "YOUR_STRIPE_ENTERPRISE_PRICE_ID"
319-
},
320314
"social": {
321315
"twitter": {
322316
"api_key": "YOUR_TWITTER_API_KEY",

railway.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[build]
2+
builder = "DOCKERFILE"
3+
dockerfilePath = "Dockerfile"
4+
5+
[deploy]
6+
startCommand = "python -m gateway.server"
7+
healthcheckPath = "/health"
8+
healthcheckTimeout = 30
9+
restartPolicyType = "ON_FAILURE"
10+
restartPolicyMaxRetries = 10

runtime/referrals/__init__.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)