kaui 0.4.3 → 0.4.4

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,12 +1,12 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- kaui (0.4.3)
4
+ kaui (0.4.4)
5
5
  cancan (~> 1.6.10)
6
6
  d3_rails (~> 3.2.8)
7
7
  devise (~> 3.0.2)
8
8
  jquery-rails (~> 3.0.4)
9
- killbill-client (~> 0.3.3)
9
+ killbill-client (~> 0.3.5)
10
10
  money-rails (~> 0.8.1)
11
11
  rails (~> 3.2.14)
12
12
  rest-client (~> 1.6.7)
@@ -60,7 +60,7 @@ GEM
60
60
  railties (>= 3.0, < 5.0)
61
61
  thor (>= 0.14, < 2.0)
62
62
  json (1.8.0)
63
- killbill-client (0.3.3)
63
+ killbill-client (0.3.5)
64
64
  mail (2.5.4)
65
65
  mime-types (~> 1.16)
66
66
  treetop (~> 1.4.8)
@@ -1,11 +1,12 @@
1
1
  class Kaui::AccountTagsController < Kaui::EngineController
2
2
 
3
3
  def show
4
- account_id = params[:id]
4
+ account_id = params[:account_id]
5
5
 
6
6
  if account_id.present?
7
7
  begin
8
- @tags = Kaui::KillbillHelper::get_tags_for_account(account_id, options_for_klient)
8
+ @tags = Kaui::KillbillHelper::get_tags_for_account(account_id, "FULL", options_for_klient)
9
+ @account = Kaui::KillbillHelper::get_account(account_id, false, false, options_for_klient)
9
10
  rescue => e
10
11
  flash.now[:error] = "Error while getting tags: #{as_string(e)}"
11
12
  end
@@ -19,7 +20,7 @@ class Kaui::AccountTagsController < Kaui::EngineController
19
20
  begin
20
21
  @available_tags = Kaui::TagDefinition.all_for_account(options_for_klient).sort
21
22
  @account = Kaui::KillbillHelper::get_account(@account_id, false, false, options_for_klient)
22
- @tag_names = Kaui::KillbillHelper::get_tags_for_account(@account.account_id, options_for_klient).map { |tag| tag.tag_definition_name }
23
+ @tag_names = Kaui::KillbillHelper::get_tags_for_account(@account.account_id, "NONE", options_for_klient).map { |tag| tag.tag_definition_name }
23
24
  rescue => e
24
25
  flash.now[:error] = "Error while editing tags: #{as_string(e)}"
25
26
  end
@@ -27,7 +28,7 @@ class Kaui::AccountTagsController < Kaui::EngineController
27
28
 
28
29
  def update
29
30
  begin
30
- current_tags = Kaui::KillbillHelper::get_tags_for_account(params[:account_id], options_for_klient).map { |tag| tag.tag_definition_id }
31
+ current_tags = Kaui::KillbillHelper::get_tags_for_account(params[:account_id], "NONE", options_for_klient).map { |tag| tag.tag_definition_id }
31
32
 
32
33
  new_tags = []
33
34
  params.each do |tag, tag_name|
@@ -23,7 +23,9 @@ class Kaui::AccountsController < Kaui::EngineController
23
23
 
24
24
  if @account.present? and @account.is_a? Kaui::Account
25
25
  begin
26
- @tags = Kaui::KillbillHelper::get_tags_for_account(@account.account_id, options_for_klient).sort
26
+ @tags = Kaui::KillbillHelper::get_tags_for_account(@account.account_id, "NONE", options_for_klient).sort_by do |tag|
27
+ @tag_definition_name <=> tag.tag_definition_name
28
+ end
27
29
  @account_emails = Kaui::AccountEmail.where({ :account_id => @account.account_id }, options_for_klient)
28
30
  @overdue_state = Kaui::KillbillHelper::get_overdue_state_for_account(@account.account_id, options_for_klient)
29
31
  @payment_methods = Kaui::KillbillHelper::get_non_external_payment_methods(@account.account_id, options_for_klient)
@@ -211,7 +211,8 @@ module Kaui
211
211
 
212
212
  entitlement = KillBillClient::Model::EntitlementNoEvents.new
213
213
  entitlement.subscription_id = subscription_id
214
- entitlement.cancel(extract_created_by(current_user), extract_reason_code(reason), comment, nil, policy, options)
214
+ # We are using same entitlement/billing policy here for now
215
+ entitlement.cancel(extract_created_by(current_user), extract_reason_code(reason), comment, nil, policy, policy, options)
215
216
  end
216
217
 
217
218
  def self.compute_previous_ctd(ctd, billing_period, options = {})
@@ -457,9 +458,8 @@ module Kaui
457
458
  build_audit_headers(current_user, reason, comment, options)
458
459
  end
459
460
 
460
- def self.get_tags_for_account(account_id, options = {})
461
- data = call_killbill :get, "/1.0/kb/accounts/#{account_id}/tags", options
462
- process_response(data, :multiple) { |json| Kaui::Tag.new(json) }
461
+ def self.get_tags_for_account(account_id, audit = "NONE", options = {})
462
+ KillBillClient::Model::Tag.find_all_by_account_id account_id, audit, options
463
463
  end
464
464
 
465
465
  def self.get_tags_for_bundle(bundle_id, options = {})
