# 📱 BinaryPro - Mobile App Development Prompt
# Google Play Payment Gateway Integration સાથે Binary Options Trading App

---

## 🎯 Project Overview (પ્રોજેક્ટ ઓવરવ્યૂ)

**App Name:** BinaryPro - Binary Options Trading  
**Platform:** Android (Google Play Store)  
**Technology:** Android Native (Kotlin/Java) + WebView Hybrid  
**Backend:** Existing PHP REST API (`binary-options` web platform)  
**Currency:** INR (₹)  
**Payment Gateway:** Google Play Billing Library  

### હાલની Web Platform Features:
- Real-time cryptocurrency trading (Binance API integration)
- User registration, login, profile management
- Deposit & Withdrawal system (UPI-based)
- Trading dashboard with live charts
- Admin panel for user/trade/payment management
- KYC verification system
- Referral & bonus system
- Live chat & support ticket system

---

## 🏗️ App Architecture (એપ આર્કિટેક્ચર)

### Recommended Approach: Hybrid App (WebView + Native Components)

```
┌─────────────────────────────────────────────┐
│              Mobile App (Android)            │
├──────────────┬──────────────────────────────┤
│  Native Layer│     WebView Layer            │
│  (Kotlin)    │     (PHP Web Pages)          │
│              │                              │
│  • Splash    │  • Trading Chart (trade.php) │
│  • Auth      │  • Dashboard (dashboard.php) │
│  • Google Pay│  • Profile (profile.php)     │
│  • Push Notif│  • History (history.php)     │
│  • Biometric │  • Deposit (deposit.php)     │
│              │  • Withdraw (withdraw.php)   │
│              │  • Support (support.php)     │
└──────────────┴──────────────────────────────┘
         │                    │
         ▼                    ▼
┌─────────────────────────────────────────────┐
│          Backend API (PHP Server)            │
│  • /api/trade/   (place, close, active)     │
│  • /api/payment/ (create, check, webhook)   │
│  • /api/user/    (profile, auth)            │
│  • /api/deposit/ (UPI + Google Play)        │
│  • /api/withdraw/(request, status)          │
│  • /api/support/ (tickets)                  │
└─────────────────────────────────────────────┘
         │
         ▼
┌─────────────────────────────────────────────┐
│          External Services                   │
│  • Binance API (Real-time prices)           │
│  • Google Play Billing API                  │
│  • Firebase (Push Notifications)            │
│  • Firebase Crashlytics                     │
└─────────────────────────────────────────────┘
```

---

## 📋 Feature Modules (ફીચર મોડ્યુલ્સ)

### Module 1: Authentication (ઓથેન્ટિકેશન)
- **Login** — Email/Password login (`user/login.php` API)
- **Register** — New user registration (`user/register.php` API)
- **Biometric Login** — Fingerprint/Face unlock (Native Android)
- **Remember Me** — Auto-login with secure token storage
- **Session Management** — JWT/Session token handling
- **Forgot Password** — Password reset via email

### Module 2: Dashboard (ડેશબોર્ડ)
- **Portfolio Overview** — Real balance + Demo balance display
- **Quick Stats** — Total trades, win rate, profit/loss
- **Recent Trades** — Last 10 trades with status
- **Quick Actions** — Trade, Deposit, Withdraw shortcuts
- **Market Summary** — Top moving assets

### Module 3: Trading (ટ્રેડિંગ)
- **Live Chart** — Real-time candlestick/line chart (Binance API)
- **Asset Selection** — Crypto, Forex, Stocks, Commodities, Indices
- **Trade Placement** — CALL/PUT with amount & expiry time
- **Active Trades** — Live monitoring of open positions
- **Trade History** — Past trades with profit/loss details
- **Demo Mode** — Practice trading with virtual ₹10,000

### Module 4: Deposit (ડિપોઝિટ) — Google Play Billing Integration
- **Google Play Payment** — In-app purchase for wallet top-up
- **UPI Payment** — Existing UPI payment method (WebView)
- **Deposit History** — All past deposits with status
- **Minimum Deposit:** ₹100
- **Maximum Deposit:** ₹1,00,000

