kaui 0.4.8 → 0.4.9
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/refunds_controller.rb +7 -5
- data/app/helpers/kaui/killbill_helper.rb +17 -14
- data/app/views/kaui/account_timelines/show.html.erb +1 -1
- data/app/views/kaui/refunds/_refunds_table.html.erb +1 -1
- data/kaui.gemspec +1 -1
- data/lib/kaui/version.rb +1 -1
- metadata +5 -5
data/Gemfile.lock
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
kaui (0.4.
|
4
|
+
kaui (0.4.9)
|
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.
|
9
|
+
killbill-client (~> 0.4.1)
|
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.
|
63
|
+
killbill-client (0.4.1)
|
64
64
|
mail (2.5.4)
|
65
65
|
mime-types (~> 1.16)
|
66
66
|
treetop (~> 1.4.8)
|
@@ -66,10 +66,12 @@ class Kaui::RefundsController < Kaui::EngineController
|
|
66
66
|
|
67
67
|
def create
|
68
68
|
invoice = Kaui::KillbillHelper::get_invoice(params[:invoice_id], true, "NONE", options_for_klient)
|
69
|
-
refund =
|
70
|
-
refund.
|
71
|
-
|
72
|
-
|
69
|
+
refund = {}
|
70
|
+
refund.merge! params[:refund]
|
71
|
+
refund["adjusted"] = (refund["adjustment_type"] != "noInvoiceAdjustment")
|
72
|
+
|
73
|
+
if refund["adjustment_type"] == "invoiceItemAdjustment"
|
74
|
+
refund["adjustments"] = []
|
73
75
|
params[:adjustments].each_with_index do |ii, idx|
|
74
76
|
original_item = find_original_item(invoice.items, ii[0])
|
75
77
|
h = Hash.new
|
@@ -79,7 +81,7 @@ class Kaui::RefundsController < Kaui::EngineController
|
|
79
81
|
h[:amount] = (ii[1].to_f == original_item.amount) ? nil : ii[1]
|
80
82
|
kaui_ii = Kaui::InvoiceItem.new(h)
|
81
83
|
puts "Got #{kaui_ii.inspect}"
|
82
|
-
refund
|
84
|
+
refund["adjustments"][idx] = kaui_ii
|
83
85
|
end
|
84
86
|
end
|
85
87
|
if refund.present?
|
@@ -186,7 +186,7 @@ module Kaui
|
|
186
186
|
|
187
187
|
def self.create_subscription(subscription, current_user = nil, reason = nil, comment = nil, options = {})
|
188
188
|
|
189
|
-
entitlement = KillBillClient::Model::
|
189
|
+
entitlement = KillBillClient::Model::Subscription.new
|
190
190
|
entitlement.account_id = subscription.account_id
|
191
191
|
entitlement.bundle_id = subscription.bundle_id
|
192
192
|
entitlement.external_key = subscription.external_key
|
@@ -202,7 +202,7 @@ module Kaui
|
|
202
202
|
def self.update_subscription(subscription, requested_date = nil, policy = nil, current_user = nil, reason = nil, comment = nil, options = {})
|
203
203
|
|
204
204
|
requested_date = requested_date.to_s unless requested_date.blank?
|
205
|
-
entitlement = KillBillClient::Model::
|
205
|
+
entitlement = KillBillClient::Model::Subscription.new
|
206
206
|
entitlement.subscription_id = subscription.subscription_id
|
207
207
|
entitlement.change_plan({:productName => subscription.product_name, :billingPeriod => subscription.billing_period, :priceList => subscription.price_list},
|
208
208
|
extract_created_by(current_user), extract_reason_code(reason), comment, requested_date, policy, false, options)
|
@@ -210,7 +210,7 @@ module Kaui
|
|
210
210
|
|
211
211
|
def self.delete_subscription(subscription_id, current_user = nil, reason = nil, comment = nil, policy = nil, options = {})
|
212
212
|
|
213
|
-
entitlement = KillBillClient::Model::
|
213
|
+
entitlement = KillBillClient::Model::Subscription.new
|
214
214
|
entitlement.subscription_id = subscription_id
|
215
215
|
# We are using same entitlement/billing policy here for now
|
216
216
|
entitlement.cancel(extract_created_by(current_user), extract_reason_code(reason), comment, nil, policy, policy, true, options)
|
@@ -387,24 +387,27 @@ module Kaui
|
|
387
387
|
############## REFUND ##############
|
388
388
|
|
389
389
|
def self.get_refund(refund_id, options = {})
|
390
|
-
|
391
|
-
process_response(data, :single) { |json| Kaui::Refund.new(json) }
|
390
|
+
KillBillClient::Model::Refund.find_by_id refund_id, options
|
392
391
|
end
|
393
392
|
|
394
393
|
def self.get_refunds_for_payment(payment_id, options = {})
|
395
|
-
|
396
|
-
process_response(data, :multiple) { |json| Kaui::Refund.new(json) }
|
394
|
+
KillBillClient::Model::Refund.find_all_by_payment_id payment_id, options
|
397
395
|
end
|
398
396
|
|
399
397
|
def self.create_refund(payment_id, refund, current_user = nil, reason = nil, comment = nil, options = {})
|
400
|
-
refund_data = Kaui::Refund.camelize(refund.to_hash)
|
401
|
-
# We don't want to pass adjustment_type
|
402
|
-
refund_data.delete(:adjustmentType)
|
403
398
|
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
399
|
+
new_refund = KillBillClient::Model::Refund.new
|
400
|
+
new_refund.amount = refund["amount"]
|
401
|
+
new_refund.adjusted = refund["adjusted"]
|
402
|
+
new_refund.adjustments = refund["adjustments"]
|
403
|
+
#no need to pass adjustment_type
|
404
|
+
|
405
|
+
new_refund.create(payment_id,
|
406
|
+
refund,
|
407
|
+
extract_created_by(current_user),
|
408
|
+
extract_reason_code(reason),
|
409
|
+
comment,
|
410
|
+
options)
|
408
411
|
end
|
409
412
|
|
410
413
|
############## CHARGEBACK ##############
|
@@ -179,7 +179,7 @@
|
|
179
179
|
<td><%= "CHARGEBACK" %></td>
|
180
180
|
<td>
|
181
181
|
<%= "Payment id:" %> <%= chargeback.payment_id %><br/>
|
182
|
-
<%= "Chargeback Amount:" %> <%= humanized_money_with_symbol Kaui::Base.to_money(chargeback.
|
182
|
+
<%= "Chargeback Amount:" %> <%= humanized_money_with_symbol Kaui::Base.to_money(chargeback.amount, payment.currency) %> (<%= payment.currency %>)<br/>
|
183
183
|
</td>
|
184
184
|
<td>
|
185
185
|
<% if chargeback.audit_logs.present? %>
|
@@ -19,7 +19,7 @@
|
|
19
19
|
<tr>
|
20
20
|
<td><%= format_date(refund.requested_date, @account.timezone).html_safe if refund.requested_date.present? %></td>
|
21
21
|
<td><%= format_date(refund.effective_date, @account.timezone).html_safe if refund.effective_date.present? %></td>
|
22
|
-
<td><%= humanized_money_with_symbol refund.
|
22
|
+
<td><%= humanized_money_with_symbol Kaui::Base.to_money(refund.amount, refund.currency) %> (<%= refund.currency %>)</td>
|
23
23
|
<td><%= refund.adjusted %></td>
|
24
24
|
<td><%= link_to refund.refund_id, refund_path(refund.refund_id) %></td>
|
25
25
|
<td><%= refund.payment_id %></td>
|
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.
|
30
|
+
s.add_dependency 'killbill-client', '~> 0.4.1'
|
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.
|
4
|
+
version: 0.4.9
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-09-
|
12
|
+
date: 2013-09-19 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -98,7 +98,7 @@ dependencies:
|
|
98
98
|
requirements:
|
99
99
|
- - ~>
|
100
100
|
- !ruby/object:Gem::Version
|
101
|
-
version: 0.
|
101
|
+
version: 0.4.1
|
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.
|
109
|
+
version: 0.4.1
|
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: 11207357591109144
|
439
439
|
requirements: []
|
440
440
|
rubyforge_project:
|
441
441
|
rubygems_version: 1.8.25
|