feat: add email settings with database overrides for admin and vendor

Platform Email Settings (Admin):
- Add GET/PUT/DELETE /admin/settings/email/* endpoints
- Settings stored in admin_settings table override .env values
- Support all providers: SMTP, SendGrid, Mailgun, Amazon SES
- Edit mode UI with provider-specific configuration forms
- Reset to .env defaults functionality
- Test email to verify configuration

Vendor Email Settings:
- Add VendorEmailSettings model with one-to-one vendor relationship
- Migration: v0a1b2c3d4e5_add_vendor_email_settings.py
- Service: vendor_email_settings_service.py with tier validation
- API endpoints: /vendor/email-settings/* (CRUD, status, verify)
- Email tab in vendor settings page with full configuration
- Warning banner until email is configured (like billing warnings)
- Premium providers (SendGrid, Mailgun, SES) tier-gated to Business+

Email Service Updates:
- get_platform_email_config(db) checks DB first, then .env
- Configurable provider classes accept config dict
- EmailService uses database-aware providers
- Vendor emails use vendor's own SMTP (Wizamart doesn't pay)
- "Powered by Wizamart" footer for Essential/Professional tiers
- White-label (no footer) for Business/Enterprise tiers

Other:
- Add scripts/install.py for first-time platform setup
- Add make install target
- Update init-prod to include email template seeding

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
2026-01-05 22:23:47 +01:00
parent ad28a8a9a3
commit 36603178c3
51 changed files with 4959 additions and 1141 deletions

123
TODO-VENDOR-SECTION Normal file
View File

@@ -0,0 +1,123 @@
> can you please do a 360 analysis for settings, what else is missing and should be editable / viewable by vendors to properly manage their operations and storefront
● Explore(Analyze vendor settings comprehensively)
 Done (38 tool uses · 66.4k tokens · 1m 18s)
● 360° Vendor Settings Analysis
Current Settings Page Structure
| Section | Status |
|---------------|------------------------------|
| General | ✅ Basic (subdomain, status) |
| Localization | ✅ Complete |
| Marketplace | ⚠️ Partial (only CSV URLs) |
| Notifications | ❌ Display-only placeholder |
---
What's Missing (by Priority)
Priority 1: Existing Data Not Exposed
| Category | Fields in DB | Current UI |
|------------------------|-----------------------------------------------------------------------|------------|
| Business Profile | name, description, contact_email, phone, website, address, tax_number | ❌ None |
| Letzshop Feed Settings | default_tax_rate, boost_sort, delivery_method, preorder_days | ❌ None |
| Letzshop Sync Settings | auto_sync, sync_interval, test_mode, carriers | ❌ None |
| Invoice Settings | company legal info, VAT, bank details, invoice numbering | ❌ None |
| Theme/Branding | colors, fonts, logos, layout, custom CSS, social links | ❌ None |
| Custom Domains | domain, SSL status, verification | ❌ None |
Priority 2: Needs Database Models
| Category | Description |
|----------------------|---------------------------------------------|
| Shipping/Fulfillment | Zones, rates, carriers, return policies |
| Order Preferences | Auto-confirm, auto-ship, order numbering |
| SEO/Marketing | Google Analytics, Meta Pixel, schema markup |
| Legal/Compliance | Terms, Privacy, GDPR, cookie consent |
| Security | 2FA, API key rotation, IP whitelist |
---
Proposed Settings Page Restructure
Settings
├── General
│ ├── Store Name & Description
│ ├── Subdomain
│ └── Store Status (view only)
├── Business Info
│ ├── Contact Email, Phone
│ ├── Website
│ ├── Business Address
│ └── Tax Number
├── Localization ✅ (done)
│ ├── Currency (view only)
│ ├── Number Format (locale)
│ ├── Dashboard Language
│ ├── Content Language
│ └── Storefront Languages
├── Invoice & Billing
│ ├── Company Legal Name & Address
│ ├── VAT Registration
│ ├── Bank Details (IBAN, BIC)
│ ├── Invoice Numbering
│ └── Payment Terms
├── Branding & Theme
│ ├── Logo Upload (light/dark)
│ ├── Favicon & Banner
│ ├── Color Scheme
│ ├── Font Selection
│ ├── Layout Style
│ └── Social Links
├── Letzshop Integration
│ ├── CSV Feed URLs ✅
│ ├── Feed Settings (tax, delivery, preorder)
│ ├── API Credentials
│ ├── Sync Settings (auto, interval, test mode)
│ └── Carrier Configuration
├── Domains
│ ├── Custom Domain Setup
│ ├── SSL Status
│ └── Verification
├── Notifications
│ ├── Email Notifications
│ ├── Order Alerts
│ └── Marketing Emails
└── Security (future)
├── API Keys
├── Two-Factor Auth
└── Session Management
---
Quick Wins (Can Add Now)
1. Business Info section - Fields exist in Vendor model, just need UI
2. Invoice Settings section - VendorInvoiceSettings model exists
3. Letzshop Feed Settings - Fields exist: letzshop_default_tax_rate, letzshop_delivery_method, etc.
4. Theme/Branding - VendorTheme model exists with colors, fonts, logos
---
Would you like me to implement any of these sections? I'd suggest starting with:
1. Business Info (quick, uses existing fields)
2. Invoice Settings (model exists, high business value)
3. Letzshop Feed Settings (completes marketplace section)
-------->
> let's tackle all of that this seems great. a few comments from my side:
1/ vendor business details should be the one at company level unless overriden (please have a look at current architecture)
2/ email templates is a complex feature because it has to be similar to what we have done at CMS level: admin will have some platform default ones (in multiple languages) and the vendor can override them (but not create any new ones cause it
won't be supported unlike CMS pages where he can create pretty much anything - btw let s make a note that number of pages should be defined in tiers)
3/ custom domain setup: admin should be contacted to setup. same for SSL. custom emails. (this should be readonly for now)
4/ API keys: stripe keys should be there
5/ sections in settings page are not displayed properly: general , localization etc take 2/3 of the screen size