Skip to content

v3.0.0

Choose a tag to compare

@github-actions github-actions released this 27 Aug 16:06
· 166 commits to main since this release
5cf1914

Telegram Shop Bot v3.0.0

One guided command to launch. A durable payment core when money gets complicated.

v3 makes the shop dramatically easier to start and makes Telegram Stars and CryptoBot payments deterministic, auditable, and recoverable.

🚀 One-command setup

  • Run telegram-shop-bot quickstart and answer only two questions: the BotFather token and your Telegram admin ID.
  • The initializer validates the bot with Telegram, derives BOT_USERNAME, creates .env atomically without overwriting an existing file, and applies private permissions on Unix.
  • New doctor diagnostics check configuration, SQLite migrations, optional Redis, Telegram identity, webhook state, and pending updates without exposing secrets.
  • init, doctor, quickstart, run, version, and help ship in the same binary. Running the binary without arguments remains compatible with previous releases.

💳 Durable commerce ledger

  • Order, payment, and fulfillment now have independent states instead of sharing one overloaded order status.
  • Captures, refunds, anomalies, payment attempts, and operator resolutions are stored in append-only timelines.
  • Provider ID, payer, amount, currency, and occurrence time are validated before settlement.
  • Exact replays remain idempotent: stock, loyalty rewards, referrals, and subscription access are not applied twice.
  • Telegram webhook and polling acknowledgements wait until every Stars charge is either settled or durably quarantined.
  • Recurring Stars payment and entitlement updates commit atomically; refunds revoke or roll back access consistently.

🧰 Guarded payment operations

  • reconcile-stars performs a bounded, read-only comparison between Telegram and the local ledger.
  • payment-review lists quarantined Stars and CryptoBot facts with redacted output.
  • Recovery is preview-first and requires explicit --apply plus exact order confirmation.
  • Revenue analytics now separates gross captures, refunds, and net revenue.

🔐 Webhook and CryptoBot hardening

  • WEBHOOK_URL is now the public base URL. Telegram uses /telegram-webhook; CryptoBot uses /cryptobot-webhook.
  • Every public Telegram webhook requires a strong TELEGRAM_WEBHOOK_SECRET, regardless of application mode.
  • CryptoBot now uses exact decimal conversion, provider occurrence timestamps, durable malformed-fact preservation, and mutable-head-safe pagination.
  • Transient SQLite lock conflicts are retried through a bounded settlement path.
  • Startup transport errors are sanitized so BotFather tokens do not appear in logs.

⚠️ Upgrade notes

  1. Create a verified SQLite backup before the first v3 start.
  2. Migrations 017_commerce_ledger.sql and 018_provider_fact_immutability.sql apply automatically.
  3. Set WEBHOOK_URL to the HTTPS base URL only; remove old /webhook/... suffixes.
  4. When webhook mode is enabled, configure a 32–256 character TELEGRAM_WEBHOOK_SECRET.
  5. Forks calling the Go payment service directly should migrate to ConfirmPaymentReceipt with a validated provider receipt.
  6. Monitor the first live recurring Stars renewal after upgrading.

Docker

docker pull ghcr.io/jumpcodefrog/telegram-shop-bot:v3.0.0

Quick start

./telegram-shop-bot quickstart

Telegram Shop Bot v3.0.0 — по-русски

Одна команда для запуска. Надёжный платёжный контур для реальных денег.

🚀 Проще начать

  • telegram-shop-bot quickstart спрашивает только BotFather-токен и Telegram ID администратора, проверяет их, создаёт приватный .env, запускает диагностику и магазин.
  • Новый doctor проверяет конфигурацию, SQLite, Redis, Telegram и webhook без вывода секретов.
  • Все команды находятся в одном бинарнике; запуск без аргументов работает как раньше.

💳 Платежи под контролем

  • Состояния заказа, оплаты и исполнения разделены.
  • Captures, refunds, anomalies и решения оператора сохраняются в неизменяемом журнале.
  • Повтор одного платежа не списывает товар, не начисляет бонусы и не продлевает подписку второй раз.
  • Stars webhook и polling подтверждают update только после сохранённого settlement или quarantine.
  • Оплата подписки и выдача доступа проходят атомарно; возврат корректно отзывает доступ.
  • Аналитика показывает gross, refunds и net revenue отдельно.

🧰 Восстановление без опасной автоматики

  • reconcile-stars выполняет только чтение и сверку с Telegram.
  • payment-review показывает спорные операции без секретов и требует preview, --apply и точное подтверждение заказа.
  • CryptoBot получил точные суммы, provider timestamps и пагинацию без пропуска новых оплаченных инвойсов.

⚠️ Перед обновлением

  1. Сделайте проверенный бэкап SQLite.
  2. Миграции 017 и 018 применятся автоматически.
  3. Укажите в WEBHOOK_URL только базовый HTTPS URL.
  4. При webhook-режиме задайте сильный TELEGRAM_WEBHOOK_SECRET длиной 32–256 символов.
  5. Проверьте первое живое продление Stars после обновления.

Полный список изменений: CHANGELOG.md.