kaui 0.15.4 → 0.15.5
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/app/controllers/kaui/bundles_controller.rb +32 -0
- data/app/controllers/kaui/credits_controller.rb +1 -1
- data/app/helpers/kaui/subscription_helper.rb +1 -1
- data/app/views/kaui/bundles/index.html.erb +5 -1
- data/app/views/kaui/bundles/pause_resume.html.erb +42 -0
- data/config/routes.rb +2 -0
- data/lib/kaui/version.rb +1 -1
- data/test/functional/kaui/bundles_controller_test.rb +2 -2
- data/test/killbill_test_helper.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 156564f2fffc9ed94c485edefc7d203528625c26
|
4
|
+
data.tar.gz: f0384c9f2e24c0a68346becaa2c6a823ec4b5ed9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e4931a11ef92ca0dd389d9b63ca96a73213fb978c8c77aa7f6da209b6f2beec685c07fb7806cf51fcb7a4c0cd4948968156a7045779eff2ab65341ed4aca7bc
|
7
|
+
data.tar.gz: 040d8c650dd2a709828d98f4270eccf9a6d981a3c7df388273680ae2d6aef65d0fa6c9e760cfa547bdecf7abdcd9ea6e2fb06328701a82fb18df3ea34532d2c1
|
@@ -38,4 +38,36 @@ class Kaui::BundlesController < Kaui::EngineController
|
|
38
38
|
bundle = Kaui::Bundle.find_by_id_or_key(params.require(:id), options_for_klient)
|
39
39
|
redirect_to kaui_engine.account_bundles_path(bundle.account_id)
|
40
40
|
end
|
41
|
+
|
42
|
+
def pause_resume
|
43
|
+
@bundle = Kaui::Bundle.find_by_id_or_key(params.require(:id), options_for_klient)
|
44
|
+
@base_subscription = @bundle.subscriptions.find { |sub| sub.product_category == 'BASE' }
|
45
|
+
end
|
46
|
+
|
47
|
+
def do_pause_resume
|
48
|
+
bundle = Kaui::Bundle::new(:bundle_id => params.require(:id))
|
49
|
+
|
50
|
+
paused = false
|
51
|
+
resumed = false
|
52
|
+
|
53
|
+
if params[:pause_requested_date].present?
|
54
|
+
bundle.pause(params[:pause_requested_date], current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
55
|
+
paused = true
|
56
|
+
end
|
57
|
+
|
58
|
+
if params[:resume_requested_date].present?
|
59
|
+
bundle.resume(params[:resume_requested_date], current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
60
|
+
resumed = true
|
61
|
+
end
|
62
|
+
|
63
|
+
msg = 'Bundle was successfully '
|
64
|
+
if paused && !resumed
|
65
|
+
msg += 'paused'
|
66
|
+
elsif !paused && resumed
|
67
|
+
msg += 'resumed'
|
68
|
+
else
|
69
|
+
msg += 'updated'
|
70
|
+
end
|
71
|
+
redirect_to kaui_engine.account_bundles_path(@account.account_id), :notice => msg
|
72
|
+
end
|
41
73
|
end
|
@@ -22,7 +22,7 @@ class Kaui::CreditsController < Kaui::EngineController
|
|
22
22
|
# No need to show the newly created invoice for account level credits
|
23
23
|
should_redirect_to_invoice = credit.invoice_id.present?
|
24
24
|
|
25
|
-
credit = credit.create(current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
25
|
+
credit = credit.create(true, current_user.kb_username, params[:reason], params[:comment], options_for_klient)
|
26
26
|
flash[:notice] = 'Credit was successfully created'
|
27
27
|
|
28
28
|
if should_redirect_to_invoice
|
@@ -131,7 +131,7 @@ module Kaui
|
|
131
131
|
|
132
132
|
|
133
133
|
def is_subscription_future_cancelled?(sub)
|
134
|
-
sub.present?
|
134
|
+
sub.present? && sub.state != 'CANCELLED' && sub.billing_end_date.present? && Time.parse(sub.billing_end_date) > Time.now
|
135
135
|
end
|
136
136
|
|
137
137
|
def is_subscription_cancelled?(sub)
|
@@ -43,7 +43,8 @@
|
|
43
43
|
</div>
|
44
44
|
</div>
|
45
45
|
|
46
|
-
<% if !is_subscription_cancelled?(@base_subscription[bundle.bundle_id]) &&
|
46
|
+
<% if !is_subscription_cancelled?(@base_subscription[bundle.bundle_id]) &&
|
47
|
+
(can?(:create, Kaui::Subscription) || can?(:transfer, Kaui::Subscription) || can?(:pause_resume, Kaui::Subscription)) %>
|
47
48
|
<div class="tag-select" onclick="void(0)">
|
48
49
|
<span><i class="fa fa-gift"></i><i class="fa fa-caret-down"></i></span>
|
49
50
|
|
@@ -54,6 +55,9 @@
|
|
54
55
|
<% if can? :transfer, Kaui::Subscription %>
|
55
56
|
<%= link_to '<i class="fa fa-random"></i> Transfer Ownership'.html_safe, kaui_engine.transfer_bundle_path(bundle.bundle_id) %>
|
56
57
|
<% end %>
|
58
|
+
<% if can? :pause_resume, Kaui::Subscription %>
|
59
|
+
<%= link_to '<i class="fa fa-pause"></i> Pause / resume'.html_safe, kaui_engine.pause_resume_bundle_path(:account_id => bundle.account_id, :id => bundle.bundle_id) %>
|
60
|
+
<% end %>
|
57
61
|
</div>
|
58
62
|
</div>
|
59
63
|
<% end %>
|
@@ -0,0 +1,42 @@
|
|
1
|
+
<div class="register">
|
2
|
+
<div class="col-md-8 col-md-offset-2">
|
3
|
+
|
4
|
+
<div class="column-block">
|
5
|
+
<% if @base_subscription.state == 'BLOCKED' %>
|
6
|
+
<h1>Resume</h1>
|
7
|
+
<% else %>
|
8
|
+
<h1>Pause / Resume</h1>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<%= form_tag do_pause_resume_bundle_path(:account_id => @account.account_id, :id => @bundle.bundle_id), :class => 'form-horizontal', :method => :put do %>
|
12
|
+
<% if @base_subscription.state != 'BLOCKED' %>
|
13
|
+
<div class="form-group">
|
14
|
+
<%= label_tag :pause_requested_date, 'Pause date', :class => 'col-sm-2 control-label' %>
|
15
|
+
<div class="col-sm-3">
|
16
|
+
<input class="form-control" name="pause_requested_date" type="text" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-today-highlight="true">
|
17
|
+
</div>
|
18
|
+
</div>
|
19
|
+
<% end %>
|
20
|
+
<div class="form-group">
|
21
|
+
<%= label_tag :resume_requested_date, 'Resume date', :class => 'col-sm-2 control-label' %>
|
22
|
+
<div class="col-sm-3">
|
23
|
+
<input class="form-control" name="resume_requested_date" type="text" data-provide="datepicker" data-date-format="yyyy-mm-dd" data-date-today-highlight="true">
|
24
|
+
</div>
|
25
|
+
</div>
|
26
|
+
<div class="form-group">
|
27
|
+
<%= label_tag :comment, 'Comment', :class => 'col-sm-2 control-label' %>
|
28
|
+
<div class="col-sm-10">
|
29
|
+
<%= text_area_tag :comment, nil, :rows => 3, :class => 'form-control' %>
|
30
|
+
</div>
|
31
|
+
</div>
|
32
|
+
<div class="form-group">
|
33
|
+
<div class="col-sm-offset-2 col-sm-10">
|
34
|
+
<%= submit_tag @base_subscription.state == 'BLOCKED' ? 'Resume' : 'Pause / Resume', :class => 'btn btn-default' %>
|
35
|
+
</div>
|
36
|
+
</div>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
</div>
|
40
|
+
|
41
|
+
</div>
|
42
|
+
</div>
|
data/config/routes.rb
CHANGED
@@ -88,6 +88,8 @@ Kaui::Engine.routes.draw do
|
|
88
88
|
end
|
89
89
|
|
90
90
|
scope '/bundles' do
|
91
|
+
put '/:id/do_pause_resume', :to => 'bundles#do_pause_resume', :as => 'do_pause_resume_bundle'
|
92
|
+
get '/:id/pause_resume', :to => 'bundles#pause_resume', :as => 'pause_resume_bundle'
|
91
93
|
put '/:id/do_transfer', :to => 'bundles#do_transfer', :as => 'do_transfer_bundle'
|
92
94
|
get '/:id/transfer', :to => 'bundles#transfer', :as => 'transfer_bundle'
|
93
95
|
match '/:id' => 'bundles#restful_show', :via => :get, :as => 'bundle'
|
data/lib/kaui/version.rb
CHANGED
@@ -12,10 +12,10 @@ class Kaui::BundlesControllerTest < Kaui::FunctionalTestHelper
|
|
12
12
|
test 'should get index with existing tags' do
|
13
13
|
|
14
14
|
tag_definition_ids = []
|
15
|
-
def1 = create_tag_definition(SecureRandom.uuid.to_s, @tenant);
|
15
|
+
def1 = create_tag_definition(SecureRandom.uuid.to_s[0..19], @tenant);
|
16
16
|
tag_definition_ids << def1
|
17
17
|
tag_definition_ids << def1
|
18
|
-
def2 = create_tag_definition(SecureRandom.uuid.to_s, @tenant);
|
18
|
+
def2 = create_tag_definition(SecureRandom.uuid.to_s[0..19], @tenant);
|
19
19
|
tag_definition_ids << def2
|
20
20
|
|
21
21
|
add_tags(@bundle, tag_definition_ids, @tenant);
|
@@ -146,7 +146,7 @@ module Kaui
|
|
146
146
|
account = create_account(tenant, username, password, user, reason, comment) if account.nil?
|
147
147
|
|
148
148
|
credit = KillBillClient::Model::Credit.new(:invoice_id => invoice_id, :account_id => account.account_id, :credit_amount => 23.22)
|
149
|
-
credit = credit.create(user, reason, comment, build_options(tenant, username, password))
|
149
|
+
credit = credit.create(true, user, reason, comment, build_options(tenant, username, password))
|
150
150
|
|
151
151
|
invoice = KillBillClient::Model::Invoice.find_by_id_or_number(credit.invoice_id, true, 'NONE', build_options(tenant, username, password))
|
152
152
|
invoice.items.find { |ii| ii.amount == -credit.credit_amount }
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.15.
|
4
|
+
version: 0.15.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Killbill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-05-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|
@@ -570,6 +570,7 @@ files:
|
|
570
570
|
- app/views/kaui/bundle_tags/_form_bar.html.erb
|
571
571
|
- app/views/kaui/bundle_tags/edit.html.erb
|
572
572
|
- app/views/kaui/bundles/index.html.erb
|
573
|
+
- app/views/kaui/bundles/pause_resume.html.erb
|
573
574
|
- app/views/kaui/bundles/transfer.html.erb
|
574
575
|
- app/views/kaui/chargebacks/_form.html.erb
|
575
576
|
- app/views/kaui/chargebacks/new.html.erb
|