diff --git a/ospabhost/frontend/node_modules.zip b/ospabhost/frontend/node_modules.zip new file mode 100644 index 0000000..b793507 Binary files /dev/null and b/ospabhost/frontend/node_modules.zip differ diff --git a/ospabhost/frontend/src/pages/dashboard/billing.tsx b/ospabhost/frontend/src/pages/dashboard/billing.tsx index 2916524..02985ff 100644 --- a/ospabhost/frontend/src/pages/dashboard/billing.tsx +++ b/ospabhost/frontend/src/pages/dashboard/billing.tsx @@ -37,6 +37,7 @@ const Billing = () => { const [balance, setBalance] = useState(0); const [payments, setPayments] = useState([]); const [exchangeRate, setExchangeRate] = useState(95); + const [amount, setAmount] = useState('500'); // Default 500 RUB const [message, setMessage] = useState(''); const [messageType, setMessageType] = useState<'success' | 'error'>('success'); @@ -151,11 +152,29 @@ const Billing = () => { return; } + const amountInRub = parseFloat(amount); + if (isNaN(amountInRub) || amountInRub < 50) { + showMessage( + isEn ? 'Please enter amount at least 50 RUB' : 'Минимальная сумма 50 ₽', + 'error' + ); + return; + } + + const amountInUSDT = (amountInRub / exchangeRate).toFixed(2); + try { // Open DePay payment widget window.DePayWidgets.Payment({ integration: DEPAY_INTEGRATION_ID, + // Amount to pay in USDT + amount: { + token: 'USDT', + blockchain: 'polygon', + amount: amountInUSDT, + }, + // User identifier for callback user: { id: String(userData.user.id), @@ -303,6 +322,35 @@ const Billing = () => { + {/* Форма ввода суммы */} +
+ +
+ setAmount(e.target.value)} + min="50" + step="50" + className="w-full px-4 py-3 pr-20 rounded-xl border-2 border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 text-gray-900 dark:text-white focus:border-indigo-500 focus:ring-2 focus:ring-indigo-200 dark:focus:ring-indigo-800 transition-all text-lg font-semibold" + placeholder={isEn ? 'Enter amount' : 'Введите сумму'} + /> + + ₽ + +
+
+

+ {isEn ? 'Minimum: 50 RUB' : 'Минимум: 50 ₽'} +

+

+ ≈ {(parseFloat(amount || '0') / exchangeRate).toFixed(4)} USDT +

+
+
+ {/* Кнопка оплаты через DePay */}