kaui 0.4.9 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +3 -3
- data/app/controllers/kaui/credits_controller.rb +1 -1
- data/app/controllers/kaui/subscriptions_controller.rb +1 -2
- data/app/helpers/kaui/killbill_helper.rb +22 -13
- data/app/views/kaui/account_timelines/show.html.erb +1 -1
- data/app/views/kaui/charges/new.html.erb +1 -1
- data/app/views/kaui/subscriptions/edit.html.erb +1 -1
- data/kaui.gemspec +1 -1
- data/lib/kaui/version.rb +1 -1
- metadata +4 -4
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kaui (0.
|
4
|
+
kaui (0.5.0)
|
5
5
|
cancan (~> 1.6.10)
|
6
6
|
d3_rails (~> 3.2.8)
|
7
7
|
devise (~> 3.0.2)
|
8
8
|
jquery-rails (~> 3.0.4)
|
9
|
-
killbill-client (~> 0.4.
|
9
|
+
killbill-client (~> 0.4.2)
|
10
10
|
money-rails (~> 0.8.1)
|
11
11
|
rails (~> 3.2.14)
|
12
12
|
rest-client (~> 1.6.7)
|
@@ -60,7 +60,7 @@ GEM
|
|
60
60
|
railties (>= 3.0, < 5.0)
|
61
61
|
thor (>= 0.14, < 2.0)
|
62
62
|
json (1.8.0)
|
63
|
-
killbill-client (0.4.
|
63
|
+
killbill-client (0.4.2)
|
64
64
|
mail (2.5.4)
|
65
65
|
mime-types (~> 1.16)
|
66
66
|
treetop (~> 1.4.8)
|
@@ -34,7 +34,7 @@ class Kaui::CreditsController < Kaui::EngineController
|
|
34
34
|
credit_amount = @invoice.balance unless @invoice.nil?
|
35
35
|
|
36
36
|
@credit = Kaui::Credit.new("accountId" => @account_id, "invoiceId" => @invoice_id,
|
37
|
-
"creditAmount" => credit_amount, "effectiveDate" => Time.now.
|
37
|
+
"creditAmount" => credit_amount, "effectiveDate" => Date.parse(Time.now.to_s).to_s)
|
38
38
|
end
|
39
39
|
|
40
40
|
def create
|
@@ -103,7 +103,6 @@ class Kaui::SubscriptionsController < Kaui::EngineController
|
|
103
103
|
def edit
|
104
104
|
begin
|
105
105
|
@subscription = Kaui::KillbillHelper.get_subscription(params[:id], options_for_klient)
|
106
|
-
|
107
106
|
if @subscription.present?
|
108
107
|
@bundle = Kaui::KillbillHelper::get_bundle(@subscription.bundle_id, options_for_klient)
|
109
108
|
@account = Kaui::KillbillHelper::get_account(@bundle.account_id, false, false, options_for_klient)
|
@@ -133,7 +132,7 @@ class Kaui::SubscriptionsController < Kaui::EngineController
|
|
133
132
|
|
134
133
|
plan = catalog[params[:plan_name]]
|
135
134
|
requested_date = params[:requested_date]
|
136
|
-
policy = params[:policy]
|
135
|
+
policy = params[:policy] unless params[:policy].empty?
|
137
136
|
|
138
137
|
subscription.billing_period = plan["billingPeriod"]
|
139
138
|
subscription.product_category = plan["productCategory"]
|
@@ -180,7 +180,7 @@ module Kaui
|
|
180
180
|
end
|
181
181
|
|
182
182
|
def self.get_subscription(subscription_id, options = {})
|
183
|
-
data = call_killbill :get, "/1.0/kb/
|
183
|
+
data = call_killbill :get, "/1.0/kb/entitlements/#{subscription_id}", options
|
184
184
|
process_response(data, :single) { |json| Kaui::Subscription.new(json) }
|
185
185
|
end
|
186
186
|
|
@@ -397,14 +397,20 @@ module Kaui
|
|
397
397
|
def self.create_refund(payment_id, refund, current_user = nil, reason = nil, comment = nil, options = {})
|
398
398
|
|
399
399
|
new_refund = KillBillClient::Model::Refund.new
|
400
|
+
new_refund.payment_id = payment_id
|
400
401
|
new_refund.amount = refund["amount"]
|
401
402
|
new_refund.adjusted = refund["adjusted"]
|
402
|
-
|
403
|
+
if ! refund["adjustments"].nil?
|
404
|
+
new_refund.adjustments = []
|
405
|
+
refund["adjustments"].each do |a|
|
406
|
+
item = KillBillClient::Model::InvoiceItemAttributes.new
|
407
|
+
item.invoice_item_id = a.invoice_item_id
|
408
|
+
item.amount = a.amount
|
409
|
+
new_refund.adjustments << item
|
410
|
+
end
|
411
|
+
end
|
403
412
|
#no need to pass adjustment_type
|
404
|
-
|
405
|
-
new_refund.create(payment_id,
|
406
|
-
refund,
|
407
|
-
extract_created_by(current_user),
|
413
|
+
new_refund.create(extract_created_by(current_user),
|
408
414
|
extract_reason_code(reason),
|
409
415
|
comment,
|
410
416
|
options)
|
@@ -418,12 +424,14 @@ module Kaui
|
|
418
424
|
end
|
419
425
|
|
420
426
|
def self.create_chargeback(chargeback, current_user = nil, reason = nil, comment = nil, options = {})
|
421
|
-
chargeback_data = Kaui::Refund.camelize(chargeback.to_hash)
|
422
427
|
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
428
|
+
new_chargeback = KillBillClient::Model::Chargeback.new
|
429
|
+
new_chargeback.payment_id = chargeback.payment_id
|
430
|
+
new_chargeback.amount = chargeback.chargeback_amount
|
431
|
+
new_chargeback.create(extract_created_by(current_user),
|
432
|
+
extract_reason_code(reason),
|
433
|
+
comment,
|
434
|
+
options)
|
427
435
|
end
|
428
436
|
|
429
437
|
############## CREDIT ##############
|
@@ -505,8 +513,9 @@ module Kaui
|
|
505
513
|
############## OVERDUE ##############
|
506
514
|
|
507
515
|
def self.get_overdue_state_for_account(account_id, options = {})
|
508
|
-
|
509
|
-
|
516
|
+
account = KillBillClient::Model::Account.new
|
517
|
+
account.account_id = account_id
|
518
|
+
account.overdue(options)
|
510
519
|
end
|
511
520
|
|
512
521
|
############## ANALYTICS ##############
|
@@ -69,7 +69,7 @@
|
|
69
69
|
<td><%= "INVOICE" %></td>
|
70
70
|
<td><span class="hide" title="<%= invoice.invoice_number %>"></span>
|
71
71
|
<%= "Amount:" %> <%= humanized_money_with_symbol Kaui::Base.to_money(invoice.amount, @account.currency) %> (<%= @account.currency %>)<br/>
|
72
|
-
<%= "Balance:" %> <%= humanized_money_with_symbol Kaui::Base.to_money(invoice.
|
72
|
+
<%= "Balance:" %> <%= humanized_money_with_symbol Kaui::Base.to_money(invoice.balance, @account.currency) %> (<%= @account.currency %>)<br/>
|
73
73
|
<% if invoice.credit_adj.present? && invoice.credit_adj > 0 %>
|
74
74
|
<%= "Credit adjustment:" %> <%= humanized_money_with_symbol Kaui::Base.to_money(invoice.credit_adj, @account.currency) %> (<%= @account.currency %>)<br/>
|
75
75
|
<% end %>
|
@@ -64,7 +64,7 @@
|
|
64
64
|
<div class="control-group">
|
65
65
|
<%= label_tag :requested_date, 'Requested Date:', :class => "control-label" %>
|
66
66
|
<div class="controls">
|
67
|
-
<%= text_field_tag :requested_date, Time.now.
|
67
|
+
<%= text_field_tag :requested_date, Date.parse(Time.now.to_s).to_s, :class => 'input-xlarge date-picker' %>
|
68
68
|
</div>
|
69
69
|
</div>
|
70
70
|
<div class="control-group">
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<div class="control-group">
|
26
26
|
<%= label_tag :requested_date, 'Change Date:', :class => "control-label" %>
|
27
27
|
<div class="controls">
|
28
|
-
<%= text_field_tag :requested_date, Time.now.
|
28
|
+
<%= text_field_tag :requested_date, Date.parse(Time.now.to_s).to_s, :class => 'input-xlarge date-picker' %>
|
29
29
|
</div>
|
30
30
|
</div>
|
31
31
|
<div class="control-group">
|
data/kaui.gemspec
CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_dependency 'rest-client', '~> 1.6.7'
|
28
28
|
s.add_dependency 'money-rails', '~> 0.8.1'
|
29
29
|
s.add_dependency 'd3_rails', '~> 3.2.8'
|
30
|
-
s.add_dependency 'killbill-client', '~> 0.4.
|
30
|
+
s.add_dependency 'killbill-client', '~> 0.4.2'
|
31
31
|
s.add_dependency 'devise', '~> 3.0.2'
|
32
32
|
s.add_dependency 'cancan', '~> 1.6.10'
|
33
33
|
|
data/lib/kaui/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kaui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.4.
|
101
|
+
version: 0.4.2
|
102
102
|
type: :runtime
|
103
103
|
prerelease: false
|
104
104
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -106,7 +106,7 @@ dependencies:
|
|
106
106
|
requirements:
|
107
107
|
- - ~>
|
108
108
|
- !ruby/object:Gem::Version
|
109
|
-
version: 0.4.
|
109
|
+
version: 0.4.2
|
110
110
|
- !ruby/object:Gem::Dependency
|
111
111
|
name: devise
|
112
112
|
requirement: !ruby/object:Gem::Requirement
|
@@ -435,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
435
435
|
version: '0'
|
436
436
|
segments:
|
437
437
|
- 0
|
438
|
-
hash:
|
438
|
+
hash: -4397666947542555501
|
439
439
|
requirements: []
|
440
440
|
rubyforge_project:
|
441
441
|
rubygems_version: 1.8.25
|