Code pilot backend impl 20260415 124505 - #35
Merged
Conversation
…rve) - Add ratesService.js: fetches BOI average mortgage rates via their public API, parses track data (fixed/קלצ, CPI/צמוד, prime/פריים, variable/משתנה), stores in Firestore `mortgage_rates` collection with 1-hour in-memory cache - Add ratesController.js + routes/rates.js: public GET /api/v1/public/rates/latest endpoint with rate limiting (30 req/15min/IP) - Add node-cron daily job (02:00 IST) to refresh rates automatically - Add comprehensive test suite for ratesService - Update collections.js with MORTGAGE_RATES collection + document factory - Update firestore.indexes.json with date DESC index - Update initCollections.js with mortgage_rates sentinel - Update .env.example with BOI_API_BASE_URL config
…neration - Add wizardService with 4 portfolio scenarios (Market Standard, Fast Track, Inflation-Proof, Stability-First) using BOI rates + OpenAI - Add wizardController with proper error handling and response formatting - Add wizard routes with 5 req/min/IP rate limiting - Add Joi validation schema for wizard inputs (6 wizard steps) - Add comprehensive unit tests for wizardService and integration tests - Register public wizard route in index.js
… logic - Add portfolioEngine.js with advanced scoring, user profile analysis, and adaptive track allocation based on LTV, income ratio, future funds, and stability preference - Enhance wizardService.js with richer conditional logic for all 4 scenarios: Market Standard (always), Fast Track (always), Inflation-Proof (conditional), Stability-First (conditional on stabilityPreference >= 7) - Add user profile analysis (risk tolerance, affordability, LTV classification) - Add portfolio fitness scoring to rank and recommend best-fit portfolio - Add comprehensive unit tests for conditional logic and portfolio generation - Improve AI prompt with full user context for better portfolio generation
… and winning bank/branch offers - Add communityService.js with SHA-256 profile hashing, binned field matching, winning bank/branch identification, and community tips generation - Add community_profiles Firestore collection with document factory and validator - Integrate community tips into wizard submit endpoint response - Add compound Firestore indexes for efficient community profile queries - Add comprehensive test suite for communityService - Update initCollections script with community_profiles sentinel document
…rs to optimized models - Add reportService.js: compares OCR-extracted bank offers to user's selected portfolio, generates AI-powered enhanced reports with mortgage tricks, Hebrew negotiation scripts, and strategic insights - Add paidAccess middleware: checks user's paidAnalyses flag before allowing enhanced analysis - Add POST /api/v1/analysis/enhanced/:offerId endpoint (auth + paid required) - Add Joi validation for enhanced analysis request body - Add comprehensive test suite for reportService - Update analysisController with getEnhancedAnalysis handler - Update analysis routes with new enhanced endpoint
- Add paymentService.js with Stripe checkout session creation and webhook handling - Add paymentController.js with HTTP handlers for checkout and webhook endpoints - Add stripe routes: POST /api/v1/stripe/checkout (auth) and POST /api/v1/stripe/webhook (Stripe sig) - Add paymentValidator.js with Joi schemas for checkout request validation - Add comprehensive test suite for paymentService - Update index.js to register Stripe routes with raw body parsing for webhook - Add stripe@^17.4.0 dependency to package.json - Add STRIPE_SECRET_KEY, STRIPE_WEBHOOK_SECRET, STRIPE_PRICE_ID env vars to .env.example - Webhook sets paidAnalyses=true on user doc upon successful checkout.session.completed - SCA-compliant via Stripe Checkout Sessions (hosted payment page)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.