### Module 5: Withdrawal (ઉપાડ)
- **Withdrawal Request** — Bank transfer / UPI withdrawal
- **Withdrawal History** — Past withdrawals with status tracking
- **KYC Required** — KYC verification before first withdrawal

### Module 6: Profile & Settings (પ્રોફાઇલ)
- **User Profile** — Name, email, phone, avatar
- **KYC Verification** — ID document upload & status
- **Account Settings** — Password change, notifications
- **Referral System** — Referral code & earnings (5% commission)
- **App Settings** — Theme, language, notification preferences

### Module 7: Support (સપોર્ટ)
- **Live Chat** — Real-time chat with support (`live-chat.php`)
- **Support Tickets** — Create & track tickets
- **FAQ** — Frequently asked questions
- **Contact Info** — Email & phone support

### Module 8: Notifications (નોટિફિકેશન્સ)
- **Push Notifications** — Firebase Cloud Messaging (FCM)
- **Trade Alerts** — Trade result notifications (won/lost)
- **Deposit Confirmation** — Payment received alerts
- **Withdrawal Updates** — Withdrawal status changes
- **Promotional** — Bonus offers & announcements

---

## 💳 Google Play Billing Integration (ગૂગલ પ્લે પેમેન્ટ)

### Setup Requirements:

#### 1. Google Play Console Setup
```
• Google Play Developer Account (₹1,750 one-time fee)
• App listing in Google Play Console
• In-app products configuration
• Merchant account setup for payouts
```

#### 2. In-App Products Configuration
```
Product Type: Consumable (one-time purchase for wallet top-up)

Product IDs:
├── deposit_100    → ₹100 Wallet Top-up
├── deposit_500    → ₹500 Wallet Top-up
├── deposit_1000   → ₹1,000 Wallet Top-up
├── deposit_2000   → ₹2,000 Wallet Top-up
├── deposit_5000   → ₹5,000 Wallet Top-up
├── deposit_10000  → ₹10,000 Wallet Top-up
├── deposit_25000  → ₹25,000 Wallet Top-up
├── deposit_50000  → ₹50,000 Wallet Top-up
└── deposit_100000 → ₹1,00,000 Wallet Top-up
```

#### 3. Android Implementation (Kotlin)
```kotlin
// build.gradle (app level)
dependencies {
    implementation "com.android.billingclient:billing-ktx:7.0.0"
}

// BillingManager.kt
class BillingManager(private val activity: Activity) {
    
    private lateinit var billingClient: BillingClient
    
    fun initialize() {
        billingClient = BillingClient.newBuilder(activity)
            .setListener(purchasesUpdatedListener)
            .enablePendingPurchases()
            .build()
        
        billingClient.startConnection(object : BillingClientStateListener {
            override fun onBillingSetupFinished(result: BillingResult) {
                if (result.responseCode == BillingClient.BillingResponseCode.OK) {
                    // Billing client is ready
                    queryProducts()
                }
            }
            override fun onBillingServiceDisconnected() {
                // Retry connection
            }
        })
    }
    
    fun queryProducts() {
        val productList = listOf(
            QueryProductDetailsParams.Product.newBuilder()
                .setProductId("deposit_100")
                .setProductType(BillingClient.ProductType.INAPP)
                .build(),
            // ... more products
        )
        
        val params = QueryProductDetailsParams.newBuilder()
            .setProductList(productList)
            .build()
        
        billingClient.queryProductDetailsAsync(params) { result, productDetails ->
            // Handle product details
        }
    }
    
    fun launchPurchaseFlow(productDetails: ProductDetails) {
        val flowParams = BillingFlowParams.newBuilder()
            .setProductDetailsParamsList(
                listOf(
                    BillingFlowParams.ProductDetailsParams.newBuilder()
                        .setProductDetails(productDetails)
                        .build()
                )
            )
            .build()
        
        billingClient.launchBillingFlow(activity, flowParams)
    }
    
    private val purchasesUpdatedListener = PurchasesUpdatedListener { 
        billingResult, purchases ->
        if (billingResult.responseCode == BillingClient.BillingResponseCode.OK 
            && purchases != null) {
            for (purchase in purchases) {
                handlePurchase(purchase)
            }
        }
    }
    
    private fun handlePurchase(purchase: Purchase) {
        // 1. Verify purchase on server
        // 2. Credit user's wallet
        // 3. Consume the purchase (for consumable items)
        // 4. Acknowledge the purchase
        
        verifyPurchaseOnServer(purchase.purchaseToken, purchase.products[0])
        
        val consumeParams = ConsumeParams.newBuilder()
            .setPurchaseToken(purchase.purchaseToken)
            .build()
        
        billingClient.consumeAsync(consumeParams) { result, token ->
            // Purchase consumed
        }
    }
}
```

