58ca4e68db
- Go backend API with full CRUD for all modules (CRM, Sales, Finance, HR, Legal, Marketing, Support, Purchase, Inventory, Projects, Automation, Analytics) - Rust analytics service with parallel report generation - C runtime with POSIX shared memory IPC - PostgreSQL schema with 30+ tables, full migrations - Redis cache, sessions, pub/sub - Kafka event streaming with Zookeeper - WebSocket hub for real-time updates - Automation engine with cron jobs, workflows, event triggers - JWT authentication, multi-tenant from start - Docker Compose with all services - Nginx reverse proxy with rate limiting - Integration tests passing - Feature gap analysis against Fortnox/Odoo/Visma Refs: BOC-001
251 lines
8.0 KiB
HTML
251 lines
8.0 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="sv">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Betalning — quiXzoom Field Gear</title>
|
|
<script src="https://js.stripe.com/v3/"></script>
|
|
<style>
|
|
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
background: #0A0A1B;
|
|
color: #fff;
|
|
min-height: 100vh;
|
|
}
|
|
.header {
|
|
background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
|
|
padding: 1rem;
|
|
border-bottom: 1px solid rgba(255,255,255,0.1);
|
|
}
|
|
.header a {
|
|
color: #6366f1;
|
|
text-decoration: none;
|
|
}
|
|
.container {
|
|
max-width: 500px;
|
|
margin: 0 auto;
|
|
padding: 1rem;
|
|
}
|
|
.order-summary {
|
|
background: rgba(255,255,255,0.03);
|
|
border: 1px solid rgba(255,255,255,0.08);
|
|
border-radius: 12px;
|
|
padding: 1rem;
|
|
margin-bottom: 1.5rem;
|
|
}
|
|
.order-summary h2 {
|
|
font-size: 1.1rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
.order-item {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding: 0.5rem 0;
|
|
border-bottom: 1px solid rgba(255,255,255,0.05);
|
|
}
|
|
.order-total {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
padding-top: 1rem;
|
|
font-size: 1.2rem;
|
|
font-weight: 700;
|
|
color: #6366f1;
|
|
}
|
|
.payment-form {
|
|
background: rgba(255,255,255,0.03);
|
|
border: 1px solid rgba(255,255,255,0.08);
|
|
border-radius: 12px;
|
|
padding: 1rem;
|
|
}
|
|
.payment-form h2 {
|
|
font-size: 1.1rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
#card-element {
|
|
background: rgba(255,255,255,0.05);
|
|
border: 1px solid rgba(255,255,255,0.1);
|
|
border-radius: 8px;
|
|
padding: 1rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
#card-errors {
|
|
color: #ef4444;
|
|
font-size: 0.85rem;
|
|
margin-bottom: 1rem;
|
|
min-height: 1.5rem;
|
|
}
|
|
.pay-btn {
|
|
width: 100%;
|
|
background: #6366f1;
|
|
color: #fff;
|
|
border: none;
|
|
padding: 1rem;
|
|
border-radius: 8px;
|
|
font-size: 1rem;
|
|
font-weight: 600;
|
|
cursor: pointer;
|
|
transition: background 0.2s;
|
|
}
|
|
.pay-btn:hover {
|
|
background: #4f46e5;
|
|
}
|
|
.pay-btn:disabled {
|
|
background: rgba(255,255,255,0.1);
|
|
cursor: not-allowed;
|
|
}
|
|
.spinner {
|
|
display: inline-block;
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 2px solid rgba(255,255,255,0.3);
|
|
border-radius: 50%;
|
|
border-top-color: #fff;
|
|
animation: spin 1s ease-in-out infinite;
|
|
}
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
.success {
|
|
text-align: center;
|
|
padding: 2rem;
|
|
}
|
|
.success-icon {
|
|
font-size: 4rem;
|
|
margin-bottom: 1rem;
|
|
}
|
|
.success h2 {
|
|
font-size: 1.5rem;
|
|
margin-bottom: 0.5rem;
|
|
}
|
|
.success p {
|
|
color: rgba(255,255,255,0.6);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="header">
|
|
<a href="/">← Tillbaka till shoppen</a>
|
|
</div>
|
|
|
|
<div class="container">
|
|
<div id="checkout-content">
|
|
<div class="order-summary">
|
|
<h2>Din order</h2>
|
|
<div id="order-items"></div>
|
|
<div class="order-total">
|
|
<span>Totalt</span>
|
|
<span id="order-total">0 kr</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="payment-form">
|
|
<h2>Betalningsuppgifter</h2>
|
|
<div id="card-element"></div>
|
|
<div id="card-errors"></div>
|
|
<button class="pay-btn" id="pay-btn" onclick="submitPayment()">
|
|
Betala nu
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="success-message" class="success" style="display: none;">
|
|
<div class="success-icon">✅</div>
|
|
<h2>Betalning genomförd!</h2>
|
|
<p>Tack för din beställning. Du får en bekräftelse via e-post.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const orderId = urlParams.get('order_id');
|
|
let stripe, card, clientSecret;
|
|
|
|
async function init() {
|
|
const token = localStorage.getItem('quixzoom_token');
|
|
if (!token) {
|
|
alert('Logga in först');
|
|
window.location.href = '/';
|
|
return;
|
|
}
|
|
|
|
// Hämta orderdetaljer
|
|
const orderRes = await fetch(`/api/orders/${orderId}`, {
|
|
headers: { 'Authorization': `Bearer ${token}` }
|
|
});
|
|
if (!orderRes.ok) {
|
|
alert('Order hittades inte');
|
|
window.location.href = '/';
|
|
return;
|
|
}
|
|
const order = await orderRes.json();
|
|
|
|
// Visa order
|
|
const itemsDiv = document.getElementById('order-items');
|
|
order.items.forEach(item => {
|
|
itemsDiv.innerHTML += `
|
|
<div class="order-item">
|
|
<span>${item.name} x${item.quantity}</span>
|
|
<span>${(item.total/100).toFixed(0)} kr</span>
|
|
</div>
|
|
`;
|
|
});
|
|
document.getElementById('order-total').textContent = `${(order.total_amount/100).toFixed(0)} kr`;
|
|
|
|
// Skapa PaymentIntent
|
|
const intentRes = await fetch('/api/payment/create-intent', {
|
|
method: 'POST',
|
|
headers: {
|
|
'Authorization': `Bearer ${token}`,
|
|
'Content-Type': 'application/json'
|
|
},
|
|
body: JSON.stringify({ order_id: parseInt(orderId) })
|
|
});
|
|
const intentData = await intentRes.json();
|
|
|
|
// Initiera Stripe
|
|
stripe = Stripe(intentData.publishable_key);
|
|
const elements = stripe.elements();
|
|
card = elements.create('card', {
|
|
style: {
|
|
base: {
|
|
color: '#fff',
|
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif',
|
|
fontSize: '16px',
|
|
'::placeholder': { color: 'rgba(255,255,255,0.4)' }
|
|
}
|
|
}
|
|
});
|
|
card.mount('#card-element');
|
|
|
|
card.on('change', (event) => {
|
|
document.getElementById('card-errors').textContent = event.error ? event.error.message : '';
|
|
});
|
|
|
|
clientSecret = intentData.client_secret;
|
|
}
|
|
|
|
async function submitPayment() {
|
|
const btn = document.getElementById('pay-btn');
|
|
btn.disabled = true;
|
|
btn.innerHTML = '<span class="spinner"></span> Bearbetar...';
|
|
|
|
const { error, paymentIntent } = await stripe.confirmCardPayment(clientSecret, {
|
|
payment_method: { card: card }
|
|
});
|
|
|
|
if (error) {
|
|
document.getElementById('card-errors').textContent = error.message;
|
|
btn.disabled = false;
|
|
btn.textContent = 'Betala nu';
|
|
} else if (paymentIntent.status === 'succeeded') {
|
|
document.getElementById('checkout-content').style.display = 'none';
|
|
document.getElementById('success-message').style.display = 'block';
|
|
}
|
|
}
|
|
|
|
init();
|
|
</script>
|
|
</body>
|
|
</html>
|