zuora_connect 2.0.17 → 2.0.18

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd013e5e470f8e77427754cec2bf9b0f6e9949f29636e929b95395873b6aaf95
4
- data.tar.gz: 780bf3ea69add7f776ce9396bdb412909d1cf0668028c59cf56a5c97874a2f4d
3
+ metadata.gz: 94e552d4420ed7bac211118de33afd49128abdf44bba92f3e92ce27dd13322db
4
+ data.tar.gz: e2e438a6c527ba414f3186caf7b84f4175f094c5b67f2592ec6fa4fdd04df41c
5
5
  SHA512:
6
- metadata.gz: 04fd8a7485573cb7e64fdbcbbdcc470dd25e5c8411899e6b22ba0c7294ea46a014a22b73bfd523971fa78a87d32c064a309f00b7d6b71b75cd6b3463525cebe1
7
- data.tar.gz: a98aca369aa686a885166baa1af3fc9a57f40738b0125ddc2074c9a003932a2fb5c050e172a0be10c14f15f634a65f950db52253972c5f00b5f876138189c46a
6
+ metadata.gz: f753aa9944ec4c2397c5296e3cda93985e794dc7e37e65c15be1741fc130edf73eea34ea45a97cae2f7226b64e276c6e8db3cd1ad6cab4942452eb164bddf292
7
+ data.tar.gz: da356c6a1e2ab934b24fb435fe58b774d7b5bdea7824d4d4259b3ef554da60ea44ca550ec0b7120cd09db19b48a7db2fd073eab81321592a67b95140bac58f48
@@ -180,6 +180,11 @@ module ZuoraConnect
180
180
  self.reload_attributes([:refresh_token, :oauth_expires_at, :access_token])
181
181
  session = self.data_lookup(session: session)
182
182
  retry
183
+ rescue ZuoraConnect::Exceptions::MissMatch => ex
184
+ self.delete_app_instance
185
+ session = {}
186
+ ZuoraConnect.logger.error(ex, self.default_ougai_items.merge({retrieved_identifier: self.task_data['id']}))
187
+ retry
183
188
  rescue => ex
184
189
  if recoverable_session
185
190
  ZuoraConnect.logger.warn("REBUILDING - Using backup expired cache", ex, self.default_ougai_items)
@@ -398,6 +403,11 @@ module ZuoraConnect
398
403
  session = {} if session.blank?
399
404
  self.task_data = task_data
400
405
  self.mode = self.task_data["mode"]
406
+
407
+ if task_data['id'].to_s != self.id.to_s
408
+ raise ZuoraConnect::Exceptions::MissMatch.new("Wrong Instance Identifier/Lookup")
409
+ end
410
+
401
411
  self.task_data.each do |k,v|
402
412
  if k.match(/^(.*)_login$/)
403
413
  tmp = ZuoraConnect::Login.new(v)
@@ -426,6 +436,8 @@ module ZuoraConnect
426
436
  self.locale = v["local"]
427
437
  end
428
438
  end
439
+ rescue ZuoraConnect::Exceptions::MissMatch => ex
440
+ raise
429
441
  rescue => ex
430
442
  ZuoraConnect.logger.error(ex)
431
443
  ZuoraConnect.logger.error("Task Data: #{task_data}") if task_data.present?
@@ -620,6 +632,10 @@ module ZuoraConnect
620
632
  end
621
633
  end
622
634
 
635
+ def delete_app_instance
636
+ Redis.current.del("AppInstance:#{self.id}")
637
+ end
638
+
623
639
  def cache_app_instance
624
640
  if defined?(Redis.current)
625
641
  #Task data must be present and the last refresh cannot be old. We dont want to overwite new cache data with old
@@ -21,7 +21,7 @@ module ZuoraConnect
21
21
  ZuoraConnect.logger.debug("[#{@appinstance.id}] API REQUEST - API token") if @appinstance.present?
22
22
  check_instance
23
23
  elsif ZuoraConnect::AppInstance::INTERNAL_HOSTS.include?(request.headers.fetch("HOST", nil))
24
- zuora_host, zuora_entity_id, zuora_instance_id = [request.headers['zuora-host'], (request.headers['zuora-entity-ids'] || "").gsub('-',''), request.headers['zuora-instance-id']]
24
+ zuora_host, zuora_entity_id, zuora_instance_id = [request.headers['zuora-host'], (request.headers['zuora-entity-ids'] || "").gsub('-',''), request.headers['zuora-instance-id'].to_i]
25
25
 
26
26
  #Validate host present
27
27
  if zuora_host.blank?
@@ -119,7 +119,7 @@ module ZuoraConnect
119
119
  end
120
120
 
121
121
  begin
122
- zuora_instance_id = params[:sidebar_launch].to_s.to_bool ? nil : (params[:app_instance_id] || session["appInstance"])
122
+ zuora_instance_id = params[:sidebar_launch].to_s.to_bool ? nil : (params[:app_instance_id] || session["appInstance"]).to_i
123
123
 
124
124
  #Identity blank or current entity different
125
125
  different_zsession = session["ZSession"] != cookies['ZSession']
@@ -2,6 +2,7 @@ module ZuoraConnect
2
2
  module Exceptions
3
3
 
4
4
  class HoldingPattern < StandardError; end
5
+ class MissMatch < StandardError; end
5
6
  class Error < StandardError; end
6
7
  class AuthorizationNotPerformed < Error; end
7
8
 
@@ -1,3 +1,3 @@
1
1
  module ZuoraConnect
2
- VERSION = "2.0.17"
2
+ VERSION = "2.0.18"
3
3
  end
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.17
4
+ version: 2.0.18
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-27 00:00:00.000000000 Z
11
+ date: 2019-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apartment