kaui 0.1.6 → 0.1.7
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.
- data/README.rdoc +8 -1
- data/app/controllers/kaui/accounts_controller.rb +13 -9
- data/app/controllers/kaui/bundle_tags_controller.rb +15 -7
- data/app/controllers/kaui/bundles_controller.rb +11 -12
- data/app/controllers/kaui/credits_controller.rb +2 -1
- data/app/controllers/kaui/payments_controller.rb +2 -2
- data/app/controllers/kaui/subscriptions_controller.rb +40 -27
- data/app/helpers/kaui/killbill_helper.rb +38 -56
- data/app/models/kaui/account.rb +4 -0
- data/app/models/kaui/base.rb +8 -0
- data/app/models/kaui/chargeback.rb +4 -0
- data/app/models/kaui/invoice.rb +26 -0
- data/app/models/kaui/invoice_item.rb +4 -0
- data/app/models/kaui/payment.rb +9 -0
- data/app/models/kaui/refund.rb +4 -0
- data/app/views/kaui/account_timelines/show.html.erb +13 -21
- data/app/views/kaui/accounts/show.html.erb +15 -4
- data/app/views/kaui/chargebacks/new.html.erb +8 -1
- data/app/views/kaui/charges/new.html.erb +9 -2
- data/app/views/kaui/credits/new.html.erb +8 -1
- data/app/views/kaui/invoices/show.html.erb +4 -4
- data/app/views/kaui/payments/_payments_table.html.erb +2 -2
- data/app/views/kaui/payments/new.html.erb +16 -1
- data/app/views/kaui/refunds/new.html.erb +8 -1
- data/app/views/kaui/subscriptions/_subscriptions_table.html.erb +2 -2
- data/app/views/kaui/subscriptions/edit.html.erb +1 -1
- data/lib/kaui/version.rb +1 -1
- data/test/dummy/app/assets/javascripts/application.js +1 -0
- data/test/dummy/log/development.log +6795 -0
- data/test/dummy/log/test.log +6534 -0
- data/test/dummy/tmp/cache/assets/C95/690/sprockets%2Fc4b083702793f7599f4a3069c50f89a8 +0 -0
- data/test/dummy/tmp/cache/assets/CC2/520/sprockets%2F9637f46d37325381f96d96d94ae0bc50 +0 -0
- data/test/dummy/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
- data/test/dummy/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
- data/test/dummy/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
- data/test/unit/kaui/base_test.rb +14 -0
- metadata +6 -4
- data/app/controllers/kaui/external_payments_controller.rb +0 -21
- data/app/views/kaui/external_payments/new.html.erb +0 -56
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/test/unit/kaui/base_test.rb
CHANGED
@@ -36,4 +36,18 @@ class Kaui::BaseTest < ActiveSupport::TestCase
|
|
36
36
|
assert_equal Hash.new, Kaui::Base.convert_hash_keys({})
|
37
37
|
assert_equal 1, Kaui::Base.convert_hash_keys(1)
|
38
38
|
end
|
39
|
+
|
40
|
+
test "can convert to money" do
|
41
|
+
# Happy path
|
42
|
+
['GBP', 'MXN', 'BRL', 'EUR', 'AUD', 'USD', 'CAD', 'JPY'].each do |currency|
|
43
|
+
money = Kaui::Base.to_money(12.42, currency)
|
44
|
+
assert_equal 1242, money.cents
|
45
|
+
assert_equal currency, money.currency.iso_code
|
46
|
+
end
|
47
|
+
|
48
|
+
# Edge cases
|
49
|
+
bad_money = Kaui::Base.to_money(12.42, "blahblah")
|
50
|
+
assert_equal 1242, bad_money.cents
|
51
|
+
assert_equal "USD", bad_money.currency.iso_code
|
52
|
+
end
|
39
53
|
end
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: kaui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.7
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Alena Dudzinskaya
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2012-08-
|
13
|
+
date: 2012-08-21 00:00:00 Z
|
14
14
|
dependencies: []
|
15
15
|
|
16
16
|
description: Rails UI plugin for Killbill administration.
|
@@ -51,7 +51,6 @@ files:
|
|
51
51
|
- app/controllers/kaui/charges_controller.rb
|
52
52
|
- app/controllers/kaui/credits_controller.rb
|
53
53
|
- app/controllers/kaui/engine_controller.rb
|
54
|
-
- app/controllers/kaui/external_payments_controller.rb
|
55
54
|
- app/controllers/kaui/home_controller.rb
|
56
55
|
- app/controllers/kaui/invoice_items_controller.rb
|
57
56
|
- app/controllers/kaui/invoices_controller.rb
|
@@ -112,7 +111,6 @@ files:
|
|
112
111
|
- app/views/kaui/credits/index.html.erb
|
113
112
|
- app/views/kaui/credits/new.html.erb
|
114
113
|
- app/views/kaui/credits/show.html.erb
|
115
|
-
- app/views/kaui/external_payments/new.html.erb
|
116
114
|
- app/views/kaui/home/index.html.erb
|
117
115
|
- app/views/kaui/invoice_items/edit.html.erb
|
118
116
|
- app/views/kaui/invoice_items/index.html.erb
|
@@ -200,7 +198,9 @@ files:
|
|
200
198
|
- test/dummy/test/fixtures/refunds.yml
|
201
199
|
- test/dummy/test/fixtures/tag_definitions.yml
|
202
200
|
- test/dummy/tmp/cache/assets/C94/4E0/sprockets%2Fea1476dc10a3348303f74d111f70441a
|
201
|
+
- test/dummy/tmp/cache/assets/C95/690/sprockets%2Fc4b083702793f7599f4a3069c50f89a8
|
203
202
|
- test/dummy/tmp/cache/assets/CAA/680/sprockets%2F3824d037523f650518fb22acab75559d
|
203
|
+
- test/dummy/tmp/cache/assets/CC2/520/sprockets%2F9637f46d37325381f96d96d94ae0bc50
|
204
204
|
- test/dummy/tmp/cache/assets/CD0/9D0/sprockets%2F5c9508c21501c73fbe00473a09b1f5f4
|
205
205
|
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
206
206
|
- test/dummy/tmp/cache/assets/CDF/1F0/sprockets%2F76ac5628a0c4d1b976cb622ec4493751
|
@@ -335,7 +335,9 @@ test_files:
|
|
335
335
|
- test/dummy/test/fixtures/refunds.yml
|
336
336
|
- test/dummy/test/fixtures/tag_definitions.yml
|
337
337
|
- test/dummy/tmp/cache/assets/C94/4E0/sprockets%2Fea1476dc10a3348303f74d111f70441a
|
338
|
+
- test/dummy/tmp/cache/assets/C95/690/sprockets%2Fc4b083702793f7599f4a3069c50f89a8
|
338
339
|
- test/dummy/tmp/cache/assets/CAA/680/sprockets%2F3824d037523f650518fb22acab75559d
|
340
|
+
- test/dummy/tmp/cache/assets/CC2/520/sprockets%2F9637f46d37325381f96d96d94ae0bc50
|
339
341
|
- test/dummy/tmp/cache/assets/CD0/9D0/sprockets%2F5c9508c21501c73fbe00473a09b1f5f4
|
340
342
|
- test/dummy/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953
|
341
343
|
- test/dummy/tmp/cache/assets/CDF/1F0/sprockets%2F76ac5628a0c4d1b976cb622ec4493751
|
@@ -1,21 +0,0 @@
|
|
1
|
-
class Kaui::ExternalPaymentsController < Kaui::EngineController
|
2
|
-
def new
|
3
|
-
invoice_id = params[:invoice_id]
|
4
|
-
@account_id = params[:account_id]
|
5
|
-
|
6
|
-
@external_payment = Kaui::ExternalPayment.new("invoiceId" => invoice_id, "accountId" => @account_id)
|
7
|
-
|
8
|
-
@account = Kaui::KillbillHelper::get_account(@account_id)
|
9
|
-
@invoice = Kaui::KillbillHelper::get_invoice(invoice_id)
|
10
|
-
end
|
11
|
-
|
12
|
-
def create
|
13
|
-
external_payment = Kaui::ExternalPayment.new(params[:external_payment])
|
14
|
-
|
15
|
-
success = Kaui::KillbillHelper::create_external_payment(external_payment, current_user, params[:reason], params[:comment])
|
16
|
-
if success
|
17
|
-
flash[:info] = "External Payment created"
|
18
|
-
end
|
19
|
-
redirect_to kaui_engine.account_timeline_path(external_payment.account_id)
|
20
|
-
end
|
21
|
-
end
|
@@ -1,56 +0,0 @@
|
|
1
|
-
<div class="page-header">
|
2
|
-
<h1>Apply External Payment</h1>
|
3
|
-
</div>
|
4
|
-
<%= form_for(@external_payment, :url => { :action => :create }, :html => { :class => "form-horizontal" }) do |f| %>
|
5
|
-
<%= f.hidden_field :invoice_id %>
|
6
|
-
<%= f.hidden_field :account_id %>
|
7
|
-
<fieldset>
|
8
|
-
<div class="control-group">
|
9
|
-
<label class="control-label">Date</label>
|
10
|
-
<div class="controls">
|
11
|
-
<label class="checkbox">
|
12
|
-
<%= DateTime.now.to_s(:pretty) %>
|
13
|
-
</label>
|
14
|
-
</div>
|
15
|
-
</div>
|
16
|
-
<div class="control-group">
|
17
|
-
<label class="control-label">Invoice number</label>
|
18
|
-
<div class="controls">
|
19
|
-
<label class="checkbox">
|
20
|
-
<%= @invoice.invoice_number %><br/>
|
21
|
-
</label>
|
22
|
-
</div>
|
23
|
-
</div>
|
24
|
-
<div class="control-group">
|
25
|
-
<label class="control-label">Account name</label>
|
26
|
-
<div class="controls">
|
27
|
-
<label class="checkbox">
|
28
|
-
<%= @account.name %><br/>
|
29
|
-
<%= @account.email %>
|
30
|
-
</label>
|
31
|
-
</div>
|
32
|
-
<div class="control-group">
|
33
|
-
<%= f.label :amount, "Amount", :class => "control-label" %>
|
34
|
-
<div class="controls">
|
35
|
-
<%= f.text_field :amount, :class => 'input-small' %>
|
36
|
-
<p class="help-inline"><%= @account.currency %></p>
|
37
|
-
</div>
|
38
|
-
</div>
|
39
|
-
<div class="control-group">
|
40
|
-
<%= label_tag :reason, "Reason", :class => "control-label" %>
|
41
|
-
<div class="controls">
|
42
|
-
<%= select_tag :reason, options_for_select(Kaui::ExternalPayment::SAMPLE_REASON_CODES) %>
|
43
|
-
</div>
|
44
|
-
</div>
|
45
|
-
<div class="control-group">
|
46
|
-
<%= label_tag :comment, "Comment", :class => "control-label" %>
|
47
|
-
<div class="controls">
|
48
|
-
<%= text_area_tag :comment, "", :rows => 3, :class => 'input-xlarge' %>
|
49
|
-
</div>
|
50
|
-
</div>
|
51
|
-
<div class="form-actions">
|
52
|
-
<%= button_tag "Create payment", :class =>"btn btn-primary" %>
|
53
|
-
<%= link_to 'Back', :back, :class => 'btn' %>
|
54
|
-
</div>
|
55
|
-
</fieldset>
|
56
|
-
<% end %>
|