kaui 0.6.6 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +2 -0
- data/Gemfile.lock +51 -37
- data/README.md +5 -0
- data/Rakefile +1 -1
- data/app/controllers/kaui/account_emails_controller.rb +26 -44
- data/app/controllers/kaui/account_tags_controller.rb +26 -38
- data/app/controllers/kaui/account_timelines_controller.rb +47 -50
- data/app/controllers/kaui/accounts_controller.rb +68 -148
- data/app/controllers/kaui/bundle_tags_controller.rb +32 -21
- data/app/controllers/kaui/bundles_controller.rb +44 -69
- data/app/controllers/kaui/chargebacks_controller.rb +31 -61
- data/app/controllers/kaui/charges_controller.rb +19 -21
- data/app/controllers/kaui/credits_controller.rb +22 -36
- data/app/controllers/kaui/custom_fields_controller.rb +15 -13
- data/app/controllers/kaui/engine_controller.rb +8 -10
- data/app/controllers/kaui/invoice_items_controller.rb +24 -41
- data/app/controllers/kaui/invoices_controller.rb +36 -46
- data/app/controllers/kaui/payment_methods_controller.rb +84 -28
- data/app/controllers/kaui/payments_controller.rb +64 -26
- data/app/controllers/kaui/refunds_controller.rb +27 -107
- data/app/controllers/kaui/subscriptions_controller.rb +88 -132
- data/app/controllers/kaui/tag_definitions_controller.rb +32 -79
- data/app/controllers/kaui/tags_controller.rb +16 -14
- data/app/controllers/kaui/transactions_controller.rb +25 -0
- data/app/helpers/kaui/money_helper.rb +8 -0
- data/app/helpers/kaui/subscription_helper.rb +115 -0
- data/app/helpers/kaui/uuid_helper.rb +9 -0
- data/app/models/kaui/ability.rb +2 -2
- data/app/models/kaui/account.rb +25 -42
- data/app/models/kaui/account_email.rb +11 -48
- data/app/models/kaui/account_timeline.rb +1 -5
- data/app/models/kaui/audit_log.rb +1 -15
- data/app/models/kaui/base.rb +1 -126
- data/app/models/kaui/bundle.rb +47 -14
- data/app/models/kaui/catalog.rb +2 -0
- data/app/models/kaui/chargeback.rb +24 -36
- data/app/models/kaui/credit.rb +5 -20
- data/app/models/kaui/custom_field.rb +9 -5
- data/app/models/kaui/invoice.rb +9 -53
- data/app/models/kaui/invoice_item.rb +8 -18
- data/app/models/kaui/invoice_payment.rb +24 -0
- data/app/models/kaui/payment.rb +14 -32
- data/app/models/kaui/payment_method.rb +36 -0
- data/app/models/kaui/rails_methods.rb +7 -9
- data/app/models/kaui/refund.rb +5 -20
- data/app/models/kaui/subscription.rb +7 -27
- data/app/models/kaui/tag.rb +10 -6
- data/app/models/kaui/tag_definition.rb +26 -34
- data/app/models/kaui/transaction.rb +30 -0
- data/app/models/kaui/user.rb +2 -0
- data/app/views/kaui/account_emails/_form.html.erb +8 -28
- data/app/views/kaui/account_emails/show.html.erb +10 -10
- data/app/views/kaui/account_tags/_account_tags_table.html.erb +20 -18
- data/app/views/kaui/account_tags/_form.html.erb +42 -0
- data/app/views/kaui/account_tags/edit.html.erb +1 -41
- data/app/views/kaui/account_tags/show.html.erb +6 -3
- data/app/views/kaui/account_timelines/show.html.erb +273 -302
- data/app/views/kaui/accounts/_form.html.erb +116 -0
- data/app/views/kaui/accounts/index.html.erb +13 -11
- data/app/views/kaui/accounts/new.html.erb +5 -0
- data/app/views/kaui/accounts/show.html.erb +101 -99
- data/app/views/kaui/bundle_tags/_bundle_tags_table.html.erb +29 -9
- data/app/views/kaui/bundle_tags/_form.html.erb +41 -0
- data/app/views/kaui/bundle_tags/edit.html.erb +2 -34
- data/app/views/kaui/bundle_tags/show.html.erb +6 -0
- data/app/views/kaui/bundles/index.html.erb +9 -9
- data/app/views/kaui/bundles/show.html.erb +17 -15
- data/app/views/kaui/bundles/transfer.html.erb +25 -24
- data/app/views/kaui/chargebacks/_form.html.erb +44 -0
- data/app/views/kaui/chargebacks/new.html.erb +3 -115
- data/app/views/kaui/charges/_form.html.erb +73 -0
- data/app/views/kaui/charges/new.html.erb +2 -91
- data/app/views/kaui/credits/_form.html.erb +73 -0
- data/app/views/kaui/credits/new.html.erb +2 -85
- data/app/views/kaui/invoice_items/edit.html.erb +77 -78
- data/app/views/kaui/invoices/show.html.erb +3 -10
- data/app/views/kaui/layouts/kaui_application.html.erb +0 -2
- data/app/views/kaui/payment_methods/_form.html.erb +30 -0
- data/app/views/kaui/payment_methods/_new_creditcard_payment_method.html.erb +19 -18
- data/app/views/kaui/payment_methods/_payment_methods_table.html.erb +8 -5
- data/app/views/kaui/payment_methods/index.html.erb +10 -10
- data/app/views/kaui/payment_methods/new.html.erb +2 -20
- data/app/views/kaui/payment_methods/show.html.erb +2 -1
- data/app/views/kaui/payments/_payments_table.html.erb +30 -22
- data/app/views/kaui/payments/index.html.erb +1 -1
- data/app/views/kaui/payments/new.html.erb +5 -5
- data/app/views/kaui/payments/show.html.erb +3 -0
- data/app/views/kaui/refunds/new.html.erb +96 -104
- data/app/views/kaui/subscriptions/_form.html.erb +36 -0
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +39 -44
- data/app/views/kaui/subscriptions/edit.html.erb +24 -35
- data/app/views/kaui/subscriptions/index.html.erb +13 -12
- data/app/views/kaui/subscriptions/new.html.erb +6 -43
- data/app/views/kaui/subscriptions/show.html.erb +32 -25
- data/app/views/kaui/tag_definitions/_form.html.erb +10 -37
- data/app/views/kaui/tag_definitions/index.html.erb +3 -5
- data/app/views/kaui/tag_definitions/show.html.erb +1 -2
- data/app/views/kaui/transactions/_form.html.erb +77 -0
- data/app/views/kaui/transactions/new.html.erb +3 -0
- data/config/initializers/kilbill-client-init.rb +1 -1
- data/config/routes.rb +4 -15
- data/kaui.gemspec +8 -6
- data/lib/kaui/engine.rb +4 -1
- data/lib/kaui/version.rb +1 -1
- data/lib/kaui.rb +2 -2
- data/test/functional/kaui/account_emails_controller_test.rb +28 -0
- data/test/functional/kaui/account_tags_controller_test.rb +29 -0
- data/test/functional/kaui/account_timelines_controller_test.rb +21 -0
- data/test/functional/kaui/accounts_controller_test.rb +56 -50
- data/test/functional/kaui/bundle_tags_controller_test.rb +29 -0
- data/test/functional/kaui/bundles_controller_test.rb +58 -13
- data/test/functional/kaui/chargebacks_controller_test.rb +16 -5
- data/test/functional/kaui/charges_controller_test.rb +39 -0
- data/test/functional/kaui/credits_controller_test.rb +35 -0
- data/test/functional/kaui/custom_fields_controller_test.rb +21 -0
- data/test/functional/kaui/functional_test_helper.rb +61 -0
- data/test/functional/kaui/invoice_items_controller_test.rb +24 -10
- data/test/functional/kaui/invoices_controller_test.rb +41 -13
- data/test/functional/kaui/payment_methods_controller_test.rb +49 -0
- data/test/functional/kaui/payments_controller_test.rb +32 -5
- data/test/functional/kaui/refunds_controller_test.rb +40 -5
- data/test/functional/kaui/subscriptions_controller_test.rb +82 -0
- data/test/functional/kaui/tag_definitions_controller_test.rb +27 -53
- data/test/functional/kaui/tags_controller_test.rb +21 -0
- data/test/functional/kaui/transactions_controller_test.rb +32 -0
- data/test/integration/kaui/integration_test_helper.rb +31 -0
- data/test/integration/kaui/navigation_test.rb +43 -0
- data/test/killbill_test_helper.rb +143 -0
- data/test/test_helper.rb +10 -227
- data/test/unit/kaui/account_email_test.rb +19 -0
- data/test/unit/kaui/account_test.rb +7 -35
- data/test/unit/kaui/base_test.rb +5 -46
- data/test/unit/kaui/date_helper_test.rb +6 -5
- data/test/unit/kaui/invoice_item_test.rb +5 -17
- data/test/unit/kaui/invoice_payment_test.rb +42 -0
- data/test/unit/kaui/invoice_test.rb +15 -15
- data/test/unit/kaui/money_helper_test.rb +10 -0
- data/test/unit/kaui/payment_test.rb +42 -0
- data/test/unit/kaui/tag_definition_test.rb +5 -28
- data/test/unit/kaui/uuid_helper_test.rb +10 -0
- metadata +134 -159
- data/app/controllers/kaui/analytics_controller.rb +0 -28
- data/app/helpers/kaui/killbill_helper.rb +0 -611
- data/app/models/kaui/analytics.rb +0 -19
- data/app/models/kaui/analytics_sanity.rb +0 -7
- data/app/models/kaui/business_account.rb +0 -12
- data/app/models/kaui/business_field.rb +0 -6
- data/app/models/kaui/business_invoice.rb +0 -31
- data/app/models/kaui/business_invoice_item.rb +0 -17
- data/app/models/kaui/business_invoice_payment.rb +0 -25
- data/app/models/kaui/business_overdue_status.rb +0 -8
- data/app/models/kaui/business_snapshot.rb +0 -9
- data/app/models/kaui/business_subscription_transition.rb +0 -53
- data/app/models/kaui/business_tag.rb +0 -5
- data/app/models/kaui/charge.rb +0 -14
- data/app/models/kaui/entitlement.rb +0 -2
- data/app/models/kaui/event.rb +0 -13
- data/app/models/kaui/external_payment.rb +0 -15
- data/app/models/kaui/overdue_state.rb +0 -10
- data/app/models/kaui/payment_attempt.rb +0 -27
- data/app/models/kaui/product.rb +0 -24
- data/app/models/kaui/time_series_data.rb +0 -8
- data/app/views/kaui/analytics/account_snapshot.html.erb +0 -211
- data/app/views/kaui/analytics/index.html.erb +0 -17
- data/app/views/kaui/chargebacks/index.html.erb +0 -14
- data/app/views/kaui/chargebacks/show.html.erb +0 -19
- data/app/views/kaui/credits/index.html.erb +0 -14
- data/app/views/kaui/credits/show.html.erb +0 -19
- data/app/views/kaui/invoice_items/index.html.erb +0 -20
- data/app/views/kaui/invoice_items/show.html.erb +0 -31
- data/app/views/kaui/refunds/_refunds_table.html.erb +0 -31
- data/app/views/kaui/refunds/index.html.erb +0 -43
- data/app/views/kaui/refunds/show.html.erb +0 -33
- data/app/views/kaui/tag_definitions/edit.html.erb +0 -3
- data/test/dummy/test/fixtures/accounts.yml +0 -32
- data/test/dummy/test/fixtures/bill_cycle_days.yml +0 -3
- data/test/dummy/test/fixtures/bundles.yml +0 -4
- data/test/dummy/test/fixtures/invoice_items.yml +0 -13
- data/test/dummy/test/fixtures/invoices.yml +0 -11
- data/test/dummy/test/fixtures/overdue_states.yml +0 -8
- data/test/dummy/test/fixtures/payment_methods.yml +0 -5
- data/test/dummy/test/fixtures/plugin_info_properties.yml +0 -59
- data/test/dummy/test/fixtures/plugin_infos.yml +0 -2
- data/test/dummy/test/fixtures/refunds.yml +0 -9
- data/test/dummy/test/fixtures/tag_definitions.yml +0 -20
- data/test/functional/kaui/account_timeline_controller_test.rb +0 -9
- data/test/functional/kaui/extpayments_controller_test.rb +0 -9
- data/test/functional/kaui/home_controller_test.rb +0 -11
- data/test/integration/navigation_test.rb +0 -10
- data/test/kaui_test.rb +0 -7
- data/test/unit/helpers/kaui/account_timeline_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/bundles_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/chargebacks_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/extpayments_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/home_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/invoices_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/payments_helper_test.rb +0 -6
- data/test/unit/helpers/kaui/refunds_helper_test.rb +0 -6
- data/test/unit/kaui/overdue_state_test.rb +0 -18
- data/test/unit/kaui/refund_test.rb +0 -20
- 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 %> <%= 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,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,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,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,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']
|
data/test/kaui_test.rb
DELETED
@@ -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
|
data/test/unit/model_test.rb
DELETED
@@ -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
|