{ "info": { "_postman_id": "95ab582d-50b1-4acb-83ed-0bd33ed88558", "name": "Tanzania Insurance Broker API", "description": "Postman collection for testing Insurance Broker System API endpoints", "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json", "_exporter_id": "37839403", "_collection_link": "https://tz-brokers.postman.co/workspace/TZ-Brokers-Workspace~179c7ae8-dab6-426e-8597-1e87bd1ad35d/collection/37839403-95ab582d-50b1-4acb-83ed-0bd33ed88558?action=share&source=collection_link&creator=37839403" }, "item": [ { "name": "Health", "item": [ { "name": "Health Check", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response has status ok', function () {", " pm.expect(pm.response.json().status).to.equal('ok');", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/health", "host": [ "{{baseUrl}}" ], "path": [ "health" ] } }, "response": [] }, { "name": "Set Up User Roles", "request": { "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/setup", "host": [ "{{baseUrl}}" ], "path": [ "setup" ] } }, "response": [] } ] }, { "name": "Authentication", "item": [ { "name": "Login", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 401', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 401]);", "});", "pm.test('Response has token for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('access_token');", " pm.environment.set('token', pm.response.json().access_token);", " }", "});", "pm.test('Error response format for failure', function () {", " if (pm.response.code !== 200) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('code');", " pm.expect(pm.response.json().error).to.have.property('message');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"email\": \"admin@insurancebrokerage.co.tz\",\n \"password\": \"password123\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/auth/login", "host": [ "{{baseUrl}}" ], "path": [ "auth", "login" ] } }, "response": [] }, { "name": "Refresh Token", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 401', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 401]);", "});", "pm.test('Response has new token for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('access_token');", " pm.environment.set('token', pm.response.json().access_token);", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"refresh_token\": \"{{token}}\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/auth/refresh", "host": [ "{{baseUrl}}" ], "path": [ "auth", "refresh" ] } }, "response": [] }, { "name": "Logout", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.environment.unset('token');" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/auth/logout", "host": [ "{{baseUrl}}" ], "path": [ "auth", "logout" ] } }, "response": [] }, { "name": "Get Authenticated User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response has user data', function () {", " pm.expect(pm.response.json()).to.have.property('success');", " pm.expect(pm.response.json()).to.have.property('user');", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/auth/user", "host": [ "{{baseUrl}}" ], "path": [ "auth", "user" ] } }, "response": [] } ] }, { "name": "Users", "item": [ { "name": "List Users", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has data and pagination for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json()).to.have.property('pagination');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users", "host": [ "{{baseUrl}}" ], "path": [ "users" ] } }, "response": [] }, { "name": "Get User by ID", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has user data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json().data).to.have.property('id');", " pm.expect(pm.response.json().data).to.have.property('full_name');", " pm.expect(pm.response.json().data).to.have.property('email');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/019904db-83e9-702c-a604-8a16e4375db7?with_roles=true&with_permissions=true", "host": [ "{{baseUrl}}" ], "path": [ "users", "019904db-83e9-702c-a604-8a16e4375db7" ], "query": [ { "key": "with_roles", "value": "true" }, { "key": "with_permissions", "value": "true" } ] } }, "response": [] }, { "name": "brokers", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has user data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json().data).to.have.property('id');", " pm.expect(pm.response.json().data).to.have.property('full_name');", " pm.expect(pm.response.json().data).to.have.property('email');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/brokers", "host": [ "{{baseUrl}}" ], "path": [ "users", "brokers" ] } }, "response": [] }, { "name": "Create User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([201, 422]);", "});", "pm.test('Response has user data for success', function () {", " if (pm.response.code === 201) {", " pm.expect(pm.response.json().data).to.have.property('id');", " pm.expect(pm.response.json().data).to.have.property('full_name');", " pm.expect(pm.response.json().data).to.have.property('email');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"employee_id\": \"EMP00123\",\n \"full_name\": \"Jane Doe\",\n \"email\": \"jane.doe@company.co.tz\",\n \"phone_number\": \"+255712345678\",\n \"role\": \"insurance_broker\",\n \"branch_id\": \"branch-uuid\",\n \"department\": \"Sales\",\n \"password\": \"password123\"\n}" }, "url": { "raw": "{{baseUrl}}/users", "host": [ "{{baseUrl}}" ], "path": [ "users" ] } }, "response": [] }, { "name": "Update User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response has user data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json().data).to.have.property('id');", " pm.expect(pm.response.json().data).to.have.property('full_name');", " pm.expect(pm.response.json().data).to.have.property('email');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"full_name\": \"Jane Updated Doe\",\n \"email\": \"jane.updated@company.co.tz\",\n \"phone_number\": \"+255712345679\",\n \"role\": \"auditor\"\n}" }, "url": { "raw": "{{baseUrl}}/users/{{userId}}", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}" ] } }, "response": [] }, { "name": "Delete User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 204 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([204, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/users/{{userId}}", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}" ] } }, "response": [] }, { "name": "List Roles", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has success and data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('message');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/roles", "host": [ "{{baseUrl}}" ], "path": [ "users", "roles" ] } }, "response": [] }, { "name": "List Permissions", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has success and data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('message');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/permissions", "host": [ "{{baseUrl}}" ], "path": [ "users", "permissions" ] } }, "response": [] }, { "name": "Get User Roles", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has success and data array for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('message');", " pm.response.json().data.forEach(role => {", " pm.expect(role).to.have.property('id');", " pm.expect(role).to.have.property('name');", " });", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/{{userId}}/roles", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}", "roles" ] } }, "response": [] }, { "name": "Get User Permissions", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has success and data array for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('message');", " pm.response.json().data.forEach(permission => {", " pm.expect(permission).to.have.property('id');", " pm.expect(permission).to.have.property('name');", " pm.expect(permission).to.have.property('display_name');", " pm.expect(permission).to.have.property('guard_name');", " pm.expect(permission).to.have.property('created_at');", " });", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/{{userId}}/permissions", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}", "permissions" ] } }, "response": [] }, { "name": "Assign Roles to User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Roles assigned successfully', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json()).to.have.property('message', 'Roles assigned successfully.');", " pm.expect(pm.response.json().data).to.have.property('roles');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"roles\": [\"role_name\"]\n}" }, "url": { "raw": "{{baseUrl}}/users/{{userId}}/roles", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}", "roles" ] } }, "response": [] }, { "name": "Remove Roles from User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Roles removed successfully', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json()).to.have.property('message', 'Roles removed successfully.');", " pm.expect(pm.response.json().data).to.have.property('roles');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"roles\": [\"role_name\"]\n}" }, "url": { "raw": "{{baseUrl}}/users/{{userId}}/roles", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}", "roles" ] } }, "response": [] }, { "name": "Assign Permissions to User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Permissions assigned successfully', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json()).to.have.property('message', 'Permissions assigned successfully.');", " pm.expect(pm.response.json().data).to.have.property('permissions');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"permissions\": [\"permission_name\"]\n}" }, "url": { "raw": "{{baseUrl}}/users/{{userId}}/permissions", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}", "permissions" ] } }, "response": [] }, { "name": "Remove Permissions from User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Permissions removed successfully', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json()).to.have.property('message', 'Permissions removed successfully.');", " pm.expect(pm.response.json().data).to.have.property('permissions');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"permissions\": [\"permission_name\"]\n}" }, "url": { "raw": "{{baseUrl}}/users/{{userId}}/permissions", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}", "permissions" ] } }, "response": [] }, { "name": "Bulk Delete Users", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 204 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([204, 422]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"user_ids\": [\"uuid1\", \"uuid2\"]\n}" }, "url": { "raw": "{{baseUrl}}/users/bulk", "host": [ "{{baseUrl}}" ], "path": [ "users", "bulk" ] } }, "response": [] }, { "name": "Restore User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('User restored successfully', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json()).to.have.property('message', 'User restored successfully.');", " pm.expect(pm.response.json().data).to.have.property('id');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/users/{{userId}}/restore", "host": [ "{{baseUrl}}" ], "path": [ "users", "{{userId}}", "restore" ] } }, "response": [] }, { "name": "Get Users by Permission", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Users with permission retrieved', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('message');", " } else if (pm.response.code === 404) {", " pm.expect(pm.response.json()).to.have.property('message');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/permissions/{{permissionName}}", "host": [ "{{baseUrl}}" ], "path": [ "users", "permissions", "{{permissionName}}" ] } }, "response": [] }, { "name": "Get Users by Role", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Users with role retrieved', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('message');", " } else if (pm.response.code === 404) {", " pm.expect(pm.response.json()).to.have.property('message');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/users/roles/{{roleName}}", "host": [ "{{baseUrl}}" ], "path": [ "users", "roles", "{{roleName}}" ] } }, "response": [] } ] }, { "name": "Branches", "item": [ { "name": "List Branches", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has data and pagination for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('meta');", " pm.expect(pm.response.json().meta).to.have.property('current_page');", " pm.expect(pm.response.json().meta).to.have.property('per_page');", " pm.expect(pm.response.json().meta).to.have.property('total');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Branches retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/branches", "host": [ "{{baseUrl}}" ], "path": [ "branches" ], "query": [ { "key": "page", "value": "1", "description": "Page number for pagination", "disabled": true }, { "key": "limit", "value": "15", "description": "Number of items per page", "disabled": true }, { "key": "status", "value": "active", "description": "Filter by status (active/inactive)", "disabled": true }, { "key": "search", "value": "", "description": "Search by branch name or location", "disabled": true } ] } }, "response": [] }, { "name": "List Branches with Filters", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has filtered data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('meta');", " pm.expect(pm.response.json().meta).to.have.property('current_page');", " pm.expect(pm.response.json().meta).to.have.property('per_page');", " pm.expect(pm.response.json().meta).to.have.property('total');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Branches retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/branches?status=active&search=Test", "host": [ "{{baseUrl}}" ], "path": [ "branches" ], "query": [ { "key": "status", "value": "active" }, { "key": "search", "value": "Test" }, { "key": "page", "value": "1", "disabled": true }, { "key": "limit", "value": "15", "disabled": true } ] } }, "response": [] }, { "name": "Get Branch by ID", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.have.property('id');", " pm.expect(pm.response.json().data).to.have.property('name');", " pm.expect(pm.response.json().data).to.have.property('location');", " pm.expect(pm.response.json().data).to.have.property('status');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Branch retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});", "pm.test('Response includes error for not found', function () {", " if (pm.response.code === 404) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Not Found');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/branches/{{branchId}}", "host": [ "{{baseUrl}}" ], "path": [ "branches", "{{branchId}}" ] } }, "response": [] }, { "name": "Create Branch", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201, 403, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([201, 403, 422]);", "});", "pm.test('Response has data for success', function () {", " if (pm.response.code === 201) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.have.property('id');", " pm.expect(pm.response.json().data).to.have.property('name');", " pm.expect(pm.response.json().data).to.have.property('location');", " pm.expect(pm.response.json().data).to.have.property('status');", " }", "});", "pm.test('Rate limit headers present for non-403', function () {", " if (pm.response.code !== 403) {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", " }", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 201) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Branch created successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});", "pm.test('Response includes validation error for invalid data', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('details');", " pm.expect(pm.response.json().error).to.have.property('message').that.equals('Validation failed');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"name\": \"New Branch\",\n \"location\": \"Test Location\",\n \"status\": \"active\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/branches", "host": [ "{{baseUrl}}" ], "path": [ "branches" ] } }, "response": [] }, { "name": "Create Branch (Invalid Data)", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 403 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([403, 422]);", "});", "pm.test('Response includes validation error for invalid data', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('details');", " pm.expect(pm.response.json().error).to.have.property('message').that.equals('Validation failed');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});", "pm.test('Rate limit headers present for non-403', function () {", " if (pm.response.code !== 403) {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"name\": \"\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/branches", "host": [ "{{baseUrl}}" ], "path": [ "branches" ] } }, "response": [] }, { "name": "Update Branch", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, 404, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404, 422]);", "});", "pm.test('Response has data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.have.property('id');", " pm.expect(pm.response.json().data).to.have.property('name');", " pm.expect(pm.response.json().data).to.have.property('location');", " pm.expect(pm.response.json().data).to.have.property('status');", " }", "});", "pm.test('Rate limit headers present for non-403', function () {", " if (pm.response.code !== 403) {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", " }", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Branch updated successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});", "pm.test('Response includes error for not found', function () {", " if (pm.response.code === 404) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Not Found');", " }", "});", "pm.test('Response includes validation error for invalid data', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('details');", " pm.expect(pm.response.json().error).to.have.property('message').that.equals('Validation failed');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"name\": \"Updated Branch\",\n \"location\": \"Updated Location\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/branches/{{branchId}}", "host": [ "{{baseUrl}}" ], "path": [ "branches", "{{branchId}}" ] } }, "response": [] }, { "name": "Update Branch (Invalid Data)", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 403, 404, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([403, 404, 422]);", "});", "pm.test('Response includes validation error for invalid data', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('details');", " pm.expect(pm.response.json().error).to.have.property('message').that.equals('Validation failed');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});", "pm.test('Response includes error for not found', function () {", " if (pm.response.code === 404) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Not Found');", " }", "});", "pm.test('Rate limit headers present for non-403', function () {", " if (pm.response.code !== 403) {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"name\": \"\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/branches/1", "host": [ "{{baseUrl}}" ], "path": [ "branches", "1" ] } }, "response": [] }, { "name": "Delete Branch", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 204, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([204, 403, 404]);", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 204) {", " pm.expect(pm.response.json()).to.be.empty;", " }", "});", "pm.test('Rate limit headers present for non-403', function () {", " if (pm.response.code !== 403) {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});", "pm.test('Response includes error for not found', function () {", " if (pm.response.code === 404) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Not Found');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/branches/{{branchId}}", "host": [ "{{baseUrl}}" ], "path": [ "branches", "{{branchId}}" ] } }, "response": [] } ] }, { "name": "Clients", "item": [ { "name": "List Clients", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response is an array', function () {", " pm.expect(pm.response.json()).to.be.an('array');", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/clients?page=1&limit=20", "host": [ "{{baseUrl}}" ], "path": [ "clients" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "20" }, { "key": "type", "value": "individual", "disabled": true }, { "key": "status", "value": "active", "disabled": true } ] } }, "response": [] }, { "name": "Get Client", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/clients/1", "host": [ "{{baseUrl}}" ], "path": [ "clients", "1" ] } }, "response": [] }, { "name": "Create Individual Client", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201', function () {", " pm.response.to.have.status(201);", "});", "pm.test('Response has client ID', function () {", " pm.expect(pm.response.json()).to.have.property('id');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"title\": \"Mr\",\n \"first_name\": \"John\",\n \"middle_name\": \"Peter\",\n \"last_name\": \"Mwalimu\",\n \"date_of_birth\": \"1985-03-15\",\n \"gender\": \"male\",\n \"marital_status\": \"married\",\n \"national_id\": \"19850315-12345-67890-15\",\n \"occupation\": \"Teacher\",\n \"employer\": \"Dar es Salaam Secondary School\",\n \"annual_income\": 18000000,\n \"email\": \"john.mwalimu@gmail.com\",\n \"primary_phone\": \"+255712111222\",\n \"physical_address\": \"Kinondoni, Dar es Salaam\",\n \"region\": \"Dar es Salaam\",\n \"district\": \"Kinondoni\",\n \"assigned_broker_id\": \"uuid1\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/clients/individual", "host": [ "{{baseUrl}}" ], "path": [ "clients", "individual" ] } }, "response": [] }, { "name": "Create Corporate Client", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201', function () {", " pm.response.to.have.status(201);", "});", "pm.test('Response has client ID', function () {", " pm.expect(pm.response.json()).to.have.property('id');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"company_name\": \"ABC Trading Ltd\",\n \"business_registration_number\": \"REG123456\",\n \"tin_number\": \"123-456-789\",\n \"vat_registration_number\": \"VAT123456\",\n \"industry_type\": \"Trading\",\n \"business_nature\": \"Import and Export\",\n \"incorporation_date\": \"2010-05-20\",\n \"authorized_capital\": 100000000,\n \"number_of_employees\": 25,\n \"annual_turnover\": 500000000,\n \"physical_address\": \"Kariakoo, Dar es Salaam\",\n \"contact_person_name\": \"Joseph Mwenda\",\n \"contact_person_phone\": \"+255745444555\",\n \"contact_person_email\": \"joseph@abc.co.tz\",\n \"assigned_broker_id\": \"uuid1\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/clients/corporate", "host": [ "{{baseUrl}}" ], "path": [ "clients", "corporate" ] } }, "response": [] }, { "name": "Update Client", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"first_name\": \"Updated John\",\n \"last_name\": \"Mwalimu\",\n \"email\": \"updated.john@gmail.com\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/clients/1", "host": [ "{{baseUrl}}" ], "path": [ "clients", "1" ] } }, "response": [] }, { "name": "Delete Client", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/clients/1", "host": [ "{{baseUrl}}" ], "path": [ "clients", "1" ] } }, "response": [] }, { "name": "Get Client Policies", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response is an array for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.be.an('array');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/clients/1/policies", "host": [ "{{baseUrl}}" ], "path": [ "clients", "1", "policies" ] } }, "response": [] }, { "name": "Get Client Claims", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response is an array for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.be.an('array');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/clients/1/claims", "host": [ "{{baseUrl}}" ], "path": [ "clients", "1", "claims" ] } }, "response": [] } ] }, { "name": "Insurers", "item": [ { "name": "List Insurers", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response is an array', function () {", " pm.expect(pm.response.json()).to.be.an('array');", "});" ], "type": "text/javascript", "packages": {}, "requests": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/insurance-companies?page=1&limit=20&status=active&with_policies=1&with_products=1&with_stats=1", "host": [ "{{baseUrl}}" ], "path": [ "insurance-companies" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "20" }, { "key": "status", "value": "active" }, { "key": "with_policies", "value": "1" }, { "key": "with_products", "value": "1" }, { "key": "with_stats", "value": "1" } ] } }, "response": [] }, { "name": "Get Insurance Company", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript", "packages": {}, "requests": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/insurance-companies/{{id}}", "host": [ "{{baseUrl}}" ], "path": [ "insurance-companies", "{{id}}" ] } }, "response": [] }, { "name": "Create Insurance Company", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201', function () {", " pm.response.to.have.status(201);", "});", "pm.test('Response has company ID', function () {", " pm.expect(pm.response.json()).to.have.property('id');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"company_code\": \"ABC001\",\n \"company_name\": \"ABC Insurance Ltd\",\n \"license_number\": \"LIC001\",\n \"registration_number\": \"REG12345\",\n \"tin_number\": \"123-456-789\",\n \"physical_address\": \"Samora Avenue, Dar es Salaam\",\n \"contact_person\": \"David Mwenda\",\n \"phone_number\": \"+255222111222\",\n \"email\": \"info@abc.co.tz\",\n \"commission_structure\": {\n \"motor\": 15,\n \"health\": 12,\n \"property\": 10,\n \"life\": 20\n },\n \"payment_terms\": 30\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/insurance-companies", "host": [ "{{baseUrl}}" ], "path": [ "insurance-companies" ] } }, "response": [] }, { "name": "Update Insurance Company", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"company_name\": \"Updated ABC Insurance\",\n \"contact_person\": \"David Mwenda Jr\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/insurance-companies/1", "host": [ "{{baseUrl}}" ], "path": [ "insurance-companies", "1" ] } }, "response": [] }, { "name": "Delete Insurance Company", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/insurance-companies/1", "host": [ "{{baseUrl}}" ], "path": [ "insurance-companies", "1" ] } }, "response": [] } ] }, { "name": "Products", "item": [ { "name": "List Products", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response is an array', function () {", " pm.expect(pm.response.json()).to.be.an('array');", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/products", "host": [ "{{baseUrl}}" ], "path": [ "products" ], "query": [ { "key": "with_insurance_company", "value": "true", "disabled": true }, { "key": "with_policies", "value": "true", "disabled": true }, { "key": "with_quotations", "value": "true", "disabled": true }, { "key": "with_invoice_line_items", "value": "true", "disabled": true } ] } }, "response": [] }, { "name": "Get Product", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/products/1", "host": [ "{{baseUrl}}" ], "path": [ "products", "1" ] } }, "response": [] }, { "name": "Create Product", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201', function () {", " pm.response.to.have.status(201);", "});", "pm.test('Response has product ID', function () {", " pm.expect(pm.response.json()).to.have.property('id');", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"product_code\": \"MAR001\",\n \"product_name\": \"Comprehensive Marine Insurance\",\n \"insurance_company_id\": \"57b00d5e-72f6-4eee-b1d1-f9c992251dc0\",\n \"product_category\": \"Marine\",\n \"product_type\": \"Comprehensive\",\n \"coverage_description\": \"Full coverage for motor vehicles\",\n \"premium_calculation_method\": \"percentage\",\n \"minimum_premium\": 500000,\n \"maximum_premium\": 50000000,\n \"commission_rate\": 15.00,\n \"broker_commission\": 12.00,\n \"age_limit_min\": 18,\n \"age_limit_max\": 75,\n \"sum_insured_min\": 5000000,\n \"sum_insured_max\": 500000000\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/products", "host": [ "{{baseUrl}}" ], "path": [ "products" ] } }, "response": [] }, { "name": "Update Product", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"product_name\": \"Updated Motor Insurance\",\n \"premium_calculation_method\": \"fixed\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/products/1", "host": [ "{{baseUrl}}" ], "path": [ "products", "1" ] } }, "response": [] }, { "name": "Delete Product", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/products/1", "host": [ "{{baseUrl}}" ], "path": [ "products", "1" ] } }, "response": [] } ] }, { "name": "Quotations", "item": [ { "name": "List Quotations", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response is an array', function () {", " pm.expect(pm.response.json()).to.be.an('array');", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/quotations?page=1&limit=20&date_from=2025-06-01&date_to=2025-09-16&client_type=corporate&with_clients=true&with_products=true&with_insurance_companies=true&with_brokers=true&with_policies=true", "host": [ "{{baseUrl}}" ], "path": [ "quotations" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "20" }, { "key": " filters", "value": "", "disabled": true }, { "key": "status", "value": "approved", "disabled": true }, { "key": "client_id", "value": "123e4567-e89b-12d3-a456-426614174000", "disabled": true }, { "key": "broker_id", "value": "123e4567-e89b-12d3-a456-426614174999", "disabled": true }, { "key": "date_from", "value": "2025-06-01" }, { "key": "date_to", "value": "2025-09-16" }, { "key": "currency", "value": "USD", "disabled": true }, { "key": "client_type", "value": "corporate" }, { "key": "payment_frequency", "value": "annual", "disabled": true }, { "key": "product_id", "value": "123e4567-e89b-12d3-a456-426614174111", "disabled": true }, { "key": "search", "value": "acme", "disabled": true }, { "key": " relations", "value": "", "disabled": true }, { "key": "with_clients", "value": "true" }, { "key": "with_products", "value": "true" }, { "key": "with_insurance_companies", "value": "true" }, { "key": "with_brokers", "value": "true" }, { "key": "with_policies", "value": "true" } ] } }, "response": [] }, { "name": "Get Quotation", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/quotations/1", "host": [ "{{baseUrl}}" ], "path": [ "quotations", "1" ] } }, "response": [] }, { "name": "Create Quotation", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201', function () {", " pm.response.to.have.status(201);", "});", "pm.test('Response has quotation ID', function () {", " pm.expect(pm.response.json()).to.have.property('id');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"client_id\": \"uuid1\",\n \"client_type\": \"individual\",\n \"product_id\": \"uuid1\",\n \"insurance_company_id\": \"uuid1\",\n \"broker_id\": \"uuid1\",\n \"quote_date\": \"2025-01-15\",\n \"valid_until_date\": \"2025-02-14\",\n \"sum_insured\": 25000000,\n \"premium_amount\": 1250000,\n \"payment_frequency\": \"annual\",\n \"currency\": \"TZS\",\n \"risk_assessment\": \"Low risk client\",\n \"terms_and_conditions\": \"Standard terms apply\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/quotations", "host": [ "{{baseUrl}}" ], "path": [ "quotations" ] } }, "response": [] }, { "name": "Update Quotation", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"premium_amount\": 1300000,\n \"risk_assessment\": \"Medium risk client\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/quotations/1", "host": [ "{{baseUrl}}" ], "path": [ "quotations", "1" ] } }, "response": [] }, { "name": "Convert Quotation to Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/quotations/1/convert-to-policy", "host": [ "{{baseUrl}}" ], "path": [ "quotations", "1", "convert-to-policy" ] } }, "response": [] }, { "name": "Delete Quotation", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/quotations/1", "host": [ "{{baseUrl}}" ], "path": [ "quotations", "1" ] } }, "response": [] }, { "name": "Generate Quotation PDF", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/quotations/1/pdf", "host": [ "{{baseUrl}}" ], "path": [ "quotations", "1", "pdf" ] } }, "response": [] } ] }, { "name": "Policies", "item": [ { "name": "List Policies", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response is a paginated object', function () {", " pm.expect(pm.response.json()).to.have.property('data').that.is.an('array');", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/policies?page=1&per_page=15&with_client=1&with_product=1&with_insurance_company=1&with_broker=1&with_claims=1&with_payments=1&with_quote=1&with_invoices=1&with_receipts=1&with_invoice_line_items=1", "host": [ "{{baseUrl}}" ], "path": [ "policies" ], "query": [ { "key": "page", "value": "1" }, { "key": "per_page", "value": "15" }, { "key": "status", "value": "active", "disabled": true }, { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" }, { "key": "with_insurance_company", "value": "1" }, { "key": "with_broker", "value": "1" }, { "key": "with_claims", "value": "1" }, { "key": "with_payments", "value": "1" }, { "key": "with_quote", "value": "1" }, { "key": "with_invoices", "value": "1" }, { "key": "with_receipts", "value": "1" }, { "key": "with_invoice_line_items", "value": "1" } ] } }, "response": [] }, { "name": "Get Policy Certificate PDF", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response is a PDF', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.headers.get('Content-Type')).to.include('application/pdf');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/policies/:policy/certificate/pdf", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":policy", "certificate", "pdf" ], "variable": [ { "key": "policy", "value": "uuid1" } ] } }, "response": [] }, { "name": "List Expiring Policies", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.response.to.have.status(200);", "});", "pm.test('Response is a paginated object', function () {", " pm.expect(pm.response.json()).to.have.property('data').that.is.an('array');", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/policies/expiring?days=60&with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", "expiring" ], "query": [ { "key": "days", "value": "60" }, { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" }, { "key": "client_id", "value": "uuid1", "disabled": true } ] } }, "response": [] }, { "name": "Get Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404, 403]);", "});" ], "type": "text/javascript", "packages": {}, "requests": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/policies/{{id}}?with_client=1&with_product=1&with_insurance_company=1&with_broker=1&with_claims=1&with_payments=1&with_quote=1&with_invoices=1&with_receipts=1&with_invoice_line_items=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", "{{id}}" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" }, { "key": "with_insurance_company", "value": "1" }, { "key": "with_broker", "value": "1" }, { "key": "with_claims", "value": "1" }, { "key": "with_payments", "value": "1" }, { "key": "with_quote", "value": "1" }, { "key": "with_invoices", "value": "1" }, { "key": "with_receipts", "value": "1" }, { "key": "with_invoice_line_items", "value": "1" } ] } }, "response": [] }, { "name": "Create Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([201, 403]);", "});", "pm.test('Response has policy ID', function () {", " if (pm.response.code === 201) {", " pm.expect(pm.response.json()).to.have.property('id');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"quote_id\": \"uuid1\",\n \"client_id\": \"uuid1\",\n \"client_type\": \"App\\\\Models\\\\IndividualClient\",\n \"product_id\": \"uuid1\",\n \"insurance_company_id\": \"uuid1\",\n \"broker_id\": \"uuid1\",\n \"policy_start_date\": \"2025-02-01\",\n \"policy_end_date\": \"2026-01-31\",\n \"sum_insured\": 25000000,\n \"premium_amount\": 1250000,\n \"payment_frequency\": \"annual\",\n \"currency\": \"TZS\",\n \"exchange_rate\": 1.0,\n \"payment_status\": \"pending\",\n \"policy_status\": \"active\",\n \"special_conditions\": \"No special conditions\",\n \"beneficiaries\": [],\n \"attachments\": [],\n \"notes\": \"Initial policy creation\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/policies?with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" } ] } }, "response": [] }, { "name": "Update Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"premium_amount\": 1300000,\n \"special_conditions\": \"Updated conditions\",\n \"payment_status\": \"partial\",\n \"notes\": \"Updated policy details\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/policies/:id?with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":id" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" } ], "variable": [ { "key": "id", "value": "uuid1" } ] } }, "response": [] }, { "name": "Delete Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 204, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([204, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/policies/:id", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":id" ], "variable": [ { "key": "id", "value": "uuid1" } ] } }, "response": [] }, { "name": "Renew Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/policies/:id/renew?with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":id", "renew" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" } ], "variable": [ { "key": "id", "value": "uuid1" } ] } }, "response": [] }, { "name": "Cancel Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/policies/:id/cancel?with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":id", "cancel" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" } ], "variable": [ { "key": "id", "value": "uuid1" } ] } }, "response": [] }, { "name": "Suspend Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/policies/:id/suspend?with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":id", "suspend" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" } ], "variable": [ { "key": "id", "value": "uuid1" } ] } }, "response": [] }, { "name": "Reinstate Policy", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/policies/:id/reinstate?with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":id", "reinstate" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" } ], "variable": [ { "key": "id", "value": "uuid1" } ] } }, "response": [] }, { "name": "Issue Policy Certificate", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has certificate number', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('certificate_number');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "url": { "raw": "{{baseUrl}}/policies/:id/issue-certificate?with_client=1&with_product=1", "host": [ "{{baseUrl}}" ], "path": [ "policies", ":id", "issue-certificate" ], "query": [ { "key": "with_client", "value": "1" }, { "key": "with_product", "value": "1" } ], "variable": [ { "key": "id", "value": "uuid1" } ] } }, "response": [] } ] }, { "name": "Claims", "item": [ { "name": "List Claims", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Response has paginated data', function () {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('data').that.is.an('array');", " pm.expect(jsonData).to.have.property('meta').that.includes.keys('current_page', 'last_page', 'per_page', 'total');", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/claims?page=1&limit=10&with_client=true&with_policy=true&with_insurance_company=true", "host": [ "{{baseUrl}}" ], "path": [ "claims" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "10" }, { "key": "with_client", "value": "true" }, { "key": "with_policy", "value": "true" }, { "key": "with_insurance_company", "value": "true" }, { "key": "status", "value": "Reported", "disabled": true }, { "key": "policy_id", "value": "{{policyId}}", "disabled": true }, { "key": "client_id", "value": "{{clientId}}", "disabled": true }, { "key": "date_from", "value": "2025-01-01", "disabled": true }, { "key": "date_to", "value": "2025-12-31", "disabled": true } ] } }, "response": [] }, { "name": "Get Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response has claim data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('claim_number');", " pm.expect(jsonData).to.have.property('claim_date');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/claims/{{claimId}}?with_client=true&with_policy=true&with_insurance_company=true", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}" ], "query": [ { "key": "with_client", "value": "true" }, { "key": "with_policy", "value": "true" }, { "key": "with_insurance_company", "value": "true" } ] } }, "response": [] }, { "name": "Create Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([201, 422]);", "});", "pm.test('Response has claim data for success', function () {", " if (pm.response.code === 201) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('claim_number');", " pm.expect(jsonData).to.have.property('claim_date');", " pm.expect(jsonData).to.have.property('claim_status').that.equals('Reported');", " pm.environment.set('claimId', jsonData.id);", " }", "});", "pm.test('Response has validation errors for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('errors');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"policy_id\": \"{{policyId}}\",\n \"client_id\": \"{{clientId}}\",\n \"client_type\": \"App\\\\Models\\\\IndividualClient\",\n \"insurance_company_id\": \"{{insuranceCompanyId}}\",\n \"claim_date\": \"2025-01-20\",\n \"incident_date\": \"2025-01-18\",\n \"incident_location\": \"Dar es Salaam\",\n \"claim_type\": \"Accident\",\n \"claim_amount\": 5000000,\n \"description\": \"Vehicle accident on Morogoro Road\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/claims", "host": [ "{{baseUrl}}" ], "path": [ "claims" ] } }, "response": [] }, { "name": "Update Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Response has claim data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('claim_amount');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"claim_amount\": 5500000,\n \"description\": \"Updated: Vehicle accident with additional damages\",\n \"incident_location\": \"Kinondoni, Dar es Salaam\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/claims/{{claimId}}", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}" ] } }, "response": [] }, { "name": "Delete Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response has success message for deletion', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Claim deleted successfully');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/claims/{{claimId}}", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}" ] } }, "response": [] }, { "name": "Approve Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Response has updated claim status for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('claim_status').that.equals('Approved');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"approved_amount\": 4500000,\n \"adjuster_notes\": \"Claim approved with deductible applied\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/claims/{{claimId}}/approve", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}", "approve" ] } }, "response": [] }, { "name": "Reject Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Response has updated claim status for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('claim_status').that.equals('Rejected');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"rejection_reason\": \"Claim falls under policy exclusions\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/claims/{{claimId}}/reject", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}", "reject" ] } }, "response": [] }, { "name": "Settle Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 400, 422, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 400, 422, 404]);", "});", "pm.test('Response has updated claim status for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('claim_status').that.equals('Settled');", " }", "});", "pm.test('Response has error for unapproved claim', function () {", " if (pm.response.code === 400) {", " pm.expect(pm.response.json()).to.have.property('error').that.equals('Claim must be approved before settlement');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"settlement_amount\": 4500000,\n \"payment_method\": \"bank_transfer\",\n \"bank_details\": {\n \"bank_name\": \"CRDB Bank\",\n \"account_number\": \"0123456789\"\n }\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/claims/{{claimId}}/settle", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}", "settle" ] } }, "response": [] }, { "name": "Export Claim", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 422, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Response has export job data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('export_number');", " pm.expect(jsonData).to.have.property('status').that.equals('pending');", " pm.environment.set('exportId', jsonData.id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"format\": \"pdf\",\n \"template_id\": \"{{templateId}}\",\n \"email_recipients\": [\"user@company.co.tz\"],\n \"password_protect\": true\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/claims/{{claimId}}/export", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}", "export" ] } }, "response": [] }, { "name": "Print Claim Form", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 422, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Response has print job data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('status').that.equals('pending');", " pm.environment.set('printJobId', jsonData.id);", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"document_type\": \"claim_form\",\n \"template_id\": \"{{templateId}}\",\n \"printer_id\": \"{{printerId}}\",\n \"copies\": 1,\n \"duplex\": false,\n \"color\": false,\n \"paper_size\": \"A4\",\n \"orientation\": \"portrait\",\n \"watermark\": \"ORIGINAL\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/claims/{{claimId}}/print-form", "host": [ "{{baseUrl}}" ], "path": [ "claims", "{{claimId}}", "print-form" ] } }, "response": [] } ] }, { "name": "Payments", "item": [ { "name": "List Payments", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Response has paginated data', function () {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('data').that.is.an('array');", " pm.expect(jsonData).to.have.property('meta').that.includes.keys('current_page', 'last_page', 'per_page', 'total');", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript", "packages": {}, "requests": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/payments?page=1&limit=10&status=pending&with_client=true&with_policy=true&with_stats=true", "host": [ "{{baseUrl}}" ], "path": [ "payments" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "10" }, { "key": "status", "value": "pending" }, { "key": "policy_id", "value": "{{policyId}}", "disabled": true }, { "key": "client_id", "value": "{{clientId}}", "disabled": true }, { "key": "date_from", "value": "2025-01-01", "disabled": true }, { "key": "date_to", "value": "2025-12-31", "disabled": true }, { "key": "with_client", "value": "true" }, { "key": "with_policy", "value": "true" }, { "key": "with_stats", "value": "true" } ] } }, "response": [] }, { "name": "Get Payment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response has payment data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('payment_number');", " pm.expect(jsonData).to.have.property('payment_date');", " pm.expect(jsonData).to.have.property('amount_paid');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/payments/{{paymentId}}", "host": [ "{{baseUrl}}" ], "path": [ "payments", "{{paymentId}}" ] } }, "response": [] }, { "name": "Create Payment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([201, 422]);", "});", "pm.test('Response has payment data for success', function () {", " if (pm.response.code === 201) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('payment_number');", " pm.expect(jsonData).to.have.property('payment_date');", " pm.expect(jsonData).to.have.property('payment_status');", " pm.environment.set('paymentId', jsonData.id);", " }", "});", "pm.test('Response has validation errors for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('errors');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"policy_id\": \"{{policyId}}\",\n \"client_id\": \"{{clientId}}\",\n \"client_type\": \"App\\\\Models\\\\IndividualClient\",\n \"payment_date\": \"2025-02-01\",\n \"amount_due\": 1250000,\n \"amount_paid\": 944000,\n \"payment_method\": \"mobile_money\",\n \"payment_reference\": \"MP25020112345\",\n \"currency\": \"TZS\",\n \"mobile_money_number\": \"+255712345678\",\n \"receipt_number\": \"RCP001/2025\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/payments", "host": [ "{{baseUrl}}" ], "path": [ "payments" ] } }, "response": [] }, { "name": "Update Payment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Response has payment data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('amount_paid');", " pm.expect(jsonData).to.have.property('payment_status');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"amount_paid\": 1000000,\n \"payment_method\": \"bank_transfer\",\n \"bank_name\": \"CRDB Bank\",\n \"account_number\": \"0123456789\",\n \"payment_reference\": \"TXN123456789\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/payments/{{paymentId}}", "host": [ "{{baseUrl}}" ], "path": [ "payments", "{{paymentId}}" ] } }, "response": [] }, { "name": "Delete Payment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response has success message for deletion', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Payment deleted successfully');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/payments/{{paymentId}}", "host": [ "{{baseUrl}}" ], "path": [ "payments", "{{paymentId}}" ] } }, "response": [] }, { "name": "Refund Payment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Response has updated payment status for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('payment_status').that.equals('refunded');", " }", "});", "pm.test('Response has validation errors for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('errors');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"refund_amount\": 944000,\n \"refund_reason\": \"Customer requested refund due to policy cancellation\",\n \"payment_method\": \"mobile_money\",\n \"payment_reference\": \"REF25020112345\",\n \"mobile_money_number\": \"+255712345678\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/payments/{{paymentId}}/refund", "host": [ "{{baseUrl}}" ], "path": [ "payments", "{{paymentId}}", "refund" ] } }, "response": [] }, { "name": "Export Payments", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Response has export job data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('export');", " pm.expect(jsonData.export).to.have.property('id');", " pm.expect(jsonData.export).to.have.property('export_number');", " pm.expect(jsonData.export).to.have.property('status').that.equals('pending');", " pm.environment.set('exportId', jsonData.export.id);", " }", "});", "pm.test('Response has validation errors for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('errors');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/payments/export?status=pending&date_from=2025-01-01&date_to=2025-12-31", "host": [ "{{baseUrl}}" ], "path": [ "payments", "export" ], "query": [ { "key": "status", "value": "pending" }, { "key": "date_from", "value": "2025-01-01" }, { "key": "date_to", "value": "2025-12-31" }, { "key": "policy_id", "value": "{{policyId}}", "disabled": true }, { "key": "client_id", "value": "{{clientId}}", "disabled": true } ] } }, "response": [] }, { "name": "Get Outstanding Payments", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Response has paginated data', function () {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('data').that.is.an('array');", " pm.expect(jsonData).to.have.property('meta').that.includes.keys('current_page', 'last_page', 'per_page', 'total');", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/payments/outstanding?page=1&limit=10&overdue_only=true", "host": [ "{{baseUrl}}" ], "path": [ "payments", "outstanding" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "10" }, { "key": "overdue_only", "value": "true" }, { "key": "client_id", "value": "{{clientId}}", "disabled": true }, { "key": "broker_id", "value": "{{brokerId}}", "disabled": true } ] } }, "response": [] } ] }, { "name": "Disbursements", "item": [ { "name": "List Disbursements", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Response has paginated data', function () {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('data').that.is.an('array');", " pm.expect(jsonData).to.have.property('meta').that.includes.keys('current_page', 'last_page', 'per_page', 'total');", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript", "packages": {}, "requests": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/disbursements?page=1&limit=15&with_stats=1", "host": [ "{{baseUrl}}" ], "path": [ "disbursements" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "15" }, { "key": "status", "value": "processed", "disabled": true }, { "key": "company_id", "value": "{{insuranceCompanyId}}", "disabled": true }, { "key": "date_from", "value": "2025-01-01", "disabled": true }, { "key": "date_to", "value": "2025-12-31", "disabled": true }, { "key": "with_stats", "value": "1" } ] } }, "response": [] }, { "name": "Get Disbursement", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "pm.test('Response has disbursement data for success', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('id');", " pm.expect(jsonData).to.have.property('disbursement_number');", " pm.expect(jsonData).to.have.property('total_amount');", " pm.expect(jsonData).to.have.property('items').that.is.an('array');", " pm.expect(jsonData.items[0]).to.have.property('policy_number');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}" ] } }, "response": [] }, { "name": "Create Disbursement", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([201, 422]);", "});", "pm.test('Response has disbursement data for success', function () {", " if (pm.response.code === 201) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('success', true);", " pm.expect(jsonData.data).to.have.property('id');", " pm.expect(jsonData.data).to.have.property('disbursement_number');", " pm.expect(jsonData.data.total_amount).to.be.a('number');", " pm.environment.set('disbursementId', jsonData.data.id);", " pm.environment.set('disbursementNumber', jsonData.data.disbursement_number);", " }", "});", "pm.test('Validation errors on failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('errors');", " }", "});" ], "type": "text/javascript", "packages": {}, "requests": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"insurance_company_id\": \"{{insuranceCompanyId}}\",\n \"disbursement_date\": \"2025-03-15\",\n \"payment_method\": \"bank_transfer\",\n \"payment_reference\": \"RTGS250315001\",\n \"bank_name\": \"NMB Bank\",\n \"account_number\": \"0212345678901\",\n \"notes\": \"Monthly premium remittance for March 2025\",\n \"total_amount\": 1498600,\n\n \"items\": [\n {\n \"policy_id\": \"{{policyId}}\"\n },\n {\n \"policy_id\": \"{{policyId2}}\"\n }\n ],\n\n \"receipts\": [\n {\n \"receipt_id\": \"{{receiptId}}\",\n \"allocated_amount\": 1000000\n },\n {\n \"receipt_id\": \"{{recreceiptId2}}\",\n \"allocated_amount\": 498600\n }\n ]\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/disbursements", "host": [ "{{baseUrl}}" ], "path": [ "disbursements" ] } }, "response": [] }, { "name": "Update Disbursement", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422, 404]);", "});", "pm.test('Updated fields are returned', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('success', true);", " pm.expect(jsonData.data).to.have.property('payment_reference');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"payment_reference\": \"RTGS250315001-FINAL\",\n \"notes\": \"Payment confirmed by insurer on 2025-03-18\",\n \"bank_name\": \"NMB Bank - Main Branch\",\n \"exchange_rate\": 1.0\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}" ] } }, "response": [] }, { "name": "Mark Disbursement for Approval", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Status changed to pending_approval', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('success', true);", " pm.expect(jsonData.data.status).to.eql('pending_approval');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}/mark-for-approval", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}", "mark-for-approval" ] } }, "response": [] }, { "name": "Approve Disbursement", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Status changed to approved', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('success', true);", " pm.expect(jsonData.data.status).to.eql('approved');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}/approve", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}", "approve" ] } }, "response": [] }, { "name": "Initiate Payment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Status changed to payment_initiated', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('success', true);", " pm.expect(jsonData.data.status).to.eql('payment_initiated');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"payment_reference\": \"RTGS250315001-INIT\",\n \"notes\": \"Payment initiated via RTGS system\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}/initiate-payment", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}", "initiate-payment" ] } }, "response": [] }, { "name": "Cancel Disbursement", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 422]);", "});", "pm.test('Status changed to cancelled', function () {", " if (pm.response.code === 200) {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('success', true);", " pm.expect(jsonData.data.status).to.eql('cancelled');", " }", "});", "pm.test('Validation error if reason missing', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('errors');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"notes\": \"Insurance company requested cancellation due to policy changes\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}/cancel", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}", "cancel" ] } }, "response": [] }, { "name": "Mark Disbursement as Processed", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Disbursement is now processed', function () {", " pm.expect(pm.response.json()).to.have.property('success', true);", " pm.expect(pm.response.json().message).to.include('processed');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"payment_reference\": \"RTGS250315001-CONFIRMED\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}/process", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}", "process" ] } }, "response": [] }, { "name": "Generate Remittance Advice PDF", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Response is a PDF file', function () {", " const contentType = pm.response.headers.get('Content-Type');", " pm.expect(contentType).to.include('application/pdf');", "});", "pm.test('PDF has correct filename', function () {", " const disposition = pm.response.headers.get('Content-Disposition');", " pm.expect(disposition).to.include('Remittance-Advice-');", " pm.expect(disposition).to.include(pm.environment.get('disbursementNumber'));", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/disbursements/{{disbursementId}}/remittance-advice", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "{{disbursementId}}", "remittance-advice" ] } }, "response": [] }, { "name": "Export Disbursements", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Export job created', function () {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('message').that.includes('Export job');", " pm.expect(jsonData.export).to.have.property('id');", " pm.expect(jsonData.export.status).to.eql('pending');", " pm.environment.set('disbursementExportId', jsonData.export.id);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/disbursements/export?status=processed&date_from=2025-01-01&date_to=2025-12-31", "host": [ "{{baseUrl}}" ], "path": [ "disbursements", "export" ], "query": [ { "key": "status", "value": "processed" }, { "key": "date_from", "value": "2025-01-01" }, { "key": "date_to", "value": "2025-12-31" }, { "key": "company_id", "value": "{{insuranceCompanyId}}", "disabled": true } ] } }, "response": [] } ] }, { "name": "Commissions", "item": [ { "name": "List Commissions", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Response has paginated data', function () {", " const jsonData = pm.response.json();", " pm.expect(jsonData).to.have.property('data').that.is.an('array');", " pm.expect(jsonData.meta).to.have.property('current_page');", " pm.expect(jsonData.meta).to.have.property('per_page');", " pm.expect(jsonData.meta).to.have.property('total');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/commissions?page=1&limit=15&with_policy=1&with_broker=1&with_insurance_company=1&with_payment=1", "host": [ "{{baseUrl}}" ], "path": [ "commissions" ], "query": [ { "key": "page", "value": "1" }, { "key": "limit", "value": "15" }, { "key": "payment_status", "value": "Pending", "disabled": true }, { "key": "policy_id", "value": "{{policyId}}", "disabled": true }, { "key": "broker_id", "value": "{{brokerId}}", "disabled": true }, { "key": "with_policy", "value": "1" }, { "key": "with_broker", "value": "1" }, { "key": "with_insurance_company", "value": "1" }, { "key": "with_payment", "value": "1", "description": "Loads policy.payments" } ] } }, "response": [] }, { "name": "Get Commission", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});", "if (pm.response.code === 200) {", " pm.test('Response contains commission data', function () {", " const json = pm.response.json();", " pm.expect(json).to.have.property('id');", " pm.expect(json).to.have.property('commission_number');", " pm.expect(json).to.have.property('net_commission');", " pm.expect(json).to.have.property('payment_status');", " });", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/commissions/{{commissionId}}?with_policy=1&with_broker=1&with_insurance_company=1", "host": [ "{{baseUrl}}" ], "path": [ "commissions", "{{commissionId}}" ], "query": [ { "key": "with_policy", "value": "1" }, { "key": "with_broker", "value": "1" }, { "key": "with_insurance_company", "value": "1" } ] } }, "response": [] }, { "name": "Create Commission (Adjustment only)", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 201 or 422 or 400', function () {", " pm.expect(pm.response.code).to.be.oneOf([201, 400, 422]);", "});", "if (pm.response.code === 201) {", " pm.test('Commission created successfully', function () {", " const json = pm.response.json();", " pm.expect(json).to.have.property('id');", " pm.expect(json.payment_status).to.eql('Pending');", " pm.environment.set('commissionId', json.id);", " });", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"policy_id\": \"{{policyId}}\",\n \"broker_id\": \"{{brokerId}}\",\n \"insurance_company_id\": \"{{insuranceCompanyId}}\",\n \"commission_type\": \"adjustment\",\n \"commission_rate\": 2.5,\n \"premium_amount\": {{policyPremiumAmount}},\n \"currency\": \"TZS\",\n \"exchange_rate\": 2650.75,\n \"period_from\": \"2025-02-01\",\n \"period_to\": \"2025-12-31\",\n \"notes\": \"Additional commission adjustment due to policy endorsement\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/commissions", "host": [ "{{baseUrl}}" ], "path": [ "commissions" ] } }, "response": [] }, { "name": "Update Commission (only if pending)", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, 404 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404, 422]);", "});", "if (pm.response.code === 200) {", " pm.test('Commission updated', function () {", " const json = pm.response.json();", " pm.expect(json).to.have.property('net_commission');", " });", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"commission_rate\": 3.0,\n \"premium_amount\": {{policyPremiumAmount}},\n \"period_to\": \"2026-01-31\",\n \"notes\": \"Adjusted rate after negotiation\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/commissions/{{commissionId}}", "host": [ "{{baseUrl}}" ], "path": [ "commissions", "{{commissionId}}" ] } }, "response": [] }, { "name": "Delete Commission (only if pending)", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 204, 403 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([204, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/commissions/{{commissionId}}", "host": [ "{{baseUrl}}" ], "path": [ "commissions", "{{commissionId}}" ] } }, "response": [] }, { "name": "Calculate Commission", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', function () {", " pm.expect(pm.response.code).to.equal(200);", "});", "pm.test('Returns calculation breakdown', function () {", " const json = pm.response.json();", " pm.expect(json).to.have.all.keys('gross_commission', 'vat_amount', 'withholding_tax', 'net_commission', 'commission_rate');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"premium_amount\": 5000000,\n \"commission_rate\": 12.5,\n \"currency\": \"TZS\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/commissions/calculate", "host": [ "{{baseUrl}}" ], "path": [ "commissions", "calculate" ] } }, "response": [] }, { "name": "Approve Payment", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, 404 or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404, 422]);", "});", "if (pm.response.code === 200) {", " pm.test('Payment status changed to Paid', function () {", " const json = pm.response.json();", " pm.expect(json.payment_status).to.eql('Paid');", " });", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"payment_date\": \"2025-03-15\",\n \"payment_method\": \"bank_transfer\",\n \"payment_reference\": \"COM-PAY-20250315-001\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/commissions/{{commissionId}}/approve-payment", "host": [ "{{baseUrl}}" ], "path": [ "commissions", "{{commissionId}}", "approve-payment" ] } }, "response": [] }, { "name": "Disburse to Agent", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"payment_date\": \"2025-03-15\",\n \"payment_method\": \"bank_transfer\",\n \"payment_reference\": \"DISB-20250315-001\"\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/commissions/{{commissionId}}/disburse", "host": [ "{{baseUrl}}" ], "path": [ "commissions", "{{commissionId}}", "disburse" ] } }, "response": [] }, { "name": "Get Commission Split", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 404]);", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/commissions/{{commissionId}}/split", "host": [ "{{baseUrl}}" ], "path": [ "commissions", "{{commissionId}}", "split" ] } }, "response": [] } ] }, { "name": "Invoices", "item": [ { "name": "List Invoices", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200', () => {", " pm.response.to.have.status(200);", "});", "", "pm.test('Response has pagination meta', () => {", " const json = pm.response.json();", " pm.expect(json).to.have.property('data');", " pm.expect(json).to.have.property('links');", " pm.expect(json).to.have.property('meta');", "});", "", "pm.test('Data is an array', () => {", " const json = pm.response.json();", " pm.expect(json.data).to.be.an('array');", "});", "", "pm.test('Pagination meta has required fields', () => {", " const meta = pm.response.json().meta;", " pm.expect(meta).to.have.property('current_page');", " pm.expect(meta).to.have.property('per_page');", " pm.expect(meta).to.have.property('total');", " pm.expect(meta).to.have.property('last_page');", "});", "", "pm.test('Each invoice has required fields', () => {", " const json = pm.response.json();", " if (json.data.length > 0) {", " const invoice = json.data[0];", " pm.expect(invoice).to.have.property('id');", " pm.expect(invoice).to.have.property('invoice_number');", " pm.expect(invoice).to.have.property('invoice_type');", " pm.expect(invoice).to.have.property('status');", " pm.expect(invoice).to.have.property('total_amount');", " pm.expect(invoice).to.have.property('outstanding_amount');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/invoices?per_page=20&page=1", "host": [ "{{baseUrl}}" ], "path": [ "invoices" ], "query": [ { "key": "per_page", "value": "20", "description": "Number of records per page (default: 20)" }, { "key": "page", "value": "1", "description": "Page number for pagination" }, { "key": "status", "value": "sent", "description": "Filter by invoice status: draft, sent, paid, overdue, void, cancelled", "disabled": true }, { "key": "client_id", "value": "{{clientId}}", "description": "Filter by client UUID", "disabled": true }, { "key": "broker_id", "value": "{{brokerId}}", "description": "Filter by broker UUID", "disabled": true }, { "key": "invoice_type", "value": "premium", "description": "Filter by invoice type: premium, commission, endorsement, refund", "disabled": true }, { "key": "date_from", "value": "2024-01-01", "description": "Filter invoices from this date (Y-m-d format)", "disabled": true }, { "key": "date_to", "value": "2024-12-31", "description": "Filter invoices up to this date (Y-m-d format)", "disabled": true }, { "key": "overdue_only", "value": "true", "description": "Show only overdue invoices (true/false or 1/0)", "disabled": true } ] } }, "response": [] }, { "name": "Get Single Invoice", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status is 200 or 404', () => pm.expect(pm.response.code).to.be.oneOf([200, 404]));", "if (pm.response.code === 200) {", " const data = pm.response.json().data;", " pm.expect(data).to.have.property('id');", " pm.expect(data).to.have.property('invoice_number');", " pm.expect(data).to.have.property('status');", " pm.expect(data).to.have.property('client');", " pm.expect(data).to.have.property('line_items');", "}" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/invoices/{{invoiceId}}", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "{{invoiceId}}" ] } }, "response": [] }, { "name": "Create Invoice", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status is 201 on success', () => {", " if (pm.response.code === 201) {", " const json = pm.response.json();", " pm.expect(json.success).to.be.true;", " pm.expect(json.data.id).to.exist;", " pm.environment.set('invoiceId', json.data.id);", " pm.environment.set('invoiceNumber', json.data.invoice_number);", " } else if (pm.response.code === 422) {", " console.log('Validation errors:', pm.response.json());", " }", " pm.expect([201, 422]).to.include(pm.response.code);", "});" ], "type": "text/javascript", "packages": {}, "requests": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"invoice_type\": \"premium\",\n \"policy_id\": \"{{policyId}}\",\n \"client_id\": \"{{clientId}}\",\n \"client_type\": \"individual\",\n \"broker_id\": \"{{brokerId}}\",\n \"insurance_company_id\": \"{{insuranceCompanyId}}\",\n \"invoice_date\": \"2025-02-01\",\n \"due_date\": \"2025-03-03\",\n \"line_items\": [\n {\n \"description\": \"Motor Comprehensive Premium\",\n \"quantity\": 1,\n \"unit_price\": 1250000,\n \"taxable\": true\n },\n {\n \"description\": \"Policy Fee\",\n \"quantity\": 1,\n \"unit_price\": 50000,\n \"taxable\": true\n }\n ],\n \"discount_amount\": 0,\n \"payment_terms\": 30,\n \"notes\": \"Generated from policy renewal\",\n \"terms_and_conditions\": \"Payment due within 30 days.\"\n}" }, "url": { "raw": "{{baseUrl}}/invoices", "host": [ "{{baseUrl}}" ], "path": [ "invoices" ] } }, "response": [] }, { "name": "Update Invoice", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status is 200 on success', () => {", " pm.expect([200, 422, 404, 403]).to.include(pm.response.code);", " if (pm.response.code === 200) {", " const json = pm.response.json();", " pm.expect(json.data.discount_amount).to.eql(150000);", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"line_items\": [\n {\n \"description\": \"Motor Comprehensive Premium - Updated\",\n \"quantity\": 1,\n \"unit_price\": 1350000,\n \"taxable\": true\n }\n ],\n \"discount_amount\": 150000,\n \"notes\": \"Premium updated after vehicle value reassessment + loyalty discount\"\n}" }, "url": { "raw": "{{baseUrl}}/invoices/{{invoiceId}}", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "{{invoiceId}}" ] } }, "response": [] }, { "name": "Send Invoice (Email + SMS)", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Invoice sent successfully', () => {", " pm.response.to.have.status(200);", " const json = pm.response.json();", " pm.expect(json.data.status).to.eql('sent');", " pm.expect(json.data.sent_date).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"send_method\": \"both\",\n \"email_subject\": \"Your Insurance Invoice - {{invoiceNumber}}\",\n \"email_message\": \"Dear customer,\\n\\nPlease find attached your insurance invoice.\\nPayment is due by {{due_date}}.\\n\\nThank you.\",\n \"sms_message\": \"Your invoice {{invoiceNumber}} for TZS {{total_amount}} is due on {{due_date}}. Pay now via M-Pesa: 0766888999\"\n}" }, "url": { "raw": "{{baseUrl}}/invoices/{{invoiceId}}/send", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "{{invoiceId}}", "send" ] } }, "response": [] }, { "name": "Void Invoice", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Invoice voided', () => {", " pm.response.to.have.status(200);", " const json = pm.response.json();", " pm.expect(json.data.status).to.eql('void');", " pm.expect(json.data.voided_at).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"reason\": \"Client cancelled policy before inception\"\n}" }, "url": { "raw": "{{baseUrl}}/invoices/{{invoiceId}}/void", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "{{invoiceId}}", "void" ] } }, "response": [] }, { "name": "Download Invoice PDF", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('PDF downloaded', () => {", " pm.expect(pm.response.headers.get('content-type')).to.eql('application/pdf');", " pm.expect(pm.response.headers.get('content-disposition')).to.include('attachment');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/invoices/{{invoiceId}}/pdf?template=detailed&download=true", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "{{invoiceId}}", "pdf" ], "query": [ { "key": "template", "value": "detailed" }, { "key": "download", "value": "true" } ] } }, "response": [] }, { "name": "Stream Invoice PDF (Preview)", "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/invoices/{{invoiceId}}/pdf?template=default", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "{{invoiceId}}", "pdf" ], "query": [ { "key": "template", "value": "default" } ] } }, "response": [] }, { "name": "Delete Invoice", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Deleted successfully', () => {", " pm.expect([200, 204, 404]).to.include(pm.response.code);", " if (pm.response.code === 200) {", " pm.expect(pm.response.json().message).to.include('deleted');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/invoices/{{invoiceId}}", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "{{invoiceId}}" ] } }, "response": [] }, { "name": "Bulk Send Invoices", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Bulk send success', () => {", " pm.response.to.have.status(200);", " const json = pm.response.json();", " pm.expect(json.data.count).to.be.a('number');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"invoice_ids\": [\"{{invoiceId}}\", \"00000000-0000-0000-0000-000000000001\"],\n \"send_method\": \"email\",\n \"email_subject\": \"Payment Reminder - Multiple Invoices\",\n \"email_message\": \"Please find your outstanding invoices attached.\"\n}" }, "url": { "raw": "{{baseUrl}}/invoices/bulk-send", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "bulk-send" ] } }, "response": [] }, { "name": "Bulk Void Invoices", "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [ { "key": "Content-Type", "value": "application/json" } ], "body": { "mode": "raw", "raw": "{\n \"invoice_ids\": [\"{{invoiceId}}\"],\n \"reason\": \"Bulk cancellation due to system error\"\n}" }, "url": { "raw": "{{baseUrl}}/invoices/bulk-void", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "bulk-void" ] } }, "response": [] }, { "name": "Overdue Invoices Report", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Overdue report returned', () => {", " pm.response.to.have.status(200);", " const json = pm.response.json();", " pm.expect(json.data).to.have.property('invoices');", " pm.expect(json.data).to.have.property('total_outstanding');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/invoices/overdue?days_overdue=30", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "overdue" ], "query": [ { "key": "days_overdue", "value": "30" }, { "key": "client_id", "value": "{{clientId}}", "disabled": true } ] } }, "response": [] }, { "name": "Invoice Register Report", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Register report generated', () => {", " pm.response.to.have.status(200);", " const json = pm.response.json();", " pm.expect(json.data.summary).to.have.property('total_amount');", " pm.expect(json.data.summary).to.have.property('outstanding_amount');", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/invoices/register?date_from=2025-01-01&date_to=2025-12-31", "host": [ "{{baseUrl}}" ], "path": [ "invoices", "register" ], "query": [ { "key": "date_from", "value": "2025-01-01" }, { "key": "date_to", "value": "2025-12-31" }, { "key": "status", "value": "paid", "disabled": true } ] } }, "response": [] } ] }, { "name": "Locations", "item": [ { "name": "Countries", "item": [ { "name": "Get Countries", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/countries", "host": [ "{{baseUrl}}" ], "path": [ "countries" ] } }, "response": [] }, { "name": "Create Country", "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"country_code\":\"ZMB\",\"country_code_2\":\"ZM\",\"country_name\":\"Zambia\",\"country_name_local\":\"Zambia\",\"continent\":\"Africa\",\"sub_region\":\"Southern Africa\",\"capital_city\":\"Lusaka\",\"phone_code\":\"+260\",\"timezone\":\"Africa/Lusaka\",\"date_format\":\"DD/MM/YYYY\",\"is_active\":true,\"is_supported\":true,\"display_order\":7}" }, "url": { "raw": "{{baseUrl}}/countries", "host": [ "{{baseUrl}}" ], "path": [ "countries" ] } }, "response": [] }, { "name": "Get Country", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/countries/{{country_id}}", "host": [ "{{baseUrl}}" ], "path": [ "countries", "{{country_id}}" ] } }, "response": [] }, { "name": "Update Country", "request": { "method": "PUT", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"country_name\":\"Zambia Updated\",\"is_active\":true}" }, "url": { "raw": "{{baseUrl}}/countries/{{country_id}}", "host": [ "{{baseUrl}}" ], "path": [ "countries", "{{country_id}}" ] } }, "response": [] }, { "name": "Delete Country", "request": { "method": "DELETE", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/countries/{{country_id}}", "host": [ "{{baseUrl}}" ], "path": [ "countries", "{{country_id}}" ] } }, "response": [] } ] }, { "name": "Currencies", "item": [ { "name": "Get - Currencies", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/currencies", "host": [ "{{baseUrl}}" ], "path": [ "currencies" ] } }, "response": [] }, { "name": "Create Currency", "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"currency_code\":\"ZMW\",\"currency_name\":\"Zambian Kwacha\",\"currency_symbol\":\"ZK\",\"minor_unit_name\":\"ngwee\",\"decimal_places\":2,\"symbol_position\":\"before\",\"thousands_separator\":\",\",\"decimal_separator\":\".\",\"issuing_country_id\":\"{{country_id}}\",\"is_crypto\":false,\"is_precious_metal\":false,\"status\":\"active\",\"is_base_currency\":false,\"display_order\":8}" }, "url": { "raw": "{{baseUrl}}/currencies", "host": [ "{{baseUrl}}" ], "path": [ "currencies" ] } }, "response": [] }, { "name": "Get Currency", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/currencies/{{currency_id}}", "host": [ "{{baseUrl}}" ], "path": [ "currencies", "{{currency_id}}" ] } }, "response": [] }, { "name": "Update Currency", "request": { "method": "PUT", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"currency_name\":\"Zambian Kwacha Updated\",\"status\":\"active\"}" }, "url": { "raw": "{{baseUrl}}/currencies/{{currency_id}}", "host": [ "{{baseUrl}}" ], "path": [ "currencies", "{{currency_id}}" ] } }, "response": [] }, { "name": "Delete Currency", "request": { "method": "DELETE", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/currencies/{{currency_id}}", "host": [ "{{baseUrl}}" ], "path": [ "currencies", "{{currency_id}}" ] } }, "response": [] } ] }, { "name": "Exchange Rates", "item": [ { "name": "Get Exchange Rates", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/exchange-rates", "host": [ "{{baseUrl}}" ], "path": [ "exchange-rates" ] } }, "response": [] }, { "name": "Create Exchange Rate", "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"from_currency_id\":\"{{currency_id}}\",\"to_currency_id\":\"{{tzs_currency_id}}\",\"exchange_rate\":1000,\"rate_type\":\"official\",\"effective_date\":\"2025-08-11\",\"source_name\":\"Bank of Zambia\",\"is_active\":true,\"is_manual\":false}" }, "url": { "raw": "{{baseUrl}}/exchange-rates", "host": [ "{{baseUrl}}" ], "path": [ "exchange-rates" ] } }, "response": [] }, { "name": "Get Exchange Rate", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/exchange-rates/{{exchange_rate_id}}", "host": [ "{{baseUrl}}" ], "path": [ "exchange-rates", "{{exchange_rate_id}}" ] } }, "response": [] }, { "name": "Update Exchange Rate", "request": { "method": "PUT", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"exchange_rate\":1050,\"is_active\":true}" }, "url": { "raw": "{{baseUrl}}/exchange-rates/{{exchange_rate_id}}", "host": [ "{{baseUrl}}" ], "path": [ "exchange-rates", "{{exchange_rate_id}}" ] } }, "response": [] }, { "name": "Delete Exchange Rate", "request": { "method": "DELETE", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/exchange-rates/{{exchange_rate_id}}", "host": [ "{{baseUrl}}" ], "path": [ "exchange-rates", "{{exchange_rate_id}}" ] } }, "response": [] } ] }, { "name": "Regions", "item": [ { "name": "Get Regions", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/regions", "host": [ "{{baseUrl}}" ], "path": [ "regions" ] } }, "response": [] }, { "name": "Create Region", "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"country_id\":\"{{tza_country_id}}\",\"region_code\":\"ZAN\",\"region_name\":\"Zanzibar\",\"region_name_local\":\"Zanzibar\",\"region_type\":\"Region\",\"capital_city\":\"Zanzibar City\",\"population\":1300000,\"area_km2\":2461,\"is_active\":true,\"display_order\":11}" }, "url": { "raw": "{{baseUrl}}/regions", "host": [ "{{baseUrl}}" ], "path": [ "regions" ] } }, "response": [] }, { "name": "Get Region", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/regions/{{region_id}}", "host": [ "{{baseUrl}}" ], "path": [ "regions", "{{region_id}}" ] } }, "response": [] }, { "name": "Update Region", "request": { "method": "PUT", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"region_name\":\"Zanzibar Updated\",\"is_active\":true}" }, "url": { "raw": "{{baseUrl}}/regions/{{region_id}}", "host": [ "{{baseUrl}}" ], "path": [ "regions", "{{region_id}}" ] } }, "response": [] }, { "name": "Delete Region", "request": { "method": "DELETE", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/regions/{{region_id}}", "host": [ "{{baseUrl}}" ], "path": [ "regions", "{{region_id}}" ] } }, "response": [] } ] }, { "name": "Districts", "item": [ { "name": "Get Districts", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/districts", "host": [ "{{baseUrl}}" ], "path": [ "districts" ] } }, "response": [] }, { "name": "Create District", "request": { "method": "POST", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"region_id\":\"{{dsm_region_id}}\",\"district_code\":\"KIN\",\"district_name\":\"Kinondoni\",\"district_name_local\":\"Kinondoni\",\"district_type\":\"Municipal Council\",\"capital_city\":\"Kinondoni\",\"population\":1775049,\"area_km2\":531,\"is_urban\":true,\"postal_code\":\"14100\",\"economic_status\":\"urban\",\"is_active\":true,\"display_order\":2}" }, "url": { "raw": "{{baseUrl}}/districts", "host": [ "{{baseUrl}}" ], "path": [ "districts" ] } }, "response": [] }, { "name": "Get District", "request": { "method": "GET", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/districts/{{district_id}}", "host": [ "{{baseUrl}}" ], "path": [ "districts", "{{district_id}}" ] } }, "response": [] }, { "name": "Update District", "request": { "method": "PUT", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" }, { "key": "Content-Type", "value": "application/json", "type": "text" } ], "body": { "mode": "raw", "raw": "{\"district_name\":\"Kinondoni Updated\",\"is_active\":true}" }, "url": { "raw": "{{baseUrl}}/districts/{{district_id}}", "host": [ "{{baseUrl}}" ], "path": [ "districts", "{{district_id}}" ] } }, "response": [] }, { "name": "Delete District", "request": { "method": "DELETE", "header": [ { "key": "Authorization", "value": "Bearer {{token}}", "type": "text" } ], "url": { "raw": "{{baseUrl}}/districts/{{district_id}}", "host": [ "{{baseUrl}}" ], "path": [ "districts", "{{district_id}}" ] } }, "response": [] } ] }, { "name": "Wards", "item": [ { "name": "List Wards", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 422]);", "});", "pm.test('Response has data and pagination for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data').that.is.an('array');", " pm.expect(pm.response.json()).to.have.property('pagination');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Error response format for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('code').that.equals('VALIDATION_ERROR');", " pm.expect(pm.response.json().error).to.have.property('message');", " pm.expect(pm.response.json().error).to.have.property('details');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/wards?district_id=ab37bef3-ae28-48a3-be5c-ae9ed168dea9", "host": [ "{{baseUrl}}" ], "path": [ "wards" ], "query": [ { "key": "district_id", "value": "ab37bef3-ae28-48a3-be5c-ae9ed168dea9" } ] } }, "response": [] }, { "name": "Get Ward by ID", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has ward data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('id');", " pm.expect(pm.response.json()).to.have.property('ward_name');", " pm.expect(pm.response.json()).to.have.property('ward_code');", " pm.expect(pm.response.json()).to.have.property('district');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/wards/{{wardId}}", "host": [ "{{baseUrl}}" ], "path": [ "wards", "{{wardId}}" ] } }, "response": [] }, { "name": "Create Ward", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 422]);", "});", "pm.test('Response has ward data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('id');", " pm.expect(pm.response.json()).to.have.property('ward_name');", " pm.expect(pm.response.json()).to.have.property('ward_code');", " pm.expect(pm.response.json()).to.have.property('district');", " }", "});", "pm.test('Error response format for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('code').that.equals('VALIDATION_ERROR');", " pm.expect(pm.response.json().error).to.have.property('message');", " pm.expect(pm.response.json().error).to.have.property('details');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "POST", "header": [], "body": { "mode": "raw", "raw": "{\n \"district_id\": \"{{districtId}}\",\n \"ward_code\": \"WARD001\",\n \"ward_name\": \"Sample Ward\",\n \"ward_name_local\": \"Sample Ward Swahili\",\n \"area_km2\": 50.25,\n \"population\": 10000,\n \"ward_type\": \"urban\",\n \"postal_code\": \"12345\",\n \"display_order\": 1\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/wards", "host": [ "{{baseUrl}}" ], "path": [ "wards" ] } }, "response": [] }, { "name": "Update Ward", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, 404, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404, 422]);", "});", "pm.test('Response has ward data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('id');", " pm.expect(pm.response.json()).to.have.property('ward_name');", " pm.expect(pm.response.json()).to.have.property('ward_code');", " pm.expect(pm.response.json()).to.have.property('district');", " }", "});", "pm.test('Error response format for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('code').that.equals('VALIDATION_ERROR');", " pm.expect(pm.response.json().error).to.have.property('message');", " pm.expect(pm.response.json().error).to.have.property('details');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "body": { "mode": "raw", "raw": "{\n \"ward_name\": \"Updated Ward\",\n \"ward_name_local\": \"Updated Ward Swahili\",\n \"area_km2\": 60.75,\n \"population\": 12000,\n \"ward_type\": \"rural\",\n \"postal_code\": \"54321\",\n \"display_order\": 2\n}", "options": { "raw": { "language": "json" } } }, "url": { "raw": "{{baseUrl}}/wards/{{wardId}}", "host": [ "{{baseUrl}}" ], "path": [ "wards", "{{wardId}}" ] } }, "response": [] }, { "name": "Delete Ward", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('message');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/wards/{{wardId}}", "host": [ "{{baseUrl}}" ], "path": [ "wards", "{{wardId}}" ] } }, "response": [] } ] } ] }, { "name": "Notifications", "item": [ { "name": "List Notifications", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 422]);", "});", "pm.test('Response has data and pagination for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data').that.is.an('array');", " pm.expect(pm.response.json()).to.have.property('meta');", " pm.expect(pm.response.json().meta).to.have.property('current_page');", " pm.expect(pm.response.json().meta).to.have.property('last_page');", " pm.expect(pm.response.json().meta).to.have.property('per_page');", " pm.expect(pm.response.json().meta).to.have.property('total');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Error response format for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('code').that.equals('VALIDATION_ERROR');", " pm.expect(pm.response.json().error).to.have.property('message');", " pm.expect(pm.response.json().error).to.have.property('details');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/notifications?is_read=false&per_page=10", "host": [ "{{baseUrl}}" ], "path": [ "notifications" ], "query": [ { "key": "is_read", "value": "false" }, { "key": "per_page", "value": "10" } ] } }, "response": [] }, { "name": "Get Notification by ID", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has notification data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('id');", " pm.expect(pm.response.json()).to.have.property('notification_type');", " pm.expect(pm.response.json()).to.have.property('title');", " pm.expect(pm.response.json()).to.have.property('message');", " pm.expect(pm.response.json()).to.have.property('is_read');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/notifications/{{notificationId}}", "host": [ "{{baseUrl}}" ], "path": [ "notifications", "{{notificationId}}" ] } }, "response": [] }, { "name": "Mark Notification as Read", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has updated notification data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('id');", " pm.expect(pm.response.json()).to.have.property('is_read').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('read_at');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "url": { "raw": "{{baseUrl}}/notifications/{{notificationId}}/read", "host": [ "{{baseUrl}}" ], "path": [ "notifications", "{{notificationId}}", "read" ] } }, "response": [] }, { "name": "Mark All Notifications as Read", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 422', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 422]);", "});", "pm.test('Response has success message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('message');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Error response format for failure', function () {", " if (pm.response.code === 422) {", " pm.expect(pm.response.json()).to.have.property('error');", " pm.expect(pm.response.json().error).to.have.property('code').that.equals('VALIDATION_ERROR');", " pm.expect(pm.response.json().error).to.have.property('message');", " pm.expect(pm.response.json().error).to.have.property('details');", " }", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "PUT", "header": [], "url": { "raw": "{{baseUrl}}/notifications/mark-all-read", "host": [ "{{baseUrl}}" ], "path": [ "notifications", "mark-all-read" ] } }, "response": [] }, { "name": "Delete Notification", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has success message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('message');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});" ], "type": "text/javascript" } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "DELETE", "header": [], "url": { "raw": "{{baseUrl}}/notifications/{{notificationId}}", "host": [ "{{baseUrl}}" ], "path": [ "notifications", "{{notificationId}}" ] } }, "response": [] } ] }, { "name": "Audit Logs", "item": [ { "name": "List Audit Logs", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has data and pagination for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('pagination');", " pm.expect(pm.response.json().pagination).to.have.property('page');", " pm.expect(pm.response.json().pagination).to.have.property('limit');", " pm.expect(pm.response.json().pagination).to.have.property('total');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Audit logs retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/audit-logs", "host": [ "{{baseUrl}}" ], "path": [ "audit-logs" ], "query": [ { "key": "page", "value": "1", "description": "Page number for pagination", "disabled": true }, { "key": "per_page", "value": "50", "description": "Number of items per page", "disabled": true }, { "key": "entity_type", "value": "", "description": "Filter by entity type (e.g., 'users', 'branches')", "disabled": true }, { "key": "action_type", "value": "", "description": "Filter by action type (e.g., 'created', 'updated', 'deleted')", "disabled": true }, { "key": "user_id", "value": "", "description": "Filter by user ID", "disabled": true }, { "key": "date_from", "value": "", "description": "Filter from date (YYYY-MM-DD)", "disabled": true }, { "key": "date_to", "value": "", "description": "Filter to date (YYYY-MM-DD)", "disabled": true } ] } }, "response": [] }, { "name": "List Audit Logs with Filters", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has filtered data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('pagination');", " pm.expect(pm.response.json().pagination).to.have.property('page');", " pm.expect(pm.response.json().pagination).to.have.property('limit');", " pm.expect(pm.response.json().pagination).to.have.property('total');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Audit logs retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/audit-logs?entity_type=users&action_type=created&user_id={{userId}}&date_from=2025-01-01&date_to=2025-09-25", "host": [ "{{baseUrl}}" ], "path": [ "audit-logs" ], "query": [ { "key": "entity_type", "value": "users" }, { "key": "action_type", "value": "created" }, { "key": "user_id", "value": "{{userId}}" }, { "key": "date_from", "value": "2025-01-01" }, { "key": "date_to", "value": "2025-09-25" }, { "key": "page", "value": "1", "disabled": true }, { "key": "per_page", "value": "50", "disabled": true } ] } }, "response": [] }, { "name": "Get Audit Log by ID", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200, 403, or 404', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403, 404]);", "});", "pm.test('Response has data for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('id');", " pm.expect(pm.response.json()).to.have.property('user_id');", " pm.expect(pm.response.json()).to.have.property('user_name');", " pm.expect(pm.response.json()).to.have.property('action_type');", " pm.expect(pm.response.json()).to.have.property('entity_type');", " pm.expect(pm.response.json()).to.have.property('entity_id');", " pm.expect(pm.response.json()).to.have.property('timestamp');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});", "pm.test('Response includes error for not found', function () {", " if (pm.response.code === 404) {", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Audit log not found.');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/audit-logs/{{auditLogId}}", "host": [ "{{baseUrl}}" ], "path": [ "audit-logs", "{{auditLogId}}" ] } }, "response": [] }, { "name": "Get Audit Logs for Entity", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has data and pagination for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('pagination');", " pm.expect(pm.response.json().pagination).to.have.property('page');", " pm.expect(pm.response.json().pagination).to.have.property('limit');", " pm.expect(pm.response.json().pagination).to.have.property('total');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Audit logs retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/audit-logs/entity/{{entityType}}/{{entityId}}", "host": [ "{{baseUrl}}" ], "path": [ "audit-logs", "entity", "{{entityType}}", "{{entityId}}" ], "query": [ { "key": "action_type", "value": "", "description": "Filter by action type", "disabled": true }, { "key": "user_id", "value": "", "description": "Filter by user ID", "disabled": true }, { "key": "date_from", "value": "", "description": "Filter from date (YYYY-MM-DD)", "disabled": true }, { "key": "date_to", "value": "", "description": "Filter to date (YYYY-MM-DD)", "disabled": true }, { "key": "per_page", "value": "50", "disabled": true } ] } }, "response": [] }, { "name": "Get Audit Logs for User", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has data and pagination for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('data');", " pm.expect(pm.response.json().data).to.be.an('array');", " pm.expect(pm.response.json()).to.have.property('pagination');", " pm.expect(pm.response.json().pagination).to.have.property('page');", " pm.expect(pm.response.json().pagination).to.have.property('limit');", " pm.expect(pm.response.json().pagination).to.have.property('total');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Audit logs retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/audit-logs/user/{{userId}}", "host": [ "{{baseUrl}}" ], "path": [ "audit-logs", "user", "{{userId}}" ], "query": [ { "key": "entity_type", "value": "", "description": "Filter by entity type", "disabled": true }, { "key": "action_type", "value": "", "description": "Filter by action type", "disabled": true }, { "key": "date_from", "value": "", "description": "Filter from date (YYYY-MM-DD)", "disabled": true }, { "key": "date_to", "value": "", "description": "Filter to date (YYYY-MM-DD)", "disabled": true }, { "key": "per_page", "value": "50", "disabled": true } ] } }, "response": [] }, { "name": "Get Audit Log Stats", "event": [ { "listen": "test", "script": { "exec": [ "pm.test('Status code is 200 or 403', function () {", " pm.expect(pm.response.code).to.be.oneOf([200, 403]);", "});", "pm.test('Response has stats for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('stats');", " pm.expect(pm.response.json().stats).to.have.property('total_actions');", " pm.expect(pm.response.json().stats).to.have.property('unique_users');", " pm.expect(pm.response.json().stats).to.have.property('entity_types');", " pm.expect(pm.response.json().stats).to.have.property('action_types');", " pm.expect(pm.response.json().stats).to.have.property('recent_activity');", " }", "});", "pm.test('Rate limit headers present', function () {", " pm.expect(pm.response.headers.get('X-RateLimit-Limit')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Remaining')).to.exist;", " pm.expect(pm.response.headers.get('X-RateLimit-Reset')).to.exist;", "});", "pm.test('Response includes success and message for success', function () {", " if (pm.response.code === 200) {", " pm.expect(pm.response.json()).to.have.property('success').that.equals(true);", " pm.expect(pm.response.json()).to.have.property('message').that.equals('Audit log statistics retrieved successfully.');", " }", "});", "pm.test('Response includes error for unauthorized', function () {", " if (pm.response.code === 403) {", " pm.expect(pm.response.json()).to.have.property('message').that.includes('Unauthorized');", " }", "});" ], "type": "text/javascript", "packages": {} } } ], "request": { "auth": { "type": "bearer", "bearer": [ { "key": "token", "value": "{{token}}", "type": "string" } ] }, "method": "GET", "header": [], "url": { "raw": "{{baseUrl}}/audit-logs/stats", "host": [ "{{baseUrl}}" ], "path": [ "audit-logs", "stats" ] } }, "response": [] } ] } ], "event": [ { "listen": "prerequest", "script": { "type": "text/javascript", "packages": {}, "requests": {}, "exec": [ "" ] } }, { "listen": "test", "script": { "type": "text/javascript", "packages": {}, "requests": {}, "exec": [ "" ] } } ], "variable": [ { "key": "baseUrl", "value": "http://tanzaniabrokers.test/api/v1" } ] }