zuora_connect 2.0.5zj → 2.0.5zz
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/models/zuora_connect/app_instance_base.rb +39 -47
- data/app/models/zuora_connect/telegraf.rb +2 -2
- data/app/views/zuora_connect/static/error_unhandled.erb +1 -7
- data/lib/middleware/request_id_middleware.rb +1 -1
- data/lib/zuora_connect/controllers/helpers.rb +23 -39
- data/lib/zuora_connect/version.rb +1 -1
- data/lib/zuora_connect.rb +2 -2
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89eb67971713f7c5d1f482041a612b88baad3447b060f8bad6158e7716b1fd78
|
4
|
+
data.tar.gz: 05e431bddf12100125276f9f26863ed858fcad0df15433dfd34b52884668135e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74ddb5fdb50aa38ea8e7a217993898347be48270660760f5e9a963f124ffcaafbe5fa1732dd236e67c57866bb98bc250906ee2d13b6569fb93a6f0009f3d774f
|
7
|
+
data.tar.gz: 655ecce962805517669a68eb6f1e4517fe0296be77694676c9440d5cedf4d87118fd785ecb4ae8af9bb770fd7012c29fa7f94e57ca2b751ba3b1684dfd0c1f4e
|
@@ -178,11 +178,10 @@ module ZuoraConnect
|
|
178
178
|
retry
|
179
179
|
rescue => ex
|
180
180
|
if recoverable_session
|
181
|
-
ZuoraConnect.logger.warn("REBUILDING - Using backup expired cache",
|
181
|
+
ZuoraConnect.logger.warn("REBUILDING - Using backup expired cache", self.default_ougai_items)
|
182
182
|
self.build_task(task_data: session["#{self.id}::task_data"], session: session)
|
183
183
|
return self
|
184
184
|
else
|
185
|
-
ZuoraConnect.logger.error("Failed new session", ex, self.default_ougai_items)
|
186
185
|
raise
|
187
186
|
end
|
188
187
|
ensure
|
@@ -192,26 +191,21 @@ module ZuoraConnect
|
|
192
191
|
ZuoraConnect.logger.error(ex) if !IGNORED_LOCALS.include?(ex.locale.to_s.downcase)
|
193
192
|
end
|
194
193
|
Time.zone = self.timezone
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
ElasticAPM.set_tag(:organization, organizations.first)
|
201
|
-
end
|
202
|
-
self.logitem(item: {tenant_ids: tenants, organization: organizations})
|
203
|
-
|
204
|
-
params = {
|
205
|
-
:name => self.task_data.dig('name'),
|
206
|
-
:zuora_entity_ids => (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).map{|e| e['id']},
|
207
|
-
:zuora_tenant_ids => tenants.map(&:to_s),
|
208
|
-
}
|
209
|
-
zuora_domain = self.send(LOGIN_TENANT_DESTINATION).client.rest_domain
|
210
|
-
ZuoraConnect::RequestIdMiddleware.zuora_rest_domain = zuora_domain
|
211
|
-
params.merge!({:zuora_domain => zuora_domain }) if self.methods.include?(LOGIN_TENANT_DESTINATION.to_sym)
|
212
|
-
params = params.reject{|k,v| !self.attributes.keys.member?(k.to_s) || self[k] == v}
|
213
|
-
self.update_columns(params) if params.present?
|
194
|
+
tenants = self.task_data.dig('tenant_ids') || []
|
195
|
+
organizations = self.task_data.dig('organizations') || []
|
196
|
+
if defined?(ElasticAPM) && ElasticAPM.running?
|
197
|
+
ElasticAPM.set_tag(:tenant_id, tenants.first)
|
198
|
+
ElasticAPM.set_tag(:organization, organizations.first)
|
214
199
|
end
|
200
|
+
self.logitem(item: {tenant_ids: tenants, organization: organizations})
|
201
|
+
params = {
|
202
|
+
:name => self.task_data.dig('name'),
|
203
|
+
:zuora_entity_ids => (self.task_data.dig(LOGIN_TENANT_DESTINATION,'entities') || []).map{|e| e['id']},
|
204
|
+
:zuora_tenant_ids => self.task_data.fetch('tenant_ids', []).map(&:to_s),
|
205
|
+
}
|
206
|
+
params.merge!({:zuora_domain => self.send(LOGIN_TENANT_DESTINATION).client.rest_domain })
|
207
|
+
params = params.reject{|k,v| !self.attributes.keys.member?(k.to_s) || self[k] == v}
|
208
|
+
self.update_columns(params) if params.present?
|
215
209
|
end
|
216
210
|
|
217
211
|
def refresh(session: {}, session_fallback: false)
|
@@ -224,39 +218,39 @@ module ZuoraConnect
|
|
224
218
|
|
225
219
|
ZuoraConnect.logger.debug("REFRESH TASK - Connect Task Info Request Time #{response_time.round(2).to_s}", self.default_ougai_items)
|
226
220
|
if response.code == 200
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
end
|
232
|
-
self.build_task(task_data: parsed_json, session: session)
|
221
|
+
self.build_task(task_data: JSON.parse(response.body), session: session)
|
222
|
+
self.last_refresh = Time.now.to_i
|
223
|
+
self.cache_app_instance
|
224
|
+
self.reset_mark_for_refresh
|
233
225
|
else
|
234
226
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
235
227
|
end
|
236
228
|
else
|
237
229
|
self.build_task(task_data: self.zuora_logins, session: session)
|
230
|
+
self.last_refresh = Time.now.to_i
|
231
|
+
self.cache_app_instance
|
232
|
+
self.reset_mark_for_refresh
|
238
233
|
end
|
239
|
-
|
240
|
-
self.cache_app_instance
|
241
|
-
self.reset_mark_for_refresh
|
242
|
-
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
234
|
+
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS).concat(ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
243
235
|
if (refresh_count += 1) < 3
|
244
236
|
sleep(30)
|
245
|
-
ZuoraConnect.logger.
|
237
|
+
ZuoraConnect.logger.info("REFRESH TASK - #{ex.class} Retrying(#{refresh_count})", self.default_ougai_items)
|
246
238
|
retry
|
247
239
|
else
|
248
|
-
ZuoraConnect.logger.fatal("REFRESH TASK -
|
240
|
+
ZuoraConnect.logger.fatal("REFRESH TASK - #{ex.class} Failed #{refresh_count}x", self.default_ougai_items)
|
249
241
|
raise
|
250
242
|
end
|
251
243
|
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
|
252
244
|
if (refresh_count += 1) < 3
|
253
|
-
ZuoraConnect.logger.debug("REFRESH TASK - Communication Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
|
254
245
|
if ex.code == 401
|
246
|
+
ZuoraConnect.logger.info("REFRESH TASK - Failed #{ex.code} - Retrying(#{refresh_count})", self.default_ougai_items)
|
255
247
|
self.refresh_oauth
|
248
|
+
else
|
249
|
+
ZuoraConnect.logger.warn("REFRESH TASK - Failed #{ex.code} - Retrying(#{refresh_count})", self.default_ougai_items)
|
256
250
|
end
|
257
251
|
retry
|
258
252
|
else
|
259
|
-
ZuoraConnect.logger.fatal("REFRESH TASK -
|
253
|
+
ZuoraConnect.logger.fatal("REFRESH TASK - Failed #{ex.code} - #{refresh_count}x", self.default_ougai_items)
|
260
254
|
raise
|
261
255
|
end
|
262
256
|
end
|
@@ -444,7 +438,7 @@ module ZuoraConnect
|
|
444
438
|
else
|
445
439
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
446
440
|
end
|
447
|
-
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS
|
441
|
+
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS).concat(ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
448
442
|
if (update_login_count += 1) < 3
|
449
443
|
retry
|
450
444
|
else
|
@@ -472,7 +466,7 @@ module ZuoraConnect
|
|
472
466
|
else
|
473
467
|
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
|
474
468
|
end
|
475
|
-
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS
|
469
|
+
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS).concat(ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
476
470
|
if (update_task_count += 1) < 3
|
477
471
|
retry
|
478
472
|
else
|
@@ -523,15 +517,14 @@ module ZuoraConnect
|
|
523
517
|
self.oauth_expires_at = Time.at(response_body["created_at"].to_i) + response_body["expires_in"].seconds
|
524
518
|
self.save(:validate => false)
|
525
519
|
else
|
526
|
-
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Refreshing Access Token", response.body, response.code)
|
520
|
+
raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Refreshing Access Token for #{self.id}", response.body, response.code)
|
527
521
|
end
|
528
|
-
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS
|
522
|
+
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS).concat(ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
529
523
|
if (refresh_oauth_count += 1) < 3
|
530
|
-
|
531
|
-
ZuoraConnect.logger.debug("REFRESH OAUTH - Connection Failure Retrying(#{refresh_oauth_count})", ex, self.default_ougai_items)
|
524
|
+
ZuoraConnect.logger.info("REFRESH OAUTH - #{ex.class} Retrying(#{refresh_oauth_count})", self.default_ougai_items)
|
532
525
|
retry
|
533
526
|
else
|
534
|
-
ZuoraConnect.logger.fatal("REFRESH OAUTH -
|
527
|
+
ZuoraConnect.logger.fatal("REFRESH OAUTH - #{ex.class} Failed #{refresh_oauth_count}x", self.default_ougai_items)
|
535
528
|
raise
|
536
529
|
end
|
537
530
|
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
|
@@ -542,10 +535,10 @@ module ZuoraConnect
|
|
542
535
|
return if !self.oauth_expired?
|
543
536
|
|
544
537
|
if (refresh_oauth_count += 1) < 3
|
545
|
-
ZuoraConnect.logger.
|
538
|
+
ZuoraConnect.logger.info("REFRESH OAUTH - Failed #{ex.code} - Retrying(#{refresh_oauth_count})", self.default_ougai_items)
|
546
539
|
retry
|
547
540
|
else
|
548
|
-
ZuoraConnect.logger.fatal("REFRESH OAUTH -
|
541
|
+
ZuoraConnect.logger.fatal("REFRESH OAUTH - Failed #{ex.code} - #{refresh_oauth_count}x", self.default_ougai_items)
|
549
542
|
raise
|
550
543
|
end
|
551
544
|
end
|
@@ -587,7 +580,7 @@ module ZuoraConnect
|
|
587
580
|
begin
|
588
581
|
redis_get_command ||= 0
|
589
582
|
cached_instance = Redis.current.get("AppInstance:#{self.id}")
|
590
|
-
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS
|
583
|
+
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS).concat(ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
591
584
|
if (redis_get_command += 1) < 3
|
592
585
|
retry
|
593
586
|
else
|
@@ -671,10 +664,9 @@ module ZuoraConnect
|
|
671
664
|
begin
|
672
665
|
return JSON.parse(encryptor.decrypt_and_verify(CGI::unescape(data)))
|
673
666
|
rescue ActiveSupport::MessageVerifier::InvalidSignature => ex
|
674
|
-
ZuoraConnect.logger.error("Error Decrypting",
|
667
|
+
ZuoraConnect.logger.error("Error Decrypting", self.default_ougai_items) if log_fatal
|
675
668
|
return rescue_return
|
676
669
|
rescue JSON::ParserError => ex
|
677
|
-
ZuoraConnect.logger.error("JSON Parse Error", ex, self.default_ougai_items) if log_fatal
|
678
670
|
return encryptor.decrypt_and_verify(CGI::unescape(data))
|
679
671
|
end
|
680
672
|
end
|
@@ -19,7 +19,7 @@ module ZuoraConnect
|
|
19
19
|
end
|
20
20
|
rescue => ex
|
21
21
|
self.host = nil
|
22
|
-
ZuoraConnect.logger.warn(self.format_metric_log('Telegraf', "Failed to connect: #{ex.class}"))
|
22
|
+
ZuoraConnect.logger.warn(self.format_metric_log('Telegraf', "Failed to connect: #{ex.class}"))
|
23
23
|
end
|
24
24
|
|
25
25
|
def write(direction: 'Unknown', tags: {}, values: {})
|
@@ -56,7 +56,7 @@ module ZuoraConnect
|
|
56
56
|
self.host.write InfluxDB::PointValue.new({series: series, tags: tags, values: values}).dump
|
57
57
|
rescue => ex
|
58
58
|
self.connect
|
59
|
-
ZuoraConnect.logger.warn(self.format_metric_log('Telegraf',"Failed to write udp: #{ex.class}"))
|
59
|
+
ZuoraConnect.logger.warn(self.format_metric_log('Telegraf',"Failed to write udp: #{ex.class}"))
|
60
60
|
end
|
61
61
|
|
62
62
|
def format_metric_log(message, dump = nil)
|
@@ -59,14 +59,8 @@
|
|
59
59
|
<div class="dialog" style='max-width: 74em;'>
|
60
60
|
<div><h1><%= exception.class %> - '<%= exception.message %>'</h1></div>
|
61
61
|
<p style='text-align: left;'>
|
62
|
-
<% last_line = false %>
|
63
62
|
<% exception.backtrace.each do |line| %>
|
64
|
-
|
65
|
-
<% break if !ending%>
|
66
|
-
<% if ending %>
|
67
|
-
<%= line %><br>
|
68
|
-
<% end %>
|
69
|
-
<% last_line = line.include?(Rails.root.to_s) %>
|
63
|
+
<%= line %><br>
|
70
64
|
<% end %>
|
71
65
|
</p>
|
72
66
|
</div>
|
@@ -88,46 +88,35 @@ module ZuoraConnect
|
|
88
88
|
zuora_entity_id = request.headers['ZuoraCurrentEntity'] || cookies['ZuoraCurrentEntity']
|
89
89
|
|
90
90
|
if zuora_entity_id.present?
|
91
|
-
zuora_tenant_id = cookies['Zuora-Tenant-Id']
|
92
|
-
zuora_user_id = cookies['Zuora-User-Id']
|
93
91
|
zuora_host = request.headers["HTTP_X_FORWARDED_HOST"] || "apisandbox.zuora.com"
|
94
92
|
|
95
|
-
zuora_details = {'host' => zuora_host, 'user_id' => zuora_user_id, 'tenant_id' => zuora_tenant_id, 'entity_id' => zuora_entity_id}
|
96
|
-
|
97
|
-
#Do we need to refresh session identity
|
98
|
-
if request.headers["Zuora-Auth-Token"].present?
|
99
|
-
zuora_client = ZuoraAPI::Oauth.new(url: "https://#{zuora_host}", bearer_token: request.headers["Zuora-Auth-Token"], oauth_session_expires_at: Time.now + 5.minutes )
|
100
|
-
elsif cookies['ZSession'].present?
|
101
|
-
zuora_client = ZuoraAPI::Basic.new(url: "https://#{zuora_host}", session: cookies['ZSession'])
|
102
|
-
else
|
103
|
-
render "zuora_connect/static/error_handled", :locals => {
|
104
|
-
:title => "Missing Authorization Token",
|
105
|
-
:message => "Zuora 'Zuora-Auth-Token' header and 'ZSession' cookie not present."
|
106
|
-
}, :layout => false
|
107
|
-
return
|
108
|
-
end
|
109
|
-
|
110
93
|
begin
|
111
|
-
|
94
|
+
#Do we need to refresh session identity
|
95
|
+
if request.headers["Zuora-Auth-Token"].present?
|
96
|
+
zuora_client = ZuoraAPI::Oauth.new(url: "https://#{zuora_host}", bearer_token: request.headers["Zuora-Auth-Token"], oauth_session_expires_at: Time.now + 5.minutes )
|
97
|
+
elsif cookies['ZSession'].present?
|
98
|
+
zuora_client = ZuoraAPI::Basic.new(url: "https://#{zuora_host}", session: cookies['ZSession'])
|
99
|
+
else
|
100
|
+
render "zuora_connect/static/error_handled", :locals => {
|
101
|
+
:title => "Missing Authorization Token",
|
102
|
+
:message => "Zuora 'Zuora-Auth-Token' header and 'ZSession' cookie not present."
|
103
|
+
}
|
104
|
+
return
|
105
|
+
end
|
106
|
+
zuora_instance_id = params[:sidebar_launch].to_bool ? nil : (params[:app_instance_id] || session["appInstance"])
|
112
107
|
|
113
108
|
#Identity blank or current entity different
|
114
|
-
|
115
|
-
missmatched_entity = session["ZuoraCurrentEntity"] != zuora_entity_id
|
116
|
-
missing_identity = session["ZuoraCurrentIdentity"].blank?
|
117
|
-
|
118
|
-
if (missing_identity || missmatched_entity || different_zsession)
|
119
|
-
zuora_details.merge!({'identity' => {'different_zsession' => different_zsession, 'missing_identity' => missing_identity, 'missmatched_entity' => missmatched_entity}})
|
109
|
+
if (session["ZuoraCurrentIdentity"].blank? || (session["ZuoraCurrentEntity"] != zuora_entity_id) || (session["ZSession"] != cookies['ZSession']))
|
120
110
|
identity, response = zuora_client.rest_call(url: zuora_client.rest_endpoint("identity"))
|
121
111
|
session["ZuoraCurrentIdentity"] = identity
|
122
112
|
session["ZuoraCurrentEntity"] = identity['entityId']
|
123
113
|
session["ZSession"] = cookies['ZSession']
|
124
114
|
zuora_instance_id = nil
|
125
|
-
zuora_details["identity"]["entityId"] = identity['entityId']
|
126
115
|
|
127
116
|
client_describe, response = zuora_client.rest_call(url: zuora_client.rest_endpoint("genesis/user/info").gsub('v1/', ''), session_type: zuora_client.class == ZuoraAPI::Oauth ? :bearer : :basic, headers: zuora_client.class == ZuoraAPI::Oauth ? {} : {'Authorization' => "ZSession-a3N2w #{zuora_client.get_session(prefix: false, auth_type: :basic)}"})
|
128
117
|
session["ZuoraCurrentUserInfo"] = client_describe
|
129
118
|
|
130
|
-
raise ZuoraConnect::Exceptions::Error.new("Header entity id does not match identity call entity id.") if zuora_entity_id != identity['entityId']
|
119
|
+
raise ZuoraConnect::Exceptions::Error.new("Header entity id, '#{zuora_entity_id}' does not match identity call entity id, '#{identity['entityId']}'.") if zuora_entity_id != identity['entityId']
|
131
120
|
end
|
132
121
|
|
133
122
|
#Find matching app instances.
|
@@ -176,7 +165,7 @@ module ZuoraConnect
|
|
176
165
|
#We have multiple, user must pick
|
177
166
|
elsif appinstances.size > 1
|
178
167
|
ZuoraConnect.logger.debug("User must select instance. #{@names}")
|
179
|
-
render "zuora_connect/static/launch", :locals => {:names => appinstances.to_h}
|
168
|
+
render "zuora_connect/static/launch", :locals => {:names => appinstances.to_h}
|
180
169
|
return
|
181
170
|
|
182
171
|
#We have no deployed instance for this tenant
|
@@ -188,7 +177,7 @@ module ZuoraConnect
|
|
188
177
|
render "zuora_connect/static/error_handled", :locals => {
|
189
178
|
:title => "Application can only complete its initial setup via platform administrator",
|
190
179
|
:message => "Please contact admin of tenant and have them click on link again to launch application."
|
191
|
-
}
|
180
|
+
}
|
192
181
|
return
|
193
182
|
end
|
194
183
|
Apartment::Tenant.switch!("public")
|
@@ -255,7 +244,7 @@ module ZuoraConnect
|
|
255
244
|
render "zuora_connect/static/error_handled", :locals => {
|
256
245
|
:title => "Application could not create unique tokens.",
|
257
246
|
:message => "Please contact support or retry launching application."
|
258
|
-
}
|
247
|
+
}
|
259
248
|
return
|
260
249
|
end
|
261
250
|
end
|
@@ -272,17 +261,12 @@ module ZuoraConnect
|
|
272
261
|
end
|
273
262
|
|
274
263
|
rescue ZuoraAPI::Exceptions::ZuoraAPIAuthenticationTypeError => ex
|
275
|
-
output_xml, input_xml = zuora_client.soap_call(errors: [], z_session: false) do |xml|
|
276
|
-
xml['api'].getUserInfo
|
277
|
-
end
|
278
|
-
final_error = output_xml.xpath('//fns:FaultCode', 'fns' =>'http://fault.api.zuora.com/').text
|
279
264
|
session.clear
|
280
|
-
ZuoraConnect.logger.warn(ex, zuora: zuora_details.merge({:error => final_error}))
|
281
265
|
redirect_to "https://#{zuora_host}/apps/newlogin.do?retURL=#{request.fullpath}"
|
282
266
|
return
|
283
267
|
rescue => ex
|
284
|
-
ZuoraConnect.logger.error(ex
|
285
|
-
render "zuora_connect/static/error_unhandled", :locals => {:exception => ex}
|
268
|
+
ZuoraConnect.logger.error(ex)
|
269
|
+
render "zuora_connect/static/error_unhandled", :locals => {:exception => ex}
|
286
270
|
return
|
287
271
|
end
|
288
272
|
elsif request["data"] && /^([A-Za-z0-9+\/\-\_]{4})*([A-Za-z0-9+\/]{4}|[A-Za-z0-9+\/]{3}=|[A-Za-z0-9+\/]{2}==)$/.match(request["data"].to_s)
|
@@ -294,7 +278,7 @@ module ZuoraConnect
|
|
294
278
|
render "zuora_connect/static/error_handled", :locals => {
|
295
279
|
:title => "Application state could not be verified",
|
296
280
|
:message => "Please relaunch application."
|
297
|
-
}
|
281
|
+
}
|
298
282
|
return
|
299
283
|
end
|
300
284
|
end
|
@@ -306,7 +290,7 @@ module ZuoraConnect
|
|
306
290
|
render "zuora_connect/static/error_handled", :locals => {
|
307
291
|
:title => "Application state could not be found.",
|
308
292
|
:message => "Please relaunch application."
|
309
|
-
}
|
293
|
+
}
|
310
294
|
return
|
311
295
|
end
|
312
296
|
#Call .data_lookup with the current session to retrieve session. In some cases session may be stored/cache in redis
|
@@ -400,7 +384,7 @@ module ZuoraConnect
|
|
400
384
|
if @appinstance.access_token_changed? && @appinstance.refresh_token_changed?
|
401
385
|
@appinstance.save(:validate => false)
|
402
386
|
else
|
403
|
-
raise ZuoraConnect::Exceptions::AccessDenied.new("Authorization
|
387
|
+
raise ZuoraConnect::Exceptions::AccessDenied.new("Authorization mistmatch. Possible tampering")
|
404
388
|
end
|
405
389
|
end
|
406
390
|
end
|
data/lib/zuora_connect.rb
CHANGED
@@ -41,7 +41,7 @@ module ZuoraConnect
|
|
41
41
|
data[:zuora_trace_id] = ZuoraConnect::RequestIdMiddleware.zuora_request_id if ZuoraConnect::RequestIdMiddleware.zuora_request_id.present?
|
42
42
|
#data[:traces] = {amazon_id: data[:trace_id], zuora_id: data[:zuora_trace_id]}
|
43
43
|
if !['ElasticAPM', 'ResqueScheduler', 'ResquePool', 'Resque', 'Makara'].include?(name)
|
44
|
-
if Thread.current[:appinstance].present?
|
44
|
+
if Thread.current[:appinstance].present?
|
45
45
|
data[:app_instance_id] = Thread.current[:appinstance].id
|
46
46
|
logitems = Thread.current[:appinstance].logitems
|
47
47
|
if logitems.present? && logitems.class == Hash
|
@@ -86,7 +86,7 @@ module ZuoraConnect
|
|
86
86
|
message: name == "ActionMailer" ? msg.strip : msg
|
87
87
|
}
|
88
88
|
if !['ElasticAPM', 'ResqueScheduler', 'ResquePool','Resque', 'Makara'].include?(name)
|
89
|
-
if Thread.current[:appinstance].present?
|
89
|
+
if Thread.current[:appinstance].present?
|
90
90
|
store[:app_instance_id] = Thread.current[:appinstance].id
|
91
91
|
logitems = Thread.current[:appinstance].logitems
|
92
92
|
if logitems.present? && logitems.class == Hash
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: zuora_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.5zz
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Connect Team
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-08-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|
@@ -58,20 +58,20 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.
|
61
|
+
version: 1.6.48
|
62
62
|
- - "~>"
|
63
63
|
- !ruby/object:Gem::Version
|
64
|
-
version: 1.
|
64
|
+
version: 1.6.48
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
69
|
- - ">="
|
70
70
|
- !ruby/object:Gem::Version
|
71
|
-
version: 1.
|
71
|
+
version: 1.6.48
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
|
-
version: 1.
|
74
|
+
version: 1.6.48
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: httparty
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|