mirror of
https://github.com/chillpadclub/bedolaga-cabinet.git
synced 2026-07-28 17:43:47 +00:00
@@ -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) => {
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -518,6 +518,7 @@
|
||||
"processingPayment": "در حال پردازش...",
|
||||
"starsPaymentSuccess": "پرداخت موفق! نتیجه به تلگرام ارسال شد.",
|
||||
"starsPaymentFailed": "پرداخت ناموفق. دوباره تلاش کنید.",
|
||||
"starsPaymentRedirected": "تلگرام برای پرداخت باز میشود. پس از پرداخت صفحه را بازخوانی کنید.",
|
||||
"noHistory": "هنوز تاریخچهای نیست",
|
||||
"banner": {
|
||||
"title": "شانس خود را امتحان کنید!",
|
||||
|
||||
@@ -620,6 +620,7 @@
|
||||
"starsPaymentSuccess": "Оплата прошла! Результат спина отправлен в Telegram.",
|
||||
"starsPaymentSuccessCheckHistory": "Оплата прошла! Проверьте историю или Telegram для результата.",
|
||||
"starsPaymentFailed": "Ошибка оплаты. Попробуйте еще раз.",
|
||||
"starsPaymentRedirected": "Откроется Telegram для оплаты. После оплаты обновите страницу.",
|
||||
"youWon": "Вы выиграли",
|
||||
"noPrize": "В этот раз не повезло...",
|
||||
"noHistory": "История вращений пуста",
|
||||
|
||||
@@ -522,6 +522,7 @@
|
||||
"processingPayment": "处理中...",
|
||||
"starsPaymentSuccess": "支付成功!抽奖结果已发送到Telegram。",
|
||||
"starsPaymentFailed": "支付失败。请重试。",
|
||||
"starsPaymentRedirected": "将打开Telegram进行支付。支付后请刷新页面。",
|
||||
"noHistory": "暂无抽奖记录",
|
||||
"banner": {
|
||||
"title": "试试运气!",
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user