zuora_connect 2.0.5zg → 2.0.5zh

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9b2c5af96c2a7a00a74b397b942817ab2ce03622761e92c2b25ff81c4734eba4
4
- data.tar.gz: 293379013a5d86e12b8eab8f735ca92879ef0b1874d973059d24aa7358e2e4d0
3
+ metadata.gz: 36a2f9d675095af97d07555d1aa875e5ba22b039262959a43d9a90966f45eaf3
4
+ data.tar.gz: 492c05ace818806101c42c5b4534d21227d0db38a19c11f39ce1183163a58df9
5
5
  SHA512:
6
- metadata.gz: df998490776be8d9147eb2a4aea83d48b8bce197d96218e94f72fe539601f0ee295720e9aa32d9519ca9fd6a5e3684f77a4aa5a556c2680d78889b325e4d6824
7
- data.tar.gz: 37305db8b3f4eb55034f36b170ba88ee50df7ffae2c9fe8194f9742b4b6c2f6df5a0c6ab9b8c112984a9fa6545f1d886f3413b8bbd774262ac7df2211ddb9c05
6
+ metadata.gz: 593d8e422bf1edb7959bc8fd8878ad28e4219f5b42bbc73687e05540aca05995c6a1002cdec6272c037b8e904f3ff5b0e0b43290324b1e415225531c5ddc91b9
7
+ data.tar.gz: 05671c2dd8641935619eee8de03ae5f62d721df3e8a9d113b29d889b8cfe407c9e9bbd27c85f4b54cc2c2acc9ba70f52d2b3f778009f56216dd28e231654ca5f
@@ -182,6 +182,7 @@ module ZuoraConnect
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)
185
186
  raise
186
187
  end
187
188
  ensure
@@ -221,39 +222,39 @@ module ZuoraConnect
221
222
 
222
223
  ZuoraConnect.logger.debug("REFRESH TASK - Connect Task Info Request Time #{response_time.round(2).to_s}", self.default_ougai_items)
223
224
  if response.code == 200
224
- self.build_task(task_data: JSON.parse(response.body), session: session)
225
- self.last_refresh = Time.now.to_i
226
- self.cache_app_instance
227
- self.reset_mark_for_refresh
225
+ begin
226
+ parsed_json = JSON.parse(response.body)
227
+ rescue JSON::ParserError => ex
228
+ raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("JSON parse error", response.body, response.code)
229
+ end
230
+ self.build_task(task_data: parsed_json, session: session)
228
231
  else
229
232
  raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Communicating with Connect", response.body, response.code)
230
233
  end
231
234
  else
232
235
  self.build_task(task_data: self.zuora_logins, session: session)
233
- self.last_refresh = Time.now.to_i
234
- self.cache_app_instance
235
- self.reset_mark_for_refresh
236
236
  end
237
+ self.last_refresh = Time.now.to_i
238
+ self.cache_app_instance
239
+ self.reset_mark_for_refresh
237
240
  rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
238
241
  if (refresh_count += 1) < 3
239
242
  sleep(30)
240
- ZuoraConnect.logger.info("REFRESH TASK - #{ex.class} Retrying(#{refresh_count})", self.default_ougai_items)
243
+ ZuoraConnect.logger.warn("REFRESH TASK - Connection Failure Retrying(#{refresh_count})", self.default_ougai_items)
241
244
  retry
242
245
  else
243
- ZuoraConnect.logger.fatal("REFRESH TASK - #{ex.class} Failed #{refresh_count}x", self.default_ougai_items)
246
+ ZuoraConnect.logger.fatal("REFRESH TASK - Connection Failed", ex, self.default_ougai_items)
244
247
  raise
245
248
  end
246
249
  rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
247
250
  if (refresh_count += 1) < 3
251
+ ZuoraConnect.logger.warn("REFRESH TASK - Communication Failure Retrying(#{refresh_count})", self.default_ougai_items)
248
252
  if ex.code == 401
249
- ZuoraConnect.logger.info("REFRESH TASK - Failed #{ex.code} - Retrying(#{refresh_count})", self.default_ougai_items)
250
253
  self.refresh_oauth
251
- else
252
- ZuoraConnect.logger.warn("REFRESH TASK - Failed #{ex.code} - Retrying(#{refresh_count})", self.default_ougai_items)
253
254
  end
254
255
  retry
255
256
  else
256
- ZuoraConnect.logger.fatal("REFRESH TASK - Failed #{ex.code} - #{refresh_count}x", self.default_ougai_items)
257
+ ZuoraConnect.logger.fatal("REFRESH TASK - Communication Failed #{ex.code}", ex, self.default_ougai_items)
257
258
  raise
258
259
  end
259
260
  end
@@ -520,14 +521,14 @@ module ZuoraConnect
520
521
  self.oauth_expires_at = Time.at(response_body["created_at"].to_i) + response_body["expires_in"].seconds
521
522
  self.save(:validate => false)
522
523
  else
523
- raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Refreshing Access Token for #{self.id}", response.body, response.code)
524
+ raise ZuoraConnect::Exceptions::ConnectCommunicationError.new("Error Refreshing Access Token", response.body, response.code)
524
525
  end
525
526
  rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
526
527
  if (refresh_oauth_count += 1) < 3
527
- ZuoraConnect.logger.info("REFRESH OAUTH - #{ex.class} Retrying(#{refresh_oauth_count})", self.default_ougai_items)
528
+ ZuoraConnect.logger.warn("REFRESH OAUTH - Connection Failure Retrying(#{refresh_oauth_count})", self.default_ougai_items)
528
529
  retry
529
530
  else
530
- ZuoraConnect.logger.fatal("REFRESH OAUTH - #{ex.class} Failed #{refresh_oauth_count}x", self.default_ougai_items)
531
+ ZuoraConnect.logger.fatal("REFRESH OAUTH - Connection Failed", ex, self.default_ougai_items)
531
532
  raise
532
533
  end
533
534
  rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
@@ -538,10 +539,10 @@ module ZuoraConnect
538
539
  return if !self.oauth_expired?
539
540
 
540
541
  if (refresh_oauth_count += 1) < 3
541
- ZuoraConnect.logger.info("REFRESH OAUTH - Failed #{ex.code} - Retrying(#{refresh_oauth_count})", self.default_ougai_items)
542
+ ZuoraConnect.logger.warn("REFRESH OAUTH - Communication Failure Retrying(#{refresh_oauth_count})", self.default_ougai_items)
542
543
  retry
543
544
  else
544
- ZuoraConnect.logger.fatal("REFRESH OAUTH - Failed #{ex.code} - #{refresh_oauth_count}x", self.default_ougai_items)
545
+ ZuoraConnect.logger.fatal("REFRESH OAUTH - Communication Failed #{ex.code}", ex, self.default_ougai_items)
545
546
  raise
546
547
  end
547
548
  end
@@ -667,9 +668,10 @@ module ZuoraConnect
667
668
  begin
668
669
  return JSON.parse(encryptor.decrypt_and_verify(CGI::unescape(data)))
669
670
  rescue ActiveSupport::MessageVerifier::InvalidSignature => ex
670
- ZuoraConnect.logger.error("Error Decrypting", self.default_ougai_items) if log_fatal
671
+ ZuoraConnect.logger.error("Error Decrypting", ex, self.default_ougai_items) if log_fatal
671
672
  return rescue_return
672
673
  rescue JSON::ParserError => ex
674
+ ZuoraConnect.logger.error("JSON Parse Error", ex, self.default_ougai_items) if log_fatal
673
675
  return encryptor.decrypt_and_verify(CGI::unescape(data))
674
676
  end
675
677
  end
@@ -100,7 +100,7 @@ module ZuoraConnect
100
100
  render "zuora_connect/static/error_handled", :locals => {
101
101
  :title => "Missing Authorization Token",
102
102
  :message => "Zuora 'Zuora-Auth-Token' header and 'ZSession' cookie not present."
103
- }
103
+ }, :layout => false
104
104
  return
105
105
  end
106
106
  zuora_instance_id = params[:sidebar_launch].to_s.to_bool ? nil : (params[:app_instance_id] || session["appInstance"])
@@ -165,7 +165,7 @@ module ZuoraConnect
165
165
  #We have multiple, user must pick
166
166
  elsif appinstances.size > 1
167
167
  ZuoraConnect.logger.debug("User must select instance. #{@names}")
168
- render "zuora_connect/static/launch", :locals => {:names => appinstances.to_h}
168
+ render "zuora_connect/static/launch", :locals => {:names => appinstances.to_h}, :layout => false
169
169
  return
170
170
 
171
171
  #We have no deployed instance for this tenant
@@ -177,7 +177,7 @@ module ZuoraConnect
177
177
  render "zuora_connect/static/error_handled", :locals => {
178
178
  :title => "Application can only complete its initial setup via platform administrator",
179
179
  :message => "Please contact admin of tenant and have them click on link again to launch application."
180
- }
180
+ }, :layout => false
181
181
  return
182
182
  end
183
183
  Apartment::Tenant.switch!("public")
@@ -244,7 +244,7 @@ module ZuoraConnect
244
244
  render "zuora_connect/static/error_handled", :locals => {
245
245
  :title => "Application could not create unique tokens.",
246
246
  :message => "Please contact support or retry launching application."
247
- }
247
+ }, :layout => false
248
248
  return
249
249
  end
250
250
  end
@@ -267,7 +267,7 @@ module ZuoraConnect
267
267
  return
268
268
  rescue => ex
269
269
  ZuoraConnect.logger.error(ex)
270
- render "zuora_connect/static/error_unhandled", :locals => {:exception => ex}
270
+ render "zuora_connect/static/error_unhandled", :locals => {:exception => ex}, :layout => false
271
271
  return
272
272
  end
273
273
  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)
@@ -279,7 +279,7 @@ module ZuoraConnect
279
279
  render "zuora_connect/static/error_handled", :locals => {
280
280
  :title => "Application state could not be verified",
281
281
  :message => "Please relaunch application."
282
- }
282
+ }, :layout => false
283
283
  return
284
284
  end
285
285
  end
@@ -291,7 +291,7 @@ module ZuoraConnect
291
291
  render "zuora_connect/static/error_handled", :locals => {
292
292
  :title => "Application state could not be found.",
293
293
  :message => "Please relaunch application."
294
- }
294
+ }, :layout => false
295
295
  return
296
296
  end
297
297
  #Call .data_lookup with the current session to retrieve session. In some cases session may be stored/cache in redis
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "2.0.5zg"
2
+ VERSION = "2.0.5zh"
3
3
  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? && Thread.current[:appinstance].id.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? && Thread.current[:appinstance].id.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.5zg
4
+ version: 2.0.5zh
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-08-26 00:00:00.000000000 Z
11
+ date: 2019-09-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment