This is a simple transfer app from customer to merchant.
Request :
- Method :
POST
- Endpoint :
/users
- Header :
- Content-Type : application/json
- Accept : application/json
- Body :
{
"email": "albaras@gmail.com",
"username": "albar",
"password": "secret",
"role": "user"
}
Request :
-
Method :
POST
-
Endpoint :
/users/login
-
Header :
- Content-Type : application/json
- Accept : application/json
-
Body :
{ "username": "albar", "password": "secret" }
Request :
-
Method :
GET
-
Endpoint :
/users
-
Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
Only user with role admin can access this route
Request :
- Method :
PUT
- Endpoint :
/users
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
- Body :
{
"id": "sdifjij39214",
"email": "albaras@gmail.com",
"username": "albar",
"password": "secret",
"role": "user"
}
Request :
-
Method :
POST
-
Endpoint :
/customers
-
Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
-
Body :
{ "name": "Albar Adimas Suntoro" }
Only user with role admin can access this route
Request :
- Method :
GET
- Endpoint :
/customers
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
Request :
-
Method :
GET
-
Endpoint :
/customers/:name
-
Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
Request :
- Method :
DELETE
- Endpoint :
/customers/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
Request :
- Method :
GET
- Endpoint :
/transaction/top-up
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
- Body :
{
"amount" : 10000
}
Request :
Only user with role admin can access this route
-
Method :
POST
-
Endpoint :
/merchants
-
Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
-
Body :
{ "name": "XLEND", "description": "Perusahan Retail", "busines_type": "retail" }
Only user with role admin can access this route
Request :
- Method :
DELETE
- Endpoint :
/merchants/:id
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
Request :
-
Method :
GET
-
Endpoint :
/customers/:id
-
Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
Request :
- Method :
GET
- Endpoint :
/merchants
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
Request :
-
Method :
POST
-
Endpoint :
/transactions
-
Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
-
Body :
{ "receiver_merchant_id": "659092c2-da66-42bf-b61c-0464dabb9a2e", "amount": 100 }
Request :
- Method :
GET
- Endpoint :
/transactions
- Header :
- Content-Type : application/json
- Accept : application/json
- Authorization : Bearer token
- Clone this repository
- Copy
.env.example
to.env
- Change the value of
.env
to your configuration - Download packages with
go mod tidy
- Create database db_payments
- Copy
config/database/init.sql
to your database - Run the app with
go run main.go
- Clone this repository
- Copy
.env.example
to.env
- Change the value of
.env
to your configuration - Run
docker-compose up -d
- Enter the db container with
docker exec -it payments-app-db-1 sh
- login to postgres with
psql -U postgres
- Create database db_payments with
CREATE DATABASE db_payments;
- Copy
config/database/init.sql
to your database
- Clone this repository to your server
- Do the same as how to run with docker
- Setup nginx to your server
- Setup ssl to your server
- Setup reverse proxy to your server