kaui 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. data/app/controllers/kaui/account_tags_controller.rb +38 -27
  2. data/app/controllers/kaui/account_timelines_controller.rb +10 -4
  3. data/app/controllers/kaui/accounts_controller.rb +31 -12
  4. data/app/controllers/kaui/bundle_tags_controller.rb +5 -1
  5. data/app/controllers/kaui/bundles_controller.rb +6 -3
  6. data/app/controllers/kaui/chargebacks_controller.rb +21 -12
  7. data/app/controllers/kaui/charges_controller.rb +15 -13
  8. data/app/controllers/kaui/credits_controller.rb +19 -9
  9. data/app/controllers/kaui/invoice_items_controller.rb +9 -5
  10. data/app/controllers/kaui/invoices_controller.rb +28 -20
  11. data/app/controllers/kaui/payments_controller.rb +11 -6
  12. data/app/controllers/kaui/refunds_controller.rb +9 -4
  13. data/app/controllers/kaui/subscriptions_controller.rb +50 -38
  14. data/app/helpers/kaui/killbill_helper.rb +202 -332
  15. data/app/models/kaui/account_email.rb +22 -11
  16. data/app/views/kaui/chargebacks/new.html.erb +3 -1
  17. data/app/views/kaui/refunds/new.html.erb +4 -2
  18. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +2 -4
  19. data/lib/kaui/version.rb +1 -1
  20. data/test/dummy/log/test.log +997 -113084
  21. metadata +2 -67
  22. data/app/controllers/kaui/tags_controller.rb +0 -85
  23. data/app/views/kaui/account_emails/edit.html.erb +0 -6
  24. data/app/views/kaui/tags/_form.html.erb +0 -25
  25. data/app/views/kaui/tags/edit.html.erb +0 -6
  26. data/app/views/kaui/tags/index.html.erb +0 -25
  27. data/app/views/kaui/tags/new.html.erb +0 -5
  28. data/app/views/kaui/tags/show.html.erb +0 -15
  29. data/test/dummy/log/development.log +0 -60886
  30. data/test/dummy/test/fixtures/bill_cycle_days.yml +0 -3
  31. data/test/dummy/tmp/cache/assets/C94/4E0/sprockets%2Fea1476dc10a3348303f74d111f70441a +0 -0
  32. data/test/dummy/tmp/cache/assets/C95/690/sprockets%2Fc4b083702793f7599f4a3069c50f89a8 +0 -0
  33. data/test/dummy/tmp/cache/assets/CAA/680/sprockets%2F3824d037523f650518fb22acab75559d +0 -0
  34. data/test/dummy/tmp/cache/assets/CC2/520/sprockets%2F9637f46d37325381f96d96d94ae0bc50 +0 -0
  35. data/test/dummy/tmp/cache/assets/CD0/9D0/sprockets%2F5c9508c21501c73fbe00473a09b1f5f4 +0 -0
  36. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  37. data/test/dummy/tmp/cache/assets/CDF/1F0/sprockets%2F76ac5628a0c4d1b976cb622ec4493751 +0 -381
  38. data/test/dummy/tmp/cache/assets/CEA/300/sprockets%2Fdf2ad5c9d0990441c2bf59883383d652 +0 -0
  39. data/test/dummy/tmp/cache/assets/CF7/710/sprockets%2F86d43448e1fc383cb6f3d752ef288882 +0 -0
  40. data/test/dummy/tmp/cache/assets/D17/DD0/sprockets%2F665455ecdc7609b23f4ecb366d86055a +0 -9409
  41. data/test/dummy/tmp/cache/assets/D32/200/sprockets%2Ffa467106e01bda5d6246baea72159d64 +0 -0
  42. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  43. data/test/dummy/tmp/cache/assets/D39/5E0/sprockets%2F59fd338be48a81a17a2a785cbd1612b4 +0 -0
  44. data/test/dummy/tmp/cache/assets/D44/170/sprockets%2Fac15571bce3f926a498da7cd09322d97 +0 -0
  45. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  46. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  47. data/test/dummy/tmp/cache/assets/D6C/710/sprockets%2F1765773caead06c0a6a19ea9de2453f7 +0 -0
  48. data/test/dummy/tmp/cache/assets/D76/910/sprockets%2Ff99b4bdc434e11e8634e6af62fe805e0 +0 -0
  49. data/test/dummy/tmp/cache/assets/D9F/160/sprockets%2F510462e1ebd5dbb7ae20888b77f9bed2 +0 -0
  50. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  51. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  52. data/test/dummy/tmp/cache/assets/E07/1E0/sprockets%2F5a3fe6e98fdf72bbe75c605e54ebc5b0 +0 -9409
  53. data/test/dummy/tmp/cache/assets/E20/230/sprockets%2F7d3b1348fdf74cf1b6ba2107fbbac5af +0 -0
  54. data/test/dummy/tmp/cache/assets/E22/F40/sprockets%2Faffacf2e6be325520bd3bfd2096b6dd4 +0 -0
  55. data/test/dummy/tmp/cache/assets/E24/9D0/sprockets%2Fb966ab0a50fda3c156fbad4d8ab73ef6 +0 -381
  56. data/test/functional/kaui/account_emails_controller_test.rb +0 -51
  57. data/test/functional/kaui/tags_controller_test.rb +0 -51
