billing frontend for mariadb. setup as otb_billing for outsidethebox.top accounting. also involved with outsidethedb
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

44 lines
1.1 KiB

#!/bin/bash
set -e
STAMP="$(date +%Y%m%d-%H%M%S)"
cp app.py "app.py.auto-expire-pending-v2.${STAMP}.bak"
python3 <<'PY'
from pathlib import Path
p = Path("app.py")
text = p.read_text()
old = """ cur2.execute(
"SELECT id, payment_status, txid, created_at "
"FROM payments "
"WHERE invoice_id = %s AND payment_method = 'crypto' "
"ORDER BY id DESC LIMIT 1",
(invoice_id,)
)
"""
new = """ cur2.execute(
"SELECT id, payment_method, payment_currency, payment_status, txid, created_at "
"FROM payments "
"WHERE invoice_id = %s "
"AND UPPER(COALESCE(payment_currency,'')) IN ('ETHO','ETI','EGAZ','ETH','ARB') "
"ORDER BY id DESC LIMIT 1",
(invoice_id,)
)
"""
if old not in text:
raise SystemExit("FAILED: old auto-expire query not found")
text = text.replace(old, new, 1)
p.write_text(text)
print("OK: auto-expire query updated for real crypto rows")
PY
python3 -m py_compile app.py
echo "PY_COMPILE_OK"
sudo systemctl restart otb_billing
sudo systemctl status otb_billing --no-pager -l