kaui 0.5.2 → 0.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kaui (0.5.2)
4
+ kaui (0.5.3)
5
5
  cancan (~> 1.6.10)
6
6
  d3_rails (~> 3.2.8)
7
7
  devise (~> 3.0.2)
@@ -171,4 +171,20 @@ class Kaui::SubscriptionsController < Kaui::EngineController
171
171
  end
172
172
  redirect_to :back
173
173
  end
174
+
175
+ def reinstate
176
+ subscription_id = params[:id]
177
+ if subscription_id.present?
178
+ begin
179
+ Kaui::KillbillHelper::reinstate_subscription(subscription_id, current_user, params[:reason], params[:comment], options_for_klient)
180
+ flash[:notice] = "Subscription reinstated"
181
+ rescue => e
182
+ flash[:error] = "Error while reinstating subscription: #{as_string(e)}"
183
+ end
184
+ else
185
+ flash[:error] = "No subscription id given"
186
+ end
187
+ redirect_to :back
188
+ end
189
+
174
190
  end
@@ -216,6 +216,13 @@ module Kaui
216
216
  entitlement.cancel(extract_created_by(current_user), extract_reason_code(reason), comment, nil, policy, policy, true, options)
217
217
  end
218
218
 
219
+ def self.reinstate_subscription(subscription_id, current_user = nil, reason = nil, comment = nil, options = {})
220
+ call_killbill :put,
221
+ "/1.0/kb/subscriptions/#{subscription_id}/uncancel",
222
+ "",
223
+ build_audit_headers(current_user, reason, comment, options)
224
+ end
225
+
219
226
  def self.compute_previous_ctd(ctd, billing_period, options = {})
220
227
  return nil if ctd.nil? or billing_period.nil?
221
228
 
@@ -37,7 +37,7 @@
37
37
  <span class="caret"></span>
38
38
  </a>
39
39
  <ul class="dropdown-menu">
40
- <li><%= link_to "Cancel (default policy)", kaui_engine.subscription_path(:id => sub.subscription_id), :method => :delete %></li>
40
+ <li><%= link_to "Cancel (default policy)", kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'END_OF_TERM'), :method => :delete %></li>
41
41
  <li><%= link_to "Cancel at previous CTD (no proration)", kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'IMMEDIATE', :ctd => sub.charged_through_date, :billing_period => sub.billing_period), :method => :delete %></li>
42
42
  <li><%= link_to "Cancel immediately (generate proration)", kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'IMMEDIATE'), :method => :delete %></li>
43
43
  <li><%= link_to "Cancel end of term", kaui_engine.subscription_path(:id => sub.subscription_id, :policy => 'END_OF_TERM'), :method => :delete %></li>
data/lib/kaui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = "0.5.2"
2
+ VERSION = "0.5.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kaui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.2
4
+ version: 0.5.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-09-25 00:00:00.000000000 Z
12
+ date: 2013-09-26 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -435,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
435
435
  version: '0'
436
436
  segments:
437
437
  - 0
438
- hash: -2190582630358505934
438
+ hash: -2070916750925486573
439
439
  requirements: []
440
440
  rubyforge_project:
441
441
  rubygems_version: 1.8.25