# Backend Update Requirements for MSBSGOV

This document outlines the necessary changes and additions required in the backend API to support the new features implemented in the frontend.

## 1. Membership & Payment System

### New Database Fields (User/Profile Table)
- `membership_status`: ENUM('active', 'inactive', 'pending') DEFAULT 'inactive'
- `membership_expiry`: DATE/TIMESTAMP
- `membership_id`: VARCHAR (Unique ID, e.g., MSBS/2024/0001)
- `membership_certificate_path`: VARCHAR (Path to generated PDF)
- `last_payment_id`: VARCHAR
- `last_payment_amount`: DECIMAL(10, 2)

### New Endpoints
- `POST /api/membership/initiate-payment`: Logic to create a payment order (Razorpay/Easebuzz/etc.)
- `POST /api/membership/verify-payment`: Webhook or callback to confirm payment (2500 + 18% GST).
- `GET /api/membership/certificate`: Logic to generate a PDF certificate with user details, photo, and expiry.

### Automation Tasks
- **Email Service**: Send welcome email with Certificate and ID upon successful payment.
- **SMS/WhatsApp Service**: Send confirmation text to 9423006651 and user mobile on registration/payment.
- **Validity Logic**: Automatic expiry check (1 year validity).

## 2. Bank Details Updates

### Database Fields (BankDetails Table)
- Add `account_name`: VARCHAR (e.g., Savings, Current)
- Add `pin_code`: VARCHAR(6)

## 3. Shop Registration Updates

### Database Fields (ShopRegistration Table)
- Add `farm_type`: ENUM('Pro Parity', 'Partnership', 'Private Limited', 'LLP', 'OPC')
- Add `join_as_a`: ENUM('Franchise Partner', 'Distributers', 'Dealer', 'EPC Wender', 'Stockist', 'Treaders', 'Manpower Suppliers', 'Machinery Suppliers', 'JV Partners', 'Finances Partners', 'Sub-Vendor')
- Add `owner_passport_photo`: VARCHAR (File path)
- Add `email_verified`: BOOLEAN
- Add `mobile_verified`: BOOLEAN

## 4. Location Integration
- Ensure `shop_google_location` handles full Google Maps URLs or coordinates correctly.

## 5. Daily Post App Access
- Upon membership activation, ensure the user's `daily_post_active` flag is set to `true` for 1 year.
