Compare commits
No commits in common. "227d591e68f37cd60af205614d6b6941106e0fb0" and "68d81f8e1c35f79ee5bc81bfa25400630e15065d" have entirely different histories.
227d591e68
...
68d81f8e1c
|
|
@ -166,7 +166,7 @@ function validateCVV(cvv, cardType) {
|
|||
}
|
||||
|
||||
// ZIP code validation
|
||||
function validateZipCodeRegex(zipCode) {
|
||||
function validateZipCode(zipCode) {
|
||||
return /^\d{5}(-\d{4})?$/.test(zipCode);
|
||||
}
|
||||
|
||||
|
|
@ -450,7 +450,7 @@ async function validateStep(step) {
|
|||
|
||||
// ZIP code validation
|
||||
const zipCode = document.getElementById('card-zip').value;
|
||||
if (!validateZipCodeRegex(zipCode)) {
|
||||
if (!validateZipCode(zipCode)) {
|
||||
isValid = false;
|
||||
showError('Please enter a valid ZIP code', 'card-zip', step);
|
||||
return isValid;
|
||||
|
|
|
|||
|
|
@ -822,37 +822,18 @@
|
|||
const payoneerError = document.getElementById('payoneer-error');
|
||||
const value = input.value.trim();
|
||||
|
||||
// Remove any validation styling first
|
||||
input.style.border = '';
|
||||
payoneerError.style.display = 'none';
|
||||
|
||||
if (value.length > 0) {
|
||||
// Check length
|
||||
if (value.length < 5 || value.length > 20) {
|
||||
payoneerError.textContent = 'Payoneer account must be 5-20 digits';
|
||||
payoneerError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4444';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if contains only digits
|
||||
if (!/^\d+$/.test(value)) {
|
||||
payoneerError.textContent = 'Payoneer account must contain digits only';
|
||||
payoneerError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4444';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if all zeros
|
||||
if (/^0+$/.test(value)) {
|
||||
payoneerError.textContent = 'Payoneer account cannot be all zeros';
|
||||
payoneerError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4444';
|
||||
return false;
|
||||
}
|
||||
// Payoneer typically uses email format or alphanumeric IDs
|
||||
// Adjust validation rules based on Payoneer's actual format requirements
|
||||
if (value.length > 0 && (value.length < 5 || value.length > 20)) {
|
||||
payoneerError.textContent = 'Payoneer account must be 5-20 characters';
|
||||
payoneerError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4445';
|
||||
return false;
|
||||
} else {
|
||||
payoneerError.style.display = 'none';
|
||||
input.style.border = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Function to validate Veem account number
|
||||
|
|
@ -860,37 +841,17 @@
|
|||
const veemError = document.getElementById('veem-error');
|
||||
const value = input.value.trim();
|
||||
|
||||
// Remove any validation styling first
|
||||
input.style.border = '';
|
||||
veemError.style.display = 'none';
|
||||
|
||||
if (value.length > 0) {
|
||||
// Check length
|
||||
if (value.length < 8 || value.length > 25) {
|
||||
veemError.textContent = 'Veem account must be 8-25 digits';
|
||||
veemError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4444';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if contains only digits
|
||||
if (!/^\d+$/.test(value)) {
|
||||
veemError.textContent = 'Veem account must contain digits only';
|
||||
veemError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4444';
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if all zeros
|
||||
if (/^0+$/.test(value)) {
|
||||
veemError.textContent = 'Veem account cannot be all zeros';
|
||||
veemError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4444';
|
||||
return false;
|
||||
}
|
||||
// Veem account numbers are typically longer alphanumeric strings
|
||||
if (value.length > 0 && (value.length < 8 || value.length > 25)) {
|
||||
veemError.textContent = 'Veem account must be 8-25 characters';
|
||||
veemError.style.display = 'block';
|
||||
input.style.border = '1px solid #ef4445';
|
||||
return false;
|
||||
} else {
|
||||
veemError.style.display = 'none';
|
||||
input.style.border = '';
|
||||
return true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function showError(message, fieldId = null, step = null) {
|
||||
|
|
@ -962,17 +923,4 @@
|
|||
} else {
|
||||
option.style.display = "";
|
||||
}
|
||||
}
|
||||
|
||||
function validateSkypeId(input) {
|
||||
const value = input.value.trim();
|
||||
|
||||
if (value && !/^[a-zA-Z][a-zA-Z0-9\.,\-_]+$/.test(value)) {
|
||||
input.style.border = '1px solid #ef4444';
|
||||
showError('Skype ID must start with a letter and can only contain letters, numbers, dots, hyphens, and underscores', 'skype', 3);
|
||||
return false;
|
||||
} else {
|
||||
input.style.border = '';
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -42,54 +42,54 @@ async function closePreviousSession(vaId, lastLog) {
|
|||
});
|
||||
|
||||
// console.log(`Created logout log: ${logoutLog._id}`);
|
||||
try {
|
||||
const salesforceUrl = `${process.env.SF_DOCTRACKER_API_URL}services/apexrest/docva/api/va-project-log`;
|
||||
const sfDataSync = {
|
||||
"_id": logoutLog._id,
|
||||
"loggedType": "LOGOUT",
|
||||
"vaId": vaId,
|
||||
"vaEmail": lastLog.vaEmail,
|
||||
"projectId": lastLog.projectId,
|
||||
"time": logoutLog.time,
|
||||
}
|
||||
// try {
|
||||
// const salesforceUrl = `${process.env.SF_DOCTRACKER_API_URL}services/apexrest/docva/api/va-project-log`;
|
||||
// const sfDataSync = {
|
||||
// "_id": logoutLog._id,
|
||||
// "loggedType": "LOGOUT",
|
||||
// "vaId": vaId,
|
||||
// "vaEmail": lastLog.vaEmail,
|
||||
// "projectId": lastLog.projectId,
|
||||
// "time": logoutLog.time,
|
||||
// }
|
||||
|
||||
const response = await fetch(salesforceUrl, {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
// Add any required headers for Salesforce authentication
|
||||
// 'Authorization': 'Bearer ' + process.env.SF_ACCESS_TOKEN
|
||||
},
|
||||
body: JSON.stringify(sfDataSync)
|
||||
});
|
||||
// const response = await fetch(salesforceUrl, {
|
||||
// method: 'POST',
|
||||
// headers: {
|
||||
// 'Content-Type': 'application/json',
|
||||
// // Add any required headers for Salesforce authentication
|
||||
// // 'Authorization': 'Bearer ' + process.env.SF_ACCESS_TOKEN
|
||||
// },
|
||||
// body: JSON.stringify(sfDataSync)
|
||||
// });
|
||||
|
||||
if (!response.ok) {
|
||||
const errorText = await response.text();
|
||||
throw new Error(`Salesforce API responded with status ${response.status}: ${errorText}`);
|
||||
}
|
||||
// if (!response.ok) {
|
||||
// const errorText = await response.text();
|
||||
// throw new Error(`Salesforce API responded with status ${response.status}: ${errorText}`);
|
||||
// }
|
||||
|
||||
const result = await response.json();
|
||||
// console.log("✅ Successfully synced VA data to Salesforce:", result);
|
||||
// const result = await response.json();
|
||||
// // console.log("✅ Successfully synced VA data to Salesforce:", result);
|
||||
|
||||
return {
|
||||
closedWorkTracks: openWorkTracks.length,
|
||||
logoutLogId: logoutLog._id,
|
||||
SyncSalesforce: result
|
||||
};
|
||||
} catch (error) {
|
||||
console.error("Failed to sync with Salesforce:", error.message);
|
||||
console.log(error)
|
||||
|
||||
// Create a custom error to distinguish Salesforce errors
|
||||
const salesforceError = new Error(`Salesforce sync failed: ${error.message}`);
|
||||
salesforceError.isSalesforceError = true;
|
||||
throw salesforceError;
|
||||
}
|
||||
|
||||
// return {
|
||||
// return {
|
||||
// closedWorkTracks: openWorkTracks.length,
|
||||
// logoutLogId: logoutLog._id,
|
||||
// SyncSalesforce: result
|
||||
// };
|
||||
// } catch (error) {
|
||||
// console.error("Failed to sync with Salesforce:", error.message);
|
||||
// console.log(error)
|
||||
|
||||
// // Create a custom error to distinguish Salesforce errors
|
||||
// const salesforceError = new Error(`Salesforce sync failed: ${error.message}`);
|
||||
// salesforceError.isSalesforceError = true;
|
||||
// throw salesforceError;
|
||||
// }
|
||||
|
||||
return {
|
||||
closedWorkTracks: openWorkTracks.length,
|
||||
logoutLogId: logoutLog._id,
|
||||
};
|
||||
|
||||
} catch (error) {
|
||||
console.error("Error closing previous session:", error);
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ app.get('/varegister/:sf_token?', (req, res) => {
|
|||
const { sf_token } = req.params;
|
||||
|
||||
try {
|
||||
const decoded = jwt.verify(sf_token, process.env.JWT_SECRET_SF_TOKEN);
|
||||
// const decoded = jwt.verify(sf_token, process.env.JWT_SECRET_SF_TOKEN);
|
||||
|
||||
if (decoded) {
|
||||
const email = decoded.email;
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<div class="input-container">
|
||||
<input type="text" id="skype" class="input-field" placeholder=" " oninput="validateSkypeId(this)">
|
||||
<input type="text" id="skype" class="input-field" placeholder=" ">
|
||||
<label for="skype" class="input-label">Skype ID</label>
|
||||
</div>
|
||||
</div>
|
||||
|
|
@ -334,7 +334,7 @@
|
|||
<div id="payoneer-details" class="payment-details">
|
||||
<div class="form-group">
|
||||
<div class="input-container">
|
||||
<input type="text" id="payoneerAccount" class="input-field" placeholder=" " minlength="5" maxlength="20" oninput="validatePayoneerAccount(this)" onkeypress="return event.charCode >= 48 && event.charCode <= 57" required>
|
||||
<input type="text" id="payoneerAccount" class="input-field" placeholder=" " minlength="5" maxlength="20" oninput="validatePayoneerAccount(this)" required>
|
||||
<label for="payoneerAccount" class="input-label">Payoneer Account Number *</label>
|
||||
</div>
|
||||
<div class="invalid-feedback" id="payoneer-error" style="display: none; color: #dc3545; font-size: 12px; margin-top: 5px;">
|
||||
|
|
@ -350,7 +350,7 @@
|
|||
<div id="veem-details" class="payment-details">
|
||||
<div class="form-group">
|
||||
<div class="input-container">
|
||||
<input type="text" id="veemAccount" class="input-field" placeholder=" " minlength="8" maxlength="25" oninput="validateVeemAccount(this)" onkeypress="return event.charCode >= 48 && event.charCode <= 57" required>
|
||||
<input type="text" id="veemAccount" class="input-field" placeholder=" " minlength="8" maxlength="25" oninput="validateVeemAccount(this)" required>
|
||||
<label for="veemAccount" class="input-label">Veem Account Number *</label>
|
||||
</div>
|
||||
<div class="invalid-feedback" id="veem-error" style="display: none; color: #dc3545; font-size: 12px; margin-top: 5px;">
|
||||
|
|
|
|||
Loading…
Reference in New Issue