@@ -13,25 +13,36 @@ class Kaui::AccountEmail < Kaui::Base
13
13
  end
14
14
 
15
15
  def self.where(conditions)
16
- account_emails = Kaui::KillbillHelper.get_account_emails(conditions[:account_id]) || []
17
- return account_emails.sort unless conditions[:email].present?
18
-
19
- account_emails.each do |account_email|
20
- return account_email if account_email.email == conditions[:email]
16
+ begin
17
+ account_emails = Kaui::KillbillHelper.get_account_emails(conditions[:account_id]) || []
18
+ return account_emails.sort unless conditions[:email].present?
19
+
20
+ account_emails.each do |account_email|
21
+ return account_email if account_email.email == conditions[:email]
22
+ end
23
+ rescue => e
24
+ @errors.add(:where, "Error while getting account emails: #{e.message} #{e.response}")
21
25
  end
22
26
  []
23
27
  end
24
28
 
25
29
  def save
26
- success = Kaui::KillbillHelper.add_account_email(self)
27
- @errors.add(:save, 'Unable to save the email') unless success
28
- success
30
+ begin
31
+ Kaui::KillbillHelper.add_account_email(self)
32
+ true
33
+ rescue => e
34
+ @errors.add(:save, "Error while trying to add an account email: #{e.message} #{e.response}")
35
+ false
36
+ end
29
37
  end
30
38
 
31
39
  def destroy
32
- success = Kaui::KillbillHelper.remove_account_email(self)
33
- @errors.add(:destroy, 'Unable to destroy the email') unless success
34
- success
40
+ begin
41
+ Kaui::KillbillHelper.remove_account_email(self)
42
+ true
43
+ rescue => e
44
+ @errors.add(:destroy, "Error while trying to delete an account email: #{e.message} #{e.response}")
45
+ end
35
46
  end
36
47
 
37
48
  def id
@@ -43,7 +43,9 @@
43
43
  <label class="control-label">Payment method</label>
44
44
  <div class="controls">
45
45
  <label class="checkbox">
46
- <%= @payment_method.type %> <%= @payment_method.card_type %> <%= @payment_method.mask_number %>
46
+ <% if @payment_method.present? %>
47
+ <%= @payment_method.type %> <%= @payment_method.card_type %> <%= @payment_method.mask_number %>
48
+ <% end %>
47
49
  </label>
48
50
  </div>
49
51
  </div>
@@ -42,7 +42,9 @@
42
42
  <label class="control-label">Payment method</label>
43
43
  <div class="controls">
44
44
  <label class="checkbox">
45
- <%= @payment_method.type %> <%= @payment_method.card_type %> <%= @payment_method.mask_number %>
45
+ <% if @payment_method.present? %>
46
+ <%= @payment_method.type %> <%= @payment_method.card_type %> <%= @payment_method.mask_number %>
47
+ <% end %>
46
48
  </label>
47
49
  </div>
48
50
  </div>
@@ -93,4 +95,4 @@
93
95
  preventNonNumericValues(event);
94
96
  });
95
97
  });
96
- <% end %>
98
+ <% end %>
@@ -6,7 +6,6 @@
6
6
  <tr>
7
7
  <th>Product category</th>
8
8
  <th>Product name</th>
9
- <th>Billing period</th>
10
9
  <th>Start date</th>
11
10
  <th>Charged through date</th>
12
11
  <th>Notes</th>
@@ -18,8 +17,7 @@
18
17
  <% subscriptions.each do |sub| %>
19
18
  <tr>
20
19
  <td><%= sub.product_category.downcase.capitalize if sub.product_category.present? %></td>
21
- <td><%= sub.product_name.downcase.capitalize if sub.product_name.present? %></td>
22
- <td><%= sub.billing_period.downcase.capitalize if sub.billing_period.present? %></td>
20
+ <td><%= sub.product_name.downcase.capitalize if sub.product_name.present? %> <%= sub.billing_period.downcase.capitalize if sub.billing_period.present? %> <% if sub.price_list.present? && sub.price_list.upcase != "DEFAULT" %> ( <%= sub.price_list.downcase.capitalize %> pricelist ) <% end %></td>
23
21
  <td><%= format_date(sub.start_date).html_safe if sub.start_date.present? %></td>
24
22
  <td><%= format_date(sub.charged_through_date).html_safe if sub.charged_through_date.present? %></td>
25
23
  <td>
@@ -31,7 +29,7 @@
31
29
  <nobr>
32
30
  <% if sub.product_category == 'BASE' %>
33
31
  <% if sub.canceled_date.present? && Time.parse(sub.canceled_date) > Time.now %>
34
- <%= link_to "Reinstate", kaui_engine.reinstate_subscription_path(:id => sub.subscription_id), :method => :put, :class => "btn btn-mini" %>
32
+ <%= link_to "Reinstate", kaui_engine.reinstate_subscription_path(:id => sub.subscription_id), :method => :put, :class => "btn btn-mini" %>
35
33
  <% elsif !sub.canceled_date.present? %>
36
34
  <%= link_to "Change", kaui_engine.edit_subscription_path(sub.subscription_id), :class => "btn btn-mini" %>
37
35
  <%= link_to "Cancel", kaui_engine.subscription_path(:id => sub.subscription_id), :method => :delete, :class => "btn btn-mini" %>
data/lib/kaui/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Kaui
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end