Add readme for billing

This commit is contained in:
Nico Schottelius 2020-06-20 22:15:15 +02:00
parent a3f3ca8cf9
commit 95011c2058

30
doc/README-billing.org Normal file
View file

@ -0,0 +1,30 @@
* How to handle billing in general
** Orders
- Orders are the heart of uncloud billing
- Have a starting date
- Have an ending date
*** Statuses
- CREATING/PREPARING
- INACTIVE (?)
- TO_BILL / NOT_TO_BILL
*** Updating status of orders
- If has succeeding order and billing date is last month -> set inactive
** Bills
- Are always for a month
- Can be preliminary
*** Which orders to include
- Not the cancelled ones / not active ones
-
** Flows / Approach
*** Finding all orders for a bill
- Get all orders, state != NOT_TO_BILL; for each order do:
- is it a one time order?
- has it a bill assigned?
- yes: set to NOT_TO_BILL
- no:
- get_or_create_bill_for_this_month
- assign bill to this order
- set to NOT_TO_BILL
- First of month
- Last of month