mirror of
https://github.com/yusufipk/RepoHub.git
synced 2026-09-11 10:36:07 +00:00
feat: expand cryptocurrency options and streamline payment flow
- Added support for 16 cryptocurrencies including Bitcoin, Ethereum, Monero, and popular stablecoins - Removed email field from payment form as notifications are configured in merchant settings - Organized crypto options by category (popular, stablecoins, other) for better UX
This commit is contained in:
@@ -60,6 +60,7 @@ export async function POST(request: NextRequest) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Prepare data for Cryptomus
|
// Prepare data for Cryptomus
|
||||||
|
// Note: Email notifications are configured in merchant account settings, not in API
|
||||||
const paymentData = {
|
const paymentData = {
|
||||||
merchant_id: MERCHANT_ID,
|
merchant_id: MERCHANT_ID,
|
||||||
amount: body.amount.toString(),
|
amount: body.amount.toString(),
|
||||||
@@ -68,7 +69,6 @@ export async function POST(request: NextRequest) {
|
|||||||
description: body.description,
|
description: body.description,
|
||||||
url_callback: `${process.env.NEXTAUTH_URL || 'http://localhost:3002'}/api/support/webhook`,
|
url_callback: `${process.env.NEXTAUTH_URL || 'http://localhost:3002'}/api/support/webhook`,
|
||||||
url_success: `${process.env.NEXTAUTH_URL || 'http://localhost:3002'}/support/success`,
|
url_success: `${process.env.NEXTAUTH_URL || 'http://localhost:3002'}/support/success`,
|
||||||
email: body.email || undefined,
|
|
||||||
lifetime: 3600, // 1 hour
|
lifetime: 3600, // 1 hour
|
||||||
is_payment_multiple: false
|
is_payment_multiple: false
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,18 +17,32 @@ interface SupportModalProps {
|
|||||||
export function SupportModal({ isOpen, onClose }: SupportModalProps) {
|
export function SupportModal({ isOpen, onClose }: SupportModalProps) {
|
||||||
const [amount, setAmount] = useState('')
|
const [amount, setAmount] = useState('')
|
||||||
const [currency, setCurrency] = useState('USDT')
|
const [currency, setCurrency] = useState('USDT')
|
||||||
const [email, setEmail] = useState('')
|
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const [error, setError] = useState('')
|
const [error, setError] = useState('')
|
||||||
const { t } = useLocale()
|
const { t } = useLocale()
|
||||||
|
|
||||||
const cryptoOptions = [
|
const cryptoOptions = [
|
||||||
{ value: 'USDT', label: 'USDT (TRC20)', network: 'TRC20' },
|
// Popular cryptocurrencies
|
||||||
{ value: 'USDC', label: 'USDC (TRC20)', network: 'TRC20' },
|
{ value: 'BTC', label: 'Bitcoin (BTC)', network: 'BTC' },
|
||||||
{ value: 'BTC', label: 'Bitcoin', network: 'BTC' },
|
{ value: 'ETH', label: 'Ethereum (ETH)', network: 'ETH' },
|
||||||
{ value: 'ETH', label: 'Ethereum', network: 'ETH' },
|
{ value: 'XMR', label: 'Monero (XMR)', network: 'XMR' },
|
||||||
{ value: 'LTC', label: 'Litecoin', network: 'LTC' },
|
{ value: 'SOL', label: 'Solana (SOL)', network: 'SOL' },
|
||||||
{ value: 'TRX', label: 'TRON', network: 'TRC20' }
|
{ value: 'BNB', label: 'Binance Coin (BNB)', network: 'BSC' },
|
||||||
|
|
||||||
|
// Stablecoins
|
||||||
|
{ value: 'USDT', label: 'Tether (USDT)', network: 'TRC20' },
|
||||||
|
{ value: 'USDC', label: 'USD Coin (USDC)', network: 'ETH' },
|
||||||
|
{ value: 'BUSD', label: 'Binance USD (BUSD)', network: 'BSC' },
|
||||||
|
|
||||||
|
// Other cryptocurrencies
|
||||||
|
{ value: 'LTC', label: 'Litecoin (LTC)', network: 'LTC' },
|
||||||
|
{ value: 'TRX', label: 'TRON (TRX)', network: 'TRC20' },
|
||||||
|
{ value: 'AVAX', label: 'Avalanche (AVAX)', network: 'Avalanche' },
|
||||||
|
{ value: 'MATIC', label: 'Polygon (MATIC)', network: 'Polygon' },
|
||||||
|
{ value: 'BCH', label: 'Bitcoin Cash (BCH)', network: 'BCH' },
|
||||||
|
{ value: 'DASH', label: 'Dash (DASH)', network: 'DASH' },
|
||||||
|
{ value: 'DOGE', label: 'Dogecoin (DOGE)', network: 'DOGE' },
|
||||||
|
{ value: 'SHIB', label: 'Shiba Inu (SHIB)', network: 'ETH' }
|
||||||
]
|
]
|
||||||
|
|
||||||
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
const handleSubmit = async (e: React.FormEvent<HTMLFormElement>) => {
|
||||||
@@ -46,8 +60,7 @@ export function SupportModal({ isOpen, onClose }: SupportModalProps) {
|
|||||||
amount: parseFloat(amount),
|
amount: parseFloat(amount),
|
||||||
currency,
|
currency,
|
||||||
order_id: `support_${Date.now()}`,
|
order_id: `support_${Date.now()}`,
|
||||||
description: t('support.description'),
|
description: t('support.description')
|
||||||
email: email || undefined
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -71,7 +84,6 @@ export function SupportModal({ isOpen, onClose }: SupportModalProps) {
|
|||||||
const resetForm = () => {
|
const resetForm = () => {
|
||||||
setAmount('')
|
setAmount('')
|
||||||
setCurrency('USDT')
|
setCurrency('USDT')
|
||||||
setEmail('')
|
|
||||||
setError('')
|
setError('')
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,17 +146,6 @@ export function SupportModal({ isOpen, onClose }: SupportModalProps) {
|
|||||||
</Select>
|
</Select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="space-y-2">
|
|
||||||
<Label htmlFor="email">{t('support.email_optional')}</Label>
|
|
||||||
<Input
|
|
||||||
id="email"
|
|
||||||
type="email"
|
|
||||||
placeholder="[email protected]"
|
|
||||||
value={email}
|
|
||||||
onChange={(e: React.ChangeEvent<HTMLInputElement>) => setEmail(e.target.value)}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{error && (
|
{error && (
|
||||||
<div className="flex items-center space-x-2 text-red-600 bg-red-50 p-3 rounded-lg">
|
<div className="flex items-center space-x-2 text-red-600 bg-red-50 p-3 rounded-lg">
|
||||||
<AlertCircle className="h-4 w-4" />
|
<AlertCircle className="h-4 w-4" />
|
||||||
|
|||||||
Reference in New Issue
Block a user