killbill-client 0.31.0 → 0.32.0
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.
- checksums.yaml +4 -4
- data/lib/killbill_client.rb +3 -3
- data/lib/killbill_client/api/net_http_adapter.rb +12 -7
- data/lib/killbill_client/models/combo_hosted_payment_page.rb +1 -7
- data/lib/killbill_client/models/combo_transaction.rb +1 -7
- data/lib/killbill_client/models/nodes_info.rb +2 -2
- data/lib/killbill_client/models/transaction.rb +4 -25
- data/lib/killbill_client/version.rb +1 -1
- data/spec/spec_helper.rb +1 -0
- 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: b42d9b6165b77debb78d4ad43bf66931d4c0efc9
|
4
|
+
data.tar.gz: ad346ea2dc5ec3caa7fc49109ed103b264fc26f4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2962275a008bc054ed028028800a001277d2b9abefcd6f4c9c1404b14cea5938158c013242e1ef41663d98f00b2a32c2fd1f34eb3c663631d4ab7e4c03e9e96f
|
7
|
+
data.tar.gz: 22bf03cddacefed827af25c1447462dada86d7bc6449ab95dca3827ce43e375c29664e9391d2ededbd034376b6b55e362855af9a10913bb569df410822ff2bb6
|
data/lib/killbill_client.rb
CHANGED
@@ -63,11 +63,11 @@ module KillBillClient
|
|
63
63
|
# @return [Logger, nil]
|
64
64
|
# @example
|
65
65
|
# require 'logger'
|
66
|
-
#
|
66
|
+
# KillBillClient.logger = Logger.new STDOUT
|
67
67
|
# @example Rails applications automatically log to the Rails log:
|
68
|
-
#
|
68
|
+
# KillBillClient.logger = Rails.logger
|
69
69
|
# @example Turn off logging entirely:
|
70
|
-
#
|
70
|
+
# KillBillClient.logger = nil # Or KillBillClient.logger = Logger.new nil
|
71
71
|
attr_accessor :logger
|
72
72
|
|
73
73
|
# Convenience logging method includes a Logger#progname dynamically.
|
@@ -36,12 +36,16 @@ module KillBillClient
|
|
36
36
|
}
|
37
37
|
|
38
38
|
def encode_params(options = {})
|
39
|
-
# Plugin properties are passed in the options but we want to send them as query parameters,
|
39
|
+
# Plugin properties and controlPluginNames are passed in the options but we want to send them as query parameters,
|
40
40
|
# so remove with from global hash and insert them under :params
|
41
41
|
plugin_properties = options.delete :pluginProperty
|
42
42
|
if plugin_properties && plugin_properties.size > 0
|
43
43
|
options[:params][:pluginProperty] = plugin_properties.map { |p| "#{CGI.escape p.key}=#{CGI.escape p.value}" }
|
44
44
|
end
|
45
|
+
|
46
|
+
control_plugin_names = options.delete(:controlPluginNames)
|
47
|
+
options[:params][:controlPluginName] = control_plugin_names if control_plugin_names
|
48
|
+
|
45
49
|
return nil unless (options[:params] && !options[:params].empty?)
|
46
50
|
|
47
51
|
pairs = options[:params].map { |key, value|
|
@@ -135,12 +139,12 @@ module KillBillClient
|
|
135
139
|
net_http.each_pair { |key, value| http.send "#{key}=", value }
|
136
140
|
|
137
141
|
if KillBillClient.logger
|
138
|
-
KillBillClient.log :info, '
|
142
|
+
KillBillClient.log :info, "Request method='%s', uri='%s'" % [request.method, uri]
|
139
143
|
headers = request.to_hash
|
140
144
|
headers['authorization'] &&= ['Basic [FILTERED]']
|
141
|
-
KillBillClient.log :debug, headers.
|
145
|
+
KillBillClient.log :debug, headers.keys.map { |k| "#{k}='#{headers[k].join(',')}'" }.join(', ')
|
142
146
|
if request.body && !request.body.empty? && request['Content-Type'].include?('application/json')
|
143
|
-
KillBillClient.log :debug, request.body
|
147
|
+
KillBillClient.log :debug, "requestBody='#{request.body}'"
|
144
148
|
end
|
145
149
|
start_time = Time.now
|
146
150
|
end
|
@@ -178,15 +182,16 @@ module KillBillClient
|
|
178
182
|
else
|
179
183
|
:fatal
|
180
184
|
end
|
181
|
-
KillBillClient.log level, '
|
185
|
+
KillBillClient.log level, "Response code='%d', reason='%s', latency='%.1f'" % [
|
182
186
|
code,
|
183
187
|
response.class.name[9, response.class.name.length].gsub(
|
184
188
|
/([a-z])([A-Z])/, '\1 \2'
|
185
189
|
),
|
186
190
|
latency
|
187
191
|
]
|
188
|
-
|
189
|
-
KillBillClient.log :debug,
|
192
|
+
hash_response = response.to_hash
|
193
|
+
KillBillClient.log :debug, hash_response.keys.map { |k| "#{k}='#{hash_response[k].join(',')}'" }.join(', ')
|
194
|
+
KillBillClient.log :debug, "responseBody='#{response.body}'" if response.body
|
190
195
|
end
|
191
196
|
|
192
197
|
case code
|
@@ -3,15 +3,9 @@ module KillBillClient
|
|
3
3
|
class ComboHostedPaymentPage < ComboHostedPaymentPageAttributes
|
4
4
|
|
5
5
|
def build_form_descriptor(user = nil, reason = nil, comment = nil, options = {})
|
6
|
-
query_map = {
|
7
|
-
}
|
8
|
-
if options.include? :controlPluginNames
|
9
|
-
query_map[:controlPluginName] = options.delete(:controlPluginNames)
|
10
|
-
end
|
11
|
-
|
12
6
|
self.class.post "#{HostedPaymentPage::KILLBILL_API_HPP_PREFIX}/hosted/form",
|
13
7
|
to_json,
|
14
|
-
|
8
|
+
{},
|
15
9
|
{
|
16
10
|
:user => user,
|
17
11
|
:reason => reason,
|
@@ -23,15 +23,9 @@ module KillBillClient
|
|
23
23
|
private
|
24
24
|
|
25
25
|
def combo_payment(user, reason, comment, options, refresh_options = nil)
|
26
|
-
query_map = {
|
27
|
-
}
|
28
|
-
if options.include? :controlPluginNames
|
29
|
-
query_map[:controlPluginName] = options.delete(:controlPluginNames)
|
30
|
-
end
|
31
|
-
|
32
26
|
created_transaction = self.class.post "#{Payment::KILLBILL_API_PAYMENTS_PREFIX}/combo",
|
33
27
|
to_json,
|
34
|
-
|
28
|
+
{},
|
35
29
|
{
|
36
30
|
:user => user,
|
37
31
|
:reason => reason,
|
@@ -105,7 +105,7 @@ module KillBillClient
|
|
105
105
|
|
106
106
|
def wait_for_plugin_command_completion(command, plugin, timeout_sec, sleep_sec)
|
107
107
|
if KillBillClient.logger
|
108
|
-
KillBillClient.log :info,
|
108
|
+
KillBillClient.log :info, "NodesInfo waiting for command='%s', plugin='%s'" % [command, plugin]
|
109
109
|
end
|
110
110
|
begin
|
111
111
|
Timeout::timeout(timeout_sec) do
|
@@ -117,7 +117,7 @@ module KillBillClient
|
|
117
117
|
end
|
118
118
|
rescue Timeout::Error => e
|
119
119
|
if KillBillClient.logger
|
120
|
-
KillBillClient.log :
|
120
|
+
KillBillClient.log :warn, "NodesInfo timeout after %s sec for command='%s', plugin='%s'" % [timeout_sec, command, plugin]
|
121
121
|
end
|
122
122
|
raise e
|
123
123
|
end
|
@@ -61,15 +61,9 @@ module KillBillClient
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def capture(user = nil, reason = nil, comment = nil, options = {})
|
64
|
-
query_map = {
|
65
|
-
}
|
66
|
-
if options.include? :controlPluginNames
|
67
|
-
query_map[:controlPluginName] = options.delete(:controlPluginNames)
|
68
|
-
end
|
69
|
-
|
70
64
|
created_transaction = self.class.post "#{follow_up_path(payment_id)}",
|
71
65
|
to_json,
|
72
|
-
|
66
|
+
{},
|
73
67
|
{
|
74
68
|
:user => user,
|
75
69
|
:reason => reason,
|
@@ -80,14 +74,9 @@ module KillBillClient
|
|
80
74
|
|
81
75
|
def refund(user = nil, reason = nil, comment = nil, options = {})
|
82
76
|
|
83
|
-
query_map = {
|
84
|
-
}
|
85
|
-
if options.include? :controlPluginNames
|
86
|
-
query_map[:controlPluginName] = options.delete(:controlPluginNames)
|
87
|
-
end
|
88
77
|
created_transaction = self.class.post "#{follow_up_path(payment_id)}/refunds",
|
89
78
|
to_json,
|
90
|
-
|
79
|
+
{},
|
91
80
|
{
|
92
81
|
:user => user,
|
93
82
|
:reason => reason,
|
@@ -98,14 +87,9 @@ module KillBillClient
|
|
98
87
|
|
99
88
|
def void(user = nil, reason = nil, comment = nil, options = {})
|
100
89
|
|
101
|
-
query_map = {
|
102
|
-
}
|
103
|
-
if options.include? :controlPluginNames
|
104
|
-
query_map[:controlPluginName] = options.delete(:controlPluginNames)
|
105
|
-
end
|
106
90
|
created_transaction = self.class.delete "#{follow_up_path(payment_id)}",
|
107
91
|
to_json,
|
108
|
-
|
92
|
+
{},
|
109
93
|
{
|
110
94
|
:user => user,
|
111
95
|
:reason => reason,
|
@@ -116,14 +100,9 @@ module KillBillClient
|
|
116
100
|
|
117
101
|
def chargeback(user = nil, reason = nil, comment = nil, options = {})
|
118
102
|
|
119
|
-
query_map = {
|
120
|
-
}
|
121
|
-
if options.include? :controlPluginNames
|
122
|
-
query_map[:controlPluginName] = options.delete(:controlPluginNames)
|
123
|
-
end
|
124
103
|
created_transaction = self.class.post "#{follow_up_path(payment_id)}/chargebacks",
|
125
104
|
to_json,
|
126
|
-
|
105
|
+
{},
|
127
106
|
{
|
128
107
|
:user => user,
|
129
108
|
:reason => reason,
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: killbill-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.32.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Killbill core team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|