From 3e0531cfcd9a3c09290dfbf6dd986e95416cfcf1 Mon Sep 17 00:00:00 2001 From: yatmesh Date: Wed, 31 Dec 2025 11:29:52 +0000 Subject: [PATCH] Added the sample of the CA Office api --- thecaoffice-hr.py | 196 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 196 insertions(+) diff --git a/thecaoffice-hr.py b/thecaoffice-hr.py index 03aafa6..27d87af 100644 --- a/thecaoffice-hr.py +++ b/thecaoffice-hr.py @@ -1,13 +1,209 @@ # Call inout register for prev day - credentials in json file # call team list using ca office api - credentials in json file # Api for the team list : https://api.thecaoffice.com/team/list +# Team List Input response +{ + "idUser":1643 +} +# Team List output response: +{ + "code": 1, + "data": { + "http_code": 200, + "numeric_code": 4312, + "rs0": [ + { + "authorisations_json": null, + "department_id": 699, + "department_name": "Client Management", + "email": "aramduke@gmail.com", + "full_name": "Aarm Duke", + "hierarchy_level": 1, + "json_notes": "{\n \"pdf\": \"https://nexcom.ditscentre.in/utils/files/small/download/69315bd0a468dde807890681\",\n \"salary\": 30000,\n \"maritalStatus\": \"\",\n \"dateOfBirth\": \"\",\n \"dateOfJoin\": \"\",\n \"accountNumber\": \"\",\n \"ifsc\": \"\",\n \"bankName\": \"\",\n \"esicNumber\": \"\",\n \"ppfnumber\": \"\",\n \"emergencyContactNumber\": \"\",\n \"emergencyContactName\": \"\",\n \"photoUrl\": \"https://nexcom.ditscentre.in/utils/files/small/download/6900430c77c9b049da378dab\",\n \"aadhaarUrl\": \"\",\n \"panCardUrl\": \"\",\n \"address\": \"\",\n \"billingRate\": \"\",\n \"relationship\": \"\",\n \"city\": \"\",\n \"pincode\": \"\",\n \"branchId\": 84,\n \"weeklyOff\": [],\n \"weeklyWorkingHours\": 0,\n \"noOfPaidLeaves\": 0,\n \"country\": \"India\",\n \"lastDayOfWorking\": null,\n \"applicantNotes\": {\n \"age\": null,\n \"gender\": \"\",\n \"educationLevel\": null,\n \"noChildren\": null,\n \"spouseWorkingStatus\": null,\n \"noOfChildrenAbove18\": null,\n \"noOfChildrenBelow18\": null,\n \"employmentStatus\": \"\",\n \"attendanceAllowance\": 0,\n \"performanceAllowance\": 0,\n \"adaitechEmail\": null,\n \"adaitechPassword\": null,\n \"gearincEmail\": null,\n \"payrollFor\": null,\n \"contractStartDate\": null,\n \"contractEndDate\": null,\n \"nricNo\": null,\n \"taxNo\": null,\n \"epfNo\": null,\n \"perksoNo\": null,\n \"Salutation\": null,\n \"reportingToName\": \"Aditya Shah\",\n \"outlierId\": null,\n \"addressProofUrl\": null,\n \"appointmentLetterUrl\": null,\n \"offerLetterUrl\": null,\n \"pfUanNumber\": null,\n \"panCardNumber\": null,\n \"aadhaarCardNumber\": null,\n \"payRollType\": \"onRoll\",\n \"labourContractorName\": null,\n \"labourContractorId\": null,\n \"leaveAfter\": 10\n },\n \"userBasicSalary\": 25000,\n \"houseResidencesAllowance\": 3000,\n \"dearnessAllowance\": 0,\n \"conveyance\": 1000,\n \"allowance\": 1000,\n \"providentFund\": true,\n \"employeesInsurance\": true,\n \"professionalTax\": true,\n \"salaryType\": \"Monthly\",\n \"team_master\": true,\n \"account_master_id\": 43682\n}", + "phone_number": "+916655665577", + "pseudonym": "aramduke", + "reporting_to": 2057.0, + "role": "Crm Lead", + "user_id": 2876, + "user_status": "active" + } + ] + }, + "message": "Team Member List", + "status": 1 +} + # check if any new names in the in out register vs team list # if yes then add team member / branch / department as needed # Api for the team add : https://api.thecaoffice.com/team/add + Payload = { + 'email': 'employee@company.com', + 'name': 'John Smith', + "idDepartment": 1, + 'role': 'Software Engineer', + 'phoneNo': '9876543210', + 'username': 'john.smith', + 'password': 'password123', + 'address': '123 Main St, Mumbai, Maharashtra', + "website": 'http://company.com', + "logoUrl": null, + "companyName": 'Lok Chemicals Pvt. Ltd.', + "salary": 50000.0, + "maritalStatus": 'Single', + "dateOfBirth": '1999-01-01', + "dateOfJoin": '2025-01-01', + "accountNumber": '1234567890', + "ifsc": 'BKID0001234', + "bankName": 'Bank of India', + "esicNumber": 'ESIC123456', + "ppfnumber": 'PPF123456789', + "emergencyContactNumber": '9998887777', + "emergencyContactName": 'Jane Doe', + "photoUrl": 'http://example.com/photo.jpg', + "aadhaarUrl": 'http://example.com/aadhaar.jpg', + "panCardUrl": 'http://example.com/pancard.jpg', + "billingRate": '100.0', + "hierarchy": 1, + "branchId": 101, + "city": 'Mumbai', + "pinCode": '400001', + "relationship": 'Single', + "weeklyOff": 'Saturday', + "weeklyWorkingHours": 40, + "noOfPaidLeaves": 12, + "country": 'India', + "lastDayOfWorking": '2025-12-31', + "applicantNotes": applicantNotesParam, + "reportingTo": 101, + "userBasicSalary": 30000.0, + "houseResidencesAllowance": 2000.0, + "dearnessAllowance": 3000.0, + "conveyance": 1000.0, + "allowance": 1500.0, + "providentFund": true, + "employeesInsurance": true, + "professionalTax": true, + "salaryType": 'Monthly', +}; +final applicantNotesParam = { + "age": 30, + "gender": 'Male', + "educationLevel": 'Bachelor\'s Degree', + "noChildren": 2, + "spouseWorkingStatus": 'Employed', + "noOfChildrenAbove18": '1', + "noOfChildrenBelow18": '2', + "employmentStatus": 'Full-time', + "attendanceAllowance": 100.0, + "performanceAllowance": 200.0, + "adaitechEmail": 'example@adaitech.com', + "adaitechPassword": 'password123', + "gearincEmail": 'example@gearinc.com', + "payrollFor": 'Employee', + "contractStartDate": '2025-01-01', + "contractEndDate": '2025-12-31', + "nricNo": 'S1234567D', + "taxNo": 'T123456789', + "epfNo": 'EPF123456789', + "perksoNo": 'P123456789', + "Salutation": 'Mr.', + "reportingToName": 'Jane Doe', + "outlierId": 'OUT12345', + "addressProofUrl": 'http://example.com/addressproof.jpg', + "appointmentLetterUrl": 'http://example.com/appointmentletter.pdf', + "offerLetterUrl": 'http://example.com/offerletter.pdf', + "pfUanNumber": 'PF123456789', + "panCardNumber": 'ABCDE1234F', + "aadhaarCardNumber": '1234 5678 9012', + "payRollType": 'monthly', + "labourContractorName": 'Contractor XYZ', + "labourContractorId": 101, + "leaveAfter": 30, +}; + + # Api for the branch add : https://api.thecaoffice.com/commons/branch/add +Paylod = { + 'idUser':1643 + 'branchName': 'Main Branch', + 'address': '123 Street, Mumbai, Maharashtra', + 'branchHead': 'John Doe', + 'branchHeadId': 18, + 'gstNumber': '27ABCDE1234F1Z5', + 'city': 'Mumbai', + 'pincode': '400001', + 'bankName': 'Bank of India', + 'bankAccountNo': '1234567890123456', + 'bankIfscCode': 'BKID0001234', + 'panCard': 'ABCDE1234F', + 'msmeNo': 'MSME1234567890', +} + # Api for the department add : https://api.thecaoffice.com/commons/departments/add + params = { + 'idUser':1643 + 'departmentName': departmentController.text, +}; # Mark attendance based on in out register time spent and hr rules # Api for the attendance mark : https://api.thecaoffice.com/user/attendance/mark +params = { + "date": '2025-12-31', + "idUser": 101, + "status": 'P', + "ot": 0 +}; + # Api for the attendance register : https://api.thecaoffice.com/user/attendance/register +# input json +Paylod = { + "month": '2025-12-31' +} + +# Output json +{ + "code": 1, + "data": { + "rs0": [ + { + "allowances": 32.2581, + "amount": 967.7419, + "ar_date": "2025-12-18", + "basic_salary": 806.4516, + "conveyance": 32.2581, + "da": 0.0, + "department_name": "Site Admin", + "full_name": "Aarm Duke", + "hra": 96.7742, + "idattendance_register": 21020, + "ot": 0, + "ot_amount": 806.4516, + "pseudonym": "aramduke", + "remarks": null, + "status": "P", + "user_id": 2876 + }, + { + "allowances": 32.2581, + "amount": 967.7419, + "ar_date": "2025-12-31", + "basic_salary": 806.4516, + "conveyance": 32.2581, + "da": 0.0, + "department_name": "Site Admin", + "full_name": "Aarm Duke", + "hra": 96.7742, + "idattendance_register": 21737, + "ot": 0, + "ot_amount": 806.4516, + "pseudonym": "aramduke", + "remarks": null, + "status": "P", + "user_id": 2876 + } + ] + }, + "message": "Attendance register for the entity", + "status": 1 +} # salary register download option.