This web application provides a fully integrated vehicle finance pre-approval workflow that communicates directly with the bank (WesBank API), handles all customer interactions securely, and transmits approved applicant data to Salesforce CRM for follow-up and lead management.
It’s a two-step customer interaction flow:
| Step | Description | Files / Components Involved |
|---|---|---|
| 1. User Form Submission | Customer completes the pre-approval form with ID, income, and vehicle details. | index.php |
| 2. Spinner UX / Submission | Upon submission, spinner overlay activates (loadingOverlay) until response is received. |
index.php, inline JS |
| 3. API Authentication | System authenticates with WesBank API using secure credentials (username, password, x-api-key). |
preapprove.php |
| 4. Bank Response Handling | Response data (approval result, affordability, rates, etc.) parsed and displayed. | preapprove.php |
| 5. PDF & Session Stash | Pre-approval summary and financial data stored in $_SESSION for later retrieval, and PDF export available. |
preapprove.php, pdf_export.php |
| 6. Vehicle Recommendations | If the “affordable amount” is returned, relevant vehicles under that threshold are displayed dynamically. | js/recommendations.render.js |
| 7. CRM Submission (on demand) | When the user clicks “Contact Me”, data is sent to Salesforce via AJAX. | crm_submit.php |
| 8. Confirmation Modal | Modal window assures user that the dealership will call back soon. | Bootstrap Modal |
| 9. Salesforce Integration | System uses Web-to-Lead or REST API submission, configurable in config.php. |
crm_submit.php |
| 10. Error Tolerance | Even if CRM/API calls fail, lead data is preserved in session/log for manual recovery. | crm_submit.php |
Frontend
loadingOverlay.show), Bootstrap modals for success confirmation, responsive vehicle cards & accordions, AJAX integration for CRM callsBackend
$_POST payload validated and sanitized; bank response ($pre, $fin, $grid) mapped to PHP arrays; Session variables ($_SESSION['crm_lead']) store CRM-ready payload$_SESSION['csrf_token']); no direct API credentials exposed client-side; HTTPS recommended for all production deploymentsAPI Integrations
a) Bank API
Authorization: Basic base64(username:password), x-api-key: [Bank Key]b) Salesforce CRM
config.php):
oid + retURL to post form data directly.Lead).first_name, last_name, email, phone, lead_source, description. Description field aggregates pre-approval summary (affordability, rates, MM code, etc.). Optional custom fields can be mapped via SF Field IDs (Web-to-Lead) or API names (REST).User → index.php → preapprove.php → WesBank API
↓
Response stored in $_SESSION
↓
User clicks “Contact Me”
↓
AJAX → crm_submit.php → Salesforce CRM
↓
Modal confirms success
$affordableAmount > 0, system dynamically filters vehicles from the recommendations JS array. Only vehicles ≤ affordable amount are displayed."Invalid authentication credentials" with logged response (in dev mode).$_SESSION['crm_lead'] until session expiry.php.ini or via cookies.| Layer | Mechanism |
|---|---|
| Transmission | HTTPS required (SSL) |
| API Keys | Stored server-side only in config.php |
| CSRF | Random 16-byte session token validated in AJAX |
| PII Handling | Session-based, cleared post-submission |
| Error Logging | Optional APP_DEBUG mode for developer trace |
| Salesforce Lead Source | Labeled as Website Pre-Approval for CRM tracking |
| Layer | Technology |
|---|---|
| Frontend | HTML5, CSS3, Bootstrap 5, Vanilla JS |
| Backend | PHP 8+, Apache (XAMPP or Linux/Ubuntu) |
| Database | (Optional) Session-based storage, MySQL-ready |
| APIs | WesBank API + Salesforce Web-to-Lead / REST |
| Reporting | PDF export via ReportLab (PHP) |
| Hosting | Compatible with any PHP 8+ hosting / cPanel / VPS |
recommendations.render.js can pull from a JSON feed or API for automatic updates.The user submits the pre-approval → preapprove.php handles API call and renders results. They click Contact me → modal opens, AJAX calls crm_submit.php. crm_submit.php retrieves stored session data and submits to Salesforce. Modal confirms success / fallback message. Even on API failure, data remains recoverable in the PHP session for manual follow-up.
It’s written for internal reference (developers, CRM managers, IT stakeholders, and Stellantis management) — not customers. You can drop this into your Exutate internal wiki, dealer documentation, or PDF pack.
We provide recommended vehicles within your affordable amount and a consultant will assist with stock availability, trade-in, insurance, and delivery arrangements.