@@ -1,10 +1,29 @@
1
- <dt>Tags:</dt>
2
- <dd>
3
- <% if tags.present? %>
4
- <% tags.sort.each_with_index do |tag, idx| %>
5
- <span><%= tag %><% if idx < tags.length - 1 %>, <% end %></span>
6
- <% end %>
7
- <br/>
8
- <% end %>
9
- <%= link_to 'Add/Remove', kaui_engine.tags_url_or_path, :class => "btn btn-mini" %>
10
- </dd>
1
+ <div class="page-header">
2
+ <h3>Tags for <%= (link_to @account.name, account_path(@account.account_id)) if @account.present? %></h3>
3
+ </div>
4
+ <table class="table table-condensed table-striped data-table">
5
+ <thead>
6
+ <tr>
7
+ <th>Tag Name</th>
8
+ <th>Executed date</th>
9
+ <th>Execution type</th>
10
+ <th>Executed by</th>
11
+ <th>Comments</th>
12
+ </tr>
13
+ </thead>
14
+ <tbody>
15
+ <% if @tags.present? %>
16
+ <% @tags.each do |tag| %>
17
+ <% log = tag.audit_logs.first if tag.audit_logs.present? %>
18
+ <tr>
19
+ <td><%= link_to tag.tag_definition_name, tag_definition_path(:id => tag.tag_definition_id) %></td>
20
+ <td><%= format_date(log.change_date, @account.timezone).html_safe if log.change_date.present? %></td>
21
+ <td><%= log.change_type if log.change_type.present? %></td>
22
+ <td><%= log.changed_by if log.changed_by.present? %></td>
23
+ <td><%= log.reason_code if log.reason_code.present? %> <%= log.comments if log.comments.present? %></td>
24
+ </tr>
25
+ <% end #end tag%>
26
+ <% end #end if tags present%>
27
+ </tbody>
28
+ </table>
29
+
@@ -0,0 +1,3 @@
1
+ <%= render "account_tags_table" %>
2
+ <%= link_to 'Back', :back, :class => 'btn' %>
3
+ <%= link_to 'Add/Remove Tags', edit_account_tags_path(:account_id => @account), :class => 'btn' %>
@@ -30,4 +30,4 @@
30
30
  </table>
31
31
  <% else %>
32
32
  <p>Refund info not found</p>
33
- <% end %>
33
+ <% end %>
@@ -7,4 +7,5 @@
7
7
  <br/>
8
8
  <% end %>
9
9
  <%= link_to 'Add/Remove', tags_url_or_path, :class => 'btn btn-mini' %>
10
+ <%= link_to 'Tags Audit', account_tags_path(:account_id => @account), :class => 'btn btn-mini' %>
10
11
  </dd>
data/kaui.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.add_dependency 'rest-client', '~> 1.6.7'
28
28
  s.add_dependency 'money-rails', '~> 0.8.1'
29
29
  s.add_dependency 'd3_rails', '~> 3.2.8'
30
- s.add_dependency 'killbill-client', '~> 0.3.3'
30
+ s.add_dependency 'killbill-client', '~> 0.3.5'
31
31
  s.add_dependency 'devise', '~> 3.0.2'
32
32
  s.add_dependency 'cancan', '~> 1.6.10'
33
33
 
data/lib/kaui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = "0.4.3"
2
+ VERSION = "0.4.4"
3
3
  end
data/test/test_helper.rb CHANGED
@@ -90,7 +90,7 @@ module Kaui::KillbillHelper
90
90
  []
91
91
  end
92
92
 
93
- def self.get_tags_for_account(account_id, options = {})
93
+ def self.get_tags_for_account(account_id, audit = "NONE", options = {})
94
94
  []
95
95
  end
96
96
 
@@ -8,6 +8,6 @@ class Kaui::DateHelperTest < ActiveSupport::TestCase
8
8
  end
9
9
 
10
10
  test "can parse from date" do
11
- assert_equal "2012-06-30", format_date(Date.new(2012, 7, 1))
11
+ assert_equal "2012-07-01", format_date(Date.new(2012, 7, 1))
12
12
  end
13
13
  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.4.3
4
+ version: 0.4.4
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-08-29 00:00:00.000000000 Z
12
+ date: 2013-09-04 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -98,7 +98,7 @@ dependencies:
98
98
  requirements:
99
99
  - - ~>
100
100
  - !ruby/object:Gem::Version
101
- version: 0.3.3
101
+ version: 0.3.5
102
102
  type: :runtime
103
103
  prerelease: false
104
104
  version_requirements: !ruby/object:Gem::Requirement
@@ -106,7 +106,7 @@ dependencies:
106
106
  requirements:
107
107
  - - ~>
108
108
  - !ruby/object:Gem::Version
109
- version: 0.3.3
109
+ version: 0.3.5
110
110
  - !ruby/object:Gem::Dependency
111
111
  name: devise
112
112
  requirement: !ruby/object:Gem::Requirement
@@ -259,6 +259,7 @@ files:
259
259
  - app/views/kaui/account_emails/show.html.erb
260
260
  - app/views/kaui/account_tags/_account_tags_table.html.erb
261
261
  - app/views/kaui/account_tags/edit.html.erb
262
+ - app/views/kaui/account_tags/show.html.erb
262
263
  - app/views/kaui/account_timelines/index.html.erb
263
264
  - app/views/kaui/account_timelines/show.html.erb
264
265
  - app/views/kaui/accounts/index.html.erb
@@ -437,7 +438,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
437
438
  version: '0'
438
439
  segments:
439
440
  - 0
440
- hash: 1687584771760312948
441
+ hash: -2233739606759617333
441
442
  requirements: []
442
443
  rubyforge_project:
443
444
  rubygems_version: 1.8.25