From 95011c2058446e82c34336f59237162665a19165 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Sat, 20 Jun 2020 22:15:15 +0200 Subject: [PATCH] Add readme for billing --- doc/README-billing.org | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 doc/README-billing.org diff --git a/doc/README-billing.org b/doc/README-billing.org new file mode 100644 index 0000000..d749e31 --- /dev/null +++ b/doc/README-billing.org @@ -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