improve save sections
implement dead letter topic handler
ws push the whole machine state back after persisting
Develop the central business logic of a beverage vending machine with payment function. The vending machine is to have different compartments, each with its own price for different beverages.
Make the logic available via a typified interface, on the basis of which you can demonstrate the functionality via automated tests.
The main function could look as follows, for example:
DrinkAndChange buy(Beverage chosenBeverage, Coin... payment);
The function returns the desired beverage and, if applicable, the change in the form of coins of different values.
The function returns an error if, for example, the desired beverage is sold out, the deposited amount is too small or the vending machine cannot give suitable change.
The vending machine should distinguish between the following coins:
When buying a drink at the price of 1.20 EUR and depositing a 2 EUR coin, the vending machine returns 80 cents change in the form of a 50, 20 and 10 cents coin.
The stock of goods and money in the vending machine is limited, and the interface should have functions for filling and emptying the machine.
Include in your design only as much flexibility as is reasonable, e.g.: different prices and goods for vending machines at different locations, but not different coin values.
The exercise does not require the provision of a UI, nor does it require persistence of the vending machine state in a database. A transient solution is sufficient.
The way is the goal, etc, etc...