Closed felix-b closed 5 years ago
Here I summarize a discussion that took place offline
Create a billing application for a power plant operator. The application will be responsible for:
The application will serve the following actors:
Brief requirements:
Comments and suggestions are welcome! A BDD-style specification (given-when-then) would be very useful...
This is a typical event processing system, where we:
Why event-driven? Since this system charges customers for a service, an inevitable situation must be handled where the system incorrectly charges a customer because of data corruption or human mistakes. The system must be robust in replaying its functions over the corrected inputs.
This doesn't automatically mean we're going into any special kind of technology that supports event sourcing (e.g. EventStore). We can implement event sourcing approach at specific points where it's actually necessary.
true
is applied. PaymentMethod
table. A row in PaymentMethod
table represents identification details filled by a customer for a concrete payment service. The type of the payment service is identified by the value of that row's discriminator column.
It wouldn't be necessary in an ideal world. But in reality, some Invoices might be sometimes found incorrect. This can be caused (for example) by:
The Billing job will be responsible for retroactive recalculations.
One pitfall to avoid during retroactive recalculations, is accidentally rewriting the past. As a mitigation, these restrictions apply:
(work in progress -- suggestions are welcome)
Looking good. No need in supporting all kinds of price plans and currencies right from the start. Also i recommend replacing the word "tariff" with "price plan"
Why there's need in two different apps? One app might be enough for demo purposes. The user will be redirected according to their identity to the correspondent root view
@godrose yes, I agree about not implementing variations of pricing strategies etc right from the start. Just wanted to illustrate how they are planned to be implemented.
"Pricing Plan" indeed sounds better. "Rate Plan" can also be good -- here is an indication of usage from Google Books
As for having 1 or 2 apps, I'd like to demonstrate a production-ready system, so I'd rather apply considerations about production. Since the apps serve two different kinds of users, I'm considering these points:
One interesting alternative is display 2 different login forms on a common login page. But then we have 3 apps: login, back office, and dashboard.
Service | Responsibilities | API Endpoints |
---|---|---|
Sensor service (red color, daemon) | Sensors subdomain; store sensor readings | (1) push sensor readings (2) TX = submit transaction requests (3) QX = run entity queries |
Customer service (cyan color, daemon) | Customers subdomain; manage pricing plans and contracts | TX, QX |
Billing service (purple color, daemon) | Billing subdomain; query and invalidate invoices | TX, QX |
Billing job (purple color, batch job) | Generate invoices based on data from Sensors and Customers subdomains | N/A |
Payment service (green color, daemon) | Payment subdomain + process payments through integration with online payment services | TX, QX + callback endpoints specific to payment services |
Login service (yellow color, daemon) | User Accounts subdomain + authenticate users | TX, QX |
Admin App service | Host back-office web app | Web |
Dashboard App service | Host dashboard web app | Web |
The MVP application is a driver for design and implementation of programming models in use. I gather related issues in the list below:
What's ready for review by now:
pr-mvp
The solution is structured as follows:
Note that the solution doesn't yet consume NWheels NuGet packages. Temporarily, a class library named NWheelsTempApiLib contains mocks of all NWheels APIs (https://github.com/felix-b/NWheels/tree/pr-mvp/Samples/02-ElectricityBilling/ElectricityBilling/NWheelsTempApiLib). The mocks are just for the application code to compile, they can't execute.
This is still mid-work. The most of the progress was with the Sensor Service (https://github.com/felix-b/NWheels/tree/pr-mvp/Samples/02-ElectricityBilling/ElectricityBilling/ElectricityBilling.SensorService)
We need an MVP demo application that would demonstrate the strengths of the framework.