This Transaction Commission Calculator application is built with PHP and uses Composer for dependency management. The application reads transactions from an input file, calculates commissions based on the origin country of the credit card and the transaction currency, and outputs the results.
Before proceeding with the setup, ensure you have the following installed on your machine:
- PHP
- Composer
-
Clone the Repository
First, clone the repository to your local machine. Open a terminal and run the following command:
[email protected]:gediminasnn/php.ps-code-refinery.git
(Optional) Replace
[email protected]:gediminasnn/php.ps-code-refinery.git
with the URL of repository. -
Navigate to the Application Directory
Change directory to the application root:
cd php.ps-code-refinery
(Optional) Replace
php.ps-code-refinery
with the path where you cloned the repository. -
Install Composer Dependencies
Before starting the Docker containers, install the project's PHP dependencies using Composer. Open a terminal and navigate to your project directory. Then, run the following command:
composer install
This command downloads and installs all the PHP libraries your project requires based on the
composer.json
file. -
Run the Application
You can run the application using the following command:
php app.php input.txt
Make sure to replace input.txt with the path to your input file containing the transactions.
-
(Optional) Run Tests
Open a new terminal window or tab and execute the following command:
./vendor/bin/phpunit tests
This command will execute your application's test suite. It will run all the tests located in the tests directory of your application.
By completing this step, you will have fully set up your Transaction Commission Calculator on your local development environment, ensuring it is ready for further development, testing, or deployment.
{"bin":"45717360","amount":"100.00","currency":"EUR"}
{"bin":"516793","amount":"50.00","currency":"USD"}
{"bin":"45417360","amount":"10000.00","currency":"JPY"}
{"bin":"41417360","amount":"130.00","currency":"USD"}
{"bin":"4745030","amount":"2000.00","currency":"GBP"}
php app.php input.txt
1
0.47
1.66
2.41
43.72
This project is licensed under the MIT License