kaui 0.14.2 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -0
- data/Gemfile +1 -1
- data/README.md +23 -6
- data/app/assets/javascripts/application.js +1 -0
- data/app/assets/stylesheets/application.css +1 -0
- data/app/assets/stylesheets/kaui/header.less +11 -4
- data/app/controllers/kaui/accounts_controller.rb +1 -1
- data/app/controllers/kaui/admin_tenants_controller.rb +113 -18
- data/app/controllers/kaui/bundles_controller.rb +0 -2
- data/app/controllers/kaui/chargebacks_controller.rb +1 -1
- data/app/controllers/kaui/charges_controller.rb +1 -1
- data/app/controllers/kaui/engine_controller.rb +5 -2
- data/app/controllers/kaui/invoices_controller.rb +1 -1
- data/app/controllers/kaui/payment_methods_controller.rb +1 -1
- data/app/controllers/kaui/payments_controller.rb +20 -2
- data/app/controllers/kaui/refunds_controller.rb +1 -1
- data/app/controllers/kaui/subscriptions_controller.rb +8 -13
- data/app/helpers/kaui/account_helper.rb +9 -0
- data/app/helpers/kaui/subscription_helper.rb +47 -21
- data/app/models/kaui/admin_tenant.rb +96 -2
- data/app/models/kaui/bundle.rb +1 -1
- data/app/models/kaui/catalog.rb +138 -0
- data/app/models/kaui/invoice_payment.rb +39 -5
- data/app/models/kaui/overdue.rb +85 -0
- data/app/models/kaui/simple_plan.rb +4 -0
- data/app/models/kaui/transaction.rb +2 -0
- data/app/views/kaui/account_timelines/show.html.erb +2 -1
- data/app/views/kaui/accounts/_billing_info.html.erb +18 -20
- data/app/views/kaui/accounts/_payment_methods.html.erb +11 -16
- data/app/views/kaui/admin_tenants/_form_catalog_translation.erb +24 -0
- data/app/views/kaui/admin_tenants/_form_invoice_template.erb +28 -0
- data/app/views/kaui/admin_tenants/_form_invoice_translation.erb +24 -0
- data/app/views/kaui/admin_tenants/_form_plugin_config.erb +199 -0
- data/app/views/kaui/admin_tenants/_show_catalog.erb +25 -0
- data/app/views/kaui/admin_tenants/_show_catalog_simple.erb +96 -0
- data/app/views/kaui/admin_tenants/_show_catalog_xml.erb +44 -0
- data/app/views/kaui/admin_tenants/_show_overdue.erb +89 -0
- data/app/views/kaui/admin_tenants/new_catalog.html.erb +176 -0
- data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +138 -0
- data/app/views/kaui/admin_tenants/new_plan_currency.html.erb +34 -0
- data/app/views/kaui/admin_tenants/show.html.erb +20 -127
- data/app/views/kaui/bundles/index.html.erb +1 -1
- data/app/views/kaui/invoice_items/_edit_form.html.erb +1 -0
- data/app/views/kaui/layouts/kaui_account_navbar.html.erb +2 -0
- data/app/views/kaui/payments/_payment_table.html.erb +16 -5
- data/app/views/kaui/refunds/_form.html.erb +4 -5
- data/app/views/kaui/subscriptions/_edit_form.html.erb +48 -1
- data/app/views/kaui/subscriptions/_form.html.erb +36 -0
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +12 -9
- data/config/routes.rb +8 -0
- data/db/ddl.sql +5 -2
- data/kaui.gemspec +3 -2
- data/lib/kaui/engine.rb +1 -0
- data/lib/kaui/version.rb +1 -1
- data/test/dummy/config/environments/development.rb +1 -1
- data/test/dummy/db/schema.rb +5 -5
- data/test/functional/kaui/account_emails_controller_test.rb +2 -2
- data/test/functional/kaui/accounts_controller_test.rb +4 -4
- data/test/functional/kaui/admin_tenants_controller_test.rb +5 -1
- data/test/functional/kaui/bundle_tags_controller_test.rb +1 -1
- data/test/functional/kaui/bundles_controller_test.rb +4 -4
- data/test/functional/kaui/chargebacks_controller_test.rb +2 -2
- data/test/functional/kaui/charges_controller_test.rb +2 -2
- data/test/functional/kaui/credits_controller_test.rb +2 -2
- data/test/functional/kaui/invoice_items_controller_test.rb +6 -4
- data/test/functional/kaui/invoices_controller_test.rb +2 -2
- data/test/functional/kaui/payments_controller_test.rb +4 -0
- data/test/functional/kaui/refunds_controller_test.rb +2 -2
- data/test/functional/kaui/subscriptions_controller_test.rb +6 -6
- data/test/killbill_test_helper.rb +7 -7
- metadata +47 -8
- data/db/migrate/20130812155313_devise_create_kaui_users.rb +0 -12
- data/db/migrate/20150109214021_create_kaui_tenants.rb +0 -12
- data/db/migrate/20150112232813_create_kaui_allowed_users.rb +0 -19
@@ -0,0 +1,138 @@
|
|
1
|
+
<div id="overdue_config_simple">
|
2
|
+
|
3
|
+
<div>
|
4
|
+
<h1>Overdue Configuration
|
5
|
+
<a class='btn btn-xs' href="javascript:void(0);" onclick="switch_overdue_xml_config();">Enable Advanced Configuration
|
6
|
+
(Upload XML)</a>
|
7
|
+
</h1>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<%= form_for @overdue, :url => {:action => :modify_overdue_config}, :html => {:class => 'form-horizontal'} do |f| %>
|
11
|
+
|
12
|
+
<a class='btn btn-xs' href="javascript:void(0);" onclick="overdue_new_state();" id="new_state"><%= '<i class="fa fa-plus-square"></i>'.html_safe + " new overdue states" %></a>
|
13
|
+
|
14
|
+
<table id="existing-overdue-config-for-tenants" class="table table-condensed">
|
15
|
+
<thead>
|
16
|
+
<tr>
|
17
|
+
<th>Name</th>
|
18
|
+
<th>External Message</th>
|
19
|
+
<th>Block Subscription Changes</th>
|
20
|
+
<th>Subscription Cancellation</th>
|
21
|
+
<th>Days since earliest unpaid invoice</th>
|
22
|
+
<th>Tag inclusion</th>
|
23
|
+
<th>Tag exclusion</th>
|
24
|
+
<th></th>
|
25
|
+
</tr>
|
26
|
+
</thead>
|
27
|
+
<tbody>
|
28
|
+
<%= f.hidden_field_tag(:id, @tenant.id) %>
|
29
|
+
|
30
|
+
<% @overdue.overdue_states.reverse.each_with_index do |state, idx| %>
|
31
|
+
<tr class="overdue_state_<%= state %>" id="tr_state_<%= idx %>">
|
32
|
+
<%= f.fields_for 'states[]', state do |state_form| %>
|
33
|
+
<td><%= state_form.text_field :name %></td>
|
34
|
+
<td><%= state_form.text_field :external_message %></td>
|
35
|
+
<td><%= state_form.select :block_changes, options_for_select([true, false ], state.block_changes), :class => 'form-control' %></td>
|
36
|
+
<td><%= state_form.select :subscription_cancellation_policy, options_for_select([:NONE, :POLICY_NONE, :POLICY_IMMEDIATE, :POLICY_END_OF_TERM], state.subscription_cancellation), :class => 'form-control' %></td>
|
37
|
+
<%= state_form.fields_for 'condition' do |condition| %>
|
38
|
+
<td><%= condition.text_field :time_since_earliest_unpaid_invoice_equals_or_exceeds, :value => state.condition.time_since_earliest_unpaid_invoice_equals_or_exceeds.number %></td>
|
39
|
+
<td><%= condition.select :control_tag_inclusion, options_for_select([:NONE, :AUTO_PAY_OFF, :AUTO_INVOICING_OFF, :OVERDUE_ENFORCEMENT_OFF, :MANUAL_PAY, :TEST, :PARTNER], state.condition.control_tag_inclusion), :class => 'form-control' %></td>
|
40
|
+
<td><%= condition.select :control_tag_exclusion, options_for_select([:NONE, :AUTO_PAY_OFF, :AUTO_INVOICING_OFF, :OVERDUE_ENFORCEMENT_OFF, :MANUAL_PAY, :TEST, :PARTNER], state.condition.control_tag_exclusion), :class => 'form-control'%></td>
|
41
|
+
<% end %>
|
42
|
+
<% end %>
|
43
|
+
<td><a class='btn btn-xs' href="javascript:void(0);" onclick="overdue_delete_state(this);" id="delete_state_<%= idx %>"><%= '<i class="fa fa-times"></i>'.html_safe %></a></td>
|
44
|
+
</tr>
|
45
|
+
<% end %>
|
46
|
+
</tbody>
|
47
|
+
</table>
|
48
|
+
<div class="form-group">
|
49
|
+
<div class="col-sm-offset-3 col-sm-9">
|
50
|
+
<%= submit_tag 'Save', :class => 'btn btn-default' %>
|
51
|
+
</div>
|
52
|
+
</div>
|
53
|
+
<% end %>
|
54
|
+
</div>
|
55
|
+
|
56
|
+
|
57
|
+
<div id="overdue_config_xml">
|
58
|
+
<hr/>
|
59
|
+
<h1>Upload Overdue XML Config
|
60
|
+
<a class='btn btn-xs' href="javascript:void(0);" onclick="switch_overdue_basic_config();">Enable Simple View</a>
|
61
|
+
</h1>
|
62
|
+
<% if can? :config_upload, Kaui::AdminTenant %>
|
63
|
+
<%= form_tag({:action => :upload_overdue_config}, :method => 'post', :multipart => true, :class => 'form-horizontal') do %>
|
64
|
+
<%= hidden_field_tag(:id, @tenant.id) %>
|
65
|
+
|
66
|
+
<div class="form-group">
|
67
|
+
<div class="col-sm-10">
|
68
|
+
<%= file_field_tag 'overdue', :class => 'form-control' %>
|
69
|
+
</div>
|
70
|
+
</div>
|
71
|
+
<div class="form-group">
|
72
|
+
<div class="col-sm-10">
|
73
|
+
<%= submit_tag 'Upload', :class => 'btn btn-default' %>
|
74
|
+
</div>
|
75
|
+
</div>
|
76
|
+
<% end %>
|
77
|
+
<% else %>
|
78
|
+
You don't have the permission to upload the XML config
|
79
|
+
<% end %>
|
80
|
+
</div>
|
81
|
+
|
82
|
+
|
83
|
+
<%= javascript_tag do %>
|
84
|
+
|
85
|
+
|
86
|
+
function switch_overdue_xml_config() {
|
87
|
+
$('#overdue_config_simple').hide();
|
88
|
+
$('#overdue_config_xml').show();
|
89
|
+
}
|
90
|
+
|
91
|
+
function switch_overdue_basic_config() {
|
92
|
+
$('#overdue_config_xml').hide();
|
93
|
+
$('#overdue_config_simple').show();
|
94
|
+
}
|
95
|
+
|
96
|
+
|
97
|
+
function overdue_new_state() {
|
98
|
+
/* Compute max index value to assign new rows with unsued index */
|
99
|
+
var max_idx = $.map($('[id^=delete_state_]'), function(e, i) {
|
100
|
+
return e.id.split("delete_state_")[1] }
|
101
|
+
).sort(function(a, b) {
|
102
|
+
return b - a
|
103
|
+
})[0];
|
104
|
+
|
105
|
+
/* Clone existing row and reset id based on max_idx */
|
106
|
+
var row = $('#existing-overdue-config-for-tenants tbody>tr:last').clone(true);
|
107
|
+
var row_idx = (parseInt(max_idx) + 1).toString();
|
108
|
+
row.attr('id', "tr_state_" + row_idx);
|
109
|
+
row.children("td:last").children('a').attr('id', "delete_state_" + row_idx);
|
110
|
+
|
111
|
+
/* Attach rom into dom */
|
112
|
+
row.insertAfter('#existing-overdue-config-for-tenants tbody>tr:last');
|
113
|
+
|
114
|
+
/* Also reset the disabled state */
|
115
|
+
$('#' + row.attr('id') + ' :input').each( function() {
|
116
|
+
$(this).prop('disabled', false); }
|
117
|
+
);
|
118
|
+
|
119
|
+
/* The cloned version may need to be displayed */
|
120
|
+
row.show();
|
121
|
+
}
|
122
|
+
|
123
|
+
function overdue_delete_state(obj) {
|
124
|
+
var idx = obj.id.split("delete_state_")[1];
|
125
|
+
/* Disable the entry in the form */
|
126
|
+
$("#tr_state_" + idx + " :input").each( function() {
|
127
|
+
$(this).prop('disabled', true); }
|
128
|
+
);
|
129
|
+
/* Hide the table row */
|
130
|
+
$("#tr_state_" + idx).hide();
|
131
|
+
};
|
132
|
+
|
133
|
+
$(document).ready(function() {
|
134
|
+
switch_overdue_basic_config();
|
135
|
+
});
|
136
|
+
|
137
|
+
|
138
|
+
<% end %>
|
@@ -0,0 +1,34 @@
|
|
1
|
+
<div id="catalog_simple">
|
2
|
+
|
3
|
+
<div>
|
4
|
+
<h1>Catalog (Add Plan Currency)
|
5
|
+
</h1>
|
6
|
+
</div>
|
7
|
+
<%= form_for @simple_plan, :url => {:action => :create_simple_plan}, :html => {:class => 'form-horizontal'} do |f| %>
|
8
|
+
|
9
|
+
<%= f.hidden_field_tag(:id, @tenant.id) %>
|
10
|
+
<div class="form-group">
|
11
|
+
<%= f.label :plan_id, 'Plan ID', :class => 'col-sm-3 control-label' %>
|
12
|
+
<div class="col-sm-4">
|
13
|
+
<%= f.text_field :plan_id, :class => 'form-control' %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="form-group">
|
17
|
+
<%= f.label :amount, 'Amount', :class => 'col-sm-3 control-label' %>
|
18
|
+
<div class="col-sm-4">
|
19
|
+
<%= f.text_field :amount, :class => 'form-control' %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div class="form-group">
|
23
|
+
<%= f.label :currency, 'Currency', :class => 'col-sm-3 control-label' %>
|
24
|
+
<div class="col-sm-4">
|
25
|
+
<%= f.select :currency, currencies, {:selected => 'USD'}, :class => 'form-control' %>
|
26
|
+
</div>
|
27
|
+
</div>
|
28
|
+
<div class="form-group">
|
29
|
+
<div class="col-sm-offset-3 col-sm-9">
|
30
|
+
<%= submit_tag 'Save', :class => 'btn btn-default' %>
|
31
|
+
</div>
|
32
|
+
</div>
|
33
|
+
<% end %>
|
34
|
+
</div>
|
@@ -61,133 +61,26 @@
|
|
61
61
|
<% end %>
|
62
62
|
<% end %>
|
63
63
|
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
<%= hidden_field_tag(:id, @tenant.id) %>
|
85
|
-
|
86
|
-
<div class="form-group">
|
87
|
-
<%= label_tag :overdue, 'Overdue Config', :class => 'col-sm-2 control-label' %>
|
88
|
-
<div class="col-sm-10">
|
89
|
-
<%= file_field_tag 'overdue', :class => 'form-control' %>
|
90
|
-
</div>
|
91
|
-
</div>
|
92
|
-
<div class="form-group">
|
93
|
-
<div class="col-sm-offset-2 col-sm-10">
|
94
|
-
<%= submit_tag 'Upload', :class => 'btn btn-default' %>
|
95
|
-
</div>
|
96
|
-
</div>
|
97
|
-
<% end %>
|
98
|
-
<hr/>
|
99
|
-
<%= form_tag({:action => :upload_invoice_template}, :method => 'post', :multipart => true, :class => 'form-horizontal') do %>
|
100
|
-
<%= hidden_field_tag(:id, @tenant.id) %>
|
101
|
-
|
102
|
-
<div class="form-group">
|
103
|
-
<%= label_tag :invoice_template, 'Invoice template', :class => 'col-sm-2 control-label' %>
|
104
|
-
<div class="col-sm-10">
|
105
|
-
<%= file_field_tag 'invoice_template', :class => 'form-control' %>
|
106
|
-
</div>
|
107
|
-
</div>
|
108
|
-
<div class="form-group">
|
109
|
-
<div class="col-sm-offset-2 col-sm-10">
|
110
|
-
<div class="checkbox">
|
111
|
-
<label>
|
112
|
-
<%= check_box_tag :manual_pay %>
|
113
|
-
<span>Manual Pay</span>
|
114
|
-
</label>
|
115
|
-
</div>
|
116
|
-
</div>
|
117
|
-
</div>
|
118
|
-
<div class="form-group">
|
119
|
-
<div class="col-sm-offset-2 col-sm-10">
|
120
|
-
<%= submit_tag 'Upload', :class => 'btn btn-default' %>
|
121
|
-
</div>
|
122
|
-
</div>
|
123
|
-
<% end %>
|
124
|
-
<hr/>
|
125
|
-
<%= form_tag({:action => :upload_invoice_translation}, :method => 'post', :multipart => true, :class => 'form-horizontal') do %>
|
126
|
-
<%= hidden_field_tag(:id, @tenant.id) %>
|
127
|
-
|
128
|
-
<div class="form-group">
|
129
|
-
<%= label_tag :invoice_translation, 'Invoice translation', :class => 'col-sm-2 control-label' %>
|
130
|
-
<div class="col-sm-10">
|
131
|
-
<%= file_field_tag 'invoice_translation', :class => 'form-control' %>
|
132
|
-
</div>
|
133
|
-
</div>
|
134
|
-
<div class="form-group">
|
135
|
-
<%= label_tag :translation_locale, 'Locale', :class => 'col-sm-2 control-label' %>
|
136
|
-
<div class="col-sm-10">
|
137
|
-
<%= text_field_tag :translation_locale, nil, :class => 'form-control' %>
|
138
|
-
</div>
|
139
|
-
</div>
|
140
|
-
<div class="form-group">
|
141
|
-
<div class="col-sm-offset-2 col-sm-10">
|
142
|
-
<%= submit_tag 'Upload', :class => 'btn btn-default' %>
|
143
|
-
</div>
|
144
|
-
</div>
|
145
|
-
<% end %>
|
146
|
-
<hr/>
|
147
|
-
<%= form_tag({:action => :upload_catalog_translation}, :method => 'post', :multipart => true, :class => 'form-horizontal') do %>
|
148
|
-
<%= hidden_field_tag(:id, @tenant.id) %>
|
149
|
-
|
150
|
-
<div class="form-group">
|
151
|
-
<%= label_tag :catalog_translation, 'Catalog translation', :class => 'col-sm-2 control-label' %>
|
152
|
-
<div class="col-sm-10">
|
153
|
-
<%= file_field_tag 'catalog_translation', :class => 'form-control' %>
|
154
|
-
</div>
|
155
|
-
</div>
|
156
|
-
<div class="form-group">
|
157
|
-
<%= label_tag :translation_locale, 'Locale', :class => 'col-sm-2 control-label' %>
|
158
|
-
<div class="col-sm-10">
|
159
|
-
<%= text_field_tag :translation_locale, nil, :class => 'form-control' %>
|
160
|
-
</div>
|
161
|
-
</div>
|
162
|
-
<div class="form-group">
|
163
|
-
<div class="col-sm-offset-2 col-sm-10">
|
164
|
-
<%= submit_tag 'Upload', :class => 'btn btn-default' %>
|
165
|
-
</div>
|
166
|
-
</div>
|
167
|
-
<% end %>
|
168
|
-
<hr/>
|
169
|
-
<%= form_tag({:action => :upload_plugin_config}, :method => 'post', :multipart => true, :class => 'form-horizontal') do %>
|
170
|
-
<%= hidden_field_tag(:id, @tenant.id) %>
|
171
|
-
|
172
|
-
<div class="form-group">
|
173
|
-
<%= label_tag :plugin_config, 'Plugin config', :class => 'col-sm-2 control-label' %>
|
174
|
-
<div class="col-sm-10">
|
175
|
-
<%= file_field_tag 'plugin_config', :class => 'form-control' %>
|
176
|
-
</div>
|
177
|
-
</div>
|
178
|
-
<div class="form-group">
|
179
|
-
<%= label_tag :plugin_name, 'Plugin name', :class => 'col-sm-2 control-label' %>
|
180
|
-
<div class="col-sm-10">
|
181
|
-
<%= text_field_tag :plugin_name, nil, :class => 'form-control' %>
|
182
|
-
</div>
|
183
|
-
</div>
|
184
|
-
<div class="form-group">
|
185
|
-
<div class="col-sm-offset-2 col-sm-10">
|
186
|
-
<%= submit_tag 'Upload', :class => 'btn btn-default' %>
|
187
|
-
</div>
|
188
|
-
</div>
|
189
|
-
<% end %>
|
190
|
-
<% end %>
|
64
|
+
<div class="container">
|
65
|
+
<ul class="nav nav-tabs">
|
66
|
+
<li class="nav active"><a href="#CatalogShow" data-toggle="tab">Catalog Show</a></li>
|
67
|
+
<li class="nav"><a href="#OverdueShow" data-toggle="tab">Overdue Show</a></li>
|
68
|
+
<li class="nav"><a href="#InvoiceTemplate" data-toggle="tab">Invoice Template</a></li>
|
69
|
+
<li class="nav"><a href="#InvoiceTranslation" data-toggle="tab">Invoice Translation</a></li>
|
70
|
+
<li class="nav"><a href="#CatalogTranslation" data-toggle="tab">Catalog Translation</a></li>
|
71
|
+
<li class="nav"><a href="#PluginConfig" data-toggle="tab">Plugin Config</a></li>
|
72
|
+
</ul>
|
73
|
+
|
74
|
+
<!-- Tab panes -->
|
75
|
+
<div class="tab-content">
|
76
|
+
<%= render :partial => 'show_catalog' %>
|
77
|
+
<%= render :partial => 'show_overdue' %>
|
78
|
+
<%= render :partial => 'form_invoice_template' %>
|
79
|
+
<%= render :partial => 'form_invoice_translation' %>
|
80
|
+
<%= render :partial => 'form_catalog_translation' %>
|
81
|
+
<%= render :partial => 'form_plugin_config' %>
|
82
|
+
</div>
|
83
|
+
</div>
|
191
84
|
|
192
85
|
<%= javascript_tag do %>
|
193
86
|
$(document).ready(function() {
|
@@ -43,7 +43,7 @@
|
|
43
43
|
</div>
|
44
44
|
</div>
|
45
45
|
|
46
|
-
<% if !
|
46
|
+
<% if !is_subscription_cancelled?(@base_subscription[bundle.bundle_id]) && (can?(:create, Kaui::Subscription) || can?(:transfer, Kaui::Subscription)) %>
|
47
47
|
<div class="tag-select" onclick="void(0)">
|
48
48
|
<span><i class="fa fa-gift"></i><i class="fa fa-caret-down"></i></span>
|
49
49
|
|
@@ -1,6 +1,8 @@
|
|
1
1
|
<div class="title-nav-area">
|
2
2
|
|
3
3
|
<div class="container">
|
4
|
+
<p><%= pretty_account_identifier %></p>
|
5
|
+
|
4
6
|
<%= link_to 'Account', kaui_engine.account_path(params[:account_id]), :class => (params[:controller].ends_with?('accounts') ? 'current' : 'non-current') %>
|
5
7
|
<%= link_to 'Subscriptions', kaui_engine.account_bundles_path(params[:account_id]), :class => (params[:controller].ends_with?('bundles') ? 'current' : 'non-current') %>
|
6
8
|
<%= link_to 'Invoices', kaui_engine.account_invoices_path(params[:account_id]), :class => (params[:controller].ends_with?('invoices') ? 'current' : 'non-current') %>
|
@@ -93,11 +93,22 @@
|
|
93
93
|
<td><%= transaction.gateway_error_code %></td>
|
94
94
|
<td><%= transaction.gateway_error_msg %></td>
|
95
95
|
<td>
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
96
|
+
<ul style="list-style: none">
|
97
|
+
<li>
|
98
|
+
<span <% if transaction.status != 'SUCCESS' %>class='alert-danger'<% else %>class='alert-success' <% end %>>
|
99
|
+
<%= transaction.status %>
|
100
|
+
</span>
|
101
|
+
</li>
|
102
|
+
<% if transaction.next_retry_date %>
|
103
|
+
<li>
|
104
|
+
Scheduled retry:
|
105
|
+
<%= format_date(transaction.next_retry_date) %>
|
106
|
+
<% if can? :trigger, Kaui::Payment %>
|
107
|
+
<%= link_to '<i class="fa fa-times"></i>'.html_safe, kaui_engine.payment_cancel_scheduled_payment_path(payment.payment_id, :account_id => payment.account_id, :transaction_external_key => transaction.transaction_external_key), :method => :delete %>
|
108
|
+
<% end %>
|
109
|
+
</li>
|
110
|
+
<% end %>
|
111
|
+
</ul>
|
101
112
|
</td>
|
102
113
|
</tr>
|
103
114
|
<% end %>
|
@@ -98,10 +98,10 @@
|
|
98
98
|
if (Number($("#refund_amount").attr('value')) > <%= @payment.purchased_amount %> ||
|
99
99
|
Number($("#refund_amount").attr('value')) <= 0) {
|
100
100
|
setClassForElement("#div_refund_amount", "form-group error");
|
101
|
-
$(
|
101
|
+
$('#new_kill_bill_client_model_invoice_item :submit').prop('disabled', true);
|
102
102
|
} else {
|
103
103
|
setClassForElement("#div_refund_amount", "form-group");
|
104
|
-
$(
|
104
|
+
$('#new_kill_bill_client_model_invoice_item :submit').prop('disabled', false);
|
105
105
|
}
|
106
106
|
};
|
107
107
|
|
@@ -109,6 +109,7 @@
|
|
109
109
|
* Disabled unwanted invoice item at the time we submit the form
|
110
110
|
*/
|
111
111
|
var disableNonCheckedInvoiceItem = function() {
|
112
|
+
|
112
113
|
$('input').filter(function() {
|
113
114
|
return this.id.match(/cb_adj_/);
|
114
115
|
}).each(function() {
|
@@ -196,15 +197,13 @@
|
|
196
197
|
* If doing invoice Item adjustment, disable entries that were not selected, so the controllers does not
|
197
198
|
* get them
|
198
199
|
*/
|
199
|
-
$(
|
200
|
+
$('#new_kill_bill_client_model_invoice_item :submit').mousedown(disableNonCheckedInvoiceItem);
|
200
201
|
|
201
202
|
/*
|
202
203
|
* Adjustment type handlers
|
203
204
|
*/
|
204
205
|
$("#adjustment_type_noInvoiceAdjustment")
|
205
206
|
.click(onClickWithInvoiceOrNoAdjustment);
|
206
|
-
$("#adjustment_type_invoiceAdjustment")
|
207
|
-
.click(onClickWithInvoiceOrNoAdjustment);
|
208
207
|
$("#adjustment_type_invoiceItemAdjustment")
|
209
208
|
.click(onClickWithInvoiceItemAdjustment);
|
210
209
|
|
@@ -5,13 +5,36 @@
|
|
5
5
|
<%= select_tag :plan_name, options_for_select(@plans), :class => 'form-control' %>
|
6
6
|
</div>
|
7
7
|
</div>
|
8
|
+
|
8
9
|
<div class="form-group">
|
10
|
+
<div class="col-sm-offset-2 col-sm-10">
|
11
|
+
<div class="radio">
|
12
|
+
<%= label_tag :type_change do %>
|
13
|
+
<%= radio_button_tag :type_change, 'IMM', :checked => true %>
|
14
|
+
Immediate Change
|
15
|
+
<% end %>
|
16
|
+
</div>
|
17
|
+
<div class="radio">
|
18
|
+
<%= label_tag :type_change do %>
|
19
|
+
<%= radio_button_tag :type_change, 'POLICY' %>
|
20
|
+
Specify Policy
|
21
|
+
<% end %>
|
22
|
+
</div>
|
23
|
+
<div class="radio">
|
24
|
+
<%= label_tag :type_change do %>
|
25
|
+
<%= radio_button_tag :type_change, 'DATE' %>
|
26
|
+
Specify a date
|
27
|
+
<% end %>
|
28
|
+
</div>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<div class="form-group", id="form_requested_date" >
|
9
32
|
<%= label_tag :requested_date, 'Change Date', :class => 'col-sm-2 control-label' %>
|
10
33
|
<div class="col-sm-10">
|
11
34
|
<%= text_field_tag :requested_date, Date.parse(Time.now.to_s).to_s, :class => 'form-control date-picker' %>
|
12
35
|
</div>
|
13
36
|
</div>
|
14
|
-
<div class="form-group">
|
37
|
+
<div class="form-group", id="form_policy">
|
15
38
|
<%= label_tag :policy, 'Policy', :class => 'col-sm-2 control-label' %>
|
16
39
|
<div class="col-sm-10">
|
17
40
|
<%= select_tag :policy, options_for_select(['', 'IMMEDIATE', 'END_OF_TERM']), :class => 'form-control' %>
|
@@ -24,3 +47,27 @@
|
|
24
47
|
</div>
|
25
48
|
</div>
|
26
49
|
<% end %>
|
50
|
+
|
51
|
+
<%= javascript_tag do %>
|
52
|
+
|
53
|
+
function onTypeChange() {
|
54
|
+
var value = $("input[type=radio]:checked").val();
|
55
|
+
if (value == "IMM") {
|
56
|
+
$("#form_requested_date").hide();
|
57
|
+
$("#form_policy").hide();
|
58
|
+
} else if (value == "POLICY") {
|
59
|
+
$("#form_requested_date").hide();
|
60
|
+
$("#form_policy").show();
|
61
|
+
} else if (value == "DATE") {
|
62
|
+
$("#form_policy").hide();
|
63
|
+
$("#form_requested_date").show();
|
64
|
+
}
|
65
|
+
}
|
66
|
+
|
67
|
+
$(document).ready(function() {
|
68
|
+
onTypeChange();
|
69
|
+
$( "input[type=radio]").on("click", function() {
|
70
|
+
onTypeChange();
|
71
|
+
});
|
72
|
+
});
|
73
|
+
<% end %>
|
@@ -26,6 +26,22 @@
|
|
26
26
|
</div>
|
27
27
|
<% end %>
|
28
28
|
<div class="form-group">
|
29
|
+
<div class="col-sm-offset-2 col-sm-10">
|
30
|
+
<div class="radio">
|
31
|
+
<%= label_tag :type_change do %>
|
32
|
+
<%= radio_button_tag :type_change, 'IMM', :checked => true %>
|
33
|
+
Immediate Creation
|
34
|
+
<% end %>
|
35
|
+
</div>
|
36
|
+
<div class="radio">
|
37
|
+
<%= label_tag :type_change do %>
|
38
|
+
<%= radio_button_tag :type_change, 'DATE' %>
|
39
|
+
Specify a date
|
40
|
+
<% end %>
|
41
|
+
</div>
|
42
|
+
</div>
|
43
|
+
</div>
|
44
|
+
<div class="form-group" id="form_requested_date">
|
29
45
|
<%= label_tag :requested_date, 'Date', :class => 'col-sm-2 control-label' %>
|
30
46
|
<div class="col-sm-10">
|
31
47
|
<%= text_field_tag :requested_date, Date.parse(Time.now.to_s).to_s, :class => 'form-control date-picker' %>
|
@@ -37,3 +53,23 @@
|
|
37
53
|
</div>
|
38
54
|
</div>
|
39
55
|
<% end %>
|
56
|
+
|
57
|
+
|
58
|
+
<%= javascript_tag do %>
|
59
|
+
|
60
|
+
function onTypeChange() {
|
61
|
+
var value = $("input[type=radio]:checked").val();
|
62
|
+
if (value == "IMM") {
|
63
|
+
$("#form_requested_date").hide();
|
64
|
+
} else if (value == "DATE") {
|
65
|
+
$("#form_requested_date").show();
|
66
|
+
}
|
67
|
+
}
|
68
|
+
|
69
|
+
$(document).ready(function() {
|
70
|
+
onTypeChange();
|
71
|
+
$( "input[type=radio]").on("click", function() {
|
72
|
+
onTypeChange();
|
73
|
+
});
|
74
|
+
});
|
75
|
+
<% end %>
|
@@ -3,6 +3,7 @@
|
|
3
3
|
<tr>
|
4
4
|
<th>Product category</th>
|
5
5
|
<th>Product name</th>
|
6
|
+
<th>Phase type</th>
|
6
7
|
<th>Start date</th>
|
7
8
|
<th>Charged through date</th>
|
8
9
|
<th>Notes</th>
|
@@ -11,16 +12,17 @@
|
|
11
12
|
</thead>
|
12
13
|
<tbody>
|
13
14
|
<% (bundle.subscriptions || []).each do |sub| %>
|
14
|
-
<tr class="<%=
|
15
|
-
<td><%=
|
16
|
-
<td><%=
|
17
|
-
<td><%=
|
18
|
-
<td><%=
|
19
|
-
<td><%=
|
15
|
+
<tr class="<%= is_subscription_cancelled?(sub) ? 'expired' : 'non-expired' %>">
|
16
|
+
<td><%= humanized_subscription_product_category(sub) %></td>
|
17
|
+
<td><%= humanized_subscription_full_product_name(sub) %></td>
|
18
|
+
<td><%= humanized_subscription_phase_type(sub) %></td>
|
19
|
+
<td><%= humanized_subscription_start_date(sub, account) %></td>
|
20
|
+
<td><%= humanized_subscription_charged_through_date(sub, account) %></td>
|
21
|
+
<td><%= humanized_subscription_cancelled_date(sub, account) %></td>
|
20
22
|
<td class="text-center">
|
21
|
-
<% if
|
23
|
+
<% if is_subscription_future_cancelled?(sub) %>
|
22
24
|
<%= link_to 'Reinstate', kaui_engine.reinstate_subscription_path(:id => sub.subscription_id), :method => :put, :class => 'btn btn-xs' %>
|
23
|
-
<% elsif !
|
25
|
+
<% elsif !is_subscription_cancelled?(sub) %>
|
24
26
|
<% if can? :change_plan, Kaui::Subscription %>
|
25
27
|
<%= link_to 'Change', kaui_engine.edit_subscription_path(sub.subscription_id), :class => 'btn btn-xs' %>
|
26
28
|
<% end %>
|
@@ -50,13 +52,14 @@
|
|
50
52
|
$('#subscriptions_<%= bundle.bundle_id %>').dataTable({
|
51
53
|
"dom": "t",
|
52
54
|
"paging": false,
|
53
|
-
"order": [[
|
55
|
+
"order": [[ 3, "asc" ]],
|
54
56
|
"columns": [
|
55
57
|
null,
|
56
58
|
null,
|
57
59
|
null,
|
58
60
|
null,
|
59
61
|
null,
|
62
|
+
null,
|
60
63
|
{ "orderable": false }
|
61
64
|
]
|
62
65
|
});
|
data/config/routes.rb
CHANGED
@@ -75,6 +75,7 @@ Kaui::Engine.routes.draw do
|
|
75
75
|
scope '/payments' do
|
76
76
|
match '/pagination' => 'payments#pagination', :via => :get, :as => 'payments_pagination'
|
77
77
|
match '/:id' => 'payments#restful_show', :via => :get, :as => 'payment'
|
78
|
+
match '/:id/cancel_scheduled_payment' => 'payments#cancel_scheduled_payment', :via => :delete, :as => 'payment_cancel_scheduled_payment'
|
78
79
|
end
|
79
80
|
|
80
81
|
scope '/bundles' do
|
@@ -117,7 +118,14 @@ Kaui::Engine.routes.draw do
|
|
117
118
|
|
118
119
|
resources :admin_tenants, :only => [ :index, :new, :create, :show ]
|
119
120
|
scope '/admin_tenants' do
|
121
|
+
match '/:id/new_catalog' => 'admin_tenants#new_catalog', :via => :get, :as => 'admin_tenant_new_catalog'
|
122
|
+
match '/:id/new_plan_currency' => 'admin_tenants#new_plan_currency', :via => :get, :as => 'admin_tenant_new_plan_currency'
|
123
|
+
match '/:id/new_overdue_config' => 'admin_tenants#new_overdue_config', :via => :get, :as => 'admin_tenant_new_overdue_config'
|
120
124
|
match '/upload_catalog' => 'admin_tenants#upload_catalog', :via => :post, :as => 'admin_tenant_upload_catalog'
|
125
|
+
match '/display_catalog_xml' => 'admin_tenants#display_catalog_xml', :via => :post, :as => 'admin_tenant_display_catalog_xml'
|
126
|
+
match '/display_overdue_xml' => 'admin_tenants#display_overdue_xml', :via => :post, :as => 'admin_tenant_display_overdue_xml'
|
127
|
+
match '/create_simple_plan' => 'admin_tenants#create_simple_plan', :via => :post, :as => 'admin_tenant_create_simple_plan'
|
128
|
+
match '/modify_overdue_config' => 'admin_tenants#modify_overdue_config', :via => :post, :as => 'admin_tenant_modify_overdue_config'
|
121
129
|
match '/upload_overdue_config' => 'admin_tenants#upload_overdue_config', :via => :post, :as => 'admin_tenant_upload_overdue_config'
|
122
130
|
match '/upload_invoice_template' => 'admin_tenants#upload_invoice_template', :via => :post, :as => 'admin_tenant_upload_invoice_template'
|
123
131
|
match '/upload_invoice_translation' => 'admin_tenants#upload_invoice_translation', :via => :post, :as => 'admin_tenant_upload_invoice_translation'
|
data/db/ddl.sql
CHANGED
@@ -10,13 +10,16 @@ CREATE TABLE `kaui_users` (
|
|
10
10
|
|
11
11
|
CREATE TABLE `kaui_tenants` (
|
12
12
|
`id` int(11) NOT NULL AUTO_INCREMENT,
|
13
|
-
`name` varchar(255)
|
13
|
+
`name` varchar(255) NOT NULL,
|
14
14
|
`kb_tenant_id` varchar(255) DEFAULT NULL,
|
15
15
|
`api_key` varchar(255) DEFAULT NULL,
|
16
16
|
`encrypted_api_secret` varchar(255) DEFAULT NULL,
|
17
17
|
`created_at` datetime NOT NULL,
|
18
18
|
`updated_at` datetime NOT NULL,
|
19
|
-
PRIMARY KEY (`id`)
|
19
|
+
PRIMARY KEY (`id`),
|
20
|
+
UNIQUE KEY `kaui_tenants_kb_name` (`name`),
|
21
|
+
UNIQUE KEY `kaui_tenants_kb_tenant_id` (`kb_tenant_id`),
|
22
|
+
UNIQUE KEY `kaui_tenants_kb_api_key` (`api_key`)
|
20
23
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
21
24
|
|
22
25
|
CREATE TABLE `kaui_allowed_users` (
|
data/kaui.gemspec
CHANGED
@@ -29,10 +29,11 @@ Gem::Specification.new do |s|
|
|
29
29
|
|
30
30
|
s.add_dependency 'js-routes', '~> 1.1'
|
31
31
|
s.add_dependency 'jquery-rails', '~> 3.0.4'
|
32
|
+
s.add_dependency 'jquery-ui-rails', '~> 5.0.5'
|
32
33
|
s.add_dependency 'jquery-datatables-rails', '~> 3.3.0'
|
33
34
|
s.add_dependency 'money-rails', '~> 1.3.0'
|
34
35
|
s.add_dependency 'd3_rails', '~> 3.2.8'
|
35
|
-
s.add_dependency 'killbill-client', '~> 0
|
36
|
+
s.add_dependency 'killbill-client', '~> 1.0'
|
36
37
|
s.add_dependency 'twitter-bootstrap-rails', '~> 3.2.0'
|
37
38
|
s.add_dependency 'bootstrap-datepicker-rails', '~> 1.4.0'
|
38
39
|
s.add_dependency 'devise', '~> 3.4.1'
|
@@ -42,7 +43,7 @@ Gem::Specification.new do |s|
|
|
42
43
|
s.add_dependency 'sass-rails', '~> 5.0.2'
|
43
44
|
s.add_dependency 'less-rails', '~> 2.7.0'
|
44
45
|
s.add_dependency 'concurrent-ruby', '~> 1.0.0.pre1'
|
45
|
-
|
46
|
+
s.add_dependency 'sprockets-rails', '2.3.3'
|
46
47
|
s.add_development_dependency 'fakeweb', '~> 1.3'
|
47
48
|
s.add_development_dependency 'multi_json', '~> 1.11'
|
48
49
|
s.add_development_dependency 'rake', '>= 0.8.7'
|