{"id":17678425,"url":"https://github.com/devdrops/payments-api","last_synced_at":"2025-10-20T03:09:08.778Z","repository":{"id":200897734,"uuid":"706466031","full_name":"devdrops/payments-api","owner":"devdrops","description":"An API that handles paymenttransactions","archived":false,"fork":false,"pushed_at":"2023-10-18T20:02:04.000Z","size":42,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-05T20:30:23.200Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/devdrops.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-10-18T02:26:47.000Z","updated_at":"2023-10-18T02:27:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"bf0509b9-b4cc-4e66-9372-077a418d351a","html_url":"https://github.com/devdrops/payments-api","commit_stats":null,"previous_names":["devdrops/payments-api"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdrops%2Fpayments-api","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdrops%2Fpayments-api/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdrops%2Fpayments-api/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/devdrops%2Fpayments-api/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/devdrops","download_url":"https://codeload.github.com/devdrops/payments-api/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246358323,"owners_count":20764366,"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-10-24T08:04:50.799Z","updated_at":"2025-10-20T03:09:03.730Z","avatar_url":"https://github.com/devdrops.png","language":"Go","readme":"# Payments API\n\nA [RESTful](https://en.wikipedia.org/wiki/REST) API that processes transactions.\n\n## Index\n\n- [**Concepts**](#concepts)\n  - [**Accounts**](#accounts)\n  - [**Transactions**](#transactions)\n  - [**Extras**](#extras)\n- [**Execution**](#execution)\n  - [**Prerequisites**](#prerequisites)\n  - [**How to Run**](#how-to-run)\n  - [**How to Stop**](#how-to-stop)\n  - [**How to Run Tests**](#how-to-run-tests)\n\n## Concepts\n\nThis project uses:\n\n- [Go](https://go.dev/) as the coding language.\n- [PostgreSQL](https://www.postgresql.org/) as the database.\n\n```mermaid\nflowchart LR\n    api[Go app\\nHTTP API]\n    db[(PostgreSQL\\ndatabase)]\n    api \u003c-... Write/Read Operations ...-\u003e db\n```\n\nThe expected inputs for the application should come as HTTP requests, for each specific resource/endpoint:\n\n### Accounts\n\nCreate an Account:\n\n```\nPOST /accounts\n\nRequest body:\n{\n  \"document\": \"12345678900\"\n}\n```\n\nReads an Account, based on an ID:\n\n```\nGET /accounts/{:accountID}\n```\n\n### Transactions\n\nCreate a Transaction:\n\n```\nPOST /transactions\n\nRequest body:\n{\n  \"account_id\": 1,\n  \"operation_id\": 1,\n  \"amount\": 543.21\n}\n```\n\n### Extras\n\nSome notes about what I'd thought would be nice to the project.\n\n- In the [extras](./extras) folder, you can find 2 files to use with [Postman](https://www.postman.com/): a Collection\nand an Environment.\n- I've noticed several flaws in the choice of how to work with databases: breaking interface/abstraction rules, usage of\ntransactions/commits/rollbacks, etc. In a next scenario, it will be a better choice to use something that already exists\ninstead of trying to reinvent the wheel :wink:\n\n## Execution\n\n### Prerequisites\n\nThis project offers a local environment to get this project up and running. This environment should be used **only** for\nlocal development/execution.\n\nIn order to use this environment, first make sure you have the tools below correctly installed:\n\n|TOOL|VERSION\\*|\n|:---|:---|\n|[Git](https://git-scm.com/)\\*\\*|`2.34.1`|\n|[Docker](https://www.docker.com/)|`24.0.6 (linux/amd64)`|\n|[Docker Compose](https://docs.docker.com/compose/)|`Docker Compose version v2.21.0`|\n|[Make](https://www.gnu.org/software/make/)|`GNU Make 4.3 (x86_64-pc-linux-gnu)`|\n\n\\*: these are suggested versions, for a Linux environment. It will (probably) have no issues in Mac OS, but It may (or\nnot) work using other versions/OSs.\n\\*\\*: required to clone this repository :wink:\n\n**Also important**: the local environment will try to use ports **8080** (API) and **5432** (database). Before start,\ncheck if these ports are available. If not, you can select other ports by changing them in the\n[docker-compose.yml](./docker-compose.yml) file.\n\n### How to Run\n\nOnce you're OK with the steps on [**Prerequisites**](#prerequisites), you can follow the actions below:\n\n1. Using your terminal, navigate to this project's root folder.\n2. In the same terminal windown, copy the file [`env/.env.sample`](./env/.env.sample) to `env/.env`. You can run the\ncommand below in your terminal:\n\n```shell\ncp env/.env.sample env/.env\n```\n\n3. Also in the same terminal window, run the command below:\n\n```shell\nmake start\n```\n\nThis command will:\n\n1. Pull/build the required images.\n2. Start the database server.\n3. Create the application's database.\n4. Start the application at [0.0.0.0:8080](http://0.0.0.0:8080).\n\n### How to Stop\n\n1. Using your terminal, navigate to this project's root folder.\n2. In the same terminal window, run the command below:\n\n```shell\nmake stop\n```\n\n### How to Run Tests\n\n1. Using your terminal, navigate to this project's root folder.\n2. In the same terminal window, run the command below:\n\n```shell\nmake tests\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdrops%2Fpayments-api","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdevdrops%2Fpayments-api","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdevdrops%2Fpayments-api/lists"}