#### 4. Server-Side Verification (PHP API)
```php
// api/payment/google-play-verify.php
<?php
/**
 * Google Play Purchase Verification API
 * Verifies in-app purchase and credits user wallet
 */

require_once '../../config/config.php';
require_once '../../config/database.php';

// Google Play API credentials
$GOOGLE_PLAY_PACKAGE_NAME = 'com.binarypro.trading';
$GOOGLE_SERVICE_ACCOUNT_JSON = ROOT_PATH . '/config/google-service-account.json';

function verifyGooglePlayPurchase($purchaseToken, $productId) {
    global $GOOGLE_PLAY_PACKAGE_NAME, $GOOGLE_SERVICE_ACCOUNT_JSON;
    
    // Use Google API Client Library
    $client = new Google_Client();
    $client->setAuthConfig($GOOGLE_SERVICE_ACCOUNT_JSON);
    $client->setScopes(['https://www.googleapis.com/auth/androidpublisher']);
    
    $service = new Google_Service_AndroidPublisher($client);
    
    try {
        $purchase = $service->purchases_products->get(
            $GOOGLE_PLAY_PACKAGE_NAME,
            $productId,
            $purchaseToken
        );
        
        return [
            'valid' => ($purchase->getPurchaseState() == 0),
            'orderId' => $purchase->getOrderId(),
            'purchaseTime' => $purchase->getPurchaseTimeMillis()
        ];
    } catch (Exception $e) {
        return ['valid' => false, 'error' => $e->getMessage()];
    }
}

// API endpoint handler
$data = json_decode(file_get_contents('php://input'), true);
$userId = $_SESSION['user_id'] ?? null;
$purchaseToken = $data['purchaseToken'] ?? '';
$productId = $data['productId'] ?? '';

// Product ID to amount mapping
$productAmounts = [
    'deposit_100' => 100,
    'deposit_500' => 500,
    'deposit_1000' => 1000,
    'deposit_2000' => 2000,
    'deposit_5000' => 5000,
    'deposit_10000' => 10000,
    'deposit_25000' => 25000,
    'deposit_50000' => 50000,
    'deposit_100000' => 100000,
];

$amount = $productAmounts[$productId] ?? 0;

if ($userId && $purchaseToken && $amount > 0) {
    $verification = verifyGooglePlayPurchase($purchaseToken, $productId);
    
    if ($verification['valid']) {
        // Check duplicate
        $existing = dbFetch(
            "SELECT id FROM deposits WHERE google_order_id = ?", 
            [$verification['orderId']]
        );
        
        if (!$existing) {
            // Credit user wallet
            dbExecute(
                "UPDATE users SET real_balance = real_balance + ? WHERE id = ?", 
                [$amount, $userId]
            );
            
            // Record deposit
            dbExecute(
                "INSERT INTO deposits (user_id, amount, method, status, google_order_id, google_purchase_token) 
                 VALUES (?, ?, 'google_play', 'completed', ?, ?)",
                [$userId, $amount, $verification['orderId'], $purchaseToken]
            );
            
            echo json_encode(['success' => true, 'message' => 'Deposit successful']);
        } else {
            echo json_encode(['success' => false, 'message' => 'Duplicate purchase']);
        }
    } else {
        echo json_encode(['success' => false, 'message' => 'Invalid purchase']);
    }
} else {
    echo json_encode(['success' => false, 'message' => 'Missing parameters']);
}
?>
```

