{"id":23387352,"url":"https://github.com/theointech/central-wallet-system","last_synced_at":"2025-10-10T10:32:46.697Z","repository":{"id":49748714,"uuid":"517511226","full_name":"TheoInTech/central-wallet-system","owner":"TheoInTech","description":"A simple Central Wallet System (CWS) code exercise","archived":false,"fork":false,"pushed_at":"2022-07-26T12:04:11.000Z","size":60,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-07-05T21:47:35.750Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/TheoInTech.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-07-25T04:01:31.000Z","updated_at":"2024-02-05T12:34:48.000Z","dependencies_parsed_at":"2022-08-30T17:21:44.184Z","dependency_job_id":null,"html_url":"https://github.com/TheoInTech/central-wallet-system","commit_stats":null,"previous_names":["0xth3o/central-wallet-system","theindiehacker/central-wallet-system","theointech/central-wallet-system"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/TheoInTech/central-wallet-system","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheoInTech%2Fcentral-wallet-system","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheoInTech%2Fcentral-wallet-system/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheoInTech%2Fcentral-wallet-system/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheoInTech%2Fcentral-wallet-system/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/TheoInTech","download_url":"https://codeload.github.com/TheoInTech/central-wallet-system/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/TheoInTech%2Fcentral-wallet-system/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003549,"owners_count":26083595,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-22T01:15:42.189Z","updated_at":"2025-10-10T10:32:46.669Z","avatar_url":"https://github.com/TheoInTech.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Central Wallet System Code Exercise\n\n## ⚛️ Technologies Used\n\n![tech](https://skillicons.dev/icons?i=js,ts,nodejs,express,vscode\u0026theme=light)\n\n## 🔨 Installation\n1. Clone the github repository\n2. Install npm dependencies\n```bash\nnpm install\n```\n\n## ♻️ Run App\n```bash\nnpm start\n```\n\n## API Documentation\n\n### Central Wallet System API for the following:\n- Balance Inquiry\n- Cash-In\n- Debit\n- Transaction History\n\n### Overview\nThe CWS API is coded as an exercise only.\n\nSeveral improvements can be done including, but are not limited to, the following:\n- Use of authentication / tokens\n- Use of middlewares for validation and error handling\n- Use external database instead of a temporary JSON variable\n- Use server-side date\n- More validations for request parameters\n\n### Error Codes\n- System only accepts PHP as currency\n- Insufficient funds on debit if Amount is greater than Balance\n- Negative and 0 amount Cash-In\n\n### Rate limit\nOnly 1 request every 2 minutes is allowed\n\n### API Reference\n\n#### Balance inquiry\n\nGet remaining balance\n```http\n  GET /cws/balance-inquiry\n```\n\n##### Sample Response\n\n```http\n{\n    \"data\": {\n        \"balance\": 100,\n        \"currency\": \"PHP\"\n    }\n}\n```\n---\n#### Transaction History\n\nGet all transaction history\n```http\n  GET /cws/transaction-history\n```\n\n##### Sample Response\n\n```http\n{\n    \"data\": {\n        \"txHistory\": [\n            {\n                \"id\": \"8080c452-7adf-441d-ab03-721e60ec5c8f\",\n                \"method\": \"cash-in\",\n                \"amount\": 100,\n                \"balance\": 200,\n                \"date\": \"Tue Jul 26 2022 19:43:27 GMT+0800 (China Standard Time)\"\n            },\n            {\n                \"id\": \"f2d74490-407b-4565-a414-2fc5fe48fddd\",\n                \"method\": \"cash-in\",\n                \"amount\": 2000,\n                \"balance\": 2200,\n                \"date\": \"Tue Jul 26 2022 19:43:34 GMT+0800 (China Standard Time)\"\n            }\n        ]\n    }\n}\n```\n---\n#### Cash-In\n\nCash-in an amount and increase remaining balance\n```http\n  PATCH /cws/cash-in\n```\n\n##### Request | JSON\n| Parameter     | Type     | Description                      |\n| :--------     | :------- | :------------------------------- |\n| `amount`      | `number` | **Required**. Amount to cash in. |\n| `currency`    | `string` | **Required**. Allows `PHP` only. |\n\n##### Sample Response\n\n```http\n{\n    \"data\": {\n        \"transactionId\": \"d0697f06-6373-4202-8f2a-4db96e460d65\",\n        \"amount\": 50,\n        \"balance\": 150,\n        \"currency\": \"PHP\"\n    },\n    \"message\": \"Successfully cashed in!\"\n}\n```\n---\n#### Debit\n\nGet an amount from the remaining balance\n```http\n  PATCH /cws/debit\n```\n\n##### Request | JSON\n| Parameter     | Type     | Description                      |\n| :--------     | :------- | :------------------------------- |\n| `amount`      | `number` | **Required**. Amount to debit. |\n| `currency`    | `string` | **Required**. Allows `PHP` only. |\n\n##### Sample Response\n\n```http\n{\n    \"data\": {\n        \"transactionId\": \"6360cdfe-b73b-4c04-ae37-4fe21fde584c\",\n        \"amount\": 150,\n        \"balance\": 460,\n        \"currency\": \"PHP\"\n    },\n    \"message\": \"Successful debit!\"\n}\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheointech%2Fcentral-wallet-system","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftheointech%2Fcentral-wallet-system","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftheointech%2Fcentral-wallet-system/lists"}