From e6f8ae6ab09c431d5322c851165f30469678ed72 Mon Sep 17 00:00:00 2001 From: c0mrade Date: Wed, 4 Feb 2026 16:41:25 +0300 Subject: [PATCH] feat: add Stars payment confirmation and admin validation - Show confirmation dialog before redirecting to Telegram for Stars payment (native popup in Mini App, confirm in browser) - Warn admin when saving wheel config with Stars enabled but Telegram Stars payment method is disabled globally - Add translation keys: confirmStarsTitle, confirmStarsPayment, starsNotEnabledGlobally (ru, en, zh, fa) --- src/locales/en.json | 3 +++ src/locales/fa.json | 3 +++ src/locales/ru.json | 3 +++ src/locales/zh.json | 3 +++ src/pages/AdminWheel.tsx | 20 +++++++++++++++++--- src/pages/Wheel.tsx | 9 ++++++++- 6 files changed, 37 insertions(+), 4 deletions(-) diff --git a/src/locales/en.json b/src/locales/en.json index fc1268a..0b5bf51 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -714,6 +714,8 @@ "starsPaymentFailed": "Payment failed. Please try again.", "starsPaymentRedirected": "Telegram will open for payment. Refresh the page after payment.", "starsNotAvailable": "Star payments are currently unavailable. Contact support.", + "confirmStarsTitle": "Star payment", + "confirmStarsPayment": "You will be redirected to Telegram to pay for one wheel spin. Continue?", "youWon": "You won", "noPrize": "No luck this time...", "noHistory": "No spin history yet", @@ -978,6 +980,7 @@ "promocodes": "Promocodes", "promoPrefix": "Promo code prefix" }, + "starsNotEnabledGlobally": "Star payments are not enabled in Payment Methods. Enable \"Telegram Stars\" in the Payment Methods section.", "prizes": { "addPrize": "Add Prize", "editPrize": "Edit Prize", diff --git a/src/locales/fa.json b/src/locales/fa.json index 5a92e26..e5d0b8d 100644 --- a/src/locales/fa.json +++ b/src/locales/fa.json @@ -600,6 +600,8 @@ "starsPaymentFailed": "پرداخت ناموفق. دوباره تلاش کنید.", "starsPaymentRedirected": "تلگرام برای پرداخت باز می‌شود. پس از پرداخت صفحه را بازخوانی کنید.", "starsNotAvailable": "پرداخت با ستاره در حال حاضر در دسترس نیست. با پشتیبانی تماس بگیرید.", + "confirmStarsTitle": "پرداخت با ستاره", + "confirmStarsPayment": "شما به تلگرام برای پرداخت یک چرخش منتقل خواهید شد. ادامه می‌دهید؟", "noHistory": "هنوز تاریخچه‌ای نیست", "banner": { "title": "شانس خود را امتحان کنید!", @@ -700,6 +702,7 @@ "limitsAndRtp": "محدودیت‌ها و RTP", "promocodes": "کدهای تخفیف" }, + "starsNotEnabledGlobally": "پرداخت با ستاره در روش‌های پرداخت فعال نیست. «Telegram Stars» را در بخش «روش‌های پرداخت» فعال کنید.", "prizes": { "addPrize": "افزودن جایزه", "editPrize": "ویرایش جایزه", diff --git a/src/locales/ru.json b/src/locales/ru.json index 7c83bda..c279001 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -742,6 +742,8 @@ "starsPaymentFailed": "Ошибка оплаты. Попробуйте еще раз.", "starsPaymentRedirected": "Откроется Telegram для оплаты. После оплаты обновите страницу.", "starsNotAvailable": "Оплата звёздами сейчас недоступна. Обратитесь в поддержку.", + "confirmStarsTitle": "Оплата звёздами", + "confirmStarsPayment": "Вы будете перенаправлены в Telegram для оплаты одного вращения колеса. Продолжить?", "youWon": "Вы выиграли", "noPrize": "В этот раз не повезло...", "noHistory": "История вращений пуста", @@ -1002,6 +1004,7 @@ "promocodes": "Промокоды", "promoPrefix": "Префикс промокодов" }, + "starsNotEnabledGlobally": "Оплата звёздами не включена в платёжных методах. Включите метод «Telegram Stars» в разделе «Платёжные методы».", "prizes": { "addPrize": "Добавить приз", "editPrize": "Редактировать приз", diff --git a/src/locales/zh.json b/src/locales/zh.json index 97cd77a..896a0cc 100644 --- a/src/locales/zh.json +++ b/src/locales/zh.json @@ -604,6 +604,8 @@ "starsPaymentFailed": "支付失败。请重试。", "starsPaymentRedirected": "将打开Telegram进行支付。支付后请刷新页面。", "starsNotAvailable": "星星支付暂不可用。请联系客服。", + "confirmStarsTitle": "星星支付", + "confirmStarsPayment": "您将被重定向到Telegram进行一次转盘支付。继续吗?", "noHistory": "暂无抽奖记录", "banner": { "title": "试试运气!", @@ -752,6 +754,7 @@ "limitsAndRtp": "限制和RTP", "promocodes": "促销码" }, + "starsNotEnabledGlobally": "星星支付未在支付方式中启用。请在「支付方式」中启用「Telegram Stars」。", "prizes": { "addPrize": "添加奖品", "editPrize": "编辑奖品", diff --git a/src/pages/AdminWheel.tsx b/src/pages/AdminWheel.tsx index 25bc23e..35bb2e5 100644 --- a/src/pages/AdminWheel.tsx +++ b/src/pages/AdminWheel.tsx @@ -21,7 +21,9 @@ import { } from '@dnd-kit/sortable'; import { CSS } from '@dnd-kit/utilities'; import { adminWheelApi, type WheelPrizeAdmin, type CreateWheelPrizeData } from '../api/wheel'; +import { adminPaymentMethodsApi } from '../api/adminPaymentMethods'; import { useDestructiveConfirm } from '@/platform'; +import { useNotify } from '@/platform/hooks/useNotify'; import FortuneWheel from '../components/wheel/FortuneWheel'; import { ColorPicker } from '@/components/ColorPicker'; import { useBackButton } from '../platform/hooks/useBackButton'; @@ -291,6 +293,7 @@ export default function AdminWheel() { const queryClient = useQueryClient(); const confirmDelete = useDestructiveConfirm(); const { capabilities } = usePlatform(); + const notify = useNotify(); // Use native Telegram back button in Mini App useBackButton(() => navigate('/admin')); @@ -794,10 +797,21 @@ export default function AdminWheel() { {hasSettingsChanges && (