Installation Instructions

User Manual: Pdf

Open the PDF directly: View PDF PDF.
Page Count: 5

Installation Instructions
1. Clone the project from gitlab: git clone https://github.com/bryanMt/recruitment-
test.git
2. Cd into the project: cd recruitment-test
3. Go into the docker-symfony folder: cd docker-symfony
4. Build the docker container: docker-compose build
5. Start the docker container: docker-compose up -d . If you have some other service
running on port 80, you will need to kill the process, and re-execute the command.
6. Launch docker php bash: docker-compose exec php bash
7. Install composer dependencies: composer install.
8. Run the doctrine migrations: sf3 doctrine:migrations:migrate
9. In your etc hosts file add the following entry: 127.0.0.1 localunixsocket
Example:
POST http://127.0.0.1:80/customer/:customer_id
Endpoint Documentation
1. Registering a new customer
Endpoint Route / Url
http://127.0.0.1:80/customer
Method
POST
2. Editing a customer
Post Body
{
"firstname" : "bryan",
"gender": "male | female",
"lastname": "borg",
"country": "fr",
"email": "bryborg@gmail.com"
}
Response Code
200
{
"id": 3,
"gender": "male",
"first_name": "bryan",
"last_name": "borg",
"country": "fr",
"email": "bryborg@gmail.com",
"bonus": 5
}
400
Invalid Input
Missing parameters
Invalid Country
Invalid Email
Non unique Email
500
Internal Error
Endpoint Route / Url
http://127.0.0.1:80/customer/:customer_id
Method
PUT
Post Body
{
"firstname" : "bryan",
"gender": "male | female",
"lastname": "borg",
"country": "fr",
"email": "bryborg@gmail.com"
}
Note: The body params are optional. You can update only of the the
details, if you want to. The bonus is not updatable.
Response Code
3. Depositing money
200
{
"id": 3,
"gender": "male",
"first_name": "bryan",
"last_name": "borg",
"country": "fr",
"email": "bryborg@gmail.com",
"bonus": 5
}
400
Invalid Input
Missing parameters
Invalid Country
Invalid Email
Non unique Email
500
Internal Error
Endpoint Route / Url
http://127.0.0.1:80/deposit/:customer_id
Method
POST
Post Body
{
"amount" : "50.0",
"currency": "EUR"
}
Response Code
200
{
"id": 6,
"customer_id": 3,
"real_deposit_amount": 50,
"bonus_deposit_amount": 2.5
}
400
Invalid Input
Missing parameters
Unsupported Currency
Invalid deposit amount
Invalid customer id
500
Internal Error
4. Withdrawing money
5. Statistics / Reporting
Endpoint Route / Url
http://127.0.0.1:80/withdrawal/:customer_id
Method
POST
Post Body
{
"amount" : "50.0",
"currency": "EUR"
}
Response Code
200
{
"id": 6,
"customer_id": 3,
"real_deposit_amount": 50,
"bonus_deposit_amount": 2.5
}
400
Invalid Input
Missing parameters
Unsupported Currency
Invalid amount
Invalid customer id
Insufficient Balance
500
Internal Error
Endpoint Route / Url
http://127.0.0.1:80/statistics?dateFrom=Y-m-d&dateTo=Y-m-d
Example:
?dateFrom=2018-01-01&dateTo=2018-01-10
Note: If no dates are specified a default of - 7 days is applied
Method
GET
Response Code
200
{
"txDate": "2018-01-10",
"country": "fr",
"unique_customers": "1",
"number_of_deposits": "3",
"number_of_withdrawals": "0",
"total_amount_deposits": "150",
"total_amount_withdrawals": "0"
},
{
"txDate": "2018-01-10",
"country": "mt",
"unique_customers": "2",
"number_of_deposits": "3",
"number_of_withdrawals": "3",
"total_amount_deposits": "100",
"total_amount_withdrawals": "98"
}
400
Invalid Input
Invalid Date
500
Internal Error

Navigation menu