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