kaui 1.0.0 → 1.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.
Files changed (66) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/javascripts/kaui/kaui.js +118 -11
  3. data/app/assets/stylesheets/kaui/common.less +91 -6
  4. data/app/assets/stylesheets/kaui/payment.less +1 -0
  5. data/app/controllers/kaui/account_children_controller.rb +1 -4
  6. data/app/controllers/kaui/accounts_controller.rb +4 -7
  7. data/app/controllers/kaui/admin_allowed_users_controller.rb +24 -7
  8. data/app/controllers/kaui/admin_tenants_controller.rb +59 -20
  9. data/app/controllers/kaui/audit_logs_controller.rb +3 -2
  10. data/app/controllers/kaui/charges_controller.rb +1 -1
  11. data/app/controllers/kaui/credits_controller.rb +1 -1
  12. data/app/controllers/kaui/home_controller.rb +273 -10
  13. data/app/controllers/kaui/invoice_items_controller.rb +1 -1
  14. data/app/controllers/kaui/invoices_controller.rb +3 -3
  15. data/app/controllers/kaui/payments_controller.rb +5 -3
  16. data/app/controllers/kaui/refunds_controller.rb +2 -2
  17. data/app/controllers/kaui/subscriptions_controller.rb +2 -1
  18. data/app/helpers/kaui/object_helper.rb +4 -0
  19. data/app/helpers/kaui/plugin_helper.rb +36 -20
  20. data/app/helpers/kaui/uuid_helper.rb +9 -0
  21. data/app/models/kaui/admin.rb +3 -1
  22. data/app/models/kaui/admin_tenant.rb +58 -10
  23. data/app/models/kaui/allowed_user.rb +1 -0
  24. data/app/models/kaui/catalog.rb +2 -2
  25. data/app/models/kaui/credit.rb +0 -2
  26. data/app/models/kaui/overdue.rb +5 -5
  27. data/app/views/kaui/account_children/index.html.erb +3 -3
  28. data/app/views/kaui/accounts/_account_info.html.erb +45 -91
  29. data/app/views/kaui/accounts/_billing_info.html.erb +12 -8
  30. data/app/views/kaui/accounts/_parent.html.erb +1 -1
  31. data/app/views/kaui/accounts/_payment_methods.html.erb +1 -1
  32. data/app/views/kaui/accounts/_personal_info.html.erb +74 -0
  33. data/app/views/kaui/accounts/index.html.erb +4 -4
  34. data/app/views/kaui/accounts/show.html.erb +9 -3
  35. data/app/views/kaui/admin_allowed_users/_form.html.erb +38 -10
  36. data/app/views/kaui/admin_tenants/_form_plugin_config.erb +82 -17
  37. data/app/views/kaui/admin_tenants/_show_catalog_simple.erb +11 -3
  38. data/app/views/kaui/admin_tenants/_show_overdue.erb +4 -4
  39. data/app/views/kaui/admin_tenants/_tenant_details.html.erb +7 -1
  40. data/app/views/kaui/admin_tenants/new_overdue_config.html.erb +1 -1
  41. data/app/views/kaui/audit_logs/_show_history_modal.html.erb +1 -1
  42. data/app/views/kaui/audit_logs/index.html.erb +4 -0
  43. data/app/views/kaui/home/_advanced_search_modal.html.erb +80 -0
  44. data/app/views/kaui/home/index.html.erb +18 -5
  45. data/app/views/kaui/invoices/show.html.erb +7 -1
  46. data/app/views/kaui/layouts/kaui_flash.html.erb +14 -3
  47. data/app/views/kaui/layouts/kaui_navbar.html.erb +11 -9
  48. data/app/views/kaui/payments/_form.html.erb +8 -10
  49. data/app/views/kaui/payments/_payment_table.html.erb +40 -37
  50. data/app/views/kaui/payments/index.html.erb +1 -0
  51. data/app/views/kaui/payments/show.html.erb +5 -7
  52. data/app/views/kaui/queues/index.html.erb +22 -4
  53. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +1 -1
  54. data/app/views/kaui/tag_definitions/index.html.erb +1 -1
  55. data/config/routes.rb +2 -0
  56. data/lib/kaui/version.rb +1 -1
  57. data/test/functional/kaui/accounts_controller_test.rb +35 -0
  58. data/test/functional/kaui/admin_allowed_users_controller_test.rb +55 -2
  59. data/test/functional/kaui/admin_tenants_controller_test.rb +67 -6
  60. data/test/functional/kaui/home_controller_test.rb +389 -15
  61. data/test/functional/kaui/subscriptions_controller_test.rb +1 -1
  62. data/test/killbill_test_helper.rb +2 -2
  63. data/test/unit/helpers/kaui/uuid_helper_test.rb +16 -0
  64. data/test/unit/kaui/admin_tenant_test.rb +49 -0
  65. metadata +6 -4
  66. data/test/unit/kaui/uuid_helper_test.rb +0 -10
@@ -97,7 +97,7 @@ class Kaui::SubscriptionsControllerTest < Kaui::FunctionalTestHelper
97
97
 
