Check which options are valid for this cart item using the data from the previous step and filter out the invalid options
Find the base price from the base price list for each item in the cart using its options + product type as unique keys
Perform price calculation using the data from both objects for each cart item
Price Calculation Formula
(base_price + round(base_price * artist_markup in cents)) * quantity
Architecture
I'm using Uncle Bob's Clean Architecture in combination with domain-driven design. Basically I'm grouping my Clean
Architecture concerns (gateways, use cases, presenters, etc) by their respective domains.
How I did it
Abstracted the domain problem without caring about the underlying implementation using interfaces
Started working on the underlying implementations
Cart item price calculator + tests
Whole cart price calculator + tests
Gateway that fetches the item with the base price from the JSON file + tests
Implemented the CLI app + tests
The AppTest can be considered an integration or end to end test since it encompasses the whole logic of the core package
then either java -jar target/priceyyy-1.0.0-SNAPSHOT-jar-with-dependencies.jar <cart_file_path> <base_prices_file> or
java -jar target/priceyyy-1.0.0-SNAPSHOT-jar-with-dependencies.jar for interactive mode
About
Calculate cart prices using 2 separate json files: one for the cart and one for the base prices