This is an intern assessment for the position of a go developper at Moneway.
This is a simulation of a transaction and update of a balance. There are two services, "balance" and "transaction". The "balance" service is responsible for handling the balance within the database, and the "transaction" service is responsible for updating the balance (by contacting the balance service) and storing the transaction data.
These are the Features:
- list the balance
- Credit and debit an Account
- Create transactions
- Update the balance
The goal of the exercise is to apply (at most) the good practices of microservices (microservices.io and gRPC), the mastery of the Go language, and the mastery of database operations.
This makes use of MySql Database
In the config/config.toml file you will find the configuration file for the Database. Make changes to suit your database settings.
server = "docker.for.mac.localhost"
port = "3306"
database = "moneway"
user = "your username"
password = "your password"
The database schema could be found in the moneway.sql file.
In order to build and run code,open a terminal in the MonewayV1.0 Directory and execute the following command:
docker-compose up --build
Structure of Transaction Object
"transaction": {
"AccountID" : "1",
"Description" : "This is a test",
"Amount" : 350.00,
"Currency" : "Euro",
"TransactionType" : "CREDIT"
}
TransactionType can be either CREDIT or DEBIT
In order to make a Transaction Open a New terminal and run the following command:
curl -XPOST http://localhost:8801/transct -d '{"transaction": {"AccountID" : "1", "Description" : "This is a test", "Amount" : 350.00, "Currency" : "Euro", "TransactionType" : "CREDIT"}}'
In order for easy workflow within Moneway, we will be migrating to ScyllaDB.