98
98
  post :update, :id => @bundle.subscriptions.first.subscription_id, :plan_name => 'not-exists'
99
99
  assert_redirected_to home_path
100
- assert_equal "Error while communicating with the Kill Bill server: Error 400: Could not find any plans named 'not-exists'", flash[:error]
100
+ assert_equal "Error while communicating with the Kill Bill server: Error 400: Could not find a plan matching spec: (plan: 'not-exists', product: 'undefined', billing period: 'undefined', pricelist 'undefined')", flash[:error]
101
101
  end
102
102
 
103
103
  test 'should update' do
@@ -163,12 +163,12 @@ module Kaui
163
163
  credit = KillBillClient::Model::Credit.new(:invoice_id => invoice_id, :account_id => account.account_id, :credit_amount => 23.22)
164
164
  credit = credit.create(true, user, reason, comment, build_options(tenant, username, password))
165
165
 
166
- invoice = KillBillClient::Model::Invoice.find_by_id_or_number(credit.invoice_id, true, 'NONE', build_options(tenant, username, password))
166
+ invoice = KillBillClient::Model::Invoice.find_by_id(credit.invoice_id, true, 'NONE', build_options(tenant, username, password))
167
167
  invoice.items.find { |ii| ii.amount == -credit.credit_amount }
168
168
  end
169
169
 
170
170
  def commit_invoice(invoice_id, tenant, username = USERNAME, password = PASSWORD, user = 'Kaui test', reason = nil, comment = nil)
171
- invoice = KillBillClient::Model::Invoice.find_by_id_or_number(invoice_id, false, 'NONE', build_options(tenant, username, password))
171
+ invoice = KillBillClient::Model::Invoice.find_by_id(invoice_id, false, 'NONE', build_options(tenant, username, password))
172
172
  invoice.commit(user, reason, comment, build_options(tenant, username, password))
173
173
  end
174
174
 
