PHP WebShell
Текущая директория: /var/www/bitcardoApp/user/crypto
Просмотр файла: buy_confirm.php
<?php
// user/crypto/buy_confirm.php
include '../common/header.php';
?>
<div class="container mt-3">
<div class="row">
<?php include '../common/nav.php'; ?>
<main class="col-md-9 col-lg-10 px-md-5 mb-5">
<?php include '../common/page-header.php'; ?>
<div class="row justify-content-center">
<div class="col-md-8 col-lg-7">
<div class="card shadow-sm border-0">
<div class="card-body p-4">
<h5 class="fw-bold mb-1">Purchase Confirmation</h5>
<div class="text-muted small mb-3">Your payment has been received. Details below.</div>
<div id="confirmAlert"></div>
<div class="bg-light rounded-3 p-3">
<div class="d-flex justify-content-between">
<div class="text-muted">Status</div>
<div class="fw-bold" id="c_status">—</div>
</div>
<div class="d-flex justify-content-between mt-2">
<div class="text-muted">Reference</div>
<div class="fw-semibold text-break" id="c_ref">—</div>
</div>
<hr class="my-2">
<div class="d-flex justify-content-between mt-2 d-none">
<div class="text-muted">Wallet</div>
<div class="fw-semibold text-break" id="c_wallet">—</div>
</div>
<div class="d-flex justify-content-between mt-2">
<div class="text-muted">Receiver Address</div>
<div class="fw-semibold text-break" id="c_receiver">—</div>
</div>
<hr class="my-2">
<div class="d-flex justify-content-between mt-2">
<div class="text-muted">Amount (USD)</div>
<div class="fw-semibold" id="c_usd">—</div>
</div>
<div class="d-flex justify-content-between mt-2">
<div class="text-muted">Estimated Cost (NGN)</div>
<div class="fw-semibold" id="c_net">—</div>
</div>
<div class="d-flex justify-content-between mt-2">
<div class="text-muted">Payment Gateway Fees</div>
<div class="fw-semibold" id="c_fee">—</div>
</div>
<div class="d-flex justify-content-between mt-2">
<div class="text-muted">Amount Paid (NGN)</div>
<div class="fw-bold" id="c_paid">—</div>
</div>
<hr class="my-2">
<div class="d-flex justify-content-between mt-2">
<div class="text-muted">Expected Crypto</div>
<div class="fw-bold" id="c_crypto">—</div>
</div>
</div>
<div class="mt-3 d-flex gap-2">
<a href="/user/crypto/buy.php" class="btn btn-light">Buy Again</a>
<a href="/user/dashboard/index.php" class="btn btn-primary">Back to Dashboard</a>
</div>
</div>
</div>
</div>
</div>
</main>
</div>
</div>
<script>
(function(){
const params = new URLSearchParams(window.location.search);
const ref = params.get('reference');
const alertBox = document.getElementById('confirmAlert');
function showAlert(type, msg){
alertBox.innerHTML = `<div class="alert alert-${type} text-break">${String(msg).replace(/</g,'<').replace(/>/g,'>')}</div>`;
}
function moneyNGN(n){
return '₦' + Number(n).toLocaleString(undefined, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
}
if (!ref) {
showAlert('danger', 'Missing reference.');
return;
}
document.getElementById('c_ref').textContent = ref;
fetch('/models/crypto/buy_crypto.php?action=verify_paystack&reference=' + encodeURIComponent(ref) + '&ts=' + Date.now(), {
credentials: 'include'
})
.then(r => r.json())
.then(data => {
if (!data.ok) {
showAlert('danger', data.msg || 'Verification failed.');
return;
}
const st = (data.status || '—').toUpperCase();
document.getElementById('c_status').textContent = st;
if (data.msg) showAlert('success', data.msg);
const d = data.details || {};
const coin = d.coin || '';
const wallet_id = d.wallet_id || '';
const receiver = d.receiver_address || '';
document.getElementById('c_wallet').textContent = wallet_id ? (wallet_id + (coin ? (' ('+coin+')') : '')) : '—';
document.getElementById('c_receiver').textContent = receiver || '—';
if (d.amount_usd != null) document.getElementById('c_usd').textContent = '$' + Number(d.amount_usd).toFixed(2);
if (d.ngn_cost_net != null) document.getElementById('c_net').textContent = moneyNGN(d.ngn_cost_net);
if (d.gateway_fee_ngn != null) document.getElementById('c_fee').textContent = moneyNGN(d.gateway_fee_ngn);
if (d.total_payable_ngn != null) document.getElementById('c_paid').textContent = moneyNGN(d.total_payable_ngn);
if (d.coin_qty != null && coin) {
document.getElementById('c_crypto').textContent = Number(d.coin_qty).toLocaleString(undefined, { maximumFractionDigits: 10 }) + ' ' + coin;
} else {
document.getElementById('c_crypto').textContent = '—';
}
})
.catch(() => showAlert('danger', 'Verification failed.'));
})();
</script>
<?php include '../common/footer.php'; ?>
Выполнить команду
Для локальной разработки. Не используйте в интернете!