kaui 0.1.0 → 0.1.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (122) hide show
  1. data/README.rdoc +27 -1
  2. data/app/controllers/kaui/account_tags_controller.rb +24 -9
  3. data/app/controllers/kaui/account_timelines_controller.rb +1 -1
  4. data/app/controllers/kaui/accounts_controller.rb +7 -5
  5. data/app/controllers/kaui/bundles_controller.rb +2 -2
  6. data/app/controllers/kaui/chargebacks_controller.rb +3 -2
  7. data/app/controllers/kaui/charges_controller.rb +32 -0
  8. data/app/controllers/kaui/credits_controller.rb +3 -4
  9. data/app/controllers/kaui/external_payments_controller.rb +0 -2
  10. data/app/controllers/kaui/invoice_items_controller.rb +44 -0
  11. data/app/controllers/kaui/invoices_controller.rb +4 -3
  12. data/app/controllers/kaui/payments_controller.rb +10 -13
  13. data/app/controllers/kaui/refunds_controller.rb +19 -8
  14. data/app/controllers/kaui/subscriptions_controller.rb +5 -1
  15. data/app/controllers/kaui/tag_definitions_controller.rb +85 -0
  16. data/app/helpers/kaui/date_helper.rb +1 -1
  17. data/app/helpers/kaui/killbill_helper.rb +160 -59
  18. data/app/models/kaui/account.rb +7 -1
  19. data/app/models/kaui/account_timeline.rb +0 -4
  20. data/app/models/kaui/audit_log.rb +9 -7
  21. data/app/models/kaui/base.rb +80 -1
  22. data/app/models/kaui/charge.rb +14 -0
  23. data/app/models/kaui/chargeback.rb +2 -10
  24. data/app/models/kaui/event.rb +2 -13
  25. data/app/models/kaui/invoice.rb +6 -7
  26. data/app/models/kaui/invoice_item.rb +9 -17
  27. data/app/models/kaui/payment.rb +6 -21
  28. data/app/models/kaui/payment_method.rb +1 -8
  29. data/app/models/kaui/plugin_info.rb +1 -5
  30. data/app/models/kaui/plugin_info_property.rb +0 -6
  31. data/app/models/kaui/refund.rb +5 -13
  32. data/app/models/kaui/tag.rb +10 -3
  33. data/app/models/kaui/tag_definition.rb +46 -0
  34. data/app/views/kaui/account_tags/edit.html.erb +17 -17
  35. data/app/views/kaui/account_timelines/show.html.erb +61 -39
  36. data/app/views/kaui/accounts/index.html.erb +1 -1
  37. data/app/views/kaui/accounts/show.html.erb +16 -2
  38. data/app/views/kaui/bundles/show.html.erb +2 -1
  39. data/app/views/kaui/chargebacks/new.html.erb +18 -2
  40. data/app/views/kaui/charges/new.html.erb +87 -0
  41. data/app/views/kaui/credits/new.html.erb +1 -1
  42. data/app/views/kaui/invoice_items/edit.html.erb +92 -0
  43. data/app/views/kaui/invoice_items/index.html.erb +20 -0
  44. data/app/views/kaui/invoice_items/show.html.erb +31 -0
  45. data/app/views/kaui/invoices/index.html.erb +1 -1
  46. data/app/views/kaui/invoices/show.html.erb +42 -24
  47. data/app/views/kaui/payments/_payments_table.html.erb +7 -5
  48. data/app/views/kaui/payments/new.html.erb +32 -12
  49. data/app/views/kaui/refunds/index.html.erb +3 -3
  50. data/app/views/kaui/refunds/new.html.erb +3 -3
  51. data/app/views/kaui/refunds/show.html.erb +27 -13
  52. data/app/views/kaui/subscriptions/edit.html.erb +8 -0
  53. data/app/views/kaui/tag_definitions/_form.html.erb +45 -0
  54. data/app/views/kaui/tag_definitions/edit.html.erb +3 -0
  55. data/app/views/kaui/tag_definitions/index.html.erb +34 -0
  56. data/app/views/kaui/tag_definitions/new.html.erb +3 -0
  57. data/app/views/kaui/tag_definitions/show.html.erb +12 -0
  58. data/app/views/kaui/tags/_tags_table.html.erb +3 -3
  59. data/config/locales/en.yml +3 -0
  60. data/config/locales/fr.yml +3 -0
  61. data/config/routes.rb +11 -1
  62. data/lib/kaui/version.rb +1 -1
  63. data/test/dummy/app/controllers/application_controller.rb +10 -0
  64. data/test/dummy/app/views/layouts/application.html.erb +44 -11
  65. data/test/dummy/config/application.rb +1 -0
  66. data/test/dummy/config/database.yml +5 -4
  67. data/test/dummy/config/environments/development.rb +2 -0
  68. data/test/dummy/config/routes.rb +1 -2
  69. data/test/dummy/log/development.log +2419 -0
  70. data/test/dummy/log/test.log +3265 -131
  71. data/test/dummy/test/fixtures/accounts.yml +32 -0
  72. data/test/dummy/test/fixtures/bundles.yml +4 -0
  73. data/test/dummy/test/fixtures/invoice_items.yml +13 -0
  74. data/test/dummy/test/fixtures/invoices.yml +11 -0
  75. data/test/dummy/test/fixtures/payment_methods.yml +5 -0
  76. data/test/dummy/test/fixtures/plugin_info_properties.yml +59 -0
  77. data/test/dummy/test/fixtures/plugin_infos.yml +2 -0
  78. data/test/dummy/test/fixtures/refunds.yml +8 -0
  79. data/test/dummy/test/fixtures/tag_definitions.yml +9 -0
  80. data/test/dummy/tmp/cache/assets/C8D/6D0/sprockets%2F0ce756f49d61795508c543a702955fc2 +0 -0
  81. data/test/dummy/tmp/cache/assets/C94/4E0/sprockets%2Fea1476dc10a3348303f74d111f70441a +0 -0
  82. data/test/dummy/tmp/cache/assets/CD0/9D0/sprockets%2F5c9508c21501c73fbe00473a09b1f5f4 +0 -0
  83. data/test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  84. data/test/dummy/tmp/cache/assets/CEA/300/sprockets%2Fdf2ad5c9d0990441c2bf59883383d652 +0 -0
  85. data/test/dummy/tmp/cache/assets/D0E/370/sprockets%2F27630db2080819f67c8a0ed5e491b7cb +0 -0
  86. data/test/dummy/tmp/cache/assets/D32/200/sprockets%2Ffa467106e01bda5d6246baea72159d64 +0 -0
  87. data/test/dummy/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  88. data/test/dummy/tmp/cache/assets/D39/5E0/sprockets%2F59fd338be48a81a17a2a785cbd1612b4 +0 -0
  89. data/test/dummy/tmp/cache/assets/D44/170/sprockets%2Fac15571bce3f926a498da7cd09322d97 +0 -0
  90. data/test/dummy/tmp/cache/assets/D4A/DD0/sprockets%2F0f813582283b7f56fd83fe3d52be7e2c +0 -0
  91. data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  92. data/test/dummy/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  93. data/test/dummy/tmp/cache/assets/D6C/710/sprockets%2F1765773caead06c0a6a19ea9de2453f7 +0 -0
  94. data/test/dummy/tmp/cache/assets/D76/910/sprockets%2Ff99b4bdc434e11e8634e6af62fe805e0 +0 -0
  95. data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  96. data/test/dummy/tmp/cache/assets/DF1/1A0/sprockets%2F7f6b7bfea83401d3106b7fadac81ea4b +0 -0
  97. data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  98. data/test/dummy/tmp/cache/assets/E20/230/sprockets%2F7d3b1348fdf74cf1b6ba2107fbbac5af +0 -0
  99. data/test/dummy/vendor/assets/images/img/glyphicons-halflings-white.png +0 -0
  100. data/test/dummy/vendor/assets/images/img/glyphicons-halflings.png +0 -0
  101. data/test/dummy/vendor/assets/javascripts/bootstrap.v2.0.4.min.js +6 -0
  102. data/test/dummy/vendor/assets/javascripts/jquery.dataTables.v1.9.3.min.js +156 -0
  103. data/test/dummy/vendor/assets/stylesheets/bootstrap.v2.0.4.min.css +9 -0
  104. data/test/functional/kaui/accounts_controller_test.rb +63 -0
  105. data/test/functional/kaui/bundles_controller_test.rb +18 -6
  106. data/test/functional/kaui/invoice_items_controller_test.rb +18 -0
  107. data/test/functional/kaui/invoices_controller_test.rb +18 -6
  108. data/test/functional/kaui/tag_definitions_controller_test.rb +60 -0
  109. data/test/test_helper.rb +143 -0
  110. data/test/unit/helpers/kaui/plugin_infos_helper_test.rb +20 -0
  111. data/test/unit/kaui/account_test.rb +42 -0
  112. data/test/unit/kaui/base_test.rb +39 -0
  113. data/test/unit/kaui/date_helper_test.rb +13 -0
  114. data/test/unit/kaui/invoice_item_test.rb +23 -0
  115. data/test/unit/kaui/invoice_test.rb +20 -0
  116. data/test/unit/kaui/payment_method_test.rb +26 -0
  117. data/test/unit/kaui/plugin_info_property_test.rb +20 -0
  118. data/test/unit/kaui/plugin_info_test.rb +19 -0
  119. data/test/unit/kaui/refund_test.rb +19 -0
  120. data/test/unit/kaui/tag_definition_test.rb +23 -0
  121. data/test/unit/model_test.rb +23 -23
  122. metadata +330 -226
