killbill 3.1.2 → 3.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/NEWS +3 -0
- data/VERSION +1 -1
- data/generators/active_merchant/templates/pom.xml.rb +1 -1
- data/lib/killbill/helpers/active_merchant/active_record/models/payment_method.rb +17 -4
- data/lib/killbill/helpers/active_merchant/active_record/models/response.rb +7 -2
- data/lib/killbill/helpers/active_merchant/active_record/models/transaction.rb +11 -1
- data/lib/killbill/helpers/active_merchant/payment_plugin.rb +6 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 82a09a7d410fc5aff99f49e2ff2b4426e8b951b7
|
4
|
+
data.tar.gz: db04bda5377c39f74d59c7315056a859754c59cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a98a498e8a8260ef655e34b48d5e2abcca0d5817e58d45ed6e853405ae8679f27a8891b4491211fe42ab7744c3c27a5b81697c6a36bb1d761e4fc9f7c1918e8b
|
7
|
+
data.tar.gz: 963f49b07a89afaaeb6fc4b584da8c61dabb7fc49ad417de918607af92f0da705b2e685e763260e3589bd1e94e2cda140463a452ab643a5fe6c544b069ca5172
|
data/NEWS
CHANGED
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.1.
|
1
|
+
3.1.3
|
@@ -2,7 +2,7 @@
|
|
2
2
|
<!--
|
3
3
|
~ Copyright 2014 The Billing Project, LLC
|
4
4
|
~
|
5
|
-
~
|
5
|
+
~ The Billing Project licenses this file to you under the Apache License, version 2.0
|
6
6
|
~ (the "License"); you may not use this file except in compliance with the
|
7
7
|
~ License. You may obtain a copy of the License at:
|
8
8
|
~
|
@@ -33,11 +33,19 @@ module Killbill
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.from_kb_account_id(kb_account_id, kb_tenant_id)
|
36
|
-
|
36
|
+
if kb_tenant_id.nil?
|
37
|
+
where('kb_account_id = ? AND is_deleted = ?', kb_account_id, false)
|
38
|
+
else
|
39
|
+
where('kb_account_id = ? AND kb_tenant_id = ? AND is_deleted = ?', kb_account_id, kb_tenant_id, false)
|
40
|
+
end
|
37
41
|
end
|
38
42
|
|
39
43
|
def self.from_kb_payment_method_id(kb_payment_method_id, kb_tenant_id)
|
40
|
-
|
44
|
+
if kb_tenant_id.nil?
|
45
|
+
payment_methods = where('kb_payment_method_id = ? AND is_deleted = ?', kb_payment_method_id, false)
|
46
|
+
else
|
47
|
+
payment_methods = where('kb_payment_method_id = ? AND kb_tenant_id = ? AND is_deleted = ?', kb_payment_method_id, kb_tenant_id, false)
|
48
|
+
end
|
41
49
|
raise "No payment method found for payment method #{kb_payment_method_id}" if payment_methods.empty?
|
42
50
|
raise "Kill Bill payment method #{kb_payment_method_id} mapping to multiple active plugin payment methods" if payment_methods.size > 1
|
43
51
|
payment_methods[0]
|
@@ -78,8 +86,13 @@ module Killbill
|
|
78
86
|
def self.search_query(search_key, kb_tenant_id, offset = nil, limit = nil)
|
79
87
|
t = self.arel_table
|
80
88
|
|
81
|
-
|
82
|
-
|
89
|
+
if kb_tenant_id.nil?
|
90
|
+
query = t.where(search_where_clause(t, search_key))
|
91
|
+
.order(t[:id])
|
92
|
+
else
|
93
|
+
query = t.where(search_where_clause(t, search_key).and(t[:kb_tenant_id].eq(kb_tenant_id)))
|
94
|
+
.order(t[:id])
|
95
|
+
end
|
83
96
|
|
84
97
|
if offset.blank? and limit.blank?
|
85
98
|
# true is for count distinct
|
@@ -60,8 +60,13 @@ module Killbill
|
|
60
60
|
def self.search_query(api_call, search_key, kb_tenant_id, offset = nil, limit = nil)
|
61
61
|
t = self.arel_table
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
if kb_tenant_id.nil?
|
64
|
+
query = t.where(search_where_clause(t, search_key, api_call))
|
65
|
+
.order(t[:id])
|
66
|
+
else
|
67
|
+
query = t.where(search_where_clause(t, search_key, api_call).and(t[:kb_tenant_id].eq(kb_tenant_id)))
|
68
|
+
.order(t[:id])
|
69
|
+
end
|
65
70
|
|
66
71
|
if offset.blank? and limit.blank?
|
67
72
|
# true is for count distinct
|
@@ -29,6 +29,12 @@ module Killbill
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def self.do_find_candidate_transaction_for_refund(api_call, kb_payment_id, kb_tenant_id, amount_in_cents)
|
32
|
+
|
33
|
+
if kb_tenant_id.nil?
|
34
|
+
transactions = where('amount_in_cents >= ? AND api_call = ? AND kb_payment_id = ?', amount_in_cents, api_call, kb_payment_id)
|
35
|
+
else
|
36
|
+
transactions = where('amount_in_cents >= ? AND api_call = ? AND kb_tenant_id = ? AND kb_payment_id = ?', amount_in_cents, api_call, kb_tenant_id, kb_payment_id)
|
37
|
+
end
|
32
38
|
# Find one successful charge which amount is at least the amount we are trying to refund
|
33
39
|
transactions = where('amount_in_cents >= ? AND api_call = ? AND kb_tenant_id = ? AND kb_payment_id = ?', amount_in_cents, api_call, kb_tenant_id, kb_payment_id)
|
34
40
|
raise "Unable to find transaction for payment #{kb_payment_id} and api_call #{api_call}" if transactions.size == 0
|
@@ -47,7 +53,11 @@ module Killbill
|
|
47
53
|
private
|
48
54
|
|
49
55
|
def self.transaction_from_kb_payment_id(api_call, kb_payment_id, kb_tenant_id, how_many)
|
50
|
-
|
56
|
+
if kb_tenant_id.nil?
|
57
|
+
transactions = where('api_call = ? AND kb_payment_id = ?', api_call, kb_payment_id)
|
58
|
+
else
|
59
|
+
transactions = where('api_call = ? AND kb_tenant_id = ? AND kb_payment_id = ?', api_call, kb_tenant_id, kb_payment_id)
|
60
|
+
end
|
51
61
|
raise "Unable to find transaction id for payment #{kb_payment_id}" if transactions.empty?
|
52
62
|
if how_many == :single
|
53
63
|
raise "Kill Bill payment #{kb_payment_id} mapping to multiple plugin transactions" if transactions.size > 1
|
@@ -310,7 +310,7 @@ module Killbill
|
|
310
310
|
}
|
311
311
|
|
312
312
|
# Retrieve the ActiveMerchant integration
|
313
|
-
integration_module =
|
313
|
+
integration_module = get_active_merchant_module
|
314
314
|
service_class = integration_module.const_get('Helper')
|
315
315
|
service = service_class.new(order, account, service_options)
|
316
316
|
|
@@ -353,7 +353,7 @@ module Killbill
|
|
353
353
|
options = properties_to_hash(properties)
|
354
354
|
|
355
355
|
# Retrieve the ActiveMerchant integration
|
356
|
-
integration_module =
|
356
|
+
integration_module = get_active_merchant_module
|
357
357
|
service_class = integration_module.const_get('Notification')
|
358
358
|
# notification is either a body or a query string
|
359
359
|
service = service_class.new(notification, options)
|
@@ -453,6 +453,10 @@ module Killbill
|
|
453
453
|
end
|
454
454
|
properties
|
455
455
|
end
|
456
|
+
|
457
|
+
def get_active_merchant_module
|
458
|
+
::ActiveMerchant::Billing::Integrations.const_get(@identifier.to_s.camelize)
|
459
|
+
end
|
456
460
|
end
|
457
461
|
end
|
458
462
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.1.
|
4
|
+
version: 3.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kill Bill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-05-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sinatra
|