Preview: postman_collection.json
Size: 33.05 KB
/home/byroehnu/easepaybiz.easetack.com/postman_collection.json
{
"info": {
"name": "EasePay Backend API - Complete Test Collection",
"description": "Comprehensive API testing collection for EasePay Backend with all endpoints and test data",
"version": "1.0.0",
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
},
"variable": [
{
"key": "BASE_URL",
"value": "http://localhost:5004",
"type": "string"
},
{
"key": "PROD_URL",
"value": "http://localhost:5004",
"type": "string"
},
{
"key": "TOKEN",
"value": "",
"type": "string"
},
{
"key": "USER_ID",
"value": "",
"type": "string"
},
{
"key": "BUSINESS_ID",
"value": "",
"type": "string"
}
],
"item": [
{
"name": "🏠 Server Health",
"item": [
{
"name": "Root Endpoint",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{BASE_URL}}/",
"host": ["{{BASE_URL}}"],
"path": [""]
}
},
"response": []
},
{
"name": "Health Check",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{BASE_URL}}/health",
"host": ["{{BASE_URL}}"],
"path": ["health"]
}
},
"response": []
}
]
},
{
"name": "🔐 Authentication",
"item": [
{
"name": "1. Send OTP",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 200) {",
" const response = pm.response.json();",
" if (response.otp) {",
" pm.globals.set('OTP', response.otp);",
" console.log('OTP saved:', response.otp);",
" }",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"phone\": \"+1234567890\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/auth/send-otp",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "send-otp"]
}
},
"response": []
},
{
"name": "2. Verify OTP",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 200) {",
" const response = pm.response.json();",
" if (response.token) {",
" pm.globals.set('TOKEN', response.token);",
" pm.globals.set('USER_ID', response.user.id);",
" console.log('Token saved:', response.token);",
" }",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"phone\": \"+1234567890\",\n \"otp\": \"{{OTP}}\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/auth/verify-otp",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "verify-otp"]
}
},
"response": []
},
{
"name": "3. Register User",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"test@example.com\",\n \"password\": \"TestPassword123!\",\n \"firstName\": \"John\",\n \"lastName\": \"Doe\",\n \"phone\": \"+1234567890\",\n \"businessName\": \"Test Business\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/auth/register",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "register"]
}
},
"response": []
},
{
"name": "4. Login User",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 200) {",
" const response = pm.response.json();",
" if (response.token) {",
" pm.globals.set('TOKEN', response.token);",
" pm.globals.set('USER_ID', response.user.id);",
" }",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"email\": \"test@example.com\",\n \"password\": \"TestPassword123!\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/auth/login",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "login"]
}
},
"response": []
},
{
"name": "5. Get Current User",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/auth/me",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "me"]
}
},
"response": []
},
{
"name": "6. Setup PIN",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"pin\": \"1234\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/auth/setup-pin",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "setup-pin"]
}
},
"response": []
},
{
"name": "7. Login with PIN",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"phone\": \"+1234567890\",\n \"pin\": \"1234\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/auth/login-pin",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "login-pin"]
}
},
"response": []
}
]
},
{
"name": "🏢 Business Management",
"item": [
{
"name": "1. Create Business Profile",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Test Business Ltd\",\n \"type\": \"LIMITED_COMPANY\",\n \"vatRegistered\": true,\n \"hasStaff\": false\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/business/profile",
"host": ["{{BASE_URL}}"],
"path": ["api", "business", "profile"]
}
},
"response": []
},
{
"name": "2. Get Business Profile",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/business/profile",
"host": ["{{BASE_URL}}"],
"path": ["api", "business", "profile"]
}
},
"response": []
},
{
"name": "3. Update Business Profile",
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"name\": \"Updated Business Ltd\",\n \"type\": \"LIMITED_COMPANY\",\n \"vatRegistered\": true,\n \"hasStaff\": true\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/business/profile",
"host": ["{{BASE_URL}}"],
"path": ["api", "business", "profile"]
}
},
"response": []
}
]
},
{
"name": "💰 Sales Management",
"item": [
{
"name": "1. Create Sale",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 201) {",
" const response = pm.response.json();",
" if (response.data && response.data.id) {",
" pm.globals.set('SALE_ID', response.data.id);",
" }",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"amount\": 1500.00,\n \"description\": \"Test Sale - Product Purchase\",\n \"date\": \"2026-02-23T10:00:00.000Z\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/sales",
"host": ["{{BASE_URL}}"],
"path": ["api", "sales"]
}
},
"response": []
},
{
"name": "2. Get All Sales",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/sales?page=1&limit=10",
"host": ["{{BASE_URL}}"],
"path": ["api", "sales"],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "limit",
"value": "10"
}
]
}
},
"response": []
},
{
"name": "3. Get Sale by ID",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/sales/{{SALE_ID}}",
"host": ["{{BASE_URL}}"],
"path": ["api", "sales", "{{SALE_ID}}"]
}
},
"response": []
},
{
"name": "4. Update Sale",
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"amount\": 1750.00,\n \"description\": \"Updated Sale - Product Purchase with extras\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/sales/{{SALE_ID}}",
"host": ["{{BASE_URL}}"],
"path": ["api", "sales", "{{SALE_ID}}"]
}
},
"response": []
}
]
},
{
"name": "💸 Expense Management",
"item": [
{
"name": "1. Create Expense",
"event": [
{
"listen": "test",
"script": {
"exec": [
"if (pm.response.code === 201) {",
" const response = pm.response.json();",
" if (response.data && response.data.id) {",
" pm.globals.set('EXPENSE_ID', response.data.id);",
" }",
"}"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"amount\": 500.00,\n \"description\": \"Office Supplies\",\n \"category\": \"office\",\n \"date\": \"2026-02-23T10:00:00.000Z\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/expenses",
"host": ["{{BASE_URL}}"],
"path": ["api", "expenses"]
}
},
"response": []
},
{
"name": "2. Get All Expenses",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/expenses?page=1&limit=10",
"host": ["{{BASE_URL}}"],
"path": ["api", "expenses"],
"query": [
{
"key": "page",
"value": "1"
},
{
"key": "limit",
"value": "10"
}
]
}
},
"response": []
},
{
"name": "3. Get Expense Analytics",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/expenses/analytics?period=month",
"host": ["{{BASE_URL}}"],
"path": ["api", "expenses", "analytics"],
"query": [
{
"key": "period",
"value": "month"
}
]
}
},
"response": []
},
{
"name": "4. Update Expense",
"request": {
"method": "PUT",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"amount\": 750.00,\n \"description\": \"Office Supplies - Updated\",\n \"category\": \"office\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/expenses/{{EXPENSE_ID}}",
"host": ["{{BASE_URL}}"],
"path": ["api", "expenses", "{{EXPENSE_ID}}"]
}
},
"response": []
}
]
},
{
"name": "📊 Dashboard",
"item": [
{
"name": "1. Get Dashboard Overview",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/dashboard/overview?timeframe=month",
"host": ["{{BASE_URL}}"],
"path": ["api", "dashboard", "overview"],
"query": [
{
"key": "timeframe",
"value": "month"
}
]
}
},
"response": []
},
{
"name": "2. Get Sales Analytics",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/dashboard/sales-analytics?period=month",
"host": ["{{BASE_URL}}"],
"path": ["api", "dashboard", "sales-analytics"],
"query": [
{
"key": "period",
"value": "month"
}
]
}
},
"response": []
},
{
"name": "3. Get Expense Analytics",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/dashboard/expense-analytics?period=month",
"host": ["{{BASE_URL}}"],
"path": ["api", "dashboard", "expense-analytics"],
"query": [
{
"key": "period",
"value": "month"
}
]
}
},
"response": []
}
]
},
{
"name": "📈 Reports",
"item": [
{
"name": "1. Get Sales Report",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/reports/sales?startDate=2026-01-01&endDate=2026-02-28",
"host": ["{{BASE_URL}}"],
"path": ["api", "reports", "sales"],
"query": [
{
"key": "startDate",
"value": "2026-01-01"
},
{
"key": "endDate",
"value": "2026-02-28"
}
]
}
},
"response": []
},
{
"name": "2. Get Expense Report",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/reports/expenses?startDate=2026-01-01&endDate=2026-02-28",
"host": ["{{BASE_URL}}"],
"path": ["api", "reports", "expenses"],
"query": [
{
"key": "startDate",
"value": "2026-01-01"
},
{
"key": "endDate",
"value": "2026-02-28"
}
]
}
},
"response": []
},
{
"name": "3. Get Profit/Loss Report",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/reports/profit-loss?startDate=2026-01-01&endDate=2026-02-28",
"host": ["{{BASE_URL}}"],
"path": ["api", "reports", "profit-loss"],
"query": [
{
"key": "startDate",
"value": "2026-01-01"
},
{
"key": "endDate",
"value": "2026-02-28"
}
]
}
},
"response": []
}
]
},
{
"name": "🧾 Tax Management",
"item": [
{
"name": "1. Get Tax Summary",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/tax/summary",
"host": ["{{BASE_URL}}"],
"path": ["api", "tax", "summary"]
}
},
"response": []
},
{
"name": "2. Get Quarterly Tax Report",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/tax/quarterly/2026/1",
"host": ["{{BASE_URL}}"],
"path": ["api", "tax", "quarterly", "2026", "1"]
}
},
"response": []
},
{
"name": "3. Get Annual Tax Report",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/tax/annual/2025",
"host": ["{{BASE_URL}}"],
"path": ["api", "tax", "annual", "2025"]
}
},
"response": []
}
]
},
{
"name": "📊 Credit Score",
"item": [
{
"name": "1. Get Credit Score",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/credit-score",
"host": ["{{BASE_URL}}"],
"path": ["api", "credit-score"]
}
},
"response": []
},
{
"name": "2. Get Credit Score History",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/credit-score/history?limit=12",
"host": ["{{BASE_URL}}"],
"path": ["api", "credit-score", "history"],
"query": [
{
"key": "limit",
"value": "12"
}
]
}
},
"response": []
},
{
"name": "3. Recalculate Credit Score",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{BASE_URL}}/api/credit-score/recalculate",
"host": ["{{BASE_URL}}"],
"path": ["api", "credit-score", "recalculate"]
}
},
"response": []
},
{
"name": "4. Get Credit Score Factors",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/credit-score/factors",
"host": ["{{BASE_URL}}"],
"path": ["api", "credit-score", "factors"]
}
},
"response": []
}
]
},
{
"name": "💳 Subscription Management",
"item": [
{
"name": "1. Get Available Plans",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{BASE_URL}}/api/subscription/plans",
"host": ["{{BASE_URL}}"],
"path": ["api", "subscription", "plans"]
}
},
"response": []
},
{
"name": "2. Get My Subscription",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/subscription/my-subscription",
"host": ["{{BASE_URL}}"],
"path": ["api", "subscription", "my-subscription"]
}
},
"response": []
},
{
"name": "3. Subscribe to Plan",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"planName\": \"basic\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/subscription/subscribe",
"host": ["{{BASE_URL}}"],
"path": ["api", "subscription", "subscribe"]
}
},
"response": []
},
{
"name": "4. Cancel Subscription",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"body": {
"mode": "raw",
"raw": ""
},
"url": {
"raw": "{{BASE_URL}}/api/subscription/cancel",
"host": ["{{BASE_URL}}"],
"path": ["api", "subscription", "cancel"]
}
},
"response": []
},
{
"name": "5. Get Admin Stats (Admin Only)",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
}
],
"url": {
"raw": "{{BASE_URL}}/api/subscription/admin/stats",
"host": ["{{BASE_URL}}"],
"path": ["api", "subscription", "admin", "stats"]
}
},
"response": []
}
]
},
{
"name": "🧾 Invoice Management",
"item": [
{
"name": "1. Generate Invoice PDF",
"request": {
"method": "POST",
"header": [
{
"key": "Authorization",
"value": "Bearer {{TOKEN}}"
},
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"senderDetails\": {\n \"name\": \"Test Business Ltd\",\n \"address\": \"123 Business Street\",\n \"city\": \"London\",\n \"postcode\": \"SW1A 1AA\",\n \"email\": \"billing@testbusiness.com\",\n \"phone\": \"+44 20 1234 5678\"\n },\n \"clientDetails\": {\n \"name\": \"Client Company Ltd\",\n \"address\": \"456 Client Avenue\",\n \"city\": \"Manchester\",\n \"postcode\": \"M1 1AA\",\n \"email\": \"accounts@clientcompany.com\"\n },\n \"items\": [\n {\n \"description\": \"Web Development Services\",\n \"quantity\": 40,\n \"unitPrice\": 75.00,\n \"total\": 3000.00\n },\n {\n \"description\": \"Domain & Hosting\",\n \"quantity\": 1,\n \"unitPrice\": 120.00,\n \"total\": 120.00\n }\n ],\n \"invoiceNumber\": \"INV-2026-001\",\n \"date\": \"2026-02-23\",\n \"dueDate\": \"2026-03-25\",\n \"tax\": 624.00,\n \"total\": 3744.00,\n \"notes\": \"Thank you for your business! Payment is due within 30 days.\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/invoices/generate",
"host": ["{{BASE_URL}}"],
"path": ["api", "invoices", "generate"]
}
},
"response": []
}
]
},
{
"name": "❌ Error Testing",
"item": [
{
"name": "Test 401 - Invalid Token",
"request": {
"method": "GET",
"header": [
{
"key": "Authorization",
"value": "Bearer invalid_token_here"
}
],
"url": {
"raw": "{{BASE_URL}}/api/auth/me",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "me"]
}
},
"response": []
},
{
"name": "Test 404 - Route Not Found",
"request": {
"method": "GET",
"header": [],
"url": {
"raw": "{{BASE_URL}}/api/nonexistent",
"host": ["{{BASE_URL}}"],
"path": ["api", "nonexistent"]
}
},
"response": []
},
{
"name": "Test 400 - Bad Request",
"request": {
"method": "POST",
"header": [
{
"key": "Content-Type",
"value": "application/json"
}
],
"body": {
"mode": "raw",
"raw": "{\n \"invalid\": \"data\"\n}"
},
"url": {
"raw": "{{BASE_URL}}/api/auth/send-otp",
"host": ["{{BASE_URL}}"],
"path": ["api", "auth", "send-otp"]
}
},
"response": []
}
]
}
],
"event": [
{
"listen": "prerequest",
"script": {
"type": "text/javascript",
"exec": [
"// Global pre-request script",
"console.log('Running test on:', pm.request.url.toString());"
]
}
},
{
"listen": "test",
"script": {
"type": "text/javascript",
"exec": [
"// Global test script",
"pm.test('Response time is less than 5000ms', function () {",
" pm.expect(pm.response.responseTime).to.be.below(5000);",
"});",
"",
"pm.test('Response has valid JSON structure', function () {",
" try {",
" const jsonData = pm.response.json();",
" pm.expect(jsonData).to.have.property('success');",
" } catch (e) {",
" // Skip for PDF downloads or non-JSON responses",
" }",
"});"
]
}
}
]
}
Directory Contents
Dirs: 14 × Files: 19