@@ -0,0 +1,14 @@
1
+ class Kaui::Charge < Kaui::Base
2
+
3
+ define_attr :account_id
4
+ define_attr :invoice_id
5
+ define_attr :amount
6
+ define_attr :description
7
+
8
+ def initialize(data = {})
9
+ super(:account_id => data['accountId'] || data['account_id'],
10
+ :invoice_id => data['invoiceId'] || data['invoice_id'],
11
+ :amount => data['amount'],
12
+ :description => data['description'])
13
+ end
14
+ end
@@ -24,18 +24,10 @@ class Kaui::Chargeback < Kaui::Base
24
24
 
25
25
  define_attr :payment_id
26
26
  define_attr :chargeback_amount
27
- define_attr :requested_dt
28
- define_attr :effective_dt
27
+ define_attr :requested_date
28
+ define_attr :effective_date
29
29
  define_attr :reason
30
30
 
31
31
  has_many :audit_logs, Kaui::AuditLog
32
32
 
33
- def initialize(data = {})
34
- super(:payment_id => data['paymentId'] || data['payment_id'],
35
- :chargeback_amount => data['chargebackAmount'] || data['chargeback_amount'],
36
- :requested_dt => data['requestedDate'] || data['requested_date'] || data['requested_dt'],
37
- :effective_dt => data['effectiveDate'] || data['effective_date'] || data['effective_dt'],
38
- :reason => data['reason'],
39
- :audit_logs => data['auditLogs'])
40
- end
41
33
  end
@@ -1,24 +1,13 @@
1
1
  class Kaui::Event < Kaui::Base
2
2
  define_attr :event_id
3
3
  define_attr :billing_period
4
- define_attr :effective_dt
4
+ define_attr :effective_date
5
5
  define_attr :event_type
6
6
  define_attr :phase
7
7
  define_attr :price_list
8
8
  define_attr :product
9
- define_attr :requested_dt
9
+ define_attr :requested_date
10
10
 
11
11
  has_many :audit_logs, Kaui::AuditLog
12
12
 
13
- def initialize(data = {})
14
- super(:event_id => data['eventId'],
15
- :billing_period => data['billingPeriod'],
16
- :effective_dt => data['effectiveDate'],
17
- :event_type => data['eventType'],
18
- :phase => data['phase'],
19
- :price_list => data['priceList'],
20
- :product => data['product'],
21
- :requested_dt => data['requestedDate'],
22
- :audit_logs => data['auditLogs'])
23
- end
24
13
  end
@@ -10,27 +10,26 @@ class Kaui::Invoice < Kaui::Base
10
10
  define_attr :refund_adjustment
11
11
  define_attr :credit_balance_adjustment
12
12
  define_attr :credit_adjustment
13
- define_attr :invoice_dt
13
+ define_attr :invoice_date
14
14
  define_attr :payment_dt
15
- define_attr :target_dt
15
+ define_attr :target_date
16
16
  define_attr :bundle_keys
17
17
 
18
18
  has_many :items, Kaui::InvoiceItem
19
19
  has_many :audit_logs, Kaui::AuditLog
20
20
 
21
21
  def initialize(data = {})
22
- super(
23
- :account_id => data['accountId'],
22
+ super(:account_id => data['accountId'],
24
23
  :amount => data['amount'],
25
24
  :balance => data['balance'],
26
25
  :credit_balance_adjustment => data['cba'],
27
26
  :credit_adjustment => data['creditAdj'],
28
- :invoice_dt => data['invoiceDate'],
27
+ :invoice_date => data['invoiceDate'],
29
28
  :invoice_id => data['invoiceId'],
30
29
  :invoice_number => data['invoiceNumber'],
31
30
  :refund_adjustment => data['refundAdj'],
32
- :target_dt => data['targetDate'],
33
- :items => data['items'],
31
+ :target_date => data['targetDate'],
32
+ :items => data['items'] || [],
34
33
  :bundle_keys => data['bundleKeys'],
35
34
  :audit_logs => data['auditLogs'])
36
35
  end
@@ -1,6 +1,11 @@
1
1
  require 'active_model'
2
2
 
3
3
  class Kaui::InvoiceItem < Kaui::Base
4
+ SAMPLE_REASON_CODES = [ "100 - Courtesy",
5
+ "101 - Billing Error",
6
+ "199 - OTHER" ]
7
+
8
+ define_attr :invoice_item_id
4
9
  define_attr :invoice_id
5
10
  define_attr :account_id
6
11
  define_attr :bundle_id
@@ -10,21 +15,8 @@ class Kaui::InvoiceItem < Kaui::Base
10
15
  define_attr :description
11
16
  define_attr :start_date
12
17
  define_attr :end_date
13
- define_attr :amount;
14
- define_attr :currency;
15
-
16
- def initialize(data = {})
17
- super(
18
- :account_id => data['accountId'],
19
- :amount => data['amount'],
20
- :bundle_id => data['bundleId'],
21
- :currency => data['currency'],
22
- :description => data['description'],
23
- :end_date => data['endDate'],
24
- :invoice_id => data['invoiceId'],
25
- :phase_name => data['phaseName'],
26
- :plan_name => data['planName'],
27
- :start_date => data['startDate'],
28
- :subscription_id => data['subscriptionId'])
29
- end
18
+ define_attr :amount
19
+ define_attr :currency
20
+ define_attr :linked_invoice_item_id
21
+ define_attr :audit_logs
30
22
  end
@@ -9,36 +9,21 @@ class Kaui::Payment < Kaui::Base
9
9
  define_attr :amount
10
10
  define_attr :currency
11
11
  define_attr :invoice_id
12
- define_attr :effective_dt
12
+ define_attr :effective_date
13
13
  define_attr :paid_amount
14
14
  define_attr :payment_id
15
15
  define_attr :payment_method_id
16
16
  define_attr :refund_amount
17
- define_attr :requested_dt
17
+ define_attr :requested_date
18
18
  define_attr :retry_count
19
19
  define_attr :status
20
20
  define_attr :bundle_keys
21
+ define_attr :ext_first_payment_id_ref
22
+ define_attr :ext_second_payment_id_ref
23
+ define_attr :gateway_error_code
24
+ define_attr :gateway_error_msg
21
25
 
22
26
  has_many :refunds, Kaui::Refund
23
27
  has_many :chargebacks, Kaui::Chargeback
24
28
  has_many :audit_logs, Kaui::AuditLog
25
-
26
- def initialize(data = {})
27
- super(:account_id => data['accountId'] || data['account_id'],
28
- :amount => data['amount'],
29
- :currency => data['currency'],
30
- :effective_dt => data['effectiveDate'] || data['effective_dt'],
31
- :invoice_id => data['invoiceId'] || data['invoice_id'],
32
- :paid_amount => data['paidAmount'] || data['paid_amount'],
33
- :payment_id => data['paymentId'] || data['payment_id'],
34
- :payment_method_id => data['paymentMethodId'] || data['payment_method_id'],
35
- :refund_amount => data['refundAmount'] || data['refund_amount'],
36
- :requested_dt => data['requestedDate'] || data['requested_dt'],
37
- :retry_count => data['retryCount'] || data['retry_count'],
38
- :status => data['status'],
39
- :bundle_keys => data['bundleKeys'] || data['bundle_keys'],
40
- :refunds => data['refunds'],
41
- :chargebacks => data['chargebacks'],
42
- :audit_logs => data['auditLogs'])
43
- end
44
29
  end
@@ -5,15 +5,8 @@ class Kaui::PaymentMethod < Kaui::Base
5
5
  define_attr :is_default
6
6
  define_attr :payment_method_id
7
7
  define_attr :plugin_name
8
- has_one :plugin_info, Kaui::PluginInfo
9
8
 
10
- def initialize(data = {})
11
- super(:account_id => data['accountId'],
12
- :is_default => data['isDefault'],
13
- :payment_method_id => data['paymentMethodId'],
14
- :plugin_name => data['pluginName'],
15
- :plugin_info => data['pluginInfo'])
16
- end
9
+ has_one :plugin_info, Kaui::PluginInfo
17
10
 
18
11
  def card_type
19
12
  plugin_info.property("cardType") if plugin_info.present?
@@ -2,12 +2,8 @@ require 'active_model'
2
2
 
3
3
  class Kaui::PluginInfo < Kaui::Base
4
4
  define_attr :external_payment_id
5
- has_many :properties, Kaui::PluginInfoProperty
6
5
 
7
- def initialize(data = {})
8
- super(:external_payment_id => data['externalPaymentId'],
9
- :properties => data['properties'])
10
- end
6
+ has_many :properties, Kaui::PluginInfoProperty
11
7
 
12
8
  def property(key)
13
9
  prop = properties.find { |prop| prop.key == key } unless properties.nil?
@@ -4,10 +4,4 @@ class Kaui::PluginInfoProperty < Kaui::Base
4
4
  define_attr :key
5
5
  define_attr :value
6
6
  define_attr :is_updatable
7
-
8
- def initialize(data = {})
9
- super(:key => data['key'],
10
- :value => data['value'],
11
- :is_updatable => data['isUpdatable'])
12
- end
13
7
  end
@@ -9,19 +9,11 @@ class Kaui::Refund < Kaui::Base
9
9
  define_attr :refund_id
10
10
  define_attr :payment_id
11
11
  define_attr :adjusted
12
- define_attr :refund_amount
13
- define_attr :requested_dt
14
- define_attr :effective_dt
12
+ define_attr :amount
13
+ define_attr :currency
14
+ define_attr :requested_date
15
+ define_attr :effective_date
16
+ define_attr :adjustments
15
17
 
16
18
  has_many :audit_logs, Kaui::AuditLog
17
-
18
- def initialize(data = {})
19
- super(:refund_id => data['refundId'] || data['refund_id'],
20
- :payment_id => data['paymentId'] || data['payment_id'],
21
- :adjusted => data['adjusted'],
22
- :refund_amount => data['refundAmount'] || data['refund_amount'],
23
- :requested_dt => data['requestedDate'] || data['requested_date'] || data['requested_dt'],
24
- :effective_dt => data['effectiveDate'] || data['effective_date'] || data['effective_dt'],
25
- :audit_logs => data['auditLogs'])
26
- end
27
19
  end
@@ -1,7 +1,14 @@
1
1
  class Kaui::Tag < Kaui::Base
2
2
 
3
- define_attr :account_id
4
- define_attr :name
5
- define_attr :description
3
+ define_attr :tag_definition_id
4
+ define_attr :tag_definition_name
5
+ define_attr :audit_logs
6
6
 
7
+ def is_system_tag?
8
+ Kaui::TagDefinition(:id => tag_definition_id).is_system_tag?
9
+ end
10
+
11
+ def <=>(tag)
12
+ @tag_definition_name <=> tag.tag_definition_name
13
+ end
7
14
  end
@@ -0,0 +1,46 @@
1
+ class Kaui::TagDefinition < Kaui::Base
2
+
3
+ define_attr :id
4
+ define_attr :name
5
+ define_attr :description
6
+
7
+ def self.all
8
+ Kaui::KillbillHelper.get_tag_definitions
9
+ end
10
+
11
+ def self.find(tag_definition_id)
12
+ Kaui::KillbillHelper.get_tag_definition(tag_definition_id)
13
+ end
14
+
15
+ def save
16
+ Kaui::KillbillHelper.create_tag_definition(self)
17
+ # TODO - we should return the newly created id and update the model
18
+ # @persisted = true
19
+ end
20
+
21
+ def destroy
22
+ Kaui::KillbillHelper.delete_tag_definition(@id)
23
+ @persisted = false
24
+ end
25
+
26
+ def is_system_tag?
27
+ return false unless id.present?
28
+ last_group = id.split('-')[4]
29
+
30
+ is_system_tag = true
31
+ last_group.split(//).each_with_index do |c, i|
32
+ unless (c == '0' and i < 11) or (c.to_i > 0 and i == 11)
33
+ is_system_tag = false
34
+ break
35
+ end
36
+ end
37
+ is_system_tag
38
+ end
39
+
40
+ def <=>(tag_definition)
41
+ # System tags last
42
+ return 1 if is_system_tag? and !tag_definition.is_system_tag?
43
+ return -1 if !is_system_tag? and tag_definition.is_system_tag?
44
+ @name <=> tag_definition.name
45
+ end
46
+ end
@@ -1,38 +1,38 @@
1
- <div class="page-header">
1
+ <div class='page-header'>
2
2
  <h1>Add/Remove Tags</h1>
3
3
  </div>
4
- <%= form_tag update_account_tags_path, :class => "form-horizontal" do %>
5
- <%= hidden_field_tag :account_id, @account.account_id %>
4
+ <%= form_tag update_account_tags_path, :class => 'form-horizontal' do %>
5
+ <%= hidden_field_tag :account_id, @account.account_id %>
6
6
  <fieldset>
7
- <div class="control-group">
8
- <label class="control-label">Account name</label>
9
- <div class="controls">
10
- <label class="checkbox">
11
- <%= @account.name %><br/>
7
+ <div class='control-group'>
8
+ <label class='control-label'>Account name</label>
9
+ <div class='controls'>
10
+ <label class='checkbox'>
11
+ <%= link_to @account.name, @account %><br/>
12
12
  <%= @account.email %>
13
13
  </label>
14
14
  </div>
15
15
  </div>
16
- <div class="control-group">
17
- <%= label_tag :name, "Tag", :class => "control-label" %>
18
- <div class="controls">
16
+ <div class='control-group'>
17
+ <%= label_tag :name, 'Tag', :class => 'control-label' %>
18
+ <div class='controls'>
19
19
  <% @available_tags.each do |tag| %>
20
- <label class="checkbox">
21
- <%= check_box_tag "tags[]", tag.name, @tags.include?(tag.name) %>
22
- <span href="#" class="tag-description" rel="tooltip" title="<%= tag.description %>"><%= tag.name %></span>
20
+ <label class='checkbox'>
21
+ <%= check_box_tag "tag_#{tag.id}", tag.name, @tag_names.include?(tag.name) %>
22
+ <span href='#' class='tag-description' rel='tooltip' title='<%= tag.description %>'><%= tag.name %></span>
23
23
  </label>
24
24
  <% end %>
25
25
  </div>
26
26
  </div>
27
27
 
28
- <div class="form-actions">
29
- <%= button_tag "Update", :class =>"btn btn-primary" %>
28
+ <div class='form-actions'>
29
+ <%= button_tag 'Update', :class =>'btn btn-primary' %>
30
30
  <%= link_to 'Back', :back, :class => 'btn' %>
31
31
  </div>
32
32
  </fieldset>
33
33
  <% end %>
34
34
  <%= javascript_tag do %>
35
35
  $(function() {
36
- $(".tag-description").tooltip();
36
+ $('.tag-description').tooltip();
37
37
  });
38
38
  <% end %>
@@ -40,16 +40,16 @@
40
40
  <% end %>
41
41
  <tr title="<%= bundles %>">
42
42
  <td>
43
- <% if invoice.invoice_dt.present? %>
44
- <span class="hide" title="<%= invoice.invoice_dt %>"></span>
45
- <%= invoice.invoice_dt %>
43
+ <% if invoice.invoice_date.present? %>
44
+ <span class="hide" title="<%= invoice.invoice_date %>"></span>
45
+ <%= invoice.invoice_date %>
46
46
  <% else %>
47
47
  [unknown]
48
48
  <% end %>
49
49
  <td>
50
- <% if invoice.target_dt.present? %>
51
- <span class="hide" title="<%= invoice.target_dt %>"></span>
52
- <%= invoice.target_dt %>
50
+ <% if invoice.target_date.present? %>
51
+ <span class="hide" title="<%= invoice.target_date %>"></span>
52
+ <%= invoice.target_date %>
53
53
  <% else %>
54
54
  [unknown]
55
55
  <% end %>
@@ -93,11 +93,25 @@
93
93
  </nobr>
94
94
  <nobr>
95
95
  <%= link_to "External Payment",
96
- kaui_engine.new_external_payment_path(:params => { :account_id => invoice.account_id,
97
- :invoice_id => invoice.invoice_id }),
96
+ kaui_engine.new_payment_path(:params => { :account_id => invoice.account_id,
97
+ :invoice_id => invoice.invoice_id,
98
+ :external => "true" }),
98
99
  :class => "btn btn-mini" %>
99
100
  </nobr>
100
- <% end %>
101
+ <nobr>
102
+ <%= link_to "Payment",
103
+ kaui_engine.new_payment_path(:params => { :account_id => invoice.account_id,
104
+ :invoice_id => invoice.invoice_id,
105
+ :external => "false" }),
106
+ :class => "btn btn-mini" %>
107
+ </nobr>
108
+ <% end %>
109
+ <nobr>
110
+ <%= link_to "Charge",
111
+ kaui_engine.new_charge_path(:params => { :account_id => invoice.account_id,
112
+ :invoice_id => invoice.invoice_id }),
113
+ :class => "btn btn-mini" %>
114
+ </nobr>
101
115
  </td>
102
116
  </tr>
103
117
  <% end %>
@@ -106,17 +120,17 @@
106
120
  <% bundles = payment.bundle_keys.split(",").map {|bundle_key| @bundle_names[bundle_key] }.join(",") %>
107
121
  <tr title="<%= bundles %>">
108
122
  <td>
109
- <% if refund.requested_dt.present? %>
110
- <span class="hide" title="<%= refund.requested_dt %>"></span>
111
- <%= format_date(refund.requested_dt).html_safe %>
123
+ <% if refund.requested_date.present? %>
124
+ <span class="hide" title="<%= refund.requested_date %>"></span>
125
+ <%= format_date(refund.requested_date).html_safe %>
112
126
  <% else %>
113
127
  [unknown]
114
128
  <% end %>
115
129
  </td>
116
130
  <td>
117
- <% if refund.requested_dt.present? %>
118
- <span class="hide" title="<%= refund.requested_dt %>"></span>
119
- <%= format_date(refund.requested_dt).html_safe %>
131
+ <% if refund.effective_date.present? %>
132
+ <span class="hide" title="<%= refund.effective_date %>"></span>
133
+ <%= format_date(refund.effective_date).html_safe %>
120
134
  <% else %>
121
135
  [unknown]
122
136
  <% end %>
@@ -130,7 +144,7 @@
130
144
  <td>
131
145
  <%= "Adjusted:" %> <% if refund.adjusted %>yes<% else %>no<% end %><br/>
132
146
  <%= "Payment id:" %> <%= refund.payment_id %><br/>
133
- <%= "Refund Amount:" %> <%= refund.refund_amount %><br/>
147
+ <%= "Refund Amount:" %> <%= refund.amount %><br/>
134
148
  </td>
135
149
  <td>
136
150
  <% if refund.audit_logs.present? %>
@@ -146,17 +160,17 @@
146
160
  <% bundles = payment.bundle_keys.split(",").map {|bundle_key| @bundle_names[bundle_key] }.join(",") %>
147
161
  <tr title="<%= bundles %>">
148
162
  <td>
149
- <% if chargeback.effective_dt.present? %>
150
- <span class="hide" title="<%= chargeback.effective_dt %>"></span>
151
- <%= format_date(chargeback.effective_dt).html_safe %>
163
+ <% if chargeback.effective_date.present? %>
164
+ <span class="hide" title="<%= chargeback.effective_date %>"></span>
165
+ <%= format_date(chargeback.effective_date).html_safe %>
152
166
  <% else %>
153
167
  [unknown]
154
168
  <% end %>
155
169
  </td>
156
170
  <td>
157
- <% if chargeback.effective_dt.present? %>
158
- <span class="hide" title="<%= chargeback.effective_dt %>"></span>
159
- <%= format_date(chargeback.effective_dt).html_safe %>
171
+ <% if chargeback.effective_date.present? %>
172
+ <span class="hide" title="<%= chargeback.effective_date %>"></span>
173
+ <%= format_date(chargeback.effective_date).html_safe %>
160
174
  <% else %>
161
175
  [unknown]
162
176
  <% end %>
@@ -190,17 +204,17 @@
190
204
  <% end %>
191
205
  <tr title="<%= bundles %>">
192
206
  <td>
193
- <% if payment.requested_dt.present? %>
194
- <span class="hide" title="<%= payment.requested_dt %>"></span>
195
- <%= format_date(payment.requested_dt).html_safe %>
207
+ <% if payment.requested_date.present? %>
208
+ <span class="hide" title="<%= payment.requested_date %>"></span>
209
+ <%= format_date(payment.requested_date).html_safe %>
196
210
  <% else %>
197
211
  [unknown]
198
212
  <% end %>
199
213
  </td>
200
214
  <td>
201
- <% if payment.effective_dt.present? %>
202
- <span class="hide" title="<%= payment.effective_dt %>"></span>
203
- <%= format_date(payment.effective_dt).html_safe %>
215
+ <% if payment.effective_date.present? %>
216
+ <span class="hide" title="<%= payment.effective_date %>"></span>
217
+ <%= format_date(payment.effective_date).html_safe %>
204
218
  <% else %>
205
219
  [unknown]
206
220
  <% end %>
@@ -212,7 +226,7 @@
212
226
  </td>
213
227
  <td><%= "PAYMENT" %></td>
214
228
  <td>
215
- <%= "Payment id:" %> <%= payment.id %><br/>
229
+ <%= "Payment id:" %> <%= payment.payment_id %><br/>
216
230
  <%= "Total amount:" %> <%= payment.amount %> <%= @account.currency if payment.amount.present? %><br/>
217
231
  <%= "Paid amount:" %> <%= payment.paid_amount %> <%= @account.currency %><br/>
218
232
  <span <% if payment.status == 'FAILED' %>class="alert-error" <% elsif payment.status == 'SUCCESS' %>class="alert-success" <% end %>>
@@ -222,8 +236,10 @@
222
236
  <%= "Invoice #" %> <%= link_to invoice.invoice_number, invoice_path(:id => invoice.invoice_id) %>
223
237
  </td>
224
238
  <td>
225
- <% payment.audit_logs.each do |entry| %>
226
- <%= entry.description unless entry.changed_by == 'PaymentRequestProcessor' %><br/>
239
+ <% if payment.audit_logs.present? %>
240
+ <% payment.audit_logs.each do |entry| %>
241
+ <%= entry.description unless entry.changed_by == 'PaymentRequestProcessor' %><br/>
242
+ <% end %>
227
243
  <% end %>
228
244
  </td>
229
245
  <td>
@@ -242,7 +258,7 @@
242
258
  <%= link_to 'Pay', kaui_engine.new_payment_path(:params => { :payment_id => payment.payment_id,
243
259
  :account_id => @account.account_id,
244
260
  :invoice_id => payment.invoice_id }),
245
- :class => "btn btn-mini" %>
261
+ :class => "btn btn-mini" %>
246
262
  <% end %>
247
263
  </td>
248
264
  </tr>
@@ -252,17 +268,17 @@
252
268
  <% sub.events.each do |event| %>
253
269
  <tr title="<%= @bundle_names[bundle.external_key] %>">
254
270
  <td>
255
- <% if event.requested_dt.present? %>
256
- <span class="hide" title="<%= event.requested_dt %>"></span>
257
- <%= format_date(event.requested_dt).html_safe %>
271
+ <% if event.requested_date.present? %>
272
+ <span class="hide" title="<%= event.requested_date %>"></span>
273
+ <%= format_date(event.requested_date).html_safe %>
258
274
  <% else %>
259
275
  [unknown]
260
276
  <% end %>
261
277
  </td>
262
278
  <td>
263
- <% if event.effective_dt.present? %>
264
- <span class="hide" title="<%= event.effective_dt %>"></span>
265
- <%= format_date(event.effective_dt).html_safe %>
279
+ <% if event.effective_date.present? %>
280
+ <span class="hide" title="<%= event.effective_date %>"></span>
281
+ <%= format_date(event.effective_date).html_safe %>
266
282
  <% else %>
267
283
  [unknown]
268
284
  <% end %>
@@ -272,7 +288,13 @@
272
288
  </td>
273
289
  <td><%= event.event_type %></td>
274
290
  <td><%= event.product %> <%= event.billing_period == 'NO_BILLING_PERIOD' || event.billing_period.nil? ? "" : event.billing_period.downcase.capitalize %> <%= event.phase.downcase.capitalize if event.phase.present? %></td>
275
- <td> </td>
291
+ <td>
292
+ <% if event.audit_logs.present? %>
293
+ <% event.audit_logs.each do |entry| %>
294
+ <%= entry.description %><br/>
295
+ <% end %>
296
+ <% end %>
297
+ </td>
276
298
  <td> </td>
277
299
  </tr>
278
300
  <% end %>