kaui 0.2.0 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/app/assets/javascripts/kaui/bootstrap-tweaks.js +1 -1
- data/app/assets/stylesheets/kaui/analytics.css +4 -0
- data/app/controllers/kaui/analytics_controller.rb +30 -0
- data/app/controllers/kaui/chargebacks_controller.rb +3 -1
- data/app/controllers/kaui/invoices_controller.rb +5 -0
- data/app/helpers/kaui/killbill_helper.rb +19 -0
- data/app/models/kaui/analytics_sanity.rb +7 -0
- data/app/models/kaui/base.rb +1 -0
- data/app/models/kaui/business_account.rb +12 -0
- data/app/models/kaui/business_field.rb +6 -0
- data/app/models/kaui/business_invoice.rb +31 -0
- data/app/models/kaui/business_invoice_item.rb +17 -0
- data/app/models/kaui/business_invoice_payment.rb +25 -0
- data/app/models/kaui/business_overdue_status.rb +8 -0
- data/app/models/kaui/business_snapshot.rb +9 -0
- data/app/models/kaui/business_subscription_transition.rb +54 -0
- data/app/models/kaui/business_tag.rb +5 -0
- data/app/views/kaui/analytics/account_snapshot.html.erb +211 -0
- data/app/views/kaui/analytics/index.html.erb +34 -12
- data/app/views/kaui/analytics/sanity.html.erb +47 -0
- data/app/views/kaui/chargebacks/new.html.erb +2 -0
- data/app/views/kaui/layouts/kaui_application.html.erb +1 -1
- data/app/views/kaui/payments/_payments_table.html.erb +1 -1
- data/config/routes.rb +3 -0
- data/lib/generators/kaui/install/templates/app/assets/javascripts/kaui/all.js +1 -1
- data/lib/generators/kaui/install/templates/app/assets/stylesheets/kaui/all.css +1 -1
- data/lib/kaui/version.rb +1 -1
- data/test/dummy/app/assets/javascripts/application.js +2 -2
- data/test/dummy/app/assets/stylesheets/application.css +1 -1
- data/vendor/assets/images/img/glyphicons-halflings.png +0 -0
- data/vendor/assets/javascripts/js/bootstrap.v2.2.1.min.js +6 -0
- data/vendor/assets/stylesheets/css/bootstrap.v2.2.1.min.css +9 -0
- metadata +17 -5
- data/vendor/assets/javascripts/js/bootstrap.v2.0.4.min.js +0 -6
- data/vendor/assets/stylesheets/css/bootstrap.v2.0.4.min.css +0 -9
@@ -19,6 +19,27 @@ module Kaui
|
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
+
def account_snapshot
|
23
|
+
# params[:account_id] can either be a uuid or an external key
|
24
|
+
begin
|
25
|
+
@account = Kaui::KillbillHelper::get_account_by_key(params[:account_id])
|
26
|
+
@snapshot = Kaui::KillbillHelper::get_account_snapshot(@account.account_id)
|
27
|
+
rescue => e
|
28
|
+
flash[:error] = "Error while retrieving account snapshot: #{as_string(e)}"
|
29
|
+
redirect_to :analytics
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def refresh_account
|
34
|
+
begin
|
35
|
+
Kaui::KillbillHelper::refresh_account(params[:account_id])
|
36
|
+
flash[:notice] = "Account successfully refreshed!"
|
37
|
+
rescue => e
|
38
|
+
flash[:error] = "Error while refreshing account: #{as_string(e)}"
|
39
|
+
end
|
40
|
+
redirect_to account_snapshot_path(:account_id => params[:account_id])
|
41
|
+
end
|
42
|
+
|
22
43
|
def accounts_over_time
|
23
44
|
begin
|
24
45
|
@accounts = Analytics.accounts_over_time
|
@@ -33,5 +54,14 @@ module Kaui
|
|
33
54
|
@slug = params[:slug]
|
34
55
|
@subscriptions = Analytics.subscriptions_over_time(@product_type, @slug)
|
35
56
|
end
|
57
|
+
|
58
|
+
def sanity
|
59
|
+
begin
|
60
|
+
@sanity = Kaui::KillbillHelper::check_analytics_sanity
|
61
|
+
rescue => e
|
62
|
+
flash[:error] = "Error while checking Analytics sanity: #{as_string(e)}"
|
63
|
+
redirect_to :analytics
|
64
|
+
end
|
65
|
+
end
|
36
66
|
end
|
37
67
|
end
|
@@ -27,12 +27,14 @@ class Kaui::ChargebacksController < Kaui::EngineController
|
|
27
27
|
@account = Kaui::KillbillHelper::get_account(@account_id)
|
28
28
|
@payment = Kaui::KillbillHelper::get_payment(@payment_id)
|
29
29
|
@invoice = Kaui::KillbillHelper::get_invoice(@invoice_id)
|
30
|
-
@payment_method = Kaui::KillbillHelper::get_payment_method(@payment.payment_method_id)
|
31
30
|
rescue => e
|
32
31
|
flash[:error] = "Error while starting a new chargeback: #{as_string(e)}"
|
33
32
|
redirect_to kaui_engine.account_timeline_path(:id => params[:account_id])
|
34
33
|
end
|
35
34
|
|
35
|
+
# The payment method may have been deleted
|
36
|
+
@payment_method = Kaui::KillbillHelper::get_payment_method(@payment.payment_method_id) rescue nil
|
37
|
+
|
36
38
|
@chargeback = Kaui::Chargeback.new("paymentId" => @payment_id,
|
37
39
|
"chargebackAmount" => @payment.amount)
|
38
40
|
end
|
@@ -13,6 +13,11 @@ class Kaui::InvoicesController < Kaui::EngineController
|
|
13
13
|
if @invoice.present?
|
14
14
|
@account = Kaui::KillbillHelper.get_account(@invoice.account_id)
|
15
15
|
@payments = Kaui::KillbillHelper.get_payments(@invoice_id)
|
16
|
+
@payment_methods = {}
|
17
|
+
@payments.each do |payment|
|
18
|
+
# The payment method may have been deleted
|
19
|
+
@payment_methods[payment.payment_id] = Kaui::KillbillHelper::get_payment_method(payment.payment_method_id) rescue nil
|
20
|
+
end
|
16
21
|
|
17
22
|
@subscriptions = {}
|
18
23
|
@bundles = {}
|
@@ -552,6 +552,20 @@ module Kaui
|
|
552
552
|
|
553
553
|
############## ANALYTICS ##############
|
554
554
|
|
555
|
+
def self.get_account_snapshot(account_id)
|
556
|
+
data = call_killbill :get, "/1.0/kb/analytics/#{account_id}"
|
557
|
+
process_response(data, :single) { |json| Kaui::BusinessSnapshot.new(json) }
|
558
|
+
end
|
559
|
+
|
560
|
+
def self.refresh_account(account_id, current_user = nil, reason = nil, comment = nil)
|
561
|
+
call_killbill :put,
|
562
|
+
"/1.0/kb/analytics/#{account_id}",
|
563
|
+
nil,
|
564
|
+
"X-Killbill-CreatedBy" => current_user,
|
565
|
+
"X-Killbill-Reason" => "#{reason}",
|
566
|
+
"X-Killbill-Comment" => "#{comment}"
|
567
|
+
end
|
568
|
+
|
555
569
|
def self.get_accounts_created_over_time
|
556
570
|
data = call_killbill :get, "/1.0/kb/analytics/accountsCreatedOverTime"
|
557
571
|
process_response(data, :single) { |json| Kaui::TimeSeriesData.new(json) }
|
@@ -561,5 +575,10 @@ module Kaui
|
|
561
575
|
data = call_killbill :get, "/1.0/kb/analytics/subscriptionsCreatedOverTime?productType=#{product_type}&slug=#{slug}"
|
562
576
|
process_response(data, :single) { |json| Kaui::TimeSeriesData.new(json) }
|
563
577
|
end
|
578
|
+
|
579
|
+
def self.check_analytics_sanity
|
580
|
+
data = call_killbill :get, "/1.0/kb/analytics/sanity"
|
581
|
+
process_response(data, :single) { |json| Kaui::AnalyticsSanity.new(json) }
|
582
|
+
end
|
564
583
|
end
|
565
584
|
end
|
data/app/models/kaui/base.rb
CHANGED
@@ -0,0 +1,12 @@
|
|
1
|
+
class Kaui::BusinessAccount < Kaui::Base
|
2
|
+
define_attr :external_key
|
3
|
+
define_attr :name
|
4
|
+
define_attr :currency
|
5
|
+
define_attr :balance
|
6
|
+
define_attr :last_invoice_date
|
7
|
+
define_attr :total_invoice_balance
|
8
|
+
define_attr :last_payment_status
|
9
|
+
define_attr :default_payment_method_type
|
10
|
+
define_attr :default_credit_card_type
|
11
|
+
define_attr :default_billing_address_country
|
12
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Kaui::BusinessInvoice < Kaui::Base
|
2
|
+
define_attr :invoice_id
|
3
|
+
define_attr :invoice_number
|
4
|
+
define_attr :account_id
|
5
|
+
define_attr :account_key
|
6
|
+
define_attr :invoice_date
|
7
|
+
define_attr :target_date
|
8
|
+
define_attr :currency
|
9
|
+
define_attr :balance
|
10
|
+
define_attr :amount_paid
|
11
|
+
define_attr :amount_charged
|
12
|
+
define_attr :amount_credited
|
13
|
+
|
14
|
+
has_many :invoice_items, Kaui::BusinessInvoiceItem
|
15
|
+
|
16
|
+
def balance_to_money
|
17
|
+
Kaui::Base.to_money(balance.abs, currency)
|
18
|
+
end
|
19
|
+
|
20
|
+
def amount_paid_to_money
|
21
|
+
Kaui::Base.to_money(amount_paid.abs, currency)
|
22
|
+
end
|
23
|
+
|
24
|
+
def amount_charged_to_money
|
25
|
+
Kaui::Base.to_money(amount_charged.abs, currency)
|
26
|
+
end
|
27
|
+
|
28
|
+
def amount_credited_to_money
|
29
|
+
Kaui::Base.to_money(amount_credited.abs, currency)
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Kaui::BusinessInvoiceItem < Kaui::Base
|
2
|
+
define_attr :item_id
|
3
|
+
define_attr :invoice_id
|
4
|
+
define_attr :item_type
|
5
|
+
define_attr :external_key
|
6
|
+
define_attr :product_name
|
7
|
+
define_attr :product_type
|
8
|
+
define_attr :product_category
|
9
|
+
define_attr :slug
|
10
|
+
define_attr :phase
|
11
|
+
define_attr :billing_period
|
12
|
+
define_attr :start_date
|
13
|
+
define_attr :end_date
|
14
|
+
define_attr :amount
|
15
|
+
define_attr :currency
|
16
|
+
define_attr :linked_item_id
|
17
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Kaui::BusinessInvoicePayment < Kaui::Base
|
2
|
+
define_attr :payment_id
|
3
|
+
define_attr :ext_first_payment_ref_id
|
4
|
+
define_attr :ext_second_payment_ref_id
|
5
|
+
define_attr :account_key
|
6
|
+
define_attr :invoice_id
|
7
|
+
define_attr :invoice_number
|
8
|
+
define_attr :effective_date
|
9
|
+
define_attr :amount
|
10
|
+
define_attr :currency
|
11
|
+
define_attr :payment_error
|
12
|
+
define_attr :processing_status
|
13
|
+
define_attr :requested_amount
|
14
|
+
define_attr :plugin_name
|
15
|
+
define_attr :payment_type
|
16
|
+
define_attr :payment_method
|
17
|
+
define_attr :card_type
|
18
|
+
define_attr :card_country
|
19
|
+
define_attr :invoice_payment_type
|
20
|
+
define_attr :linked_invoice_payment_id
|
21
|
+
|
22
|
+
def amount_to_money
|
23
|
+
Kaui::Base.to_money(amount.abs, currency)
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Kaui::BusinessSnapshot < Kaui::Base
|
2
|
+
has_one :business_account, Kaui::BusinessAccount
|
3
|
+
has_many :business_subscription_transitions, Kaui::BusinessSubscriptionTransition
|
4
|
+
has_many :business_invoices, Kaui::BusinessInvoice
|
5
|
+
has_many :business_invoice_payments, Kaui::BusinessInvoicePayment
|
6
|
+
has_many :business_overdue_statuses, Kaui::BusinessOverdueStatus
|
7
|
+
has_many :business_tags, Kaui::BusinessTag
|
8
|
+
has_many :business_fields, Kaui::BusinessField
|
9
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
class Kaui::BusinessSubscriptionTransition < Kaui::Base
|
2
|
+
define_attr :total_ordering
|
3
|
+
define_attr :bundle_id
|
4
|
+
define_attr :external_key
|
5
|
+
define_attr :account_id
|
6
|
+
define_attr :account_key
|
7
|
+
define_attr :subscription_id
|
8
|
+
|
9
|
+
define_attr :requested_timestamp
|
10
|
+
define_attr :event_type
|
11
|
+
define_attr :category
|
12
|
+
|
13
|
+
define_attr :prev_product_name
|
14
|
+
define_attr :prev_product_type
|
15
|
+
define_attr :prev_product_category
|
16
|
+
define_attr :prev_slug
|
17
|
+
define_attr :prev_phase
|
18
|
+
define_attr :prev_billing_period
|
19
|
+
define_attr :prev_price
|
20
|
+
define_attr :prev_price_list
|
21
|
+
define_attr :prev_mrr
|
22
|
+
define_attr :prev_currency
|
23
|
+
define_attr :prev_start_date
|
24
|
+
define_attr :prev_state
|
25
|
+
|
26
|
+
define_attr :next_product_name
|
27
|
+
define_attr :next_product_type
|
28
|
+
define_attr :next_product_category
|
29
|
+
define_attr :next_slug
|
30
|
+
define_attr :next_phase
|
31
|
+
define_attr :next_billing_period
|
32
|
+
define_attr :next_price
|
33
|
+
define_attr :next_price_list
|
34
|
+
define_attr :next_mrr
|
35
|
+
define_attr :next_currency
|
36
|
+
define_attr :next_start_date
|
37
|
+
define_attr :next_state
|
38
|
+
|
39
|
+
def prev_price_to_money
|
40
|
+
Kaui::Base.to_money(prev_price.abs, prev_currency)
|
41
|
+
end
|
42
|
+
|
43
|
+
def prev_mrr_to_money
|
44
|
+
Kaui::Base.to_money(prev_mrr.abs, prev_currency)
|
45
|
+
end
|
46
|
+
|
47
|
+
def next_price_to_money
|
48
|
+
Kaui::Base.to_money(next_price.abs, next_currency)
|
49
|
+
end
|
50
|
+
|
51
|
+
def next_mrr_to_money
|
52
|
+
Kaui::Base.to_money(next_mrr.abs, next_currency)
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,211 @@
|
|
1
|
+
<%= button_to "Refresh!", { :action => "refresh_account", :account_id => @account.account_id } %>
|
2
|
+
|
3
|
+
<h2>Account</h2>
|
4
|
+
<table class="table table-condensed table-striped right-aligned">
|
5
|
+
<thead>
|
6
|
+
<tr>
|
7
|
+
<th>External key</th>
|
8
|
+
<th>Name</th>
|
9
|
+
<th>Currency</th>
|
10
|
+
<th>Balance</th>
|
11
|
+
<th>Inv. balance</th>
|
12
|
+
<th>Last inv. date</th>
|
13
|
+
<th>Last payment status</th>
|
14
|
+
<th>Default payment method</th>
|
15
|
+
</tr>
|
16
|
+
</thead>
|
17
|
+
<tbody>
|
18
|
+
<tr>
|
19
|
+
<td><%= link_to @snapshot.business_account.external_key, Kaui.account_home_path.call(@snapshot.business_account.external_key) %></td>
|
20
|
+
<td><%= @snapshot.business_account.name %></td>
|
21
|
+
<td><%= @snapshot.business_account.currency %></td>
|
22
|
+
<td><span <% if @snapshot.business_account.balance > 0 %>class="alert-error"
|
23
|
+
<% elsif @snapshot.business_account.balance <= 0 %>class="alert-success"
|
24
|
+
<% end %>><%= @snapshot.business_account.balance %></td>
|
25
|
+
<td><span <% if @snapshot.business_account.total_invoice_balance > 0 %>class="alert-error"
|
26
|
+
<% elsif @snapshot.business_account.total_invoice_balance <= 0 %>class="alert-success"
|
27
|
+
<% end %>><%= @snapshot.business_account.total_invoice_balance %></td>
|
28
|
+
<td><%= @snapshot.business_account.last_invoice_date %></td>
|
29
|
+
<td><span <% if @snapshot.business_account.last_payment_status == 'FAILED' %>class="alert-error"
|
30
|
+
<% elsif @snapshot.business_account.last_payment_status == 'SUCCESS' %>class="alert-success"
|
31
|
+
<% end %>><%= @snapshot.business_account.last_payment_status %></td>
|
32
|
+
<td><%= @snapshot.business_account.default_payment_method_type %></td>
|
33
|
+
</tr>
|
34
|
+
</tbody>
|
35
|
+
</table>
|
36
|
+
|
37
|
+
<hr />
|
38
|
+
|
39
|
+
<h2>Subscriptions</h2>
|
40
|
+
<table class="table table-condensed table-striped data-table right-aligned">
|
41
|
+
<thead>
|
42
|
+
<tr>
|
43
|
+
<th>Bundle key</th>
|
44
|
+
<th>Requested date</th>
|
45
|
+
<th>Event</th>
|
46
|
+
<th>Next start date</th>
|
47
|
+
<th>Next slug</th>
|
48
|
+
<th>Next price</th>
|
49
|
+
<th>Next mrr</th>
|
50
|
+
</tr>
|
51
|
+
</thead>
|
52
|
+
<tbody>
|
53
|
+
<% @snapshot.business_subscription_transitions.each do |business_subscription_transition| %>
|
54
|
+
<tr <% if business_subscription_transition.event_type == 'ADD' %>class="success"
|
55
|
+
<% elsif business_subscription_transition.event_type == 'CHANGE' %>class="info"
|
56
|
+
<% elsif business_subscription_transition.event_type == 'CANCEL' %>class="warning"
|
57
|
+
<% elsif business_subscription_transition.event_type == 'SYSTEM_CANCEL' %>class="error"
|
58
|
+
<% end %>>
|
59
|
+
<td><%= link_to Kaui.bundle_key_display_string.call(business_subscription_transition.external_key), Kaui.bundle_home_path.call(business_subscription_transition.external_key) %></td>
|
60
|
+
<td><%= format_date(business_subscription_transition.requested_timestamp, @account.timezone).html_safe %></td>
|
61
|
+
<td><%= business_subscription_transition.event_type %></td>
|
62
|
+
<td><%= format_date(business_subscription_transition.next_start_date, @account.timezone).html_safe unless business_subscription_transition.next_start_date.nil? %></td>
|
63
|
+
<td><%= business_subscription_transition.next_slug %></td>
|
64
|
+
<td><%= humanized_money business_subscription_transition.next_price_to_money unless business_subscription_transition.next_price.nil? %></td>
|
65
|
+
<td><%= humanized_money business_subscription_transition.next_mrr_to_money unless business_subscription_transition.next_mrr.nil? %></td>
|
66
|
+
</tr>
|
67
|
+
<% end %>
|
68
|
+
</tbody>
|
69
|
+
</table>
|
70
|
+
|
71
|
+
<hr />
|
72
|
+
|
73
|
+
<h2>Invoices</h2>
|
74
|
+
<table class="table table-condensed table-striped data-table right-aligned">
|
75
|
+
<thead>
|
76
|
+
<tr>
|
77
|
+
<th>Invoice number</th>
|
78
|
+
<th>Invoice date</th>
|
79
|
+
<th>Target date</th>
|
80
|
+
<th>Currency</th>
|
81
|
+
<th>Balance</th>
|
82
|
+
<th>Amount paid</th>
|
83
|
+
<th>Amount charged</th>
|
84
|
+
<th>Amount credited</th>
|
85
|
+
</tr>
|
86
|
+
</thead>
|
87
|
+
<tbody>
|
88
|
+
<% @snapshot.business_invoices.each do |business_invoice| %>
|
89
|
+
<tr>
|
90
|
+
<td><%= link_to business_invoice.invoice_number, invoice_path(:id => business_invoice.invoice_id) %></td>
|
91
|
+
<td><%= business_invoice.invoice_date %></td>
|
92
|
+
<td><%= business_invoice.target_date %></td>
|
93
|
+
<td><%= business_invoice.currency %></td>
|
94
|
+
<td><span <% if business_invoice.balance > 0 %>class="alert-error"
|
95
|
+
<% elsif business_invoice.balance <= 0 %>class="alert-success"
|
96
|
+
<% end %>><%= humanized_money business_invoice.balance_to_money %></td>
|
97
|
+
<td><%= humanized_money business_invoice.amount_paid_to_money %></td>
|
98
|
+
<td><%= humanized_money business_invoice.amount_charged_to_money %></td>
|
99
|
+
<td><%= humanized_money business_invoice.amount_credited_to_money %></td>
|
100
|
+
</tr>
|
101
|
+
<% end %>
|
102
|
+
</tbody>
|
103
|
+
</table>
|
104
|
+
|
105
|
+
<hr />
|
106
|
+
|
107
|
+
<h2>Payments</h2>
|
108
|
+
<table class="table table-condensed table-striped data-table right-aligned">
|
109
|
+
<thead>
|
110
|
+
<tr>
|
111
|
+
<th>Inv. number</th>
|
112
|
+
<th>Effective date</th>
|
113
|
+
<th>Currency</th>
|
114
|
+
<th>Amount</th>
|
115
|
+
<th>Error</th>
|
116
|
+
<th>Status</th>
|
117
|
+
<th>Payment type</th>
|
118
|
+
<th>Payment method</th>
|
119
|
+
<th>Card type</th>
|
120
|
+
<th>Invoice payment type</th>
|
121
|
+
</tr>
|
122
|
+
</thead>
|
123
|
+
<tbody>
|
124
|
+
<% @snapshot.business_invoice_payments.each do |business_invoice_payment| %>
|
125
|
+
<tr <% if business_invoice_payment.processing_status == 'SUCCESS' %>class="success"
|
126
|
+
<% else %>class="error"
|
127
|
+
<% end %>>
|
128
|
+
<td><%= link_to business_invoice_payment.invoice_number, invoice_path(:id => business_invoice_payment.invoice_id) %></td>
|
129
|
+
<td><%= format_date(business_invoice_payment.effective_date, @account.timezone).html_safe %></td>
|
130
|
+
<td><%= business_invoice_payment.currency %></td>
|
131
|
+
<td><%= humanized_money business_invoice_payment.amount_to_money %></td>
|
132
|
+
<td><%= business_invoice_payment.payment_error %></td>
|
133
|
+
<td><%= business_invoice_payment.processing_status %></td>
|
134
|
+
<td><%= business_invoice_payment.payment_type %></td>
|
135
|
+
<td><%= business_invoice_payment.payment_method %></td>
|
136
|
+
<td><%= business_invoice_payment.card_type %></td>
|
137
|
+
<td><%= business_invoice_payment.invoice_payment_type %></td>
|
138
|
+
</tr>
|
139
|
+
<% end %>
|
140
|
+
</tbody>
|
141
|
+
</table>
|
142
|
+
|
143
|
+
<hr />
|
144
|
+
|
145
|
+
<h2>Tags</h2>
|
146
|
+
<table class="table table-condensed table-striped data-table">
|
147
|
+
<thead>
|
148
|
+
<tr>
|
149
|
+
<th>Object type</th>
|
150
|
+
<th>Id</th>
|
151
|
+
<th>Name</th>
|
152
|
+
</tr>
|
153
|
+
</thead>
|
154
|
+
<tbody>
|
155
|
+
<% @snapshot.business_tags.each do |business_tag| %>
|
156
|
+
<tr>
|
157
|
+
<td><%= business_tag.object_type %></td>
|
158
|
+
<td>
|
159
|
+
<% if business_tag.object_type == 'ACCOUNT' %>
|
160
|
+
<%= link_to business_tag.id, account_path(:id => business_tag.id) %>
|
161
|
+
<% elsif business_tag.object_type == 'INVOICE' %>
|
162
|
+
<%= link_to business_tag.id, invoice_path(:id => business_tag.id) %>
|
163
|
+
<% elsif business_tag.object_type == 'PAYMENT' %>
|
164
|
+
<%= link_to business_tag.id, payment_path(:id => business_tag.id) %>
|
165
|
+
<% elsif business_tag.object_type == 'BUNDLE' %>
|
166
|
+
<%= link_to business_tag.id, bundle_path(:id => business_tag.id) %>
|
167
|
+
<% else %>
|
168
|
+
<%= business_field.id %>
|
169
|
+
<% end %>
|
170
|
+
</td>
|
171
|
+
<td><%= business_tag.name %></td>
|
172
|
+
</tr>
|
173
|
+
<% end %>
|
174
|
+
</tbody>
|
175
|
+
</table>
|
176
|
+
|
177
|
+
<hr />
|
178
|
+
|
179
|
+
<h2>Custom fields</h2>
|
180
|
+
<table class="table table-condensed table-striped data-table">
|
181
|
+
<thead>
|
182
|
+
<tr>
|
183
|
+
<th>Object type</th>
|
184
|
+
<th>Id</th>
|
185
|
+
<th>Name</th>
|
186
|
+
<th>Value</th>
|
187
|
+
</tr>
|
188
|
+
</thead>
|
189
|
+
<tbody>
|
190
|
+
<% @snapshot.business_fields.each do |business_field| %>
|
191
|
+
<tr>
|
192
|
+
<td><%= business_field.object_type %></td>
|
193
|
+
<td>
|
194
|
+
<% if business_field.object_type == 'ACCOUNT' %>
|
195
|
+
<%= link_to business_field.id, account_path(:id => business_field.id) %>
|
196
|
+
<% elsif business_field.object_type == 'INVOICE' %>
|
197
|
+
<%= link_to business_field.id, invoice_path(:id => business_field.id) %>
|
198
|
+
<% elsif business_field.object_type == 'PAYMENT' %>
|
199
|
+
<%= link_to business_field.id, payment_path(:id => business_field.id) %>
|
200
|
+
<% elsif business_field.object_type == 'BUNDLE' %>
|
201
|
+
<%= link_to business_field.id, bundle_path(:id => business_field.id) %>
|
202
|
+
<% else %>
|
203
|
+
<%= business_field.id %>
|
204
|
+
<% end %>
|
205
|
+
</td>
|
206
|
+
<td><%= business_field.name %></td>
|
207
|
+
<td><%= business_field.value %></td>
|
208
|
+
</tr>
|
209
|
+
<% end %>
|
210
|
+
</tbody>
|
211
|
+
</table>
|
@@ -1,12 +1,34 @@
|
|
1
|
-
<
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
<div class="page-header">
|
2
|
+
<h1>Analytics dashboards and data</h1>
|
3
|
+
</div>
|
4
|
+
|
5
|
+
<div class="btn-group">
|
6
|
+
<%= link_to 'Accounts over time', kaui_engine.analytics_accounts_over_time_path, { :class => 'btn btn-mini' } %>
|
7
|
+
<a class="btn btn-mini dropdown-toggle" data-toggle="dropdown" href="#">
|
8
|
+
Subscriptions over time
|
9
|
+
<span class="caret"></span>
|
10
|
+
</a>
|
11
|
+
<ul class="dropdown-menu">
|
12
|
+
<% @slugs.each do |slug| %>
|
13
|
+
<li><%= link_to slug, kaui_engine.analytics_subscriptions_over_time_path(:slug => slug, :product_type => @product_type) %></li>
|
14
|
+
<% end %>
|
15
|
+
</ul>
|
16
|
+
</div>
|
17
|
+
|
18
|
+
<hr/>
|
19
|
+
|
20
|
+
<%= form_tag account_snapshot_path, :class => "form-horizontal", :method => :get do %>
|
21
|
+
<fieldset>
|
22
|
+
<div class="control-group">
|
23
|
+
<label class="control-label" for="account_id"><%=t :account %></label>
|
24
|
+
<div class="controls">
|
25
|
+
<%= text_field_tag 'account_id', nil, :class => "input-xlarge", :id => "account_id" %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<div class="form-actions">
|
29
|
+
<%= button_tag "Get account snapshot", :class =>"btn btn-primary" %>
|
30
|
+
</div>
|
31
|
+
</fieldset>
|
32
|
+
<% end %>
|
33
|
+
|
34
|
+
<%= button_to "Check sanity", { :action => "sanity" }, :method => :get %>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<h2>Accounts not passing sanity checks</h2>
|
2
|
+
<table class="table table-condensed table-striped data-table right-aligned">
|
3
|
+
<thead>
|
4
|
+
<tr>
|
5
|
+
<th>Check</th>
|
6
|
+
<th>Account id</th>
|
7
|
+
<th></th>
|
8
|
+
</tr>
|
9
|
+
</thead>
|
10
|
+
<tbody>
|
11
|
+
<% @sanity.check_entitlement.each do |account_id| %>
|
12
|
+
<tr class="error">
|
13
|
+
<td>Entitlement</td>
|
14
|
+
<td><%= link_to account_id, account_path(account_id) %></td>
|
15
|
+
<td><%= button_to "Refresh!", { :action => "refresh_account", :account_id => account_id } %></td>
|
16
|
+
</tr>
|
17
|
+
<% end %>
|
18
|
+
<% @sanity.check_invoice.each do |account_id| %>
|
19
|
+
<tr class="error">
|
20
|
+
<td>Invoice</td>
|
21
|
+
<td><%= link_to account_id, account_path(account_id) %></td>
|
22
|
+
<td><%= button_to "Refresh!", { :action => "refresh_account", :account_id => account_id } %></td>
|
23
|
+
</tr>
|
24
|
+
<% end %>
|
25
|
+
<% @sanity.check_payment.each do |account_id| %>
|
26
|
+
<tr class="error">
|
27
|
+
<td>Payment</td>
|
28
|
+
<td><%= link_to account_id, account_path(account_id) %></td>
|
29
|
+
<td><%= button_to "Refresh!", { :action => "refresh_account", :account_id => account_id } %></td>
|
30
|
+
</tr>
|
31
|
+
<% end %>
|
32
|
+
<% @sanity.check_tag.each do |account_id| %>
|
33
|
+
<tr class="error">
|
34
|
+
<td>Tag</td>
|
35
|
+
<td><%= link_to account_id, account_path(account_id) %></td>
|
36
|
+
<td><%= button_to "Refresh!", { :action => "refresh_account", :account_id => account_id } %></td>
|
37
|
+
</tr>
|
38
|
+
<% end %>
|
39
|
+
<% @sanity.check_consistency.each do |account_id| %>
|
40
|
+
<tr class="error">
|
41
|
+
<td>Consistency</td>
|
42
|
+
<td><%= link_to account_id, account_path(account_id) %></td>
|
43
|
+
<td><%= button_to "Refresh!", { :action => "refresh_account", :account_id => account_id } %></td>
|
44
|
+
</tr>
|
45
|
+
<% end %>
|
46
|
+
</tbody>
|
47
|
+
</table>
|
@@ -22,7 +22,7 @@
|
|
22
22
|
<td><%= format_date(payment.effective_date, @account.timezone).html_safe if payment.effective_date.present? %></td>
|
23
23
|
<td><%= humanized_money_with_symbol payment.amount_to_money %> (<%= payment.currency %>)</td>
|
24
24
|
<td><%= humanized_money_with_symbol payment.paid_amount_to_money %> (<%= payment.currency %>)</td>
|
25
|
-
<td
|
25
|
+
<td><%= "#{@payment_methods[payment.payment_id].type} #{@payment_methods[payment.payment_id].card_type} #{@payment_methods[payment.payment_id].mask_number}" if @payment_methods.present? and @payment_methods[payment.payment_id].present? %></td>
|
26
26
|
<td><%= payment.ext_first_payment_id_ref %> <%= " / " if payment.ext_second_payment_id_ref.present? %> <%= payment.ext_second_payment_id_ref %></td>
|
27
27
|
<td><%= payment.retry_count %></td>
|
28
28
|
<td><%= payment.status %> <%= payment.gateway_error_code unless payment.status == 'SUCCESS' %> <%= payment.gateway_error_msg %></td>
|