---

## 🗄️ Database Changes (ડેટાબેસ ફેરફારો)

### deposits ટેબલમાં નવા columns ઉમેરો:
```sql
ALTER TABLE deposits ADD COLUMN google_order_id VARCHAR(255) NULL;
ALTER TABLE deposits ADD COLUMN google_purchase_token TEXT NULL;
ALTER TABLE deposits ADD COLUMN payment_platform ENUM('web', 'android', 'ios') DEFAULT 'web';
```

### નવું ટેબલ: `app_devices`
```sql
CREATE TABLE app_devices (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT NOT NULL,
    device_token VARCHAR(255) NOT NULL,
    device_type ENUM('android', 'ios') DEFAULT 'android',
    device_model VARCHAR(100),
    app_version VARCHAR(20),
    os_version VARCHAR(20),
    is_active TINYINT(1) DEFAULT 1,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE,
    INDEX idx_device_token (device_token),
    INDEX idx_user_active (user_id, is_active)
);
```

### નવું ટેબલ: `push_notifications`
```sql
CREATE TABLE push_notifications (
    id INT AUTO_INCREMENT PRIMARY KEY,
    user_id INT NULL,
    title VARCHAR(255) NOT NULL,
    body TEXT NOT NULL,
    data JSON NULL,
    type ENUM('trade_result', 'deposit', 'withdrawal', 'promo', 'system') NOT NULL,
    is_sent TINYINT(1) DEFAULT 0,
    sent_at TIMESTAMP NULL,
    created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE SET NULL,
    INDEX idx_user_sent (user_id, is_sent)
);
```

---

## 📁 Android Project Structure (પ્રોજેક્ટ સ્ટ્રક્ચર)

```
app/
├── src/main/
│   ├── java/com/binarypro/trading/
│   │   ├── App.kt                          # Application class
│   │   ├── MainActivity.kt                 # Main activity with WebView
│   │   │
│   │   ├── ui/                             # UI Layer
│   │   │   ├── splash/
│   │   │   │   └── SplashActivity.kt       # Splash screen
│   │   │   ├── auth/
│   │   │   │   ├── LoginActivity.kt        # Login screen
│   │   │   │   └── RegisterActivity.kt     # Register screen
│   │   │   ├── main/
│   │   │   │   ├── MainFragment.kt         # WebView container
│   │   │   │   └── BottomNavManager.kt     # Bottom navigation
│   │   │   └── deposit/
│   │   │       └── DepositActivity.kt      # Google Play deposit
│   │   │
│   │   ├── billing/                        # Google Play Billing
│   │   │   ├── BillingManager.kt           # Billing client manager
│   │   │   ├── BillingRepository.kt        # Purchase data handling
│   │   │   └── ProductDetails.kt           # Product models
│   │   │
│   │   ├── network/                        # API Layer
│   │   │   ├── ApiClient.kt               # Retrofit client
│   │   │   ├── ApiService.kt              # API endpoints
│   │   │   ├── AuthInterceptor.kt         # Token interceptor
│   │   │   └── models/                    # Data models
│   │   │       ├── User.kt
│   │   │       ├── Trade.kt
│   │   │       ├── Deposit.kt
│   │   │       └── ApiResponse.kt
│   │   │
│   │   ├── firebase/                       # Push Notifications
│   │   │   ├── FCMService.kt              # Firebase messaging
│   │   │   └── NotificationHelper.kt      # Notification builder
│   │   │
│   │   ├── webview/                        # WebView Bridge
│   │   │   ├── WebViewManager.kt          # WebView configuration
│   │   │   └── JsBridge.kt               # JS ↔ Native bridge
│   │   │
│   │   ├── security/                       # Security
│   │   │   ├── BiometricManager.kt        # Fingerprint/Face
│   │   │   ├── SecureStorage.kt           # Encrypted preferences
│   │   │   └── SSLPinning.kt             # Certificate pinning
│   │   │
│   │   └── utils/                          # Utilities
│   │       ├── Constants.kt               # App constants
│   │       ├── Extensions.kt             # Kotlin extensions
│   │       └── NetworkUtils.kt           # Connectivity check
│   │
│   ├── res/
│   │   ├── layout/                         # XML layouts
│   │   │   ├── activity_splash.xml
│   │   │   ├── activity_login.xml
│   │   │   ├── activity_register.xml
│   │   │   ├── activity_main.xml
│   │   │   └── activity_deposit.xml
│   │   ├── drawable/                       # Icons & graphics
│   │   ├── values/
│   │   │   ├── colors.xml                 # Color palette
│   │   │   ├── strings.xml                # String resources
│   │   │   ├── themes.xml                 # App themes
│   │   │   └── dimens.xml                 # Dimensions
│   │   ├── mipmap/                         # App icon
│   │   └── xml/
│   │       └── network_security_config.xml
│   │
│   └── AndroidManifest.xml
│
├── build.gradle.kts                        # App build config
└── proguard-rules.pro                      # ProGuard rules
```

