kaui 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -0
- data/Gemfile +1 -1
- data/README.md +10 -15
- data/app/assets/images/kaui/duck.png +0 -0
- data/app/assets/images/kaui/logo.png +0 -0
- data/app/assets/images/kaui/search.png +0 -0
- data/app/assets/images/kaui/search_white.png +0 -0
- data/app/assets/javascripts/application.js +3 -0
- data/app/assets/javascripts/kaui/bootstrap-tweaks.js +3 -0
- data/app/assets/javascripts/kaui/kaui.js +99 -0
- data/app/assets/stylesheets/application.css +3 -1
- data/app/assets/stylesheets/bootstrap_and_overrides.less +39 -0
- data/app/assets/stylesheets/kaui/common.less +538 -0
- data/app/assets/stylesheets/kaui/datatable.less +75 -0
- data/app/assets/stylesheets/kaui/header.less +186 -0
- data/app/assets/stylesheets/kaui/home.less +82 -0
- data/app/assets/stylesheets/kaui/invoice.less +54 -0
- data/app/assets/stylesheets/kaui/kaui.less +16 -0
- data/app/assets/stylesheets/kaui/payment.less +29 -0
- data/app/assets/stylesheets/kaui/subscription.less +5 -0
- data/app/assets/stylesheets/kaui/tags.less +175 -0
- data/app/assets/stylesheets/kaui/timeline.less +4 -0
- data/app/controllers/kaui/account_emails_controller.rb +18 -18
- data/app/controllers/kaui/account_tags_controller.rb +8 -30
- data/app/controllers/kaui/account_timelines_controller.rb +13 -23
- data/app/controllers/kaui/accounts_controller.rb +65 -62
- data/app/controllers/kaui/admin_allowed_users_controller.rb +48 -32
- data/app/controllers/kaui/admin_tenants_controller.rb +147 -142
- data/app/controllers/kaui/bundle_tags_controller.rb +9 -33
- data/app/controllers/kaui/bundles_controller.rb +23 -62
- data/app/controllers/kaui/chargebacks_controller.rb +5 -11
- data/app/controllers/kaui/charges_controller.rb +11 -18
- data/app/controllers/kaui/credits_controller.rb +19 -22
- data/app/controllers/kaui/custom_fields_controller.rb +44 -16
- data/app/controllers/kaui/engine_controller.rb +56 -3
- data/app/controllers/kaui/engine_controller_util.rb +75 -1
- data/app/controllers/kaui/home_controller.rb +19 -0
- data/app/controllers/kaui/invoice_items_controller.rb +16 -21
- data/app/controllers/kaui/invoices_controller.rb +31 -53
- data/app/controllers/kaui/payment_methods_controller.rb +14 -46
- data/app/controllers/kaui/payments_controller.rb +60 -69
- data/app/controllers/kaui/refunds_controller.rb +11 -25
- data/app/controllers/kaui/registrations_controller.rb +38 -0
- data/app/controllers/kaui/subscriptions_controller.rb +82 -95
- data/app/controllers/kaui/tag_definitions_controller.rb +1 -5
- data/app/controllers/kaui/tags_controller.rb +17 -17
- data/app/controllers/kaui/tenants_controller.rb +38 -55
- data/app/controllers/kaui/transactions_controller.rb +8 -15
- data/app/helpers/kaui/application_helper.rb +4 -0
- data/app/helpers/kaui/object_helper.rb +24 -0
- data/app/helpers/kaui/payment_method_helper.rb +9 -0
- data/app/helpers/kaui/subscription_helper.rb +1 -1
- data/app/helpers/kaui/uuid_helper.rb +1 -0
- data/app/models/kaui/ability.rb +7 -1
- data/app/models/kaui/account.rb +6 -2
- data/app/models/kaui/account_email.rb +10 -0
- data/app/models/kaui/allowed_user.rb +16 -4
- data/app/models/kaui/audit_log.rb +5 -3
- data/app/models/kaui/bundle.rb +6 -11
- data/app/models/kaui/credit.rb +3 -0
- data/app/models/kaui/invoice.rb +10 -15
- data/app/models/kaui/invoice_payment.rb +10 -13
- data/app/models/kaui/killbill_registerable.rb +7 -0
- data/app/models/kaui/payment.rb +19 -12
- data/app/models/kaui/payment_method.rb +9 -0
- data/app/models/kaui/payment_state.rb +52 -0
- data/app/models/kaui/tag.rb +14 -0
- data/app/models/kaui/tag_definition.rb +8 -2
- data/app/models/kaui/user.rb +5 -4
- data/app/views/kaui/account_emails/_account_emails_table.html.erb +12 -9
- data/app/views/kaui/account_emails/_form.html.erb +9 -9
- data/app/views/kaui/account_emails/new.html.erb +9 -2
- data/app/views/kaui/account_tags/_form.html.erb +20 -29
- data/app/views/kaui/account_tags/_form_bar.html.erb +21 -0
- data/app/views/kaui/account_tags/edit.html.erb +9 -4
- data/app/views/kaui/account_timelines/show.html.erb +204 -287
- data/app/views/kaui/accounts/_account_info.html.erb +108 -0
- data/app/views/kaui/accounts/_billing_info.html.erb +129 -0
- data/app/views/kaui/accounts/_form.html.erb +127 -115
- data/app/views/kaui/accounts/_payment_methods.html.erb +28 -0
- data/app/views/kaui/accounts/edit.html.erb +10 -0
- data/app/views/kaui/accounts/index.html.erb +38 -23
- data/app/views/kaui/accounts/new.html.erb +9 -4
- data/app/views/kaui/accounts/show.html.erb +4 -106
- data/app/views/kaui/admin_allowed_users/_form.html.erb +19 -0
- data/app/views/kaui/admin_allowed_users/index.html.erb +35 -18
- data/app/views/kaui/admin_allowed_users/new.html.erb +9 -21
- data/app/views/kaui/admin_allowed_users/show.html.erb +42 -50
- data/app/views/kaui/admin_tenants/_form.html.erb +25 -0
- data/app/views/kaui/admin_tenants/_tenants_table.html.erb +27 -0
- data/app/views/kaui/admin_tenants/index.html.erb +14 -23
- data/app/views/kaui/admin_tenants/new.html.erb +8 -37
- data/app/views/kaui/admin_tenants/show.html.erb +128 -113
- data/app/views/kaui/bundle_tags/_form.html.erb +20 -28
- data/app/views/kaui/bundle_tags/_form_bar.html.erb +21 -0
- data/app/views/kaui/bundle_tags/edit.html.erb +9 -4
- data/app/views/kaui/bundles/index.html.erb +76 -29
- data/app/views/kaui/bundles/transfer.html.erb +28 -28
- data/app/views/kaui/chargebacks/_form.html.erb +31 -29
- data/app/views/kaui/chargebacks/new.html.erb +9 -4
- data/app/views/kaui/charges/_form.html.erb +35 -59
- data/app/views/kaui/charges/new.html.erb +9 -4
- data/app/views/kaui/credits/_form.html.erb +32 -59
- data/app/views/kaui/credits/new.html.erb +9 -4
- data/app/views/kaui/custom_fields/_form.html.erb +31 -0
- data/app/views/kaui/custom_fields/index.html.erb +33 -20
- data/app/views/kaui/custom_fields/new.html.erb +10 -0
- data/app/views/kaui/home/index.html.erb +12 -9
- data/app/views/kaui/invoice_items/_edit_form.html.erb +30 -0
- data/app/views/kaui/invoice_items/edit.html.erb +10 -91
- data/app/views/kaui/invoices/_invoice_table.html.erb +113 -0
- data/app/views/kaui/invoices/index.html.erb +31 -22
- data/app/views/kaui/invoices/show.html.erb +77 -91
- data/app/views/kaui/layouts/kaui_account_navbar.html.erb +11 -0
- data/app/views/kaui/layouts/kaui_application.html.erb +14 -53
- data/app/views/kaui/layouts/kaui_flash.html.erb +17 -0
- data/app/views/kaui/layouts/kaui_footer.html.erb +2 -0
- data/app/views/kaui/layouts/kaui_header.html.erb +17 -0
- data/app/views/kaui/layouts/kaui_navbar.html.erb +75 -0
- data/app/views/kaui/payment_methods/_form.html.erb +26 -23
- data/app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb +46 -41
- data/app/views/kaui/payment_methods/_payment_methods_details_table.html.erb +25 -0
- data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +50 -52
- data/app/views/kaui/payment_methods/new.html.erb +9 -4
- data/app/views/kaui/payments/_form.html.erb +55 -0
- data/app/views/kaui/payments/_payment_table.html.erb +117 -0
- data/app/views/kaui/payments/index.html.erb +31 -22
- data/app/views/kaui/payments/new.html.erb +9 -92
- data/app/views/kaui/payments/show.html.erb +38 -2
- data/app/views/kaui/refunds/_form.html.erb +240 -0
- data/app/views/kaui/refunds/new.html.erb +8 -280
- data/app/views/kaui/registrations/_form.html.erb +19 -0
- data/app/views/kaui/registrations/new.html.erb +10 -0
- data/app/views/kaui/sessions/_form.html.erb +19 -0
- data/app/views/kaui/sessions/new.html.erb +7 -18
- data/app/views/kaui/subscriptions/_edit_form.html.erb +26 -0
- data/app/views/kaui/subscriptions/_form.html.erb +34 -31
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +37 -24
- data/app/views/kaui/subscriptions/edit.html.erb +10 -30
- data/app/views/kaui/subscriptions/new.html.erb +14 -11
- data/app/views/kaui/tag_definitions/_form.html.erb +14 -11
- data/app/views/kaui/tag_definitions/index.html.erb +56 -30
- data/app/views/kaui/tag_definitions/new.html.erb +9 -2
- data/app/views/kaui/tags/_tags_table.html.erb +7 -10
- data/app/views/kaui/tags/index.html.erb +29 -20
- data/app/views/kaui/tenants/_form.html.erb +13 -0
- data/app/views/kaui/tenants/index.html.erb +9 -16
- data/app/views/kaui/transactions/_form.html.erb +47 -67
- data/app/views/kaui/transactions/new.html.erb +9 -2
- data/config/initializers/killbill_registerable.rb +4 -0
- data/config/routes.rb +88 -93
- data/kaui.gemspec +11 -2
- data/lib/kaui/engine.rb +6 -4
- data/lib/kaui/version.rb +1 -1
- data/lib/kaui.rb +24 -1
- data/test/dummy/config/application.rb +2 -0
- data/test/dummy/config/database.yml +6 -3
- data/test/dummy/config/initializers/killbill_client.rb +0 -2
- data/test/fixtures/catalog-v1.xml +74 -0
- data/test/fixtures/catalog_translation_fr-v1.properties +1 -0
- data/test/fixtures/invoice_template-v1.html +100 -0
- data/test/fixtures/invoice_translation_fr-v1.properties +23 -0
- data/test/fixtures/overdue-v1.xml +49 -0
- data/test/fixtures/stripe.yml +2 -0
- data/test/functional/kaui/account_emails_controller_test.rb +35 -8
- data/test/functional/kaui/account_tags_controller_test.rb +8 -8
- data/test/functional/kaui/account_timelines_controller_test.rb +6 -7
- data/test/functional/kaui/accounts_controller_test.rb +72 -10
- data/test/functional/kaui/admin_allowed_users_controller_test.rb +6 -5
- data/test/functional/kaui/admin_tenants_controller_test.rb +104 -48
- data/test/functional/kaui/bundle_tags_controller_test.rb +14 -9
- data/test/functional/kaui/bundles_controller_test.rb +59 -23
- data/test/functional/kaui/chargebacks_controller_test.rb +29 -7
- data/test/functional/kaui/charges_controller_test.rb +31 -10
- data/test/functional/kaui/credits_controller_test.rb +25 -6
- data/test/functional/kaui/custom_fields_controller_test.rb +25 -1
- data/test/functional/kaui/functional_test_helper_nosetup.rb +6 -4
- data/test/functional/kaui/home_controller_test.rb +24 -0
- data/test/functional/kaui/invoice_items_controller_test.rb +56 -8
- data/test/functional/kaui/invoices_controller_test.rb +27 -18
- data/test/functional/kaui/payment_methods_controller_test.rb +2 -22
- data/test/functional/kaui/payments_controller_test.rb +8 -3
- data/test/functional/kaui/refunds_controller_test.rb +40 -21
- data/test/functional/kaui/subscriptions_controller_test.rb +77 -24
- data/test/functional/kaui/tag_definitions_controller_test.rb +1 -7
- data/test/functional/kaui/tags_controller_test.rb +1 -1
- data/test/functional/kaui/tenants_controller_test.rb +9 -9
- data/test/functional/kaui/transactions_controller_test.rb +41 -16
- data/test/integration/kaui/integration_test_helper.rb +0 -1
- data/test/integration/kaui/navigation_test.rb +4 -6
- data/test/test_helper.rb +2 -0
- metadata +155 -28
- data/Gemfile.lock +0 -210
- data/app/assets/stylesheets/bootstrap_and_overrides.css +0 -7
- data/app/assets/stylesheets/datatables.scss +0 -14
- data/app/assets/stylesheets/layout.scss +0 -19
- data/app/views/kaui/account_emails/show.html.erb +0 -25
- data/app/views/kaui/account_tags/_account_tags_table.html.erb +0 -32
- data/app/views/kaui/account_tags/show.html.erb +0 -6
- data/app/views/kaui/account_timelines/index.html.erb +0 -14
- data/app/views/kaui/bundle_tags/_bundle_tags_table.html.erb +0 -31
- data/app/views/kaui/bundle_tags/show.html.erb +0 -6
- data/app/views/kaui/bundles/show.html.erb +0 -18
- data/app/views/kaui/payment_methods/index.html.erb +0 -30
- data/app/views/kaui/payment_methods/show.html.erb +0 -3
- data/app/views/kaui/payments/_payments_table.html.erb +0 -41
- data/app/views/kaui/subscriptions/index.html.erb +0 -15
- data/app/views/kaui/subscriptions/show.html.erb +0 -33
- data/app/views/kaui/tag_definitions/show.html.erb +0 -15
- data/vendor/assets/images/img/glyphicons-halflings-white.png +0 -0
- data/vendor/assets/images/img/glyphicons-halflings.png +0 -0
- data/vendor/assets/stylesheets/css/bootstrap-datepicker.cd46d38.css +0 -274
@@ -0,0 +1,21 @@
|
|
1
|
+
<% can_change_tags = can?(:add, Kaui::Tag) || can?(:delete, Kaui::Tag) %>
|
2
|
+
<%= form_tag update_account_tags_path do %>
|
3
|
+
<%= hidden_field_tag :account_id, account_id %>
|
4
|
+
|
5
|
+
<% available_tags.each do |tag| %>
|
6
|
+
<%= check_box_tag "tag_#{tag.id}", tag.name, tag_names.include?(tag.name), :disabled => !can_change_tags, :readonly => !can_change_tags %>
|
7
|
+
<label class='tag-description' rel='tooltip' title='<%= tag.description %>'><%= tag.name %></label>
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<% if can_change_tags %>
|
11
|
+
<%= label_tag :comment, 'Comment', :class => 'col-sm-2 control-label' %>
|
12
|
+
<%= text_area_tag :comment, nil, :rows => 3, :class => 'form-control' %>
|
13
|
+
<%= submit_tag 'Update', :class => 'btn btn-default' %>
|
14
|
+
<% end %>
|
15
|
+
<% end %>
|
16
|
+
|
17
|
+
<%= javascript_tag do %>
|
18
|
+
$(function() {
|
19
|
+
$('.tag-description').tooltip();
|
20
|
+
});
|
21
|
+
<% end %>
|
@@ -1,5 +1,10 @@
|
|
1
|
-
<div class=
|
2
|
-
<
|
3
|
-
|
1
|
+
<div class="register">
|
2
|
+
<div class="col-md-8 col-md-offset-2">
|
3
|
+
|
4
|
+
<div class="column-block">
|
5
|
+
<h1>Add/Remove Tags</h1>
|
6
|
+
<%= render 'form' %>
|
7
|
+
</div>
|
4
8
|
|
5
|
-
|
9
|
+
</div>
|
10
|
+
</div>
|
@@ -1,279 +1,201 @@
|
|
1
|
-
<div class="
|
2
|
-
<h3>Account <%= @account.name %></h3>
|
3
|
-
<%= link_to @account.email, Kaui.account_home_path.call(@account.external_key) %>
|
4
|
-
</div>
|
5
|
-
<form class="form-horizontal">
|
6
|
-
<div class="control-group">
|
7
|
-
<label for="bundles" class="control-label">Filter by bundle name</label>
|
1
|
+
<div class="search">
|
8
2
|
|
9
|
-
|
10
|
-
<%= select_tag 'bundles', options_for_select([''] + @bundle_names.values.sort, @selected_bundle || 'all') %>
|
11
|
-
</div>
|
3
|
+
<div class="column-block">
|
12
4
|
|
13
|
-
<
|
5
|
+
<h1>Account timeline</h1>
|
14
6
|
|
15
|
-
<
|
16
|
-
|
17
|
-
|
7
|
+
<form class="form-horizontal">
|
8
|
+
<div class="form-group">
|
9
|
+
<label for="bundles" class="col-sm-2 control-label">Filter by bundle</label>
|
18
10
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
</
|
25
|
-
|
26
|
-
<
|
27
|
-
<
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
</
|
38
|
-
<
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
<br/>
|
69
|
-
<% end %>
|
70
|
-
<% end %>
|
71
|
-
</td>
|
72
|
-
<td><%= 'INVOICE' %></td>
|
73
|
-
<td><span class="hide" title="<%= invoice.invoice_number %>"></span>
|
74
|
-
<%= 'Amount:' %> <%= humanized_money_with_symbol invoice.amount_to_money %>
|
75
|
-
(<%= @account.currency %>)<br/>
|
76
|
-
<%= 'Balance:' %> <%= humanized_money_with_symbol invoice.balance_to_money %>
|
77
|
-
(<%= @account.currency %>)<br/>
|
78
|
-
<% if invoice.credit_adj.present? && invoice.credit_adj > 0 %>
|
79
|
-
<%= 'Credit adjustment:' %> <%= humanized_money_with_symbol invoice.credit_adjustment_to_money %>
|
80
|
-
(<%= @account.currency %>)<br/>
|
81
|
-
<% end %>
|
82
|
-
<% if invoice.credits.present? && invoice.credits > 0 %>
|
83
|
-
<%= 'Credit balance adjustment:' %> <%= humanized_money_with_symbol invoice.credits_to_money %>
|
84
|
-
(<%= @account.currency %>)<br/>
|
85
|
-
<% end %>
|
86
|
-
<% if invoice.refund_adj.present? && invoice.refund_adj < 0 %>
|
87
|
-
<%= 'Refund adjustment:' %> <%= humanized_money_with_symbol invoice.refund_adjustment_to_money %>
|
88
|
-
(<%= @account.currency %>)<br/>
|
89
|
-
<% end %>
|
90
|
-
<%= 'Invoice #' %>
|
91
|
-
<%= link_to invoice.invoice_number, invoice_path(:id => invoice.invoice_id) %>
|
92
|
-
</td>
|
93
|
-
<td>
|
94
|
-
<% if invoice_stub.audit_logs.present? %>
|
95
|
-
<% invoice_stub.audit_logs.each do |entry| %>
|
96
|
-
<%= Kaui::AuditLog.description(entry) unless entry.changed_by == 'Transition' %>
|
97
|
-
<br/>
|
98
|
-
<% end %>
|
99
|
-
<% end %>
|
100
|
-
</td>
|
101
|
-
<td>
|
102
|
-
<nobr>
|
103
|
-
<%= link_to 'Payment',
|
104
|
-
kaui_engine.new_payment_path(:params => {:account_id => invoice.account_id,
|
105
|
-
:invoice_id => invoice.invoice_id}),
|
106
|
-
:class => "btn btn-xs #{'disabled' unless invoice.balance > 0}" %>
|
107
|
-
</nobr>
|
108
|
-
<% if can? :credit, Kaui::Invoice %>
|
109
|
-
<nobr>
|
110
|
-
<%= link_to 'Credit',
|
111
|
-
kaui_engine.new_credit_path(:params => {:account_id => invoice.account_id,
|
112
|
-
:invoice_id => invoice.invoice_id}),
|
113
|
-
:class => 'btn btn-xs' %>
|
114
|
-
</nobr>
|
115
|
-
<% end %>
|
116
|
-
<% if can? :charge, Kaui::Invoice %>
|
117
|
-
<nobr>
|
118
|
-
<%= link_to 'Charge',
|
119
|
-
kaui_engine.new_charge_path(:params => {:account_id => invoice.account_id,
|
120
|
-
:invoice_id => invoice.invoice_id}),
|
121
|
-
:class => 'btn btn-xs' %>
|
122
|
-
</nobr>
|
123
|
-
<% end %>
|
124
|
-
</td>
|
125
|
-
</tr>
|
126
|
-
<% end %>
|
127
|
-
<% @timeline.payments.each do |payment| %>
|
128
|
-
<% if payment.target_invoice_id.present? %>
|
129
|
-
<% bundles = @bundle_names_by_invoice_id[payment.target_invoice_id].to_a.join(',') %>
|
130
|
-
<% invoice = @invoices_by_id[payment.target_invoice_id] %>
|
131
|
-
<% else %>
|
132
|
-
<% bundles = nil %>
|
133
|
-
<% invoice = nil %>
|
134
|
-
<% end %>
|
135
|
-
<% payment.transactions.each do |transaction| %>
|
136
|
-
<tr title="<%= bundles %>" data-event_type="PAYMENT">
|
137
|
-
<td>
|
138
|
-
<% if transaction.effective_date.present? %>
|
139
|
-
<%= format_date(transaction.effective_date, @account.time_zone).html_safe %>
|
140
|
-
<% else %>
|
141
|
-
[unknown]
|
142
|
-
<% end %>
|
143
|
-
</td>
|
144
|
-
<td>
|
145
|
-
<% if transaction.effective_date.present? %>
|
146
|
-
<%= format_date(transaction.effective_date, @account.time_zone).html_safe %>
|
147
|
-
<% else %>
|
148
|
-
[unknown]
|
149
|
-
<% end %>
|
150
|
-
</td>
|
151
|
-
<td>
|
152
|
-
<% (@bundle_keys_by_invoice_id[payment.target_invoice_id] || []).each do |bundle_key| %>
|
153
|
-
<%= link_to @bundle_names[bundle_key], Kaui.bundle_home_path.call(bundle_key) %>
|
154
|
-
<br/>
|
155
|
-
<% end %>
|
156
|
-
</td>
|
157
|
-
<td><%= transaction.transaction_type %></td>
|
158
|
-
<td>
|
159
|
-
<span class="hide" title="<%= invoice.invoice_number unless invoice.nil? %>"></span>
|
160
|
-
<%= 'Transaction id:' %> <%= truncate_uuid(transaction.transaction_id) %>
|
161
|
-
<br/>
|
162
|
-
<%= 'Amount:' %> <%= humanized_money_with_symbol Kaui::Transaction.amount_to_money(transaction) %>
|
163
|
-
(<%= transaction.currency %>)<br/>
|
164
|
-
<span
|
165
|
-
<% if transaction.status == 'FAILED' %>class="alert-error"
|
166
|
-
<% elsif transaction.status == 'SUCCESS' %>class="alert-success" <% end %>>
|
167
|
-
<%= transaction.status %>
|
168
|
-
</span>
|
169
|
-
<br/>
|
170
|
-
<%= 'Payment #' %> <%= link_to payment.payment_number, payment_path(:id => payment.payment_id) %>
|
171
|
-
<% unless invoice.nil? %>
|
172
|
-
<br/><%= 'Invoice #' %> <%= link_to invoice.invoice_number, invoice_path(:id => invoice.invoice_id) %>
|
173
|
-
<% end %>
|
174
|
-
</td>
|
175
|
-
<td>
|
176
|
-
<% if transaction.audit_logs.present? %>
|
177
|
-
<% transaction.audit_logs.each do |entry| %>
|
178
|
-
<%= Kaui::AuditLog.description(entry) unless entry.changed_by == 'PaymentRequestProcessor' %>
|
179
|
-
<br/>
|
180
|
-
<% end %>
|
181
|
-
<% end %>
|
182
|
-
</td>
|
183
|
-
<td>
|
184
|
-
<% if invoice.present? and %w(CAPTURE PURCHASE).include?(transaction.transaction_type) %>
|
185
|
-
<% if can? :refund, Kaui::Payment %>
|
186
|
-
<nobr>
|
187
|
-
<%= link_to 'Refund', kaui_engine.new_refund_path(:params => {:payment_id => payment.payment_id,
|
188
|
-
:account_id => @account.account_id,
|
189
|
-
:invoice_id => payment.target_invoice_id}),
|
190
|
-
:class => "btn btn-xs #{'disabled' unless payment.payment_id.present? and transaction.status == 'SUCCESS' }" %>
|
191
|
-
</nobr>
|
192
|
-
<% end %>
|
193
|
-
<% if can? :chargeback, Kaui::Payment %>
|
194
|
-
<nobr>
|
195
|
-
<%= link_to 'Chargeback', kaui_engine.new_chargeback_path(:params => {:payment_id => payment.payment_id,
|
196
|
-
:account_id => @account.account_id,
|
197
|
-
:invoice_id => payment.target_invoice_id}),
|
198
|
-
:class => "btn btn-xs #{'disabled' unless payment.payment_id.present? and transaction.status == 'SUCCESS'}" %>
|
199
|
-
</nobr>
|
200
|
-
<% end %>
|
201
|
-
<% elsif !invoice.present? %>
|
202
|
-
<% if transaction.transaction_type == 'AUTHORIZE' %>
|
203
|
-
<% %w(CAPTURE VOID).each do |transaction_type| %>
|
204
|
-
<nobr>
|
205
|
-
<%= link_to transaction_type.downcase.capitalize, kaui_engine.new_transaction_path(:account_id => payment.account_id,
|
206
|
-
:payment_id => transaction.payment_id,
|
207
|
-
:payment_method_id => payment.payment_method_id,
|
208
|
-
:amount => transaction.amount,
|
209
|
-
:currency => transaction.currency,
|
210
|
-
:transaction_type => transaction_type), :class => 'btn btn-xs' %>
|
211
|
-
</nobr>
|
212
|
-
<% end %>
|
213
|
-
<% elsif %w(CAPTURE PURCHASE).include?(transaction.transaction_type) %>
|
214
|
-
<% %w(REFUND CHARGEBACK).each do |transaction_type| %>
|
215
|
-
<nobr>
|
216
|
-
<%= link_to transaction_type.downcase.capitalize, kaui_engine.new_transaction_path(:account_id => payment.account_id,
|
217
|
-
:payment_id => transaction.payment_id,
|
218
|
-
:payment_method_id => payment.payment_method_id,
|
219
|
-
:amount => transaction.amount,
|
220
|
-
:currency => transaction.currency,
|
221
|
-
:transaction_type => transaction_type), :class => 'btn btn-xs' %>
|
222
|
-
</nobr>
|
11
|
+
<div class="col-sm-10">
|
12
|
+
<%= select_tag 'bundles', options_for_select([''] + @bundle_names.values.sort, @selected_bundle || 'all'), :class => 'form-control' %>
|
13
|
+
</div>
|
14
|
+
</div>
|
15
|
+
<div class="form-group">
|
16
|
+
<label for="events" class="col-sm-2 control-label">Filter by event type</label>
|
17
|
+
|
18
|
+
<div class="col-sm-10 ">
|
19
|
+
<%= select_tag 'event_types', options_for_select('<option value="all">ALL</option><option value="invoice">INVOICE</option><option value="payment">PAYMENT</option><option value="entitlement">ENTITLEMENTS</option>'.html_safe), :class => 'form-control' %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</form>
|
23
|
+
|
24
|
+
<hr/>
|
25
|
+
|
26
|
+
<table id="timeline-table" class="table table-condensed mobile-data">
|
27
|
+
<thead>
|
28
|
+
<tr>
|
29
|
+
<th>Effective Date</th>
|
30
|
+
<th>Bundle</th>
|
31
|
+
<th>Event Type</th>
|
32
|
+
<th>Details</th>
|
33
|
+
<th>Reason Code / Comments</th>
|
34
|
+
</tr>
|
35
|
+
</thead>
|
36
|
+
<tbody>
|
37
|
+
<% if @account.present? %>
|
38
|
+
<% @invoices.each do |invoice_stub| %>
|
39
|
+
<% if invoice_stub.bundle_keys.present? %>
|
40
|
+
<% bundles = invoice_stub.bundle_keys.split(',').map { |bundle_key| @bundle_names[bundle_key] }.join(',') %>
|
41
|
+
<% end %>
|
42
|
+
<% if invoice_stub.invoice_id.present? && @invoices_by_id.has_key?(invoice_stub.invoice_id) %>
|
43
|
+
<% invoice = @invoices_by_id[invoice_stub.invoice_id] %>
|
44
|
+
<% else %>
|
45
|
+
<% invoice = invoice_stub %>
|
46
|
+
<% end %>
|
47
|
+
<tr title="<%= bundles %>" data-event_type="INVOICE">
|
48
|
+
<td>
|
49
|
+
<% if invoice.target_date.present? %>
|
50
|
+
<%= invoice.target_date %>
|
51
|
+
<% else %>
|
52
|
+
[unknown]
|
53
|
+
<% end %>
|
54
|
+
</td>
|
55
|
+
<td>
|
56
|
+
<% if invoice_stub.bundle_keys.present? %>
|
57
|
+
<ul>
|
58
|
+
<% invoice_stub.bundle_keys.split(',').each do |bundle_key| %>
|
59
|
+
<li><%= truncate_uuid(@bundle_names[bundle_key]) %></li>
|
223
60
|
<% end %>
|
61
|
+
</ul>
|
62
|
+
<% end %>
|
63
|
+
</td>
|
64
|
+
<td>INVOICE</td>
|
65
|
+
<td>
|
66
|
+
<ul>
|
67
|
+
<li><span class="hide" title="<%= invoice.invoice_number %>"></span>
|
68
|
+
<%= 'Amount:' %> <%= humanized_money_with_symbol invoice.amount_to_money %>
|
69
|
+
(<%= @account.currency %>)
|
70
|
+
</li>
|
71
|
+
<li><%= 'Balance:' %> <%= humanized_money_with_symbol invoice.balance_to_money %>
|
72
|
+
(<%= @account.currency %>)
|
73
|
+
</li>
|
74
|
+
</li>
|
75
|
+
<% if invoice.credit_adj.present? && invoice.credit_adj > 0 %>
|
76
|
+
<li><%= 'Credit adjustment:' %> <%= humanized_money_with_symbol invoice.credit_adjustment_to_money %>
|
77
|
+
(<%= @account.currency %>)
|
78
|
+
</li>
|
224
79
|
<% end %>
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
<% end %>
|
230
|
-
<% @timeline.bundles.each do |bundle| %>
|
231
|
-
<% bundle.subscriptions.each do |sub| %>
|
232
|
-
<% sub.events.each do |event| %>
|
233
|
-
<!-- SKIP SERVICE_STATE_CHANGE -->
|
234
|
-
<% next if event.event_type == 'SERVICE_STATE_CHANGE' %>
|
235
|
-
<tr title="<%= @bundle_names[bundle.external_key] %>" data-event_type="<%= event.event_type %>">
|
236
|
-
<td>
|
237
|
-
<% if event.requested_date.present? %>
|
238
|
-
<%= format_date(event.requested_date, @account.time_zone).html_safe %>
|
239
|
-
<% else %>
|
240
|
-
[unknown]
|
241
|
-
<% end %>
|
242
|
-
</td>
|
243
|
-
<td>
|
244
|
-
<% if event.effective_date.present? %>
|
245
|
-
<%= format_date(event.effective_date, @account.time_zone).html_safe %>
|
246
|
-
<% else %>
|
247
|
-
[unknown]
|
80
|
+
<% if invoice.refund_adj.present? && invoice.refund_adj < 0 %>
|
81
|
+
<li><%= 'Refund adjustment:' %> <%= humanized_money_with_symbol invoice.refund_adjustment_to_money %>
|
82
|
+
(<%= @account.currency %>)
|
83
|
+
</li>
|
248
84
|
<% end %>
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
</td>
|
258
|
-
<td>
|
259
|
-
<% if event.audit_logs.present? %>
|
260
|
-
<% event.audit_logs.each do |entry| %>
|
261
|
-
<%= Kaui::AuditLog.description(entry) %>
|
262
|
-
<br/>
|
85
|
+
<li><%= 'Invoice #' %> <%= link_to invoice.invoice_number, account_invoice_path(invoice.account_id, invoice.invoice_id) %></li>
|
86
|
+
</ul>
|
87
|
+
</td>
|
88
|
+
<td>
|
89
|
+
<% if invoice_stub.audit_logs.present? %>
|
90
|
+
<ul>
|
91
|
+
<% invoice_stub.audit_logs.each do |entry| %>
|
92
|
+
<li><%= Kaui::AuditLog.description(entry) %></li>
|
263
93
|
<% end %>
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
271
|
-
<%
|
272
|
-
|
273
|
-
|
274
|
-
|
275
|
-
|
94
|
+
</ul>
|
95
|
+
<% end %>
|
96
|
+
</td>
|
97
|
+
</tr>
|
98
|
+
<% end %>
|
99
|
+
<% @payments.each do |payment| %>
|
100
|
+
<% if payment.target_invoice_id.present? %>
|
101
|
+
<% bundles = @bundle_names_by_invoice_id[payment.target_invoice_id].to_a.join(',') %>
|
102
|
+
<% invoice = @invoices_by_id[payment.target_invoice_id] %>
|
103
|
+
<% else %>
|
104
|
+
<% bundles = nil %>
|
105
|
+
<% invoice = nil %>
|
106
|
+
<% end %>
|
107
|
+
<% payment.transactions.each do |transaction| %>
|
108
|
+
<tr title="<%= bundles %>" data-event_type="PAYMENT">
|
109
|
+
<td>
|
110
|
+
<% if transaction.effective_date.present? %>
|
111
|
+
<%= format_date(transaction.effective_date, @account.time_zone).html_safe %>
|
112
|
+
<% else %>
|
113
|
+
[unknown]
|
114
|
+
<% end %>
|
115
|
+
</td>
|
116
|
+
<td>
|
117
|
+
<% if @bundle_keys_by_invoice_id[payment.target_invoice_id].present? %>
|
118
|
+
<ul>
|
119
|
+
<% @bundle_keys_by_invoice_id[payment.target_invoice_id].each do |bundle_key| %>
|
120
|
+
<li><%= truncate_uuid(@bundle_names[bundle_key]) %></li>
|
121
|
+
<% end %>
|
122
|
+
</ul>
|
123
|
+
<% end %>
|
124
|
+
</td>
|
125
|
+
<td><%= transaction.transaction_type %></td>
|
126
|
+
<td>
|
127
|
+
<ul>
|
128
|
+
<li><%= 'Amount:' %> <%= humanized_money_with_symbol Kaui::Transaction.amount_to_money(transaction) %>
|
129
|
+
(<%= transaction.currency %>)
|
130
|
+
</li>
|
131
|
+
<li>
|
132
|
+
<span
|
133
|
+
<% if transaction.status != 'SUCCESS' %>class="alert-danger"
|
134
|
+
<% else %>class="alert-success" <% end %>>
|
135
|
+
<%= transaction.status %>
|
136
|
+
</span>
|
137
|
+
</li>
|
138
|
+
<li><%= 'Payment #' %> <%= link_to payment.payment_number, account_payment_path(payment.account_id, payment.payment_id) %></li>
|
139
|
+
<% unless invoice.nil? %>
|
140
|
+
<li><%= 'Invoice #' %> <%= link_to invoice.invoice_number, account_invoice_path(invoice.account_id, invoice.invoice_id) %></li>
|
141
|
+
<% end %>
|
142
|
+
</ul>
|
143
|
+
</td>
|
144
|
+
<td>
|
145
|
+
<% if transaction.audit_logs.present? %>
|
146
|
+
<ul>
|
147
|
+
<% transaction.audit_logs.each do |entry| %>
|
148
|
+
<li><%= Kaui::AuditLog.description(entry) %></li>
|
149
|
+
<% end %>
|
150
|
+
</ul>
|
151
|
+
<% end %>
|
152
|
+
</td>
|
153
|
+
</tr>
|
154
|
+
<% end %>
|
155
|
+
<% end %>
|
156
|
+
<% @bundles.each do |bundle| %>
|
157
|
+
<% bundle.subscriptions.each do |sub| %>
|
158
|
+
<% sub.events.each do |event| %>
|
159
|
+
<!-- SKIP SERVICE_STATE_CHANGE -->
|
160
|
+
<% next if event.event_type == 'SERVICE_STATE_CHANGE' %>
|
161
|
+
<tr title="<%= @bundle_names[bundle.external_key] %>" data-event_type="<%= event.event_type %>">
|
162
|
+
<td>
|
163
|
+
<% if event.effective_date.present? %>
|
164
|
+
<%= format_date(event.effective_date, @account.time_zone).html_safe %>
|
165
|
+
<% else %>
|
166
|
+
[unknown]
|
167
|
+
<% end %>
|
168
|
+
</td>
|
169
|
+
<td>
|
170
|
+
<ul>
|
171
|
+
<li><%= truncate_uuid(@bundle_names[bundle.external_key]) %></li>
|
172
|
+
</ul>
|
173
|
+
</td>
|
174
|
+
<td><%= event.event_type %></td>
|
175
|
+
<td>
|
176
|
+
<ul>
|
177
|
+
<li><span class="hide" title="<%= sub.product_category %>"></span><%= event.phase %></li>
|
178
|
+
</ul>
|
179
|
+
</td>
|
180
|
+
<td>
|
181
|
+
<% if event.audit_logs.present? %>
|
182
|
+
<ul>
|
183
|
+
<% event.audit_logs.each do |entry| %>
|
184
|
+
<li><%= Kaui::AuditLog.description(entry) %></li>
|
185
|
+
<% end %>
|
186
|
+
</ul>
|
187
|
+
<% end %>
|
188
|
+
</td>
|
189
|
+
</tr>
|
190
|
+
<% end %>
|
191
|
+
<% end %>
|
192
|
+
<% end %>
|
193
|
+
<% end %>
|
194
|
+
</tbody>
|
195
|
+
</table>
|
196
|
+
</div>
|
276
197
|
</div>
|
198
|
+
|
277
199
|
<%= javascript_tag do %>
|
278
200
|
function disableLinks() {
|
279
201
|
$('a.btn.disabled').click(function (e) {
|
@@ -318,26 +240,21 @@
|
|
318
240
|
};
|
319
241
|
|
320
242
|
function initTable() {
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
329
|
-
|
330
|
-
|
331
|
-
|
332
|
-
|
333
|
-
|
334
|
-
|
335
|
-
|
336
|
-
{ "sType": 'timeline-details' },
|
337
|
-
null,
|
338
|
-
null
|
339
|
-
]
|
340
|
-
});
|
243
|
+
return $("#timeline-table").dataTable({
|
244
|
+
"dom": "t",
|
245
|
+
"paging": "false",
|
246
|
+
"iDisplayLength": 100,
|
247
|
+
"retrieve": true,
|
248
|
+
// Force a predictive order for event types, invoices and payments
|
249
|
+
"order": [[0, 'desc'], [2, 'desc']],
|
250
|
+
"columns": [
|
251
|
+
{ "type": 'date' },
|
252
|
+
null,
|
253
|
+
{ "type": 'timeline-event' },
|
254
|
+
{ "type": 'timeline-details' },
|
255
|
+
null
|
256
|
+
]
|
257
|
+
});
|
341
258
|
}
|
342
259
|
|
343
260
|
function filterEachNode(rows) {
|