The idea that customers can save money every time they eat at one of the restaurants participating in the "Rewards" network. - "A Frequent Flyer" program for restaurants.
The "rewards" application rewards an account for dining at a restaurant participating in the reward network. A reward takes the form of a monetary contribution to an account that is distributed among the account's beneficiaries. Here is how this application is used:
- When they are hungry, members dine at participating restaurants using their regular credit cards.
2. Every two weeks, a file containing the dining credit card transactions made by memberes during that period is generated.
3. A standalone `DiningBatchProcessor` application reads this file and submits each Dining record to the rewards application for processing.
The RewardNetwork is the central interface clients such as the DiningBatchProcessor use to invoke the application.
A RewardNetwork rewards an account for dining by making a monetary contribution to the account that is in turn distributed among the account's beneficiaries. The sequence diagram below shows a client's interaction with the application illustrating this process:
Internally, the RewardNetwork implementation delegates to domaon objects to carry out a rewardAccountFor(Dining) transaction. Classes exist for the two central domain concepts of the application:
Account and Restaurant.
This flow is shown below:
The RewardNetwork asks the Restaurant to calculate how much benefit to award, then continues that amount to the Account.
The Reward Dining applications use a database with this schema:


