kaui 2.0.4 → 2.1.0
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.
- checksums.yaml +4 -4
- data/README.md +0 -16
- data/app/assets/stylesheets/kaui/account.less +9 -1
- data/app/assets/stylesheets/kaui/common.less +2 -2
- data/app/controllers/kaui/accounts_controller.rb +11 -15
- data/app/controllers/kaui/audit_logs_controller.rb +2 -2
- data/app/controllers/kaui/engine_controller_util.rb +24 -17
- data/app/controllers/kaui/invoice_tags_controller.rb +28 -0
- data/app/controllers/kaui/invoices_controller.rb +45 -14
- data/app/controllers/kaui/payment_methods_controller.rb +5 -0
- data/app/helpers/kaui/account_helper.rb +10 -2
- data/app/helpers/kaui/plugin_helper.rb +1 -1
- data/app/helpers/kaui/uuid_helper.rb +1 -0
- data/app/models/kaui/tag.rb +1 -1
- data/app/views/kaui/accounts/_billing_info.html.erb +4 -0
- data/app/views/kaui/accounts/_payment_methods.html.erb +3 -0
- data/app/views/kaui/accounts/index.html.erb +7 -4
- data/app/views/kaui/admin_tenants/_form_plugin_config.erb +13 -3
- data/app/views/kaui/bundles/_bundle_details.html.erb +12 -0
- data/app/views/kaui/bundles/index.html.erb +2 -13
- data/app/views/kaui/invoice_tags/_form.html.erb +33 -0
- data/app/views/kaui/invoice_tags/_form_bar.html.erb +21 -0
- data/app/views/kaui/invoice_tags/edit.html.erb +10 -0
- data/app/views/kaui/invoices/_invoice_table.html.erb +28 -7
- data/app/views/kaui/invoices/index.html.erb +6 -4
- data/app/views/kaui/invoices/show.html.erb +10 -1
- data/app/views/kaui/layouts/kaui_flash.html.erb +8 -1
- data/app/views/kaui/payments/index.html.erb +3 -1
- data/config/routes.rb +6 -0
- data/lib/kaui.rb +55 -0
- data/lib/kaui/version.rb +1 -1
- data/test/dummy/config/initializers/money.rb +2 -0
- data/test/functional/kaui/account_emails_controller_test.rb +2 -2
- data/test/functional/kaui/account_tags_controller_test.rb +1 -1
- data/test/functional/kaui/accounts_controller_test.rb +4 -4
- data/test/functional/kaui/admin_tenants_controller_test.rb +1 -1
- data/test/functional/kaui/bundle_tags_controller_test.rb +1 -1
- data/test/functional/kaui/bundles_controller_test.rb +3 -3
- 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 +3 -3
- data/test/functional/kaui/invoices_controller_test.rb +2 -2
- 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 +2 -0
- data/test/unit/kaui/account_test.rb +2 -2
- data/test/unit/kaui/invoice_item_test.rb +1 -1
- data/test/unit/kaui/invoice_payment_test.rb +7 -7
- data/test/unit/kaui/invoice_test.rb +4 -4
- data/test/unit/kaui/payment_test.rb +7 -7
- metadata +83 -76
@@ -44,8 +44,8 @@
|
|
44
44
|
</div>
|
45
45
|
<div class="form-group">
|
46
46
|
<%= label_tag :configuration, 'Configuration', :class => 'col-sm-2 control-label' %>
|
47
|
-
<div class="col-sm-
|
48
|
-
<textarea name="plugin_properties[raw_config]" id="raw_config" rows="
|
47
|
+
<div class="col-sm-6">
|
48
|
+
<textarea name="plugin_properties[raw_config]" id="raw_config" rows="20" class="form-control"></textarea>
|
49
49
|
</div>
|
50
50
|
</div>
|
51
51
|
|
@@ -170,9 +170,19 @@
|
|
170
170
|
/* Retrieve existing plugin properties for this tenant */
|
171
171
|
var existing_props = get_existing_tenant_plugin_properties(plugin_key);
|
172
172
|
|
173
|
-
//
|
173
|
+
// Try by plugin name for proprietary plugins
|
174
174
|
if (isBlank(existing_props) && !isBlank(plugin_name)) {
|
175
175
|
existing_props = get_existing_tenant_plugin_properties(plugin_name);
|
176
|
+
if (isBlank(existing_props)) {
|
177
|
+
// For proprietary plugins, the killbill- prefix likely doesn't exist (see Kaui::PluginHelper discussion)
|
178
|
+
plugin_name = plugin_name.replace('killbill-', '');
|
179
|
+
existing_props = get_existing_tenant_plugin_properties(plugin_name);
|
180
|
+
if (isBlank(existing_props)) {
|
181
|
+
// For proprietary plugins, our docs suggest acme:foo as the format for the plugin key, and often the plugin name becomes acme-foo
|
182
|
+
plugin_name = plugin_name.replace(':', '-');
|
183
|
+
existing_props = get_existing_tenant_plugin_properties(plugin_name);
|
184
|
+
}
|
185
|
+
}
|
176
186
|
}
|
177
187
|
|
178
188
|
return existing_props;
|
@@ -0,0 +1,12 @@
|
|
1
|
+
<table class="transparent subtitle">
|
2
|
+
<tr>
|
3
|
+
<th>Bundle ID</th>
|
4
|
+
<td><%= bundle.bundle_id %></td>
|
5
|
+
</tr>
|
6
|
+
<% unless bundle.bundle_id == bundle.external_key %>
|
7
|
+
<tr>
|
8
|
+
<th>Bundle key</th>
|
9
|
+
<td><%= bundle.external_key %></td>
|
10
|
+
</tr>
|
11
|
+
<% end %>
|
12
|
+
</table>
|
@@ -10,19 +10,8 @@
|
|
10
10
|
|
11
11
|
<% @bundles.each_with_index do |bundle, idx| %>
|
12
12
|
<div class="row">
|
13
|
-
<div class="col-md-
|
14
|
-
|
15
|
-
<tr>
|
16
|
-
<th>Bundle ID</th>
|
17
|
-
<td><%= bundle.bundle_id %></td>
|
18
|
-
</tr>
|
19
|
-
<% unless bundle.bundle_id == bundle.external_key %>
|
20
|
-
<tr>
|
21
|
-
<th>Bundle key</th>
|
22
|
-
<td><%= bundle.external_key %></td>
|
23
|
-
</tr>
|
24
|
-
<% end %>
|
25
|
-
</table>
|
13
|
+
<div class="col-md-6">
|
14
|
+
<%= render :partial => Kaui.bundle_details_partial, :locals => { :bundle => bundle, :account => @account, :catalog => @catalog } %>
|
26
15
|
</div>
|
27
16
|
</div>
|
28
17
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
<%= form_tag update_invoice_tags_path, :class => 'form-horizontal' do %>
|
2
|
+
<%= hidden_field_tag :invoice_id, @invoice_id %>
|
3
|
+
|
4
|
+
<div class='form-group'>
|
5
|
+
<div class="col-sm-offset-2 col-sm-10">
|
6
|
+
<% @available_tags.each do |tag| %>
|
7
|
+
<div class="checkbox">
|
8
|
+
<label>
|
9
|
+
<%= check_box_tag "tag_#{tag.id}", tag.name, @tag_names.include?(tag.name) %>
|
10
|
+
<span class='tag-description' rel='tooltip' title='<%= tag.description %>'><%= tag.name %></span>
|
11
|
+
</label>
|
12
|
+
</div>
|
13
|
+
<% end %>
|
14
|
+
</div>
|
15
|
+
</div>
|
16
|
+
<div class="form-group">
|
17
|
+
<%= label_tag :comment, 'Comment', :class => 'col-sm-2 control-label' %>
|
18
|
+
<div class="col-sm-10">
|
19
|
+
<%= text_area_tag :comment, nil, :rows => 3, :class => 'form-control' %>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<div class="form-group">
|
23
|
+
<div class="col-sm-offset-2 col-sm-10">
|
24
|
+
<%= submit_tag 'Update', :class => 'btn btn-default' %>
|
25
|
+
</div>
|
26
|
+
</div>
|
27
|
+
<% end %>
|
28
|
+
|
29
|
+
<%= javascript_tag do %>
|
30
|
+
$(function() {
|
31
|
+
$(".tag-description").tooltip();
|
32
|
+
});
|
33
|
+
<% end %>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<% can_change_tags = can?(:add, Kaui::Tag) || can?(:delete, Kaui::Tag) %>
|
2
|
+
<%= form_tag update_invoice_tags_path do %>
|
3
|
+
<%= hidden_field_tag :invoice_id, invoice_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,14 +1,22 @@
|
|
1
1
|
<div class="info-wrapper">
|
2
2
|
|
3
3
|
<% display_payment_options = (!dry_run && ((can?(:credit, Kaui::Account) && @invoice.status == 'DRAFT') || (can?(:charge, Kaui::Account) && @invoice.status == 'DRAFT') || (@invoice.balance > 0 && can?(:trigger, Kaui::Payment))))
|
4
|
-
if !(@custom_fields ||= nil).blank? || display_payment_options %>
|
4
|
+
if !(@available_invoice_tags ||= nil).blank? || !(@custom_fields ||= nil).blank? || display_payment_options %>
|
5
5
|
<div class="tag-bar">
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
6
|
+
<% unless @available_invoice_tags.blank? %>
|
7
|
+
<div class="tag-select" onclick="void(0)">
|
8
|
+
<span><i class="fa fa-tag"></i><i class="fa fa-caret-down"></i></span>
|
9
|
+
|
10
|
+
<div class="tag-select-box">
|
11
|
+
<strong>Tag As:</strong>
|
12
|
+
<%= render :partial => 'kaui/invoice_tags/form_bar',
|
13
|
+
:locals => {:account_id => @account.account_id,
|
14
|
+
:invoice_id => @invoice.invoice_id,
|
15
|
+
:tag_names => @invoice_tags.map { |tag| tag.tag_definition_name },
|
16
|
+
:available_tags => @available_invoice_tags} %>
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
12
20
|
<%= render :partial => 'kaui/custom_fields/list_bar',
|
13
21
|
:locals => {:custom_fields => @custom_fields} %>
|
14
22
|
|
@@ -35,6 +43,19 @@
|
|
35
43
|
</div>
|
36
44
|
<% end %>
|
37
45
|
|
46
|
+
<% if can?(:void, Kaui::Invoice) && @invoice.status != 'VOID' && @invoice_tags.find { |t| t.tag_definition_name == 'WRITTEN_OFF' }.nil? # The backend will do more comprehensive checks %>
|
47
|
+
<div class="tag-select" onclick="void(0)">
|
48
|
+
<span><i class="fa fa-trash"></i><i class="fa fa-caret-down"></i></span>
|
49
|
+
|
50
|
+
<div class="tag-select-box">
|
51
|
+
<%= form_tag void_invoice_path(:id => @invoice.invoice_id), :method => :delete do %>
|
52
|
+
<%= label_tag :comment, 'Comment', :class => 'col-sm-2 control-label' %>
|
53
|
+
<%= text_area_tag :comment, nil, :rows => 3, :class => 'form-control' %>
|
54
|
+
<%= submit_tag 'Void', :class => 'btn btn-default' %>
|
55
|
+
<% end %>
|
56
|
+
</div>
|
57
|
+
</div>
|
58
|
+
<% end %>
|
38
59
|
</div>
|
39
60
|
<% end %>
|
40
61
|
|
@@ -8,9 +8,9 @@
|
|
8
8
|
<thead>
|
9
9
|
<tr>
|
10
10
|
<th>Number</th>
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
<% (@account.account_id.blank? ? Kaui.invoice_search_columns : Kaui.account_invoices_columns).call()[0].each do |title| %>
|
12
|
+
<th><%= title %></th>
|
13
|
+
<% end %>
|
14
14
|
</tr>
|
15
15
|
</thead>
|
16
16
|
<tbody>
|
@@ -43,7 +43,9 @@ $(document).ready(function() {
|
|
43
43
|
"paging": false,
|
44
44
|
"ajax": "<%= invoices_pagination_path :format => :json %>",
|
45
45
|
<% end %>
|
46
|
-
<%
|
46
|
+
<% if @search_query.blank? %>
|
47
|
+
"ordering": false,
|
48
|
+
<% elsif !@ordering.blank? %>
|
47
49
|
"order": [[ 0, "<%= @ordering %>" ]],
|
48
50
|
<% end %>
|
49
51
|
"processing": true,
|
@@ -5,7 +5,7 @@
|
|
5
5
|
<h1>
|
6
6
|
Invoice <%= @invoice.invoice_number %>
|
7
7
|
<% unless @invoice.invoice_number.blank? %>
|
8
|
-
<%=
|
8
|
+
<%= Kaui.customer_invoice_link.call(@invoice, self) %>
|
9
9
|
<% end %>
|
10
10
|
</h1>
|
11
11
|
|
@@ -22,6 +22,15 @@
|
|
22
22
|
This is a DRAFT invoice.
|
23
23
|
<%= link_to 'Commit it', kaui_engine.commit_invoice_path(:id => @invoice.invoice_id), :method => :post %>.
|
24
24
|
</div>
|
25
|
+
<% elsif @invoice.status == 'VOID' %>
|
26
|
+
<div class="alert alert-danger">
|
27
|
+
This invoice has been voided.
|
28
|
+
</div>
|
29
|
+
<% end %>
|
30
|
+
<% unless @invoice_tags.find { |t| t.tag_definition_name == 'WRITTEN_OFF' }.nil? %>
|
31
|
+
<div class="alert alert-danger">
|
32
|
+
This invoice has been written off.
|
33
|
+
</div>
|
25
34
|
<% end %>
|
26
35
|
|
27
36
|
<div class="row">
|
@@ -8,6 +8,13 @@
|
|
8
8
|
</div>
|
9
9
|
<% end %>
|
10
10
|
<% end %>
|
11
|
+
<% if flash[:warning] %>
|
12
|
+
<div class="row server-alert">
|
13
|
+
<div class="col-md-12">
|
14
|
+
<div class="alert alert-warning"><%= flash[:warning] %></div>
|
15
|
+
</div>
|
16
|
+
</div>
|
17
|
+
<% end %>
|
11
18
|
<% if flash[:notice] %>
|
12
19
|
<div class="row server-alert">
|
13
20
|
<div class="col-md-12">
|
@@ -36,4 +43,4 @@
|
|
36
43
|
<span id="ajaxInfoAlertMessage" class="ajaxAlertMessage"></span>
|
37
44
|
</div>
|
38
45
|
</div>
|
39
|
-
</div>
|
46
|
+
</div>
|
@@ -46,7 +46,9 @@ $(document).ready(function() {
|
|
46
46
|
"paging": false,
|
47
47
|
"ajax": "<%= payments_pagination_path :format => :json %>",
|
48
48
|
<% end %>
|
49
|
-
<%
|
49
|
+
<% if @search_query.blank? %>
|
50
|
+
"ordering": false,
|
51
|
+
<% elsif !@ordering.blank? %>
|
50
52
|
"order": [[ 0, "<%= @ordering %>" ]],
|
51
53
|
<% end %>
|
52
54
|
"processing": true,
|
data/config/routes.rb
CHANGED
@@ -46,6 +46,10 @@ Kaui::Engine.routes.draw do
|
|
46
46
|
match '/edit' => 'bundle_tags#edit', :via => :get, :as => 'edit_bundle_tags'
|
47
47
|
match '/edit' => 'bundle_tags#update', :via => :post, :as => 'update_bundle_tags'
|
48
48
|
end
|
49
|
+
scope '/invoice_tags' do
|
50
|
+
match '/edit' => 'invoice_tags#edit', :via => :get, :as => 'edit_invoice_tags'
|
51
|
+
match '/edit' => 'invoice_tags#update', :via => :post, :as => 'update_invoice_tags'
|
52
|
+
end
|
49
53
|
scope '/timeline' do
|
50
54
|
match '/' => 'account_timelines#show', :via => :get, :as => 'account_timeline'
|
51
55
|
end
|
@@ -86,6 +90,7 @@ Kaui::Engine.routes.draw do
|
|
86
90
|
|
87
91
|
scope '/payment_methods' do
|
88
92
|
match '/validate_external_key' => 'payment_methods#validate_external_key', :via => :get, :as => 'payment_methods_validate_external_key'
|
93
|
+
match '/refresh' => 'payment_methods#refresh', :via => :post, :as => 'refresh_payment_methods'
|
89
94
|
end
|
90
95
|
resources :payment_methods, :only => [:new, :create, :show, :destroy]
|
91
96
|
|
@@ -94,6 +99,7 @@ Kaui::Engine.routes.draw do
|
|
94
99
|
match '/:id/show_html' => 'invoices#show_html', :via => :get, :as => 'show_html_invoice'
|
95
100
|
match '/:id' => 'invoices#restful_show', :via => :get, :as => 'invoice'
|
96
101
|
match '/commit' => 'invoices#commit_invoice', :via => :post, :as => 'commit_invoice'
|
102
|
+
match '/void' => 'invoices#void_invoice', :via => :delete, :as => 'void_invoice'
|
97
103
|
end
|
98
104
|
resources :invoices, :only => [ :index ]
|
99
105
|
|
data/lib/kaui.rb
CHANGED
@@ -10,8 +10,18 @@ module Kaui
|
|
10
10
|
mattr_accessor :new_user_session_path
|
11
11
|
mattr_accessor :destroy_user_session_path
|
12
12
|
|
13
|
+
mattr_accessor :bundle_details_partial
|
14
|
+
|
15
|
+
mattr_accessor :pretty_account_identifier
|
13
16
|
mattr_accessor :bundle_key_display_string
|
14
17
|
mattr_accessor :creditcard_plugin_name
|
18
|
+
|
19
|
+
mattr_accessor :account_search_columns
|
20
|
+
mattr_accessor :invoice_search_columns
|
21
|
+
mattr_accessor :account_invoices_columns
|
22
|
+
|
23
|
+
mattr_accessor :customer_invoice_link
|
24
|
+
|
15
25
|
mattr_accessor :layout
|
16
26
|
|
17
27
|
mattr_accessor :thread_pool
|
@@ -39,9 +49,54 @@ module Kaui
|
|
39
49
|
self.home_path = lambda { Kaui::Engine.routes.url_helpers.home_path }
|
40
50
|
self.tenant_home_path = lambda { Kaui::Engine.routes.url_helpers.tenants_path }
|
41
51
|
|
52
|
+
self.bundle_details_partial = 'kaui/bundles/bundle_details'
|
53
|
+
|
54
|
+
self.pretty_account_identifier = lambda { |account| account.name.presence || account.email.presence || Kaui::UuidHelper.truncate_uuid(account.external_key) }
|
42
55
|
self.bundle_key_display_string = lambda {|bundle_key| bundle_key }
|
43
56
|
self.creditcard_plugin_name = lambda { '__EXTERNAL_PAYMENT__' }
|
44
57
|
|
58
|
+
self.account_search_columns = lambda do |account=nil, view_context=nil|
|
59
|
+
[
|
60
|
+
['External key', 'Balance'],
|
61
|
+
[
|
62
|
+
account&.external_key,
|
63
|
+
account.nil? || view_context.nil? ? nil : view_context.humanized_money_with_symbol(account.balance_to_money)
|
64
|
+
]
|
65
|
+
]
|
66
|
+
end
|
67
|
+
|
68
|
+
self.invoice_search_columns = lambda do |invoice=nil, view_context=nil|
|
69
|
+
default_label = 'label-info'
|
70
|
+
default_label = 'label-default' if invoice&.status == 'DRAFT'
|
71
|
+
default_label = 'label-success' if invoice&.status == 'COMMITTED'
|
72
|
+
default_label = 'label-danger' if invoice&.status == 'VOID'
|
73
|
+
[
|
74
|
+
['Date', 'Status'],
|
75
|
+
[
|
76
|
+
invoice&.invoice_date,
|
77
|
+
invoice.nil? || view_context.nil? ? nil : view_context.content_tag(:span, invoice.status, class: ['label', default_label])
|
78
|
+
]
|
79
|
+
]
|
80
|
+
end
|
81
|
+
|
82
|
+
self.account_invoices_columns = lambda do |invoice=nil, view_context=nil|
|
83
|
+
default_label = 'label-info'
|
84
|
+
default_label = 'label-default' if invoice&.status == 'DRAFT'
|
85
|
+
default_label = 'label-success' if invoice&.status == 'COMMITTED'
|
86
|
+
default_label = 'label-danger' if invoice&.status == 'VOID'
|
87
|
+
[
|
88
|
+
['Date', 'Amount', 'Balance', 'Status'],
|
89
|
+
[
|
90
|
+
invoice&.invoice_date,
|
91
|
+
invoice.nil? || view_context.nil? ? nil : view_context.humanized_money_with_symbol(invoice.amount_to_money),
|
92
|
+
invoice.nil? || view_context.nil? ? nil : view_context.humanized_money_with_symbol(invoice.balance_to_money),
|
93
|
+
invoice.nil? || view_context.nil? ? nil : view_context.content_tag(:span, invoice.status, class: ['label', default_label])
|
94
|
+
]
|
95
|
+
]
|
96
|
+
end
|
97
|
+
|
98
|
+
self.customer_invoice_link = lambda { |invoice, ctx| ctx.link_to 'View customer invoice html', ctx.kaui_engine.show_html_invoice_path(invoice.invoice_id), :class => 'btn', :target => '_blank' }
|
99
|
+
|
45
100
|
self.demo_mode = false
|
46
101
|
|
47
102
|
# Root credentials for SaaS operations
|
data/lib/kaui/version.rb
CHANGED
@@ -24,14 +24,14 @@ class Kaui::AccountEmailsControllerTest < Kaui::FunctionalTestHelper
|
|
24
24
|
:email => 'toto@example.com'
|
25
25
|
}
|
26
26
|
assert_redirected_to account_path(account_id)
|
27
|
-
assert_equal "Error while communicating with the Kill Bill server:
|
27
|
+
assert_equal "Error while communicating with the Kill Bill server: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
|
28
28
|
end
|
29
29
|
|
30
30
|
test 'should handle Kill Bill errors during deletion' do
|
31
31
|
account_id = 'invalid-id'
|
32
32
|
delete :destroy, :account_id => account_id, :id => 'toto@example.com'
|
33
33
|
assert_redirected_to account_path(account_id)
|
34
|
-
assert_equal 'Error while communicating with the Kill Bill server:
|
34
|
+
assert_equal 'Error while communicating with the Kill Bill server: ', flash[:error]
|
35
35
|
end
|
36
36
|
|
37
37
|
test 'should add and destroy email' do
|
@@ -6,7 +6,7 @@ class Kaui::AccountTagsControllerTest < Kaui::FunctionalTestHelper
|
|
6
6
|
account_id = '1234'
|
7
7
|
get :edit, :account_id => account_id
|
8
8
|
assert_redirected_to account_path(account_id)
|
9
|
-
assert_equal 'Error while communicating with the Kill Bill server:
|
9
|
+
assert_equal 'Error while communicating with the Kill Bill server: ', flash[:error]
|
10
10
|
end
|
11
11
|
|
12
12
|
test 'should get edit' do
|
@@ -43,7 +43,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
|
|
43
43
|
account_id = SecureRandom.uuid.to_s
|
44
44
|
get :show, :account_id => account_id
|
45
45
|
assert_redirected_to home_path
|
46
|
-
assert_equal "Error while communicating with the Kill Bill server:
|
46
|
+
assert_equal "Error while communicating with the Kill Bill server: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
|
47
47
|
end
|
48
48
|
|
49
49
|
test 'should find account by id' do
|
@@ -101,7 +101,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
|
|
101
101
|
|
102
102
|
post :create, :account => {:external_key => external_key}
|
103
103
|
assert_template :new
|
104
|
-
assert_equal "Error while creating account:
|
104
|
+
assert_equal "Error while creating account: Account already exists for key #{external_key}", flash[:error]
|
105
105
|
end
|
106
106
|
|
107
107
|
test 'should create account' do
|
@@ -152,7 +152,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
|
|
152
152
|
account_id = SecureRandom.uuid.to_s
|
153
153
|
put :set_default_payment_method, :account_id => account_id, :payment_method_id => @payment_method.payment_method_id
|
154
154
|
assert_redirected_to home_path
|
155
|
-
assert_equal "Error while communicating with the Kill Bill server:
|
155
|
+
assert_equal "Error while communicating with the Kill Bill server: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
|
156
156
|
end
|
157
157
|
|
158
158
|
test 'should set default payment method' do
|
@@ -164,7 +164,7 @@ class Kaui::AccountsControllerTest < Kaui::FunctionalTestHelper
|
|
164
164
|
account_id = SecureRandom.uuid.to_s
|
165
165
|
post :pay_all_invoices, :account_id => account_id
|
166
166
|
assert_redirected_to home_path
|
167
|
-
assert_equal "Error while communicating with the Kill Bill server:
|
167
|
+
assert_equal "Error while communicating with the Kill Bill server: Object id=#{account_id} type=ACCOUNT doesn't exist!", flash[:error]
|
168
168
|
end
|
169
169
|
|
170
170
|
test 'should pay all invoices' do
|