---

## 🎨 App Design System (ડિઝાઇન સિસ્ટમ)

### Color Palette (Existing Web Theme Match):
```xml
<!-- colors.xml -->
<color name="bg_primary">#0A0E17</color>
<color name="bg_secondary">#111827</color>
<color name="bg_card">#151C28</color>
<color name="bg_tertiary">#1A2332</color>
<color name="border_color">#1F2937</color>
<color name="accent_green">#00D09C</color>
<color name="accent_green_dark">#00A87A</color>
<color name="accent_red">#FF5252</color>
<color name="accent_blue">#3B82F6</color>
<color name="accent_yellow">#FBBF24</color>
<color name="accent_purple">#8B5CF6</color>
<color name="text_primary">#FFFFFF</color>
<color name="text_secondary">#E5E7EB</color>
<color name="text_muted">#6B7280</color>
```

### Typography:
- **Font:** Inter (Google Fonts) — matches web platform
- **Heading:** 700/800 weight
- **Body:** 400/500 weight

### Design Guidelines:
- Dark theme by default (matches web platform)
- Green accent color for primary actions (#00D09C)
- Red for SELL/PUT actions (#FF5252)
- Card-based layout with rounded corners (16px)
- Subtle glassmorphism effects
- Smooth micro-animations for interactions

---

## 🔧 Dependencies (build.gradle.kts)

```kotlin
dependencies {
    // Android Core
    implementation("androidx.core:core-ktx:1.13.1")
    implementation("androidx.appcompat:appcompat:1.7.0")
    implementation("com.google.android.material:material:1.12.0")
    implementation("androidx.constraintlayout:constraintlayout:2.2.0")
    implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.7")
    implementation("androidx.navigation:navigation-fragment-ktx:2.8.4")
    
    // Google Play Billing
    implementation("com.android.billingclient:billing-ktx:7.0.0")
    
    // Networking
    implementation("com.squareup.retrofit2:retrofit:2.11.0")
    implementation("com.squareup.retrofit2:converter-gson:2.11.0")
    implementation("com.squareup.okhttp3:logging-interceptor:4.12.0")
    
    // Firebase
    implementation(platform("com.google.firebase:firebase-bom:33.6.0"))
    implementation("com.google.firebase:firebase-messaging-ktx")
    implementation("com.google.firebase:firebase-analytics-ktx")
    implementation("com.google.firebase:firebase-crashlytics-ktx")
    
    // Security
    implementation("androidx.biometric:biometric:1.2.0-alpha05")
    implementation("androidx.security:security-crypto:1.1.0-alpha06")
    
    // Image Loading
    implementation("io.coil-kt:coil:2.7.0")
    
    // WebView
    implementation("androidx.webkit:webkit:1.12.1")
    
    // Coroutines
    implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.9.0")
}
```

---

## 🔐 Security Requirements (સુરક્ષા)

1. **SSL Certificate Pinning** — Server certificate verification
2. **Encrypted SharedPreferences** — Secure token storage
3. **ProGuard/R8** — Code obfuscation
4. **Root Detection** — Block rooted devices (optional)
5. **Biometric Authentication** — Fingerprint/Face ID for login
6. **Google Play Purchase Verification** — Server-side token verification
7. **Anti-Tampering** — SafetyNet/Play Integrity API
8. **WebView Security** — Disable file access, JavaScript injection prevention

---

## 📊 API Endpoints Required (API એન્ડપોઇન્ટ્સ)

### Existing APIs (Ready to Use):
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/user/login` | POST | User login |
| `/api/user/register` | POST | User registration |
| `/api/trade/place` | POST | Place a trade |
| `/api/trade/close` | POST | Close active trade |
| `/api/trade/active` | GET | Get active trades |
| `/api/payment/create` | POST | Create payment |
| `/api/payment/check` | GET | Check payment status |
| `/api/payment/webhook` | POST | Payment webhook |
| `/api/support/create` | POST | Create support ticket |
| `/api/deposit/create` | POST | Create deposit request |
| `/api/withdraw/request` | POST | Request withdrawal |

### New APIs Required (બનાવવાના):
| Endpoint | Method | Description |
|----------|--------|-------------|
| `/api/payment/google-play-verify` | POST | Verify Google Play purchase |
| `/api/user/device-register` | POST | Register FCM device token |
| `/api/user/device-unregister` | POST | Remove device token |
| `/api/notifications/list` | GET | Get user notifications |
| `/api/notifications/mark-read` | POST | Mark notification as read |
| `/api/user/app-config` | GET | Get app configuration |

---

## 🚀 Deployment Checklist (ડિપ્લોયમેન્ટ ચેકલિસ્ટ)

### Google Play Console Setup:
- [ ] Google Play Developer Account create કરો (₹1,750)
- [ ] App listing create કરો (title, description, screenshots)
- [ ] App signing key generate કરો
- [ ] In-app products (deposit amounts) configure કરો
- [ ] Content rating questionnaire complete કરો
- [ ] Privacy policy URL add કરો
- [ ] Data safety form complete કરો

### Firebase Setup:
- [ ] Firebase project create કરો
- [ ] `google-services.json` download & add કરો
- [ ] FCM (Cloud Messaging) enable કરો
- [ ] Crashlytics enable કરો
- [ ] Analytics enable કરો

### Server-Side Setup:
- [ ] Google Play Service Account create કરો
- [ ] Service account JSON key server પર upload કરો
- [ ] Google Play Developer API enable કરો
- [ ] New API endpoints implement કરો
- [ ] Database migration run કરો (new tables & columns)
- [ ] Firebase Admin SDK install કરો (push notifications)
- [ ] HTTPS/SSL certificate verify કરો

### App Build & Release:
- [ ] Release signing config setup કરો
- [ ] ProGuard rules configure કરો
- [ ] App bundle (AAB) generate કરો
- [ ] Internal testing track upload કરો
- [ ] Testing complete કરો
- [ ] Production release submit કરો

---

## ⚠️ Important Notes (મહત્વપૂર્ણ નોંધ)

### Google Play Policy Compliance:
> [!CAUTION]
> Binary options / trading apps ને Google Play Store પર publish કરવા માટે 
> **Financial Services Policy** ને follow કરવી ખૂબ જ જરૂરી છે:
> 
> 1. **Gambling Policy** — Binary options ને Google gambling policy હેઠળ classify થઈ શકે છે
> 2. **Financial Services** — Proper disclaimers અને risk warnings required છે
> 3. **Restricted Content** — કેટલાક દેશોમાં binary options restricted છે
> 4. **Real Money** — Real money involvement ના કારણે extra review થાય છે
> 5. **KYC/AML** — Know Your Customer / Anti-Money Laundering compliance required

### Google Play Billing Policy:
> [!IMPORTANT]
> Google Play Billing Library mandatory છે digital goods/services માટે.
> Google 15-30% commission લે છે દરેક transaction પર.
> 
> - **First $1M/year:** 15% commission
> - **After $1M/year:** 30% commission
> 
> આ cost ને pricing strategy માં include કરવી.

### Alternative Approaches:
> [!TIP]
> Google Play Billing ની commission ટાળવા માટે:
> 
> 1. **PWA (Progressive Web App)** — WebView-based app, browser payment
> 2. **Direct UPI Integration** — App માંથી directly UPI payment (Google Play policy check required)
> 3. **Razorpay/Cashfree SDK** — Third-party payment gateway (Google policy compliant)

---

## 📱 App Screens Flow (સ્ક્રીન ફ્લો)

```
Splash Screen
    │
    ├── [Not Logged In] ──→ Login Screen
    │                           ├── Register Screen
    │                           └── Forgot Password
    │
    └── [Logged In] ──→ Main Screen (Bottom Navigation)
                            │
                            ├── 🏠 Dashboard
                            │     ├── Portfolio Summary
                            │     ├── Quick Actions
                            │     └── Recent Trades
                            │
                            ├── 📈 Trade (WebView)
                            │     ├── Live Chart
                            │     ├── Asset Selector
                            │     └── Trade Panel
                            │
                            ├── 💰 Deposit
                            │     ├── Google Play Payment
                            │     ├── UPI Payment
                            │     └── Deposit History
                            │
                            ├── 💸 Withdraw
                            │     ├── Withdrawal Form
                            │     └── Withdrawal History
                            │
                            └── 👤 Profile
                                  ├── Account Details
                                  ├── KYC Verification
                                  ├── Referral Program
                                  ├── Support/Chat
                                  └── Settings
```

---

## 🧪 Testing Plan (ટેસ્ટિંગ પ્લાન)

### Unit Tests:
- Billing flow verification
- API response parsing
- Token management
- Purchase validation logic

### Integration Tests:
- Google Play Billing sandbox testing
- WebView ↔ Native communication
- Push notification delivery
- API authentication flow

### Google Play Testing Tracks:
1. **Internal Testing** — Development team only
2. **Closed Testing (Alpha)** — Selected testers
3. **Open Testing (Beta)** — Public beta
4. **Production** — Full release

### Test Accounts:
```
Google Play Sandbox test email: Use "License testers" in Google Play Console
This allows test purchases without real charges.
```

---

## 📅 Development Timeline (ડેવલપમેન્ટ ટાઇમલાઇન)

| Phase | Duration | Tasks |
|-------|----------|-------|
| **Phase 1** | 1-2 Weeks | Project setup, Auth screens, WebView integration |
| **Phase 2** | 1-2 Weeks | Google Play Billing integration, Deposit flow |
| **Phase 3** | 1 Week | Push notifications, Firebase setup |
| **Phase 4** | 1 Week | Security, Testing, Bug fixes |
| **Phase 5** | 1 Week | Google Play Store submission & review |
| **Total** | **5-7 Weeks** | Complete app development & release |

---

## 📝 Summary (સારાંશ)

આ prompt document **BinaryPro** mobile app development માટેની complete guide છે:

✅ **Hybrid App approach** — WebView + Native components  
✅ **Google Play Billing** — In-app purchase for wallet deposits  
✅ **Server-side verification** — Purchase token verification  
✅ **Firebase integration** — Push notifications & analytics  
✅ **Security measures** — Biometric, SSL pinning, encryption  
✅ **Existing API reuse** — PHP backend compatibility  
✅ **Design consistency** — Web platform theme match  
✅ **Policy compliance** — Google Play Store guidelines  

---

*Document Created: March 8, 2026*  
*Project: BinaryPro - Binary Options Trading Platform*  
*Version: 1.0*
