File size: 2,190 Bytes
38738e2
b7d6890
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38738e2
b7d6890
 
 
38738e2
b7d6890
38738e2
 
b7d6890
 
 
 
 
 
 
 
 
 
38738e2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

document.addEventListener('DOMContentLoaded', function() {
    // Get URL parameters
    const urlParams = new URLSearchParams(window.location.search);
    const amount = urlParams.get('amount');
    const currency = urlParams.get('currency');
    
    // DOM Elements
    const sendAmountEl = document.getElementById('sendAmount');
    const sendCurrencyEl = document.getElementById('sendCurrency');
    const receiveAmountEl = document.getElementById('receiveAmount');
    const receiveCurrencyEl = document.getElementById('receiveCurrency');
    const summaryAmountEl = document.getElementById('summaryAmount');
    const summaryCurrencyEl = document.getElementById('summaryCurrency');
    const exchangeRateEl = document.getElementById('exchangeRate');
    const totalReceiveEl = document.getElementById('totalReceive');
    const confirmPaymentBtn = document.getElementById('confirmPayment');
    
    // Display the transaction details
    if (amount && currency) {
        // For demo purposes, we'll use a fixed exchange rate
        // In a real application, you would fetch this from an API
        const exchangeRates = {
            'USDT': 1.00,
            'BNB': 300.00,
            'BTC': 45000.00,
            'SOL': 100.00
        };
        
        const rate = exchangeRates[currency] || 1.00;
        const receiveAmount = (amount / rate).toFixed(6);
        
        // Update UI
        sendAmountEl.textContent = `${amount}`;
        sendCurrencyEl.textContent = currency;
        receiveAmountEl.textContent = `${receiveAmount}`;
        receiveCurrencyEl.textContent = currency;
        summaryAmountEl.textContent = `${amount}`;
        summaryCurrencyEl.textContent = currency;
        exchangeRateEl.textContent = `1 ${currency} = ${rate.toFixed(2)} USD`;
        totalReceiveEl.textContent = `${amount}`;
    }
    
    // Confirm payment button
    confirmPaymentBtn.addEventListener('click', function() {
        // Show confirmation message
        alert('Payment confirmed! In a real application, this would process the transaction.');
        
        // Redirect to success page or back to home
        window.location.href = 'index.html';
    });
});