Skip to content

Code pilot backend impl 20260415 124505 - #35

Merged
Tambeej merged 7 commits into
mainfrom
code-pilot-backend-impl-20260415-124505
May 3, 2026
Merged

Code pilot backend impl 20260415 124505#35
Tambeej merged 7 commits into
mainfrom
code-pilot-backend-impl-20260415-124505

Conversation

@Tambeej

@Tambeej Tambeej commented May 3, 2026

Copy link
Copy Markdown
Owner

No description provided.

Tambeej and others added 7 commits April 15, 2026 12:53
…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)
@Tambeej
Tambeej merged commit 82d49eb into main May 3, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant