Merge pull request #113 from BEDOLAGA-DEV/dev

Dev
This commit is contained in:
Egor
2026-01-28 21:13:40 +03:00
committed by GitHub
6 changed files with 28 additions and 21 deletions

View File

@@ -210,10 +210,7 @@ export default function TopUpModal({ method, onClose, initialAmountRubles }: Top
// openInvoice requires WebApp version 6.1+ // openInvoice requires WebApp version 6.1+
const supportsInvoice = const supportsInvoice =
webApp?.openInvoice && webApp?.isVersionAtLeast && webApp.isVersionAtLeast('6.1'); webApp?.openInvoice && webApp?.isVersionAtLeast && webApp.isVersionAtLeast('6.1');
if (!supportsInvoice) { if (supportsInvoice) {
setError(t('balance.errors.starsOnlyInTelegram'));
return;
}
try { try {
webApp.openInvoice(data.invoice_url, (status) => { webApp.openInvoice(data.invoice_url, (status) => {
if (status === 'paid') { if (status === 'paid') {
@@ -226,6 +223,11 @@ export default function TopUpModal({ method, onClose, initialAmountRubles }: Top
} catch (e) { } catch (e) {
setError(t('balance.errors.generic', { details: String(e) })); setError(t('balance.errors.generic', { details: String(e) }));
} }
} else {
// Fallback: open invoice URL in Telegram (browser or unsupported WebApp version)
window.open(data.invoice_url, '_blank', 'noopener,noreferrer');
onClose();
}
}, },
onError: (err: unknown) => { onError: (err: unknown) => {
const axiosError = err as { response?: { data?: { detail?: string }; status?: number } }; const axiosError = err as { response?: { data?: { detail?: string }; status?: number } };

View File

@@ -597,6 +597,7 @@
"starsPaymentSuccess": "Payment successful! Spin result sent to Telegram.", "starsPaymentSuccess": "Payment successful! Spin result sent to Telegram.",
"starsPaymentSuccessCheckHistory": "Payment successful! Check history or Telegram for the result.", "starsPaymentSuccessCheckHistory": "Payment successful! Check history or Telegram for the result.",
"starsPaymentFailed": "Payment failed. Please try again.", "starsPaymentFailed": "Payment failed. Please try again.",
"starsPaymentRedirected": "Telegram will open for payment. Refresh the page after payment.",
"youWon": "You won", "youWon": "You won",
"noPrize": "No luck this time...", "noPrize": "No luck this time...",
"noHistory": "No spin history yet", "noHistory": "No spin history yet",

View File

@@ -518,6 +518,7 @@
"processingPayment": "در حال پردازش...", "processingPayment": "در حال پردازش...",
"starsPaymentSuccess": "پرداخت موفق! نتیجه به تلگرام ارسال شد.", "starsPaymentSuccess": "پرداخت موفق! نتیجه به تلگرام ارسال شد.",
"starsPaymentFailed": "پرداخت ناموفق. دوباره تلاش کنید.", "starsPaymentFailed": "پرداخت ناموفق. دوباره تلاش کنید.",
"starsPaymentRedirected": "تلگرام برای پرداخت باز می‌شود. پس از پرداخت صفحه را بازخوانی کنید.",
"noHistory": "هنوز تاریخچه‌ای نیست", "noHistory": "هنوز تاریخچه‌ای نیست",
"banner": { "banner": {
"title": "شانس خود را امتحان کنید!", "title": "شانس خود را امتحان کنید!",

View File

@@ -620,6 +620,7 @@
"starsPaymentSuccess": "Оплата прошла! Результат спина отправлен в Telegram.", "starsPaymentSuccess": "Оплата прошла! Результат спина отправлен в Telegram.",
"starsPaymentSuccessCheckHistory": "Оплата прошла! Проверьте историю или Telegram для результата.", "starsPaymentSuccessCheckHistory": "Оплата прошла! Проверьте историю или Telegram для результата.",
"starsPaymentFailed": "Ошибка оплаты. Попробуйте еще раз.", "starsPaymentFailed": "Ошибка оплаты. Попробуйте еще раз.",
"starsPaymentRedirected": "Откроется Telegram для оплаты. После оплаты обновите страницу.",
"youWon": "Вы выиграли", "youWon": "Вы выиграли",
"noPrize": "В этот раз не повезло...", "noPrize": "В этот раз не повезло...",
"noHistory": "История вращений пуста", "noHistory": "История вращений пуста",

View File

@@ -522,6 +522,7 @@
"processingPayment": "处理中...", "processingPayment": "处理中...",
"starsPaymentSuccess": "支付成功抽奖结果已发送到Telegram。", "starsPaymentSuccess": "支付成功抽奖结果已发送到Telegram。",
"starsPaymentFailed": "支付失败。请重试。", "starsPaymentFailed": "支付失败。请重试。",
"starsPaymentRedirected": "将打开Telegram进行支付。支付后请刷新页面。",
"noHistory": "暂无抽奖记录", "noHistory": "暂无抽奖记录",
"banner": { "banner": {
"title": "试试运气!", "title": "试试运气!",

View File

@@ -299,20 +299,21 @@ export default function Wheel() {
} }
}); });
} else { } else {
// openInvoice not available - show error // Fallback: open invoice URL in Telegram (browser or unsupported WebApp version)
setIsPayingStars(false); setIsPayingStars(false);
window.open(data.invoice_url, '_blank', 'noopener,noreferrer');
setSpinResult({ setSpinResult({
success: false, success: true,
prize_id: null, prize_id: null,
prize_type: null, prize_type: null,
prize_value: 0, prize_value: 0,
prize_display_name: '', prize_display_name: '',
emoji: '😔', emoji: '',
color: '#EF4444', color: '#8B5CF6',
rotation_degrees: 0, rotation_degrees: 0,
message: t('wheel.errors.starsNotAvailable'), message: t('wheel.starsPaymentRedirected'),
promocode: null, promocode: null,
error: 'stars_not_available', error: null,
}); });
setShowResultModal(true); setShowResultModal(true);
} }