{"id":18331139,"url":"https://github.com/bankole2000/tql-card-validation","last_synced_at":"2025-06-28T17:07:43.548Z","repository":{"id":109354007,"uuid":"383053228","full_name":"Bankole2000/tql-card-validation","owner":"Bankole2000","description":"Repo for the TQL Backend Challenge","archived":false,"fork":false,"pushed_at":"2021-07-05T19:32:02.000Z","size":24,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-22T22:55:25.725Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/Bankole2000.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-07-05T07:31:20.000Z","updated_at":"2021-07-05T19:32:04.000Z","dependencies_parsed_at":"2023-04-08T10:48:08.978Z","dependency_job_id":null,"html_url":"https://github.com/Bankole2000/tql-card-validation","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Bankole2000/tql-card-validation","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bankole2000%2Ftql-card-validation","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bankole2000%2Ftql-card-validation/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bankole2000%2Ftql-card-validation/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bankole2000%2Ftql-card-validation/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Bankole2000","download_url":"https://codeload.github.com/Bankole2000/tql-card-validation/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Bankole2000%2Ftql-card-validation/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262465751,"owners_count":23315640,"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","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-11-05T19:28:25.036Z","updated_at":"2025-06-28T17:07:43.519Z","avatar_url":"https://github.com/Bankole2000.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# TQL Cards API\nA credit-card validation api - TalentQL technical assessment submission.\n\n## About\n\u003cbr /\u003e\nThe API was built using NodeJs only. No frameworks or packages.\u003cbr /\u003e\u003cbr /\u003e\nI tried to implement it with concepts like Routing, Middleware, and Response methods to make the API development easier and more organized. I also implemented a simple database using JSON files for user authentication, storing user cards, and making withdrawals and deposits\u003cbr /\u003e\u003cbr /\u003e\n\n## Endpoints\n| S/N | Verb | Endpoint           | Description                                                       |\n| ---:| ---- | ------------------ | ----------------------------------------------------------------- |\n|   1 | Get  | `/` or `/api`      | Home route - API Info                                             |\n|   2 | Post | /api/register      | Register with `username` `email` and `Password`                   |\n|   3 | Post | /api/login         | Login with `email` and `password` to get `accessToken` for header |\n|   4 | Get  | /api/token         | Requires Bearer Token - Get logged in user info                   |\n|   5 | Post | /api/validate-card | Validate Card details                                             |\n|   6 | Post | /api/deposit       | Requires Bearer token, valid card details and `amount` field      |\n|   7 | Post | /api/withdraw      | Requires Bearer token, valid card details and `amount` field      |\n|   8 | Get  | /api/logout        | Requires Bearer token, logs user out (i.e. destroys/invalidates token)                                                                  |\n\n\n\n## How to use\n\n* Clone this repository\n* No need for `npm install` you can just run it right away - `node app.js`\n* All Data can be posted as JSON, Form-Data, x-www-form-url-encoded or xml.\n* Register a user by posting `username`, `email` and `password` to `/api/register`;\n* Login to user account by posting `email` and `password` to `/api/login` to get `accessToken`\n* Use Access token in request header `Authorization: Bearer \u003caccessToken\u003e` to send card validation request to `/api/validate-card`\n* Whenever the user validates a card, it gets added to the user data. If the card has been validated before, the card gets updated in the user data\n* Users can add to their account balance by making a deposit with valid card details\n* Users can withdraw or charge their card by making a withdrawal. \n\n\n\n## Sample Test data\n\n* Sample Validate card Request (`POST` to `/api/validate-card` with `Authorization: Bearer \u003ctoken\u003e` header)\n```js\n    {\n        \"cardNumber\": \"5061021052970696111\",\n        \"expirationDate\": \"2021-11-31\",\n        \"email\": \"techybanky@gmail.com\",\n        \"cvv2\": \"123\",\n        \"phoneNumber\": \"08069166906\",\n        \"mobile\": \"+2348069166906\"\n        //\"amount\": 100\n    }\n```\nadd `amount` field if you want to deposit or withdraw (`POST` to `/api/deposit` or `/api/withdraw` with `Authorization: Bearer \u003ctoken\u003e` header)\n\n* Response (json - success)\n```js\n{\n    \"status\": 200,\n    \"data\": {\n        \"valid\": true,\n        \"message\": \"Valid Card\", \n        \"card\": {\n          //...cardDetails\n        }\n    }\n}\n```\n## XML Response \nTo get response in XML - simply change the `content-type` in the header to `application/xml`\n\n## To get accessToken \nsend Signup data to `/api/register` with `username`, `email`, and `password`, eg:  \n```js\n  {\n    \"username\": \"John Doe\", \n    \"email\": \"john@doe.com\", \n    \"password\": \"acoolpassword\"\n  }\n```\nThen Login to `/api/login` with `email` and `password`, e.g:\n```js\n  {\n    \"email\": \"your@email.com\", \n    \"password\": \"yoUrP5AsSW01Rd\"\n  }\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbankole2000%2Ftql-card-validation","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbankole2000%2Ftql-card-validation","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbankole2000%2Ftql-card-validation/lists"}