Installation Instructions

User Manual: Pdf

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

DownloadInstallation Instructions
Open PDF In BrowserView PDF
Installation Instructions

1. Clone the project from gitlab: git clone https://github.com/bryanMt/recruitmenttest.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

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
}

2.

400

Invalid Input

500

Internal Error

Missing parameters
Invalid Country
Invalid Email
Non unique Email

Editing a customer

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

200

{
"id": 3,
"gender": "male",
"first_name": "bryan",
"last_name": "borg",
"country": "fr",
"email": "bryborg@gmail.com",
"bonus": 5
}

3.

400

Invalid Input

500

Internal Error

Missing parameters
Invalid Country
Invalid Email
Non unique Email

Depositing money

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

500

Internal Error

Missing parameters
Unsupported Currency
Invalid deposit amount
Invalid customer id

4.

Withdrawing money

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
}

5.

400

Invalid Input

500

Internal Error

Missing parameters
Unsupported Currency
Invalid amount
Invalid customer id
Insufficient Balance

Statistics / Reporting

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

500

Internal Error

Invalid Date



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.3
Linearized                      : No
Page Count                      : 5
Title                           : Installation_instructions (1).pages
Producer                        : Mac OS X 10.12.6 Quartz PDFContext
Creator                         : Pages
Create Date                     : 2018:01:11 15:03:25Z
Modify Date                     : 2018:01:11 15:03:25Z
EXIF Metadata provided by EXIF.tools

Navigation menu