Skip to content

v2.0.0

Choose a tag to compare

@github-actions github-actions released this 04 Aug 05:56
· 167 commits to main since this release

Telegram Shop Bot v2.0.0

The biggest release yet: two waves of critical payment fixes, a revived loyalty & referral economy, product reviews, photo galleries, Stars subscriptions, an embedded Telegram Mini App, and full five-language i18n — verified by a new end-to-end test suite running the whole buyer journey against a mock Bot API.

🔴 Critical fixes

  • False payment confirmation — the CryptoBot polling worker marked unpaid (active) invoices as paid every 30 s, confirming orders and draining stock without money. Now only status == "paid" invoices are processed.
  • Unvalidated Stars pre-checkout — payments were approved after merely parsing the payload. The bot now verifies the order exists, belongs to the payer, is pending, and the invoice amount matches.
  • Subscriptions were never persisted — a wrong FK in migration 014 made every subscription insert fail (found by the E2E suite; fixed in migration 016).
  • Referral links never attached the referrer — SetReferrer addressed the wrong column (found by the E2E suite).
  • Stock check ignored quantity — buying 10 units with 1 in stock passed checkout and then failed inside payment confirmation, causing endless webhook retries. Idempotent webhook replies (HTTP 200 on repeats) end CryptoBot retry storms for good.
  • Cashback no longer loses points to float truncation; graceful shutdown drains all workers before closing the DB; SQLite runs in WAL with busy_timeout; backups use VACUUM INTO (no external sqlite3 binary — works in Docker) with keep-7 rotation.

✨ New features

  • Loyalty & referrals actually work: 1–10 % cashback in points on every paid order (all three payment paths), level upgrades, referrer gets 100 pts for an invited user's first purchase, the newcomer gets a personal one-off REF-… promo (−10 %, 30 days). Race-proof: a concurrent double confirmation awards exactly once (property-tested).
  • Product reviews & ratings — 1–5 ⭐ invitation after delivery, optional text, average rating on the product card, admin moderation via /reviews.
  • Photo upload & galleries — admins send photos straight to the chat (up to 10 per product), buyers get a media-group gallery.
  • Stars subscriptions — 30-day recurring products, /mysubs with one-tap cancel, expiry worker with reminders. Recurring renewals are mock-verified only — watch the first live renewal.
  • Telegram Mini App — catalog → cart → checkout in a web app embedded into the binary (no build toolchain), REST API with Telegram initData HMAC auth. Set WEBAPP_URL to enable.
  • Redesigned main menu — dense two-column colored layout; /search and /wishlist are fully interactive now.
  • Admin analytics — 14-day revenue chart, top-10 buyers, promo report, date-filtered CSV export; all five Prometheus metrics live with refreshed Grafana panels.
  • Forum-topic admin notifications — route order events to supergroup topics via ADMIN_GROUP_ID / TOPIC_*.
  • Full i18n — 5 languages everywhere including the admin panel; regional tags (ru-RU, zh-hans) resolve correctly; es/de/zh translations completed.

⚠️ Breaking changes

  • OrderService.ConfirmPayment now returns (*PaymentOutcome, error); worker constructors changed signatures.
  • Default fallback language is English (was Russian).
  • WAL mode adds -wal/-shm files next to the database; copy backups via VACUUM INTO, not cp.

Migrations 012–016 apply automatically on startup — both clean installs and v1.x upgrades are tested.


Telegram Shop Bot v2.0.0 (RU)

Самый большой релиз: критические фиксы платежей, работающие лояльность и рефералка, отзывы, галереи фото, подписки Stars, встроенный Mini App и полный перевод на 5 языков — всё проверено новым E2E-набором, прогоняющим полный путь покупателя на mock Bot API.

🔴 Критические исправления

  • Ложное подтверждение оплаты — поллинг CryptoBot каждые 30 с помечал неоплаченные инвойсы оплаченными и списывал склад. Теперь обрабатываются только paid.
  • Stars pre-checkout без проверок — теперь проверяются заказ, владелец, статус и сумма.
  • Подписки не сохранялись (битый FK, миграция 016) и рефералы не привязывались — оба бага найдены E2E-тестами.
  • Проверка остатка не учитывала количество — плюс идемпотентный вебхук: конец бесконечных ретраев CryptoBot.
  • Кэшбэк больше не теряет баллы на округлении; graceful shutdown дожидается воркеров до закрытия БД; SQLite в WAL; бэкапы через VACUUM INTO (работают в Docker) с ротацией 7 шт.

✨ Новое

  • Лояльность и рефералка работают: кэшбэк 1–10 % баллами, уровни, рефереру 100 баллов за первую покупку приглашённого, новичку персональный промокод REF-… (−10 %, 30 дней). Гонки исключены property-тестом.
  • Отзывы и рейтинги, загрузка фото в чат + галереи, подписки Stars (/mysubs, отмена, напоминания; продление проверено только на моках), Mini App (WEBAPP_URL), новое 2-колоночное меню, живые /search и /wishlist, аналитика админки с графиком и CSV по датам, Topics-уведомления, полный i18n на 5 языках включая админку.

⚠️ Ломающие изменения

  • ConfirmPayment возвращает (*PaymentOutcome, error); изменились конструкторы воркеров.
  • Язык по умолчанию — английский (был русский).
  • WAL добавляет файлы -wal/-shm; бэкапы — только VACUUM INTO, не cp.

Миграции 012–016 применяются автоматически: чистая установка и апгрейд с v1.x протестированы.

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