This is a simple Java program that shows the best payment method for a given orders based on the provided payment methods and their discounts.
You need two files, one with the orders and the other one with payment methods. Both of them are supposed to be json files, e.g.
- orders.json
[
{
"id": "ORDER1",
"value": "100.00",
"promotions": [
"mZysk"
]
},
{
"id": "ORDER2",
"value": "200.00",
"promotions": [
"BosBankrut"
]
},
{
"id": "ORDER3",
"value": "150.00",
"promotions": [
"mZysk",
"BosBankrut"
]
},
{
"id": "ORDER4",
"value": "50.00"
}
]- paymentmethods.json
[
{
"id": "PUNKTY",
"discount": "15",
"limit": "100.00"
},
{
"id": "mZysk",
"discount": "10",
"limit": "180.00"
},
{
"id": "BosBankrut",
"discount": "5",
"limit": "200.00"
}
]- Clone the repository
- Open the terminal and navigate to the project directory
- Run the following command to build the project:
mvn install
- This will create a JAR file in the
targetdirectory.
You either need to build the program first, or download the JAR file from the releases. Run the following command to execute the program:
java -jar payment-deals-1.0-SNAPSHOT.jar <path_to_orders.json> <path_to_paymentmethods.json>
To run the tests, use the following command:
mvn testand optionally, you can build a website with a raport and test results:
mvn site