killbill-memoizeit

analytics: add first set of system dashboards (payments) Signed-off-by:

5/16/2013 6:57:44 PM

Details

diff --git a/osgi-bundles/bundles/analytics/src/main/resources/reports/analytics.ini b/osgi-bundles/bundles/analytics/src/main/resources/reports/analytics.ini
index 3824b19..a3804e5 100644
--- a/osgi-bundles/bundles/analytics/src/main/resources/reports/analytics.ini
+++ b/osgi-bundles/bundles/analytics/src/main/resources/reports/analytics.ini
@@ -31,3 +31,23 @@ prettyName = Conversions per day
 [cancellations_per_day]
 tableName = v_cancellations_per_day
 prettyName = Effective cancellations per day
+
+[system_report_payment_plugin_failure_aborted]
+tableName = v_system_report_payment_plugin_failure_aborted
+prettyName = PLUGIN_FAILURE_ABORTED and UNKNOWN
+
+[system_report_payment_plugin_failure]
+tableName = v_system_report_payment_plugin_failure
+prettyName = PLUGIN_FAILURE
+
+[system_report_payment_payment_failure_aborted]
+tableName = v_system_report_payment_payment_failure_aborted
+prettyName = PAYMENT_FAILURE_ABORTED
+
+[system_report_payment_payment_failure]
+tableName = v_system_report_payment_payment_failure
+prettyName = PAYMENT_FAILURE
+
+[system_report_payment_success]
+tableName = v_system_report_payment_success
+prettyName = SUCCESS
diff --git a/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_payment_failure.sql b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_payment_failure.sql
new file mode 100644
index 0000000..a13b6b8
--- /dev/null
+++ b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_payment_failure.sql
@@ -0,0 +1,11 @@
+create or replace view v_system_report_payment_payment_failure as
+select
+  date_format(updated_date, '%Y-%m-%d') as day
+, count(*) as count
+from payments
+join bin using(invoice_id)
+where bin.balance > 0
+and payment_status = 'PAYMENT_FAILURE'
+group by date_format(updated_date, '%Y-%m-%d')
+order by date_format(updated_date, '%Y-%m-%d') asc
+;
diff --git a/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_payment_failure_aborted.sql b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_payment_failure_aborted.sql
new file mode 100644
index 0000000..7d7e8d1
--- /dev/null
+++ b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_payment_failure_aborted.sql
@@ -0,0 +1,11 @@
+create or replace view v_system_report_payment_payment_failure_aborted as
+select
+  date_format(updated_date, '%Y-%m-%d') as day
+, count(*) as count
+from payments
+join bin using(invoice_id)
+where bin.balance > 0
+and payment_status = 'PAYMENT_FAILURE_ABORTED'
+group by date_format(updated_date, '%Y-%m-%d')
+order by date_format(updated_date, '%Y-%m-%d') asc
+;
diff --git a/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_plugin_failure.sql b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_plugin_failure.sql
new file mode 100644
index 0000000..81f2f87
--- /dev/null
+++ b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_plugin_failure.sql
@@ -0,0 +1,11 @@
+create or replace view v_system_report_payment_plugin_failure as
+select
+  date_format(updated_date, '%Y-%m-%d') as day
+, count(*) as count
+from payments
+join bin using(invoice_id)
+where bin.balance > 0
+and payment_status = 'PLUGIN_FAILURE'
+group by date_format(updated_date, '%Y-%m-%d')
+order by date_format(updated_date, '%Y-%m-%d') asc
+;
diff --git a/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_plugin_failure_aborted.sql b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_plugin_failure_aborted.sql
new file mode 100644
index 0000000..fa0ee08
--- /dev/null
+++ b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_plugin_failure_aborted.sql
@@ -0,0 +1,11 @@
+create or replace view v_system_report_payment_plugin_failure_aborted as
+select
+  date_format(updated_date, '%Y-%m-%d') as day
+, count(*) as count
+from payments
+join bin using(invoice_id)
+where bin.balance > 0
+and (payment_status = 'PLUGIN_FAILURE_ABORTED' or payment_status = 'UNKNOWN')
+group by date_format(updated_date, '%Y-%m-%d')
+order by date_format(updated_date, '%Y-%m-%d') asc
+;
diff --git a/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_success.sql b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_success.sql
new file mode 100644
index 0000000..78b542d
--- /dev/null
+++ b/osgi-bundles/bundles/analytics/src/main/resources/reports/system_report_payment_success.sql
@@ -0,0 +1,11 @@
+create or replace view v_system_report_payment_success as
+select
+  date_format(updated_date, '%Y-%m-%d') as day
+, count(*) as count
+from payments
+join bin using(invoice_id)
+where bin.balance > 0
+and payment_status = 'SUCCESS'
+group by date_format(updated_date, '%Y-%m-%d')
+order by date_format(updated_date, '%Y-%m-%d') asc
+;