Responsible for managing payments with third-party providers.
Commands used to build and run the application can be found in Makefile.
E.g. the application can be started by running make compose/up
. You can check by visiting port 4000 on your browser.
Application monitoring is done with Prometheus.
The endpoint that Prometheus scrapes is http://localhost:4000/metrics
Application metrics can be visualized with Grafana.
Default login: admin/admin
We use Testify as our testing library in conjunction with the standard library from Go.
This library also provides Mock capabilities and in order to auto-generate interfaces we can use Mockery
You can create all mocks by running go generate ./...
and the files that has the annotation below, they'll be
automatically generated.
//go:generate mockery --name=HttpClient --output ./../../mocks/ --filename http_client.go --structname HttpClientMock
If you want to generate a specific Mock from an interface go to the interface folder and run:
E.g.
cd internal/commmunications/http
mockery --name=HttpClient --output ./../../mocks/ --filename http_client.go --structname HttpClientMock
This command will generate a mock for our tests.
Usage:
httpClient := &mocks.HttpClientMock{}
httpClient.On("Post").Return(nil, nil)
Our database version control is done with go-migrate.
There are a couple of ways of installing it, and homebrew is one of them:
brew install golang-migrate
Every change to the database schema must be done through the usage of this tool.
Usage:
migrate create -seq -ext=.sql -dir=./migrations create_charges_table
Applying migration:
export DSN='postgres://facilittei:4321@localhost/facilittei?sslmode=disable'
migrate -path ./migrations -database ${DSN} up