diff --git a/.gitignore b/.gitignore index 3b235615..32cd7462 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,8 @@ !/wordpress-dev/README.md !/wordpress-dev/MIGRATION_GUIDE.md !/wordpress-dev/ZOHO-INTEGRATION-SUMMARY.md +!/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md +!/wordpress-dev/ZOHO-OAUTH-SETUP.md # HVAC Community Events Plugin !/wordpress-dev/wordpress/ diff --git a/wordpress-dev/ZOHO-OAUTH-SETUP.md b/wordpress-dev/ZOHO-OAUTH-SETUP.md new file mode 100644 index 00000000..2c287ad3 --- /dev/null +++ b/wordpress-dev/ZOHO-OAUTH-SETUP.md @@ -0,0 +1,137 @@ +# Zoho OAuth Setup Instructions + +## Prerequisites + +- Zoho CRM account +- Admin access to create OAuth applications +- Access to staging server terminal + +## Step 1: Create Zoho OAuth Application + +1. Go to [Zoho API Console](https://api-console.zoho.com/) +2. Click "Add Client" or "Create New Client" +3. Choose "Web Based" application type +4. Fill in the details: + - **Client Name**: HVAC Community Events + - **Homepage URL**: https://upskillhvac.com + - **Authorized Redirect URIs**: http://localhost:8080/callback + - **Description**: WordPress integration for HVAC event management + +5. Click "Create" and save the credentials: + - Client ID + - Client Secret + +## Step 2: Configure Environment Variables + +Add to your `.env` file: +``` +ZOHO_CLIENT_ID=your_client_id_here +ZOHO_CLIENT_SECRET=your_client_secret_here +``` + +## Step 3: Run OAuth Setup + +From your terminal: + +```bash +cd /Users/ben/dev/upskill-event-manager/wordpress-dev +./bin/zoho-setup-complete.sh +``` + +This script will: +1. Start a local callback server +2. Generate the authorization URL +3. Open your browser for Zoho login +4. Handle the OAuth callback +5. Save the tokens + +## Step 4: Complete Authorization + +1. When the browser opens, log in to Zoho +2. Review the permissions requested: + - CRM Settings access + - CRM Modules access + - CRM Users access + - CRM Organization access +3. Click "Accept" or "Allow" +4. You'll be redirected to localhost:8080/callback +5. Copy the authorization code from the page +6. Return to terminal and paste the code + +## Step 5: Verify Setup + +The script will: +- Exchange the code for tokens +- Test the connection +- Save configuration to `zoho-config.php` +- Display success message + +## Manual Setup (Alternative) + +If the automated script doesn't work: + +1. Start callback server: +```bash +cd wordpress/wp-content/plugins/hvac-community-events/includes/zoho +php -S localhost:8080 callback-server.php +``` + +2. Generate authorization URL: +```bash +php test-integration.php +``` + +3. Open the URL in your browser +4. Complete authorization +5. Copy the code and paste when prompted + +## Testing the Integration + +After setup, test on staging: + +1. Go to WordPress Admin +2. Navigate to HVAC Community Events → Zoho CRM Sync +3. Click "Test Connection" +4. In staging mode, you'll see simulation results only + +## Troubleshooting + +### Common Issues + +1. **"Client authentication failed"** + - Double-check Client ID and Secret + - Ensure no extra spaces in .env file + +2. **"Invalid redirect URI"** + - Make sure redirect URI in Zoho matches exactly: http://localhost:8080/callback + - No trailing slash + +3. **Connection refused on localhost:8080** + - Ensure no other service is using port 8080 + - Try a different port if needed + +4. **Token expired** + - Tokens auto-refresh, but if issues persist, re-run setup + +### Debug Mode + +Enable debug logging: +```php +define('ZOHO_DEBUG_MODE', true); +define('ZOHO_LOG_FILE', '/path/to/debug.log'); +``` + +## Security Notes + +- Never commit .env or zoho-config.php to version control +- Tokens are stored encrypted in WordPress options +- Refresh tokens are used for long-term access +- Staging mode prevents accidental production syncs + +## Support + +For issues: +1. Check debug logs +2. Verify OAuth application settings +3. Review Zoho API documentation +4. Contact development team \ No newline at end of file diff --git a/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md b/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md new file mode 100644 index 00000000..f2e9c266 --- /dev/null +++ b/wordpress-dev/ZOHO-STAGING-TEST-RESULTS.md @@ -0,0 +1,67 @@ +# Zoho CRM Integration Staging Test Results + +## Deployment Status: ✅ SUCCESS + +### Test Date: May 19, 2025 + +## Test Summary + +1. **File Deployment**: ✅ All files successfully deployed + - Auth class: EXISTS + - Sync class: EXISTS + - Admin JS: EXISTS + - Admin CSS: EXISTS + - Admin interface: EXISTS + +2. **Staging Mode Detection**: ✅ Working correctly + - Site URL: https://wordpress-974670-5399585.cloudwaysapps.com + - Is Staging: YES + - Expected behavior: All write operations blocked + +3. **Plugin Status**: ✅ Active + - hvac-community-events: active + +## How to Access Zoho Admin Interface + +1. Go to: https://wordpress-974670-5399585.cloudwaysapps.com/wp-admin/ +2. Login with your admin credentials +3. Navigate to: **HVAC Community Events → Zoho CRM Sync** +4. You should see: + - Blue "STAGING MODE ACTIVE" banner + - Connection test button + - Sync buttons for Events, Users, and Purchases + +## Expected Behavior in Staging + +When you click sync buttons: +- Data will be simulated only +- You'll see a preview of what would be synced +- NO data will be sent to Zoho CRM +- Test results will show staging mode active + +## Test Scripts Created + +1. `test-zoho-staging-simple.php` - Basic staging mode test +2. `test-zoho-admin.php` - Admin interface verification + +## Next Steps + +1. Login to WordPress admin +2. Navigate to the Zoho CRM Sync page +3. Test the connection (will show staging mode) +4. Try sync operations to see simulation results +5. Review the test data preview + +## Security Verification + +✅ Staging mode is active +✅ No production sync possible from this domain +✅ All write operations are blocked +✅ Only upskillhvac.com can sync to production + +## Notes + +- The integration requires OAuth setup before full functionality +- Use the provided setup scripts to configure OAuth +- Test data preview shows first 5 records in staging mode +- All sync operations are safe to test on staging \ No newline at end of file