@@ -0,0 +1,16 @@
1
+ require 'test_helper'
2
+
3
+ class Kaui::UuidHelperTest < ActionView::TestCase
4
+
5
+ #include Kaui::UuidHelper
6
+
7
+ test 'can truncate' do
8
+ assert_equal '04bdf7b6-...-ab062d33c425', truncate_uuid('04bdf7b6-a95d-4a08-9990-ab062d33c425')
9
+ end
10
+
11
+ test 'can create a popover' do
12
+ object_id = SecureRandom.uuid
13
+ expected_markup = %{<span id="#{object_id}-popover" class="object-id-popover" data-id="#{object_id}" data-placement="right">#{truncate_uuid(object_id)}</span}
14
+ assert_dom_equal expected_markup, object_id_popover(object_id)
15
+ end
16
+ end
@@ -2,6 +2,8 @@ require 'test_helper'
2
2
 
3
3
  class Kaui::AdminTenantTest < ActiveSupport::TestCase
4
4
 
5
+ include Kaui::KillbillTestHelper
6
+
5
7
  PLUGIN_REPO = '[{"plugin_key":"analytics","plugin_name":"killbill-analytics","plugin_type":"java","installed":true},{"plugin_key":"kpm","plugin_name":"killbill-kpm","plugin_type":"ruby","installed":true},{"plugin_key":"paypal-express","plugin_name":"killbill-paypal-express","plugin_type":"ruby","installed":true},
6
8
  {"plugin_key":"killbill-email-notifications","plugin_name":"killbill-email-notifications","plugin_type":null,"installed":true},{"plugin_key":"accertify","plugin_name":"killbill-accertify","plugin_type":"java","installed":false},{"plugin_key":"adyen","plugin_name":"killbill-adyen","plugin_type":"java","installed":false},
7
9
  {"plugin_key":"avatax","plugin_name":"killbill-avatax","plugin_type":"java","installed":false},{"plugin_key":"braintree_blue","plugin_name":"killbill-braintree_blue","plugin_type":"ruby","installed":false},{"plugin_key":"currency","plugin_name":"killbill-currency","plugin_type":"ruby","installed":false},
@@ -72,6 +74,53 @@ class Kaui::AdminTenantTest < ActiveSupport::TestCase
72
74
 
73
75
  end
74
76
 
77
+ test 'should fetch proprietary plugin config' do
78
+ tenant = create_tenant()
79
+ assert_not_nil(tenant)
80
+
81
+ options = build_options(tenant)
82
+ # upload plugin configuration
83
+ plugin_name = 'duck-plugin'
84
+ plugin_config = 'key=value'
85
+ Kaui::AdminTenant.upload_tenant_plugin_config(plugin_name, plugin_config, options[:username], nil, nil, options)
86
+
87
+
88
+ plugins_config = Kaui::AdminTenant.get_tenant_plugin_config({}, options)
89
+ assert_not_nil(plugins_config)
90
+
91
+ plugin_info = plugins_config.split('::')
92
+ assert_equal plugin_name, plugin_info[0]
93
+ assert_equal plugin_config, plugin_info[1].gsub('raw_config=','')
94
+ end
95
+
96
+ test 'should fetch plugin config' do
97
+ tenant = create_tenant()
98
+ assert_not_nil(tenant)
99
+
100
+ options = build_options(tenant)
101
+ # upload plugin configuration
102
+ plugin_key = 'paypal_express'
103
+ plugin_name = 'killbill-paypal-express'
104
+ plugin_properties = { 'signature': 'AUmv9J3knY3wGGZoAYL5LM.8OzizApMN7rxHvpXbjb13reJ2CtexMApg',
105
+ 'login': 'joel-batista-facilitator_api1.live.com',
106
+ 'password': 'Z93EWSRUYYHYXT3L'
107
+ }
108
+
109
+ plugin_config = Kaui::AdminTenant.format_plugin_config(plugin_key, 'ruby', plugin_properties)
110
+ Kaui::AdminTenant.upload_tenant_plugin_config(plugin_name, plugin_config, options[:username], nil, nil, options)
111
+
112
+
113
+ plugins_config = Kaui::AdminTenant.get_tenant_plugin_config({ :paypal_express => { 'type' => 'ruby',
114
+ 'artifact_id' => 'paypal-express-plugin'} }, options)
115
+ assert_not_nil(plugins_config)
116
+ plugin_info = plugins_config.split('::')
117
+ assert_equal plugin_key, plugin_info[0]
118
+ response_plugin_properties = plugin_info[1].split('|')
119
+ assert_equal plugin_properties[:signature], response_plugin_properties[0].split('=')[1]
120
+ assert_equal plugin_properties[:login], response_plugin_properties[1].split('=')[1]
121
+ assert_equal plugin_properties[:password], response_plugin_properties[2].split('=')[1]
122
+ end
123
+
75
124
  private
76
125
 
77
126
  def plugins_repo
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: 1.0.0
4
+ version: 1.1.0
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: 2018-05-18 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -634,6 +634,7 @@ files:
634
634
  - app/views/kaui/accounts/_link_parent_modal.html.erb
635
635
  - app/views/kaui/accounts/_parent.html.erb
636
636
  - app/views/kaui/accounts/_payment_methods.html.erb
637
+ - app/views/kaui/accounts/_personal_info.html.erb
637
638
  - app/views/kaui/accounts/edit.html.erb
638
639
  - app/views/kaui/accounts/index.html.erb
639
640
  - app/views/kaui/accounts/new.html.erb
@@ -682,6 +683,7 @@ files:
682
683
  - app/views/kaui/custom_fields/_list_bar.html.erb
683
684
  - app/views/kaui/custom_fields/index.html.erb
684
685
  - app/views/kaui/custom_fields/new.html.erb
686
+ - app/views/kaui/home/_advanced_search_modal.html.erb
685
687
  - app/views/kaui/home/index.html.erb
686
688
  - app/views/kaui/invoice_items/_edit_form.html.erb
687
689
  - app/views/kaui/invoice_items/edit.html.erb
@@ -843,6 +845,7 @@ files:
843
845
  - test/unit/helpers/kaui/admin_allowed_users_helper_test.rb
844
846
  - test/unit/helpers/kaui/admin_tenants_helper_test.rb
845
847
  - test/unit/helpers/kaui/tenants_helper_test.rb
848
+ - test/unit/helpers/kaui/uuid_helper_test.rb
846
849
  - test/unit/kaui/account_email_test.rb
847
850
  - test/unit/kaui/account_test.rb
848
851
  - test/unit/kaui/admin_tenant_test.rb
@@ -856,7 +859,6 @@ files:
856
859
  - test/unit/kaui/payment_test.rb
857
860
  - test/unit/kaui/tag_definition_test.rb
858
861
  - test/unit/kaui/tenant_test.rb
859
- - test/unit/kaui/uuid_helper_test.rb
860
862
  homepage: http://www.killbill.io
861
863
  licenses:
862
864
  - Apache License (2.0)
@@ -902,10 +904,10 @@ test_files:
902
904
  - test/unit/kaui/date_helper_test.rb
903
905
  - test/unit/kaui/tenant_test.rb
904
906
  - test/unit/kaui/money_helper_test.rb
905
- - test/unit/kaui/uuid_helper_test.rb
906
907
  - test/unit/helpers/kaui/tenants_helper_test.rb
907
908
  - test/unit/helpers/kaui/admin_tenants_helper_test.rb
908
909
  - test/unit/helpers/kaui/admin_allowed_users_helper_test.rb
910
+ - test/unit/helpers/kaui/uuid_helper_test.rb
909
911
  - test/test_helper.rb
910
912
  - test/integration/kaui/integration_test_helper.rb
911
913
  - test/integration/kaui/navigation_test.rb
@@ -1,10 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Kaui::UuidHelperTest < ActiveSupport::TestCase
4
-
5
- include Kaui::UuidHelper
6
-
7
- test 'can truncate' do
8
- assert_equal '04bdf7b6-...-ab062d33c425', truncate_uuid('04bdf7b6-a95d-4a08-9990-ab062d33c425')
9
- end
10
- end