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,21 +210,23 @@ export default function TopUpModal({ method, onClose, initialAmountRubles }: Top
// openInvoice requires WebApp version 6.1+
const supportsInvoice =
webApp?.openInvoice && webApp?.isVersionAtLeast && webApp.isVersionAtLeast('6.1');
if (!supportsInvoice) {
setError(t('balance.errors.starsOnlyInTelegram'));
return;
}
try {
webApp.openInvoice(data.invoice_url, (status) => {
if (status === 'paid') {
setError(null);
onClose();
} else if (status === 'failed') {
setError(t('wheel.starsPaymentFailed'));
}
});
} catch (e) {
setError(t('balance.errors.generic', { details: String(e) }));
if (supportsInvoice) {
try {
webApp.openInvoice(data.invoice_url, (status) => {
if (status === 'paid') {
setError(null);
onClose();
} else if (status === 'failed') {
setError(t('wheel.starsPaymentFailed'));
}
});
} catch (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) => {

View File

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

View File

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

View File

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

View File

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

View File

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