kaui 0.6.6 → 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +2 -0
  3. data/Gemfile.lock +51 -37
  4. data/README.md +5 -0
  5. data/Rakefile +1 -1
  6. data/app/controllers/kaui/account_emails_controller.rb +26 -44
  7. data/app/controllers/kaui/account_tags_controller.rb +26 -38
  8. data/app/controllers/kaui/account_timelines_controller.rb +47 -50
  9. data/app/controllers/kaui/accounts_controller.rb +68 -148
  10. data/app/controllers/kaui/bundle_tags_controller.rb +32 -21
  11. data/app/controllers/kaui/bundles_controller.rb +44 -69
  12. data/app/controllers/kaui/chargebacks_controller.rb +31 -61
  13. data/app/controllers/kaui/charges_controller.rb +19 -21
  14. data/app/controllers/kaui/credits_controller.rb +22 -36
  15. data/app/controllers/kaui/custom_fields_controller.rb +15 -13
  16. data/app/controllers/kaui/engine_controller.rb +8 -10
  17. data/app/controllers/kaui/invoice_items_controller.rb +24 -41
  18. data/app/controllers/kaui/invoices_controller.rb +36 -46
  19. data/app/controllers/kaui/payment_methods_controller.rb +84 -28
  20. data/app/controllers/kaui/payments_controller.rb +64 -26
  21. data/app/controllers/kaui/refunds_controller.rb +27 -107
  22. data/app/controllers/kaui/subscriptions_controller.rb +88 -132
  23. data/app/controllers/kaui/tag_definitions_controller.rb +32 -79
  24. data/app/controllers/kaui/tags_controller.rb +16 -14
  25. data/app/controllers/kaui/transactions_controller.rb +25 -0
  26. data/app/helpers/kaui/money_helper.rb +8 -0
  27. data/app/helpers/kaui/subscription_helper.rb +115 -0
  28. data/app/helpers/kaui/uuid_helper.rb +9 -0
  29. data/app/models/kaui/ability.rb +2 -2
  30. data/app/models/kaui/account.rb +25 -42
  31. data/app/models/kaui/account_email.rb +11 -48
  32. data/app/models/kaui/account_timeline.rb +1 -5
  33. data/app/models/kaui/audit_log.rb +1 -15
  34. data/app/models/kaui/base.rb +1 -126
  35. data/app/models/kaui/bundle.rb +47 -14
  36. data/app/models/kaui/catalog.rb +2 -0
  37. data/app/models/kaui/chargeback.rb +24 -36
  38. data/app/models/kaui/credit.rb +5 -20
  39. data/app/models/kaui/custom_field.rb +9 -5
  40. data/app/models/kaui/invoice.rb +9 -53
  41. data/app/models/kaui/invoice_item.rb +8 -18
  42. data/app/models/kaui/invoice_payment.rb +24 -0
  43. data/app/models/kaui/payment.rb +14 -32
  44. data/app/models/kaui/payment_method.rb +36 -0
  45. data/app/models/kaui/rails_methods.rb +7 -9
  46. data/app/models/kaui/refund.rb +5 -20
  47. data/app/models/kaui/subscription.rb +7 -27
  48. data/app/models/kaui/tag.rb +10 -6
  49. data/app/models/kaui/tag_definition.rb +26 -34
  50. data/app/models/kaui/transaction.rb +30 -0
  51. data/app/models/kaui/user.rb +2 -0
  52. data/app/views/kaui/account_emails/_form.html.erb +8 -28
  53. data/app/views/kaui/account_emails/show.html.erb +10 -10
  54. data/app/views/kaui/account_tags/_account_tags_table.html.erb +20 -18
  55. data/app/views/kaui/account_tags/_form.html.erb +42 -0
  56. data/app/views/kaui/account_tags/edit.html.erb +1 -41
  57. data/app/views/kaui/account_tags/show.html.erb +6 -3
  58. data/app/views/kaui/account_timelines/show.html.erb +273 -302
  59. data/app/views/kaui/accounts/_form.html.erb +116 -0
  60. data/app/views/kaui/accounts/index.html.erb +13 -11
  61. data/app/views/kaui/accounts/new.html.erb +5 -0
  62. data/app/views/kaui/accounts/show.html.erb +101 -99
  63. data/app/views/kaui/bundle_tags/_bundle_tags_table.html.erb +29 -9
  64. data/app/views/kaui/bundle_tags/_form.html.erb +41 -0
  65. data/app/views/kaui/bundle_tags/edit.html.erb +2 -34
  66. data/app/views/kaui/bundle_tags/show.html.erb +6 -0
  67. data/app/views/kaui/bundles/index.html.erb +9 -9
  68. data/app/views/kaui/bundles/show.html.erb +17 -15
  69. data/app/views/kaui/bundles/transfer.html.erb +25 -24
  70. data/app/views/kaui/chargebacks/_form.html.erb +44 -0
  71. data/app/views/kaui/chargebacks/new.html.erb +3 -115
  72. data/app/views/kaui/charges/_form.html.erb +73 -0
  73. data/app/views/kaui/charges/new.html.erb +2 -91
  74. data/app/views/kaui/credits/_form.html.erb +73 -0
  75. data/app/views/kaui/credits/new.html.erb +2 -85
  76. data/app/views/kaui/invoice_items/edit.html.erb +77 -78
  77. data/app/views/kaui/invoices/show.html.erb +3 -10
  78. data/app/views/kaui/layouts/kaui_application.html.erb +0 -2
  79. data/app/views/kaui/payment_methods/_form.html.erb +30 -0
  80. data/app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb +19 -18
  81. data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +8 -5
  82. data/app/views/kaui/payment_methods/index.html.erb +10 -10
  83. data/app/views/kaui/payment_methods/new.html.erb +2 -20
  84. data/app/views/kaui/payment_methods/show.html.erb +2 -1
  85. data/app/views/kaui/payments/_payments_table.html.erb +30 -22
  86. data/app/views/kaui/payments/index.html.erb +1 -1
  87. data/app/views/kaui/payments/new.html.erb +5 -5
  88. data/app/views/kaui/payments/show.html.erb +3 -0
  89. data/app/views/kaui/refunds/new.html.erb +96 -104
  90. data/app/views/kaui/subscriptions/_form.html.erb +36 -0
  91. data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +39 -44
  92. data/app/views/kaui/subscriptions/edit.html.erb +24 -35
  93. data/app/views/kaui/subscriptions/index.html.erb +13 -12
  94. data/app/views/kaui/subscriptions/new.html.erb +6 -43
  95. data/app/views/kaui/subscriptions/show.html.erb +32 -25
  96. data/app/views/kaui/tag_definitions/_form.html.erb +10 -37
  97. data/app/views/kaui/tag_definitions/index.html.erb +3 -5
  98. data/app/views/kaui/tag_definitions/show.html.erb +1 -2
  99. data/app/views/kaui/transactions/_form.html.erb +77 -0
  100. data/app/views/kaui/transactions/new.html.erb +3 -0
  101. data/config/initializers/kilbill-client-init.rb +1 -1
  102. data/config/routes.rb +4 -15
  103. data/kaui.gemspec +8 -6
  104. data/lib/kaui/engine.rb +4 -1
  105. data/lib/kaui/version.rb +1 -1
  106. data/lib/kaui.rb +2 -2
  107. data/test/functional/kaui/account_emails_controller_test.rb +28 -0
  108. data/test/functional/kaui/account_tags_controller_test.rb +29 -0
  109. data/test/functional/kaui/account_timelines_controller_test.rb +21 -0
  110. data/test/functional/kaui/accounts_controller_test.rb +56 -50
  111. data/test/functional/kaui/bundle_tags_controller_test.rb +29 -0
  112. data/test/functional/kaui/bundles_controller_test.rb +58 -13
  113. data/test/functional/kaui/chargebacks_controller_test.rb +16 -5
  114. data/test/functional/kaui/charges_controller_test.rb +39 -0
  115. data/test/functional/kaui/credits_controller_test.rb +35 -0
  116. data/test/functional/kaui/custom_fields_controller_test.rb +21 -0
  117. data/test/functional/kaui/functional_test_helper.rb +61 -0
  118. data/test/functional/kaui/invoice_items_controller_test.rb +24 -10
  119. data/test/functional/kaui/invoices_controller_test.rb +41 -13
  120. data/test/functional/kaui/payment_methods_controller_test.rb +49 -0
  121. data/test/functional/kaui/payments_controller_test.rb +32 -5
  122. data/test/functional/kaui/refunds_controller_test.rb +40 -5
  123. data/test/functional/kaui/subscriptions_controller_test.rb +82 -0
  124. data/test/functional/kaui/tag_definitions_controller_test.rb +27 -53
  125. data/test/functional/kaui/tags_controller_test.rb +21 -0
  126. data/test/functional/kaui/transactions_controller_test.rb +32 -0
  127. data/test/integration/kaui/integration_test_helper.rb +31 -0
  128. data/test/integration/kaui/navigation_test.rb +43 -0
  129. data/test/killbill_test_helper.rb +143 -0
  130. data/test/test_helper.rb +10 -227
  131. data/test/unit/kaui/account_email_test.rb +19 -0
  132. data/test/unit/kaui/account_test.rb +7 -35
  133. data/test/unit/kaui/base_test.rb +5 -46
  134. data/test/unit/kaui/date_helper_test.rb +6 -5
  135. data/test/unit/kaui/invoice_item_test.rb +5 -17
  136. data/test/unit/kaui/invoice_payment_test.rb +42 -0
  137. data/test/unit/kaui/invoice_test.rb +15 -15
  138. data/test/unit/kaui/money_helper_test.rb +10 -0
  139. data/test/unit/kaui/payment_test.rb +42 -0
  140. data/test/unit/kaui/tag_definition_test.rb +5 -28
  141. data/test/unit/kaui/uuid_helper_test.rb +10 -0
  142. metadata +134 -159
  143. data/app/controllers/kaui/analytics_controller.rb +0 -28
  144. data/app/helpers/kaui/killbill_helper.rb +0 -611
  145. data/app/models/kaui/analytics.rb +0 -19
  146. data/app/models/kaui/analytics_sanity.rb +0 -7
  147. data/app/models/kaui/business_account.rb +0 -12
  148. data/app/models/kaui/business_field.rb +0 -6
  149. data/app/models/kaui/business_invoice.rb +0 -31
  150. data/app/models/kaui/business_invoice_item.rb +0 -17
  151. data/app/models/kaui/business_invoice_payment.rb +0 -25
  152. data/app/models/kaui/business_overdue_status.rb +0 -8
  153. data/app/models/kaui/business_snapshot.rb +0 -9
  154. data/app/models/kaui/business_subscription_transition.rb +0 -53
  155. data/app/models/kaui/business_tag.rb +0 -5
  156. data/app/models/kaui/charge.rb +0 -14
  157. data/app/models/kaui/entitlement.rb +0 -2
  158. data/app/models/kaui/event.rb +0 -13
  159. data/app/models/kaui/external_payment.rb +0 -15
  160. data/app/models/kaui/overdue_state.rb +0 -10
  161. data/app/models/kaui/payment_attempt.rb +0 -27
  162. data/app/models/kaui/product.rb +0 -24
  163. data/app/models/kaui/time_series_data.rb +0 -8
  164. data/app/views/kaui/analytics/account_snapshot.html.erb +0 -211
  165. data/app/views/kaui/analytics/index.html.erb +0 -17
  166. data/app/views/kaui/chargebacks/index.html.erb +0 -14
  167. data/app/views/kaui/chargebacks/show.html.erb +0 -19
  168. data/app/views/kaui/credits/index.html.erb +0 -14
  169. data/app/views/kaui/credits/show.html.erb +0 -19
  170. data/app/views/kaui/invoice_items/index.html.erb +0 -20
  171. data/app/views/kaui/invoice_items/show.html.erb +0 -31
  172. data/app/views/kaui/refunds/_refunds_table.html.erb +0 -31
  173. data/app/views/kaui/refunds/index.html.erb +0 -43
  174. data/app/views/kaui/refunds/show.html.erb +0 -33
  175. data/app/views/kaui/tag_definitions/edit.html.erb +0 -3
  176. data/test/dummy/test/fixtures/accounts.yml +0 -32
  177. data/test/dummy/test/fixtures/bill_cycle_days.yml +0 -3
  178. data/test/dummy/test/fixtures/bundles.yml +0 -4
  179. data/test/dummy/test/fixtures/invoice_items.yml +0 -13
  180. data/test/dummy/test/fixtures/invoices.yml +0 -11
  181. data/test/dummy/test/fixtures/overdue_states.yml +0 -8
  182. data/test/dummy/test/fixtures/payment_methods.yml +0 -5
  183. data/test/dummy/test/fixtures/plugin_info_properties.yml +0 -59
  184. data/test/dummy/test/fixtures/plugin_infos.yml +0 -2
  185. data/test/dummy/test/fixtures/refunds.yml +0 -9
  186. data/test/dummy/test/fixtures/tag_definitions.yml +0 -20
  187. data/test/functional/kaui/account_timeline_controller_test.rb +0 -9
  188. data/test/functional/kaui/extpayments_controller_test.rb +0 -9
  189. data/test/functional/kaui/home_controller_test.rb +0 -11
  190. data/test/integration/navigation_test.rb +0 -10
  191. data/test/kaui_test.rb +0 -7
  192. data/test/unit/helpers/kaui/account_timeline_helper_test.rb +0 -6
  193. data/test/unit/helpers/kaui/bundles_helper_test.rb +0 -6
  194. data/test/unit/helpers/kaui/chargebacks_helper_test.rb +0 -6
  195. data/test/unit/helpers/kaui/extpayments_helper_test.rb +0 -6
  196. data/test/unit/helpers/kaui/home_helper_test.rb +0 -6
  197. data/test/unit/helpers/kaui/invoices_helper_test.rb +0 -6
  198. data/test/unit/helpers/kaui/payments_helper_test.rb +0 -6
  199. data/test/unit/helpers/kaui/refunds_helper_test.rb +0 -6
  200. data/test/unit/kaui/overdue_state_test.rb +0 -18
  201. data/test/unit/kaui/refund_test.rb +0 -20
  202. data/test/unit/model_test.rb +0 -151
@@ -1,43 +0,0 @@
1
- <%= form_tag refunds_path, :class => "form-horizontal", :method => :get do %>
2
- <fieldset>
3
- <legend>Please enter either a refund or payment id</legend>
4
- <div class="control-group">
5
- <label class="control-label" for="refund_id">Refund or payment</label>
6
- <div class="controls">
7
- <%= text_field_tag "refund_id", nil, :class => "input-xlarge", :id => "refund_id" %>
8
- </div>
9
- </div>
10
- <div class="form-actions">
11
- <%= button_tag "Search", :class =>"btn btn-primary" %>
12
- </div>
13
- </fieldset>
14
- <% end %>
15
-
16
- <table id="refunds-table" class="table table-condensed">
17
- <thead>
18
- <tr>
19
- <th>Refund ID</th>
20
- <th>Date</th>
21
- <th>Amount</th>
22
- <th>Adjusted?</th>
23
- <th>Status</th>
24
- </tr>
25
- </thead>
26
- <tbody>
27
- <tr>
28
- <td colspan="1" class="dataTables_empty">Loading data from server</td>
29
- </tr>
30
- </tbody>
31
- </table>
32
-
33
- <%= javascript_tag do %>
34
- $(document).ready(function() {
35
- $('#refunds-table').dataTable({
36
- "sDom": "<'row-fluid'<'span6'l><'span6'f>r>t<'row-fluid'<'span6'i><'span6'p>>",
37
- "sPaginationType": "bootstrap",
38
- "bProcessing": true,
39
- "bServerSide": true,
40
- "sAjaxSource": "<%= refunds_pagination_path :format => :json %>"
41
- });
42
- });
43
- <% end %>
@@ -1,33 +0,0 @@
1
- <% if @refunds.present? and @refunds.size > 0 %>
2
- <div class="page-header">
3
- <h2>Refunds</h2>
4
- </div>
5
- <table class="table table-condensed table-striped">
6
- <thead>
7
- <tr>
8
- <th>Refund id</th>
9
- <th>Payment id</th>
10
- <th>Amount</th>
11
- <th>Adjusted?</th>
12
- <th>Requested date</th>
13
- <th>Effective date</th>
14
- <th>Adjustments</th>
15
- </tr>
16
- </thead>
17
- <tbody>
18
- <% @refunds.each do |refund| %>
19
- <tr>
20
- <td><%= refund.refund_id %></td>
21
- <td><%= link_to refund.payment_id, payment_path(refund.payment_id) %></td>
22
- <td><%= refund.amount %>&nbsp;<%= refund.currency %></td>
23
- <td><%= refund.adjusted %></td>
24
- <td><%= format_date(refund.requested_date, @account.timezone).html_safe %></td>
25
- <td><%= format_date(refund.effective_date, @account.timezone).html_safe %></td>
26
- <td><%= refund.adjustments %></td>
27
- </tr>
28
- <% end %>
29
- </tbody>
30
- </table>
31
- <% else %>
32
- <p>Refund info not found</p>
33
- <% end %>
@@ -1,3 +0,0 @@
1
- <h2>Update tag definition</h2>
2
-
3
- <%= render 'form' %>
@@ -1,32 +0,0 @@
1
- pierre:
2
- accountId: cef727ef-0acc-42a0-b1a1-2f3631a01e10
3
- address1: 92 Rue de Richelieu
4
- address2: Cidex
5
- city: Paris
6
- company: Glam Media France
7
- country: France
8
- currency: EUR
9
- email: pierre@glam.com
10
- externalKey: 025ae772-03c5-41b6-b19a-d4e96ef5fe6d
11
- isMigrated: true
12
- isNotifiedForInvoices: true
13
- length: 22
14
- locale: FR_fr
15
- name: Pierre-Alexandre Meyer
16
- paymentMethodId: e819c5a6-7f16-450e-a4da-6d14cce4bfff
17
- phone: +33 (0) 6 42 74 19 84
18
- postalCode: 75002
19
- state: Île-de-France
20
- timeZone: CEST
21
-
22
- account_with_positive_balance:
23
- accountId: def727ef-0acc-42a0-b1a1-2f3631a01e11
24
- accountBalance: 17
25
-
26
- account_with_negative_balance:
27
- accountId: aef727ef-0acc-42a0-b1a1-2f3631a01e12
28
- accountBalance: -17
29
-
30
- account_with_zero_balance:
31
- accountId: bef727ef-0acc-42a0-b1a1-2f3631a01e13
32
- accountBalance: 0
@@ -1,3 +0,0 @@
1
- the_sixth:
2
- dayOfMonthLocal: 6
3
- dayOfMonthUTC: 6
@@ -1,4 +0,0 @@
1
- bundle_for_pierre:
2
- bundleId: 6dd8af87-8e45-42bb-ad4c-b04ba4242f44
3
- externalKey: 10293
4
- accountId: cef727ef-0acc-42a0-b1a1-2f3631a01e10
@@ -1,13 +0,0 @@
1
- recurring_item_for_pierre:
2
- invoiceItemId: 8dc9c444-a63f-4776-b2a3-2bf783ae7d5f
3
- invoiceId: 42f52d03-d2da-4912-bd2f-81695bb97627
4
- accountId: cef727ef-0acc-42a0-b1a1-2f3631a01e10
5
- bundleId: 6dd8af87-8e45-42bb-ad4c-b04ba4242f44
6
- subscriptionId: b9d367f9-8bb0-415b-817c-3a81b874b58a
7
- planName: pistol-monthly
8
- phaseName: evergreen
9
- description: Evergreen phase for the monthly Pistol plan
10
- startDate: 2012-07-16
11
- endDate: 2012-08-15
12
- amount: 100.12
13
- currency: USD
@@ -1,11 +0,0 @@
1
- invoice_for_pierre:
2
- amount: 200.12
3
- cba: 0.0
4
- creditAdj: 12.1
5
- refundAdj: 0.0
6
- invoiceId: 42f52d03-d2da-4912-bd2f-81695bb97627
7
- invoiceDate: 2012-07-01
8
- targetDate: 2012-07-30
9
- invoiceNumber: 43124
10
- balance: 128.33
11
- accountId: cef727ef-0acc-42a0-b1a1-2f3631a01e10
@@ -1,8 +0,0 @@
1
- od1:
2
- name: OD1
3
- externalMessage: OD1 message
4
- daysBetweenPaymentRetries: 1
5
- disableEntitlementAndChangesBlocked: false
6
- blockChanges: true
7
- clearState: false
8
- reevaluationIntervalDays: 5
@@ -1,5 +0,0 @@
1
- payment_method_for_pierre:
2
- accountId: 6cef727ef-0acc-42a0-b1a1-2f3631a01e10
3
- isDefault: true
4
- paymentMethodId: d9e5f642-4532-40df-b733-f7abbfb32b2a
5
- pluginName: chargorifomariphic
@@ -1,59 +0,0 @@
1
- plugin_info_property_accountId:
2
- isUpdatable: false
3
- key: accountId
4
- value: 2c92c0f9388395fa01389106b7684c96
5
-
6
- plugin_info_property_type:
7
- isUpdatable: false
8
- key: type
9
- value: CreditCard
10
-
11
- plugin_info_property_cardHolderName:
12
- isUpdatable: true
13
- key: cardHolderName
14
- value: pierre
15
-
16
- plugin_info_property_cardType:
17
- isUpdatable: false
18
- key: cardType
19
- value: MasterCard
20
-
21
- plugin_info_property_expirationDate:
22
- isUpdatable: true
23
- key: expirationDate
24
- value: 2026-01
25
-
26
- plugin_info_property_maskNumber:
27
- isUpdatable: false
28
- key: maskNumber
29
- value: 1111
30
-
31
- plugin_info_property_address1:
32
- isUpdatable: false
33
- key: address1
34
- value: 10, rue du puits
35
-
36
- plugin_info_property_address2:
37
- isUpdatable: false
38
- key: address2
39
- value: Cidex 12341
40
-
41
- plugin_info_property_city:
42
- isUpdatable: false
43
- key: city
44
- value: Nantes
45
-
46
- plugin_info_property_postalCode:
47
- isUpdatable: false
48
- key: postalCode
49
- value: 44100
50
-
51
- plugin_info_property_state:
52
- isUpdatable: false
53
- key: state
54
- value: Pays de la Loire
55
-
56
- plugin_info_property_country:
57
- isUpdatable: false
58
- key: country
59
- value: France
@@ -1,2 +0,0 @@
1
- plugin_info_for_pierre:
2
- externalPaymentId: 2c92c0f9388395fa01389107266a4dae
@@ -1,9 +0,0 @@
1
- refund_for_pierre:
2
- refundId: a85108be-4132-4384-b15e-9a650dc3a4ef
3
- paymentId: 02445ff7-75a2-41c9-9d95-fc20584a17f9
4
- amount: 1.95
5
- currency: USD
6
- adjusted: false
7
- requestedDate: 2012-07-17 00:57:26
8
- effectiveDate: 2012-07-18 00:57:26
9
- adjustments: []
@@ -1,20 +0,0 @@
1
- payment_plan:
2
- id: f88080f3-57ba-4ab1-ac5e-8a61371132ae
3
- name: Payment-plan
4
- description: Accounts on a special payment plan
5
- isControlTag: false
6
- applicableObjectTypes: ['ACCOUNT', 'TAG_DEFINITION']
7
-
8
- auto_pay_off:
9
- id: 00000000-0000-0000-0000-000000000001
10
- name: AUTO_PAY_OFF
11
- description: Suspends payments until removed.
12
- isControlTag: true
13
- applicableObjectTypes: ['ACCOUNT']
14
-
15
- some_user_tag_for_invoice:
16
- id: bc018d37-b758-45fb-9135-b1996d43bcc8
17
- name: Foo
18
- description: Is the new bar
19
- isControlTag: false
20
- applicableObjectTypes: ['INVOICE']
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class AccountTimelineControllerTest < ActionController::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -1,9 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class ExtpaymentsControllerTest < ActionController::TestCase
5
- # test "the truth" do
6
- # assert true
7
- # end
8
- end
9
- end
@@ -1,11 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class HomeControllerTest < ActionController::TestCase
5
- test "should get index" do
6
- get :index, :use_route => 'kaui'
7
- assert_response :success
8
- end
9
-
10
- end
11
- end
@@ -1,10 +0,0 @@
1
- require 'test_helper'
2
-
3
- class NavigationTest < ActionDispatch::IntegrationTest
4
- fixtures :all
5
-
6
- # test "the truth" do
7
- # assert true
8
- # end
9
- end
10
-
data/test/kaui_test.rb DELETED
@@ -1,7 +0,0 @@
1
- require 'test_helper'
2
-
3
- class KauiTest < ActiveSupport::TestCase
4
- test "truth" do
5
- assert_kind_of Module, Kaui
6
- end
7
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class AccountTimelineHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class BundlesHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class ChargebacksHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class ExtpaymentsHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class HomeHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class InvoicesHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class PaymentsHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,6 +0,0 @@
1
- require 'test_helper'
2
-
3
- module Kaui
4
- class RefundsHelperTest < ActionView::TestCase
5
- end
6
- end
@@ -1,18 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Kaui::OverdueStateTest < ActiveSupport::TestCase
4
- fixtures :overdue_states
5
-
6
- test "can serialize from json" do
7
- as_json = overdue_states(:od1)
8
- od1 = Kaui::OverdueState.new(as_json)
9
-
10
- assert_equal as_json["name"], od1.name
11
- assert_equal as_json["externalMessage"], od1.external_message
12
- assert_equal as_json["daysBetweenPaymentRetries"], od1.days_between_payment_retries
13
- assert_equal as_json["disableEntitlementAndChangesBlocked"], od1.disable_entitlement_and_changes_blocked
14
- assert_equal as_json["blockChanges"], od1.block_changes
15
- assert_equal as_json["clearState"], od1.clear_state
16
- assert_equal as_json["reevaluationIntervalDays"], od1.reevaluation_interval_days
17
- end
18
- end
@@ -1,20 +0,0 @@
1
- require 'test_helper'
2
-
3
- class Kaui::RefundTest < ActiveSupport::TestCase
4
- fixtures :refunds, :invoice_items
5
-
6
- test "can serialize from json" do
7
- as_json = refunds(:refund_for_pierre)
8
- refund = Kaui::Refund.new(as_json)
9
-
10
- assert_equal as_json["refundId"], refund.refund_id
11
- assert_equal as_json["paymentId"], refund.payment_id
12
- assert_equal as_json["amount"], refund.amount
13
- assert_equal as_json["currency"], refund.currency
14
- assert_equal as_json["adjusted"], refund.adjusted
15
- assert_equal as_json["requestedDate"], refund.requested_date
16
- assert_equal as_json["effectiveDate"], refund.effective_date
17
- assert_equal as_json["adjustments"], refund.adjustments
18
- end
19
-
20
- end
@@ -1,151 +0,0 @@
1
- require "test_helper"
2
-
3
- module Kaui
4
- class ModelTest < ActiveSupport::TestCase
5
-
6
- def test_full_json
7
- json_text = <<-EOS
8
- {
9
- "payments": [
10
- {
11
- "amount": 125.0,
12
- "invoice_id": "the_invoice_id_1",
13
- "requested_date": "2012-03-15T15:35:23.000Z",
14
- "effective_date": "2012-03-15T15:35:23.000Z",
15
- "status": "Success",
16
- "payment_id": "the_payment_id_1"
17
- },
18
- {
19
- "amount": 33.45,
20
- "invoice_id": "the_invoice_id_2",
21
- "requested_date": "2012-03-21T15:35:23.000Z",
22
- "effective_date": "2012-03-21T15:35:23.000Z",
23
- "status": "Success",
24
- "payment_id": "the_payment_id_2"
25
- },
26
- {
27
- "amount": 75.34,
28
- "invoice_id": "the_invoice_id_3",
29
- "requested_date": "2012-05-12T15:34:23.000Z",
30
- "effective_date": "2012-05-12T15:34:23.000Z",
31
- "status": "Success",
32
- "payment_id": "the_payment_id_3"
33
- }
34
- ],
35
- "account": {
36
- "external_key": "yoyo_the_bozo",
37
- "account_id": "the_account_id"
38
- },
39
- "bundles": [
40
- {
41
- "external_key": "123456",
42
- "subscriptions": [
43
- {
44
- "events": [
45
- {
46
- "event_id": "id_create_1",
47
- "billing_period": "monthly",
48
- "requested_date": "2012-03-15T15:34:22.000Z",
49
- "product": "pro",
50
- "effective_date": "2012-03-15T15:34:22.000Z",
51
- "price_list": "default",
52
- "event_type": "CREATE",
53
- "phase": "trial"
54
- },
55
- {
56
- "event_id": "id_create_1",
57
- "billing_period": "monthly",
58
- "requested_date": "2012-04-14T15:34:22.000Z",
59
- "product": "pro",
60
- "effective_date": "2012-04-14T15:34:22.000Z",
61
- "price_list": "default",
62
- "event_type": "PHASE",
63
- "phase": "evergreen"
64
- },
65
- {
66
- "event_id": "id_create_1",
67
- "billing_period": "monthly",
68
- "requested_date": "2012-05-12T15:34:22.000Z",
69
- "product": "plus",
70
- "effective_date": "2012-05-12T15:34:22.000Z",
71
- "price_list": "default",
72
- "event_type": "CHANGE",
73
- "phase": "evergreen"
74
- }
75
- ],
76
- "subscription_id": "the_mpp_subscription_id",
77
- "product_category": "MPP"
78
- },
79
- {
80
- "events": [
81
- {
82
- "event_id": "id_create_2",
83
- "billing_period": "monthly",
84
- "requested_date": "2012-03-21T15:34:22.000Z",
85
- "product": "paid_access",
86
- "effective_date": "2012-03-21T15:34:22.000Z",
87
- "price_list": "default",
88
- "event_type": "CREATE",
89
- "phase": "evergreen"
90
- }
91
- ],
92
- "subscription_id": "the_ao_subscription_id",
93
- "product_category": "ADDON"
94
- }
95
- ],
96
- "bundle_id": "the_bundle_id_1"
97
- }
98
- ],
99
- "invoices": [
100
- {
101
- "amount": 125.0,
102
- "invoice_id": "the_invoice_id_1",
103
- "requested_date": "2012-03-15T15:34:23.000Z",
104
- "invoice_number": "INV_0001",
105
- "effective_date": "2012-03-15T15:34:23.000Z",
106
- "balance": 0.0
107
- },
108
- {
109
- "amount": 33.45,
110
- "invoice_id": "the_invoice_id_2",
111
- "requested_date": "2012-03-21T15:34:23.000Z",
112
- "invoice_number": "INV_0002",
113
- "effective_date": "2012-03-21T15:34:23.000Z",
114
- "balance": 0.0
115
- },
116
- {
117
- "amount": 75.34,
118
- "invoice_id": "the_invoice_id_3",
119
- "requested_date": "2012-05-12T15:34:23.000Z",
120
- "invoice_number": "INV_0003",
121
- "effective_date": "2012-05-12T15:34:23.000Z",
122
- "balance": 0.0
123
- }
124
- ]
125
- }
126
- EOS
127
- obj = AccountTimeline.from_json(json_text)
128
- assert obj.is_a?(AccountTimeline)
129
- assert obj.account.is_a?(Account)
130
- assert obj.payments.is_a?(Array)
131
- obj.payments.each do |payment|
132
- payment.is_a?(Payment)
133
- end
134
- assert obj.bundles.is_a?(Array)
135
- obj.bundles.each do |bundle|
136
- bundle.is_a?(Bundle)
137
- assert bundle.subscriptions.is_a?(Array)
138
- bundle.subscriptions.each do |subscription|
139
- subscription.is_a?(Subscription)
140
- end
141
- end
142
- assert obj.invoices.is_a?(Array)
143
- obj.invoices.each do |invoice|
144
- invoice.is_a?(Invoice)
145
- end
146
- new_json = ActiveSupport::JSON.encode(obj, :root => false)
147
- new_obj = AccountTimeline.from_json(new_json)
148
- assert_equal obj, new_obj
149
- end
150
- end
151
- end