This project was generated with Angular CLI version 12.2.6, NGRX version 12.4.0.
Paysera users can go to a branch to cash in and/or cash out from Paysera account. There are also commission fees for both cash in and cash out. Only supported currency is EUR.
Commission fee - 0.03% from total amount, but no more than 5.00 EUR.
You can get configuration from API
There are different commission fees for cash out for natural and legal persons.
Default commission fee - 0.3% from cash out amount.
1000.00 EUR per week (from monday to sunday) is free of charge.
If total cash out amount is exceeded - commission is calculated only from exceeded amount (that is, for 1000.00 EUR there is still no commission fee).
You can get configuration from API
Commission fee - 0.3% from amount, but not less than 0.50 EUR for operation.
You can get configuration from API
After calculating commission fee, it's rounded to the smallest currency item (for example, for EUR currency - cents) to upper bound (ceiled). For example, 0.023 EUR should be rounded to 3 Euro cents.
Input data is given in JSON file. Performed operations are given in that file. In each object following data is provided:
{
"date": "2016-01-05", // operation date in format `Y-m-d`
"user_id": 1, // user id, integer
"user_type": "natural", // user type, one of “natural”(natural person) or “juridical”(legal person)
"type": "cash_in", // operation type, one of “cash_in” or “cash_out”
"operation": {
"amount": 200, // operation amount(for example `2.12` or `3`)
"currency": "EUR" // operation currency `EUR`
}
}
All operations are ordered by their date ascendingly.
As a single argument program must accept a path to the input file.
Program must output result to stdout.
Result - calculated commission fees for each operation. In each line only final calculated commission fee must be provided without currency.
➜ cat input.json
[
{ "date": "2016-01-05", "user_id": 1, "user_type": "natural", "type": "cash_in", "operation": { "amount": 200.00, "currency": "EUR" } },
{ "date": "2016-01-06", "user_id": 2, "user_type": "juridical", "type": "cash_out", "operation": { "amount": 300.00, "currency": "EUR" } },
{ "date": "2016-01-06", "user_id": 1, "user_type": "natural", "type": "cash_out", "operation": { "amount": 30000, "currency": "EUR" } },
{ "date": "2016-01-07", "user_id": 1, "user_type": "natural", "type": "cash_out", "operation": { "amount": 1000.00, "currency": "EUR" } },
{ "date": "2016-01-07", "user_id": 1, "user_type": "natural", "type": "cash_out", "operation": { "amount": 100.00, "currency": "EUR" } },
{ "date": "2016-01-10", "user_id": 1, "user_type": "natural", "type": "cash_out", "operation": { "amount": 100.00, "currency": "EUR" } },
{ "date": "2016-01-10", "user_id": 2, "user_type": "juridical", "type": "cash_in", "operation": { "amount": 1000000.00, "currency": "EUR" } },
{ "date": "2016-01-10", "user_id": 3, "user_type": "natural", "type": "cash_out", "operation": { "amount": 1000.00, "currency": "EUR" } },
{ "date": "2016-02-15", "user_id": 1, "user_type": "natural", "type": "cash_out", "operation": { "amount": 300.00, "currency": "EUR" } },
]
➜ node app.js input.json
0.06
0.90
87.00
3.00
0.30
0.30
5.00
0.00
0.00
Further information about the task is here: https://gist.github.com/PayseraGithub/ef12dabace4c00a3f450f9a9f259d3cd#requirements
Clone the repo and install the dependencies.
git clone https://github.com/elham-sedighi/feecalculation---Angular.git
cd feecalculation---Angular-master
npm install
Run ng serve
for a dev server. Navigate to http://localhost:4200/
. The app will automatically reload if you change any of the source files.
Run ng generate component component-name
to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module
.
Run ng build
to build the project. The build artifacts will be stored in the dist/
directory.
Run ng test
to execute the unit tests via Karma.
Run ng e2e
to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities.
To get more help on the Angular CLI use ng help
or go check out the Angular CLI Overview and Command Reference page.