{
	"info": {
		"_postman_id": "udankhatola-mobile-app-v2",
		"name": "UdanKhatola Mobile App API V2",
		"description": "Complete API collection for UdanKhatola mobile app with location validation and simplified booking flow",
		"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
	},
	"variable": [
		{
			"key": "base_url",
			"value": "http://localhost:8000/api",
			"type": "string"
		},
		{
			"key": "token",
			"value": "",
			"type": "string"
		}
	],
	"item": [
		{
			"name": "Authentication",
			"item": [
				{
					"name": "1. Request OTP",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"mobile_number\": \"9876543210\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/request-otp",
							"host": ["{{base_url}}"],
							"path": ["v2", "request-otp"]
						},
						"description": "Request OTP for login. OTP will be sent via WhatsApp and SMS."
					}
				},
				{
					"name": "2. Login (Persistent)",
					"event": [
						{
							"listen": "test",
							"script": {
								"exec": [
									"var jsonData = pm.response.json();",
									"if (jsonData.success && jsonData.data.token) {",
									"    pm.collectionVariables.set(\"token\", jsonData.data.token);",
									"    console.log(\"Token saved:\", jsonData.data.token);",
									"}"
								],
								"type": "text/javascript"
							}
						}
					],
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"mobile_number\": \"9876543210\",\n  \"otp\": \"123456\",\n  \"device_id\": \"device-unique-id-123\",\n  \"fcm_token\": \"firebase-token-here\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/login",
							"host": ["{{base_url}}"],
							"path": ["v2", "login"]
						},
						"description": "Login with OTP. User remains logged in until logout (persistent session)."
					}
				},
				{
					"name": "3. Verify Token",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/v2/verify-token",
							"host": ["{{base_url}}"],
							"path": ["v2", "verify-token"]
						},
						"description": "Verify if the current token is still valid. Use on app startup."
					}
				},
				{
					"name": "4. Logout",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/v2/logout",
							"host": ["{{base_url}}"],
							"path": ["v2", "logout"]
						},
						"description": "Logout and clear device information."
					}
				}
			]
		},
		{
			"name": "Location Validation",
			"item": [
				{
					"name": "1. Validate Location (Geofencing)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"latitude\": 30.3165,\n  \"longitude\": 78.0322\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/validate-location",
							"host": ["{{base_url}}"],
							"path": ["v2", "validate-location"]
						},
						"description": "Validate if agent is within allowed geofence radius. Call before showing Book Ticket page."
					}
				},
				{
					"name": "2. Get Partner Region Locations",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/v2/partner-region-locations",
							"host": ["{{base_url}}"],
							"path": ["v2", "partner-region-locations"]
						},
						"description": "Get all locations in agent's region with geofence details."
					}
				},
				{
					"name": "3. Get Location Details",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"loccode\": \"CHD\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/location-details",
							"host": ["{{base_url}}"],
							"path": ["v2", "location-details"]
						},
						"description": "Get specific location details with coordinates and geofence info."
					}
				},
				{
					"name": "4. Calculate Distance",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"lat1\": 30.3165,\n  \"lon1\": 78.0322,\n  \"lat2\": 30.3265,\n  \"lon2\": 78.0422\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/calculate-distance",
							"host": ["{{base_url}}"],
							"path": ["v2", "calculate-distance"]
						},
						"description": "Calculate distance between two coordinates."
					}
				}
			]
		},
		{
			"name": "Booking Flow (V2 - Simplified)",
			"item": [
				{
					"name": "1. Get Location List",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/v2/location-list",
							"host": ["{{base_url}}"],
							"path": ["v2", "location-list"]
						},
						"description": "Get list of all available locations."
					}
				},
				{
					"name": "2. Get Price Cards by Location",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"loccode\": \"CHD\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/price-card-by-location",
							"host": ["{{base_url}}"],
							"path": ["v2", "price-card-by-location"]
						},
						"description": "Get available tickets for a location."
					}
				},
				{
					"name": "3. Get Available Slots",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"code\": \"ADULT001\",\n  \"visit_date\": \"2026-04-15\",\n  \"next_loccode\": \"CHD\",\n  \"ticket_count\": 2\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/available-slots",
							"host": ["{{base_url}}"],
							"path": ["v2", "available-slots"]
						},
						"description": "Get available time slots for booking."
					}
				},
				{
					"name": "4. Book Ticket (No Customer OTP)",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"customer_name\": \"John Doe\",\n  \"customer_mobile\": \"9876543210\",\n  \"loccode\": \"CHD\",\n  \"visit_date\": \"2026-04-15\",\n  \"slot\": 10,\n  \"tickets\": [\n    {\n      \"code\": \"ADULT001\",\n      \"quantity\": 2,\n      \"amount\": 500\n    },\n    {\n      \"code\": \"CHILD001\",\n      \"quantity\": 1,\n      \"amount\": 250\n    }\n  ],\n  \"total_amount\": 750,\n  \"latitude\": 30.3165,\n  \"longitude\": 78.0322\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/book-ticket",
							"host": ["{{base_url}}"],
							"path": ["v2", "book-ticket"]
						},
						"description": "Create booking without customer OTP. Location is validated before booking."
					}
				},
				{
					"name": "5. Confirm Payment",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"booking_id\": \"UDK17131234565678\",\n  \"payment_reference\": \"UPI123456789\",\n  \"payment_status\": \"success\",\n  \"latitude\": 30.3165,\n  \"longitude\": 78.0322\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/confirm-payment",
							"host": ["{{base_url}}"],
							"path": ["v2", "confirm-payment"]
						},
						"description": "Confirm payment. Location is re-validated for timeout protection."
					}
				}
			]
		},
		{
			"name": "Ticket Management",
			"item": [
				{
					"name": "1. Download Ticket PDF",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/v2/download-ticket/UDK17131234565678",
							"host": ["{{base_url}}"],
							"path": ["v2", "download-ticket", "UDK17131234565678"]
						},
						"description": "Download ticket as PDF. Replace booking_id in URL."
					}
				},
				{
					"name": "2. Share Ticket via WhatsApp",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"booking_id\": \"UDK17131234565678\",\n  \"mobile\": \"9876543210\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/share-ticket",
							"host": ["{{base_url}}"],
							"path": ["v2", "share-ticket"]
						},
						"description": "Share ticket via WhatsApp to specified mobile number."
					}
				},
				{
					"name": "3. Booking History",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/v2/booking-history?page=1",
							"host": ["{{base_url}}"],
							"path": ["v2", "booking-history"],
							"query": [
								{
									"key": "page",
									"value": "1"
								}
							]
						},
						"description": "Get agent's booking history with pagination."
					}
				},
				{
					"name": "4. Resend Ticket",
					"request": {
						"method": "POST",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							},
							{
								"key": "Content-Type",
								"value": "application/json"
							}
						],
						"body": {
							"mode": "raw",
							"raw": "{\n  \"booking_id\": \"UDK17131234565678\"\n}"
						},
						"url": {
							"raw": "{{base_url}}/v2/resend-ticket",
							"host": ["{{base_url}}"],
							"path": ["v2", "resend-ticket"]
						},
						"description": "Resend ticket to customer via WhatsApp and SMS."
					}
				}
			]
		},
		{
			"name": "Partner Profile",
			"item": [
				{
					"name": "1. Get Partner Details",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/getPartnerDetailByToken",
							"host": ["{{base_url}}"],
							"path": ["getPartnerDetailByToken"]
						},
						"description": "Get logged-in partner's details."
					}
				},
				{
					"name": "2. Get Partner Available Quota",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/getPartnerAvailableQuota",
							"host": ["{{base_url}}"],
							"path": ["getPartnerAvailableQuota"]
						},
						"description": "Get partner's remaining ticket quota."
					}
				},
				{
					"name": "3. Get Partner Earnings",
					"request": {
						"method": "GET",
						"header": [
							{
								"key": "Authorization",
								"value": "Bearer {{token}}"
							}
						],
						"url": {
							"raw": "{{base_url}}/v2/partner-earnings",
							"host": ["{{base_url}}"],
							"path": ["v2", "partner-earnings"]
						},
						"description": "Get partner's earnings and payout information."
					}
				}
			]
		}
	]
}
