9 Commits

Author SHA1 Message Date
Matt
039ddc0fa8 Fix admin email to display correct payment amount
All checks were successful
Build and Push Docker Images / docker (push) Successful in 2m18s
- Admin notification was showing 6 instead of 600
- Root cause: double cents-to-dollars conversion
- webhooks.js already converts to dollars before calling sendAdminNotification
- Updated sendAdminNotification to handle pre-converted dollar amounts
- Simplified formatting logic for clarity

server/utils/emailService.js:155-162
2025-11-03 13:47:03 +01:00
Matt
0b66378423 Update admin email to matt@puffinoffset.com
All checks were successful
Build and Push Docker Images / docker (push) Successful in 58s
- Update default admin email from admin@ to matt@puffinoffset.com
- Add ADMIN_EMAIL environment variable to docker-compose.yml
- Add complete Email Configuration section to .env.example
- Admin email receives contact form submissions and order notifications

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 21:01:57 +01:00
Matt
977ecb6d38 Fix confirmation email display issues
All checks were successful
Build and Push Docker Images / docker (push) Successful in 1m5s
- Remove escaped dollar signs in currency displays
- Fix percentage calculations (multiply decimal by 100)
- Force white text color on mobile for "Your Impact" header
- Add comma formatting to currency values (16343.46 → 16,343.46)
- Update portfolioColors.js to properly convert Wren API decimal percentages

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 20:53:04 +01:00
Matt
7bdd462be9 Implement comprehensive email templates with SMTP integration
Some checks failed
Build and Push Docker Images / docker (push) Has been cancelled
- Add beautiful HTML email templates for receipts, admin notifications, and contact forms
- Implement SMTP email service with Nodemailer and Handlebars templating
- Add carbon equivalency calculations with EPA/DEFRA/IMO 2024 conversion factors
- Add portfolio color palette system for project visualization
- Integrate Wren API portfolio fetching in webhook handler
- Add light mode enforcement for email client compatibility
- Include Puffin logo from MinIO S3 in all templates
- Add test email endpoint for template validation

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 20:09:31 +01:00
Matt
6787ccd2d8 Add portfolio distribution chart to receipt and update ID display
All checks were successful
Build and Push Docker Images / docker (push) Successful in 49s
Backend:
- Add getWrenPortfolios() to wrenClient.js with detailed logging including certification status
- Modify checkout endpoint to fetch and include portfolio data in order response
- Add stripeSessionId to order response for Payment ID display

Frontend:
- Create new StaticPortfolioPieChart component for printable receipt
- Add portfolio distribution visualization to CheckoutSuccess page
- Update receipt to show Payment ID (Stripe) and Offsetting Order ID (Wren)
- Implement responsive grid layout for order IDs
- Add print-friendly styling with Tailwind print classes

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-31 17:24:51 +01:00
Matt
837411699f Fix Wren API request body to match official API specification
All checks were successful
Build and Push Docker Images / docker (push) Successful in 45s
Changed request parameters to match Wren API docs:
- 'portfolio' → 'portfolioId' (correct parameter name)
- 'dry_run' → 'dryRun' (camelCase as per API)
- Removed 'currency' and 'amount_charged' (API calculates amount)
- Removed 'source' object (not in API spec)
- Added 'note' with customer email for record keeping

API will now calculate and return the amount charged based on tons and portfolio.
Reference: https://www.wren.co/api/offset-orders documentation
2025-10-31 12:58:48 +01:00
Matt
a6e655c4a9 Fix Wren API endpoint URL
All checks were successful
Build and Push Docker Images / docker (push) Successful in 47s
Changed from non-existent api.wren.co to correct www.wren.co
Changed endpoint path from offset_orders to offset-orders (hyphen not underscore)

Correct endpoints:
- POST https://www.wren.co/api/offset-orders
- GET https://www.wren.co/api/offset-orders/:id
2025-10-31 12:55:45 +01:00
Matt
569cf84cde Add comprehensive server-side logging for Wren API calls
All checks were successful
Build and Push Docker Images / docker (push) Successful in 49s
- Added detailed request/response logging for createWrenOffsetOrder
- Added detailed request/response logging for getWrenOffsetOrder
- Logs include timestamp, duration, status, parameters, and full responses
- API token is masked for security (shows first 8 and last 4 chars)
- Logs will appear in Docker container logs with [WREN API SERVER] prefix
- Makes it easier to track and debug Wren API calls from webhooks
2025-10-30 16:40:27 +01:00
Matt
06733cb2cb Integrate Stripe Checkout and add comprehensive UI enhancements
All checks were successful
Build and Push Docker Image / docker (push) Successful in 42s
## Stripe Payment Integration
- Add Express.js backend server with Stripe Checkout Sessions
- Create SQLite database for order tracking
- Implement Stripe webhook handlers for payment events
- Integrate with Wren Climate API for carbon offset fulfillment
- Add CheckoutSuccess and CheckoutCancel pages
- Create checkout API client for frontend
- Update OffsetOrder component to redirect to Stripe Checkout
- Add processing fee calculation (3% of base amount)
- Implement order status tracking (pending → paid → fulfilled)

Backend (server/):
- Express server with CORS and middleware
- SQLite database with Order schema
- Stripe configuration and client
- Order CRUD operations model
- Checkout session creation endpoint
- Webhook handler for payment confirmation
- Wren API client for offset fulfillment

Frontend:
- CheckoutSuccess page with order details display
- CheckoutCancel page with retry encouragement
- Updated OffsetOrder to use Stripe checkout flow
- Added checkout routes to App.tsx
- TypeScript interfaces for checkout flow

## Visual & UX Enhancements
- Add CertificationBadge component for project verification status
- Create PortfolioDonutChart for visual portfolio allocation
- Implement RadialProgress for percentage displays
- Add reusable form components (FormInput, FormTextarea, FormSelect, FormFieldWrapper)
- Refactor OffsetOrder with improved layout and animations
- Add offset percentage slider with visual feedback
- Enhance MobileOffsetOrder with better responsive design
- Improve TripCalculator with cleaner UI structure
- Update CurrencySelect with better styling
- Add portfolio distribution visualization
- Enhance project cards with hover effects and animations
- Improve color palette and gradient usage throughout

## Configuration
- Add VITE_API_BASE_URL environment variable
- Create backend .env.example template
- Update frontend .env.example with API URL
- Add Stripe documentation references

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-29 21:45:14 +01:00