zuora_connect 2.0.5zh → 2.0.5zi
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1e225cbc2b46a9186017ebe18ab9d044ab6f64978caa2655a815c19629160240
|
4
|
+
data.tar.gz: d91c300ababad49297f2391fc2fad6264a3db233974dcede676c3b7f7f9c389c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9585fb1c69ad98eb15eb4909ef1187ffff48ea6297bc0e686e54f9f4fa6d2a9a078f6fd8f617889b0ba3128786d46c9ab3f2dce5491ad15a28c6533c2e12d0a0
|
7
|
+
data.tar.gz: 321b5a5ef4e139dc813287e36260b015ee6e8293705085db59b3406049ab939b2f335a4a24b5ceefbc86712caaa331a7504456f796dcb08ec0b6c138ff4fc3a7
|
@@ -178,7 +178,7 @@ module ZuoraConnect
|
|
178
178
|
retry
|
179
179
|
rescue => ex
|
180
180
|
if recoverable_session
|
181
|
-
ZuoraConnect.logger.warn("REBUILDING - Using backup expired cache", self.default_ougai_items)
|
181
|
+
ZuoraConnect.logger.warn("REBUILDING - Using backup expired cache", ex, 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
|
@@ -240,7 +240,7 @@ module ZuoraConnect
|
|
240
240
|
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
241
241
|
if (refresh_count += 1) < 3
|
242
242
|
sleep(30)
|
243
|
-
ZuoraConnect.logger.
|
243
|
+
ZuoraConnect.logger.debug("REFRESH TASK - Connection Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
|
244
244
|
retry
|
245
245
|
else
|
246
246
|
ZuoraConnect.logger.fatal("REFRESH TASK - Connection Failed", ex, self.default_ougai_items)
|
@@ -248,7 +248,7 @@ module ZuoraConnect
|
|
248
248
|
end
|
249
249
|
rescue ZuoraConnect::Exceptions::ConnectCommunicationError => ex
|
250
250
|
if (refresh_count += 1) < 3
|
251
|
-
ZuoraConnect.logger.
|
251
|
+
ZuoraConnect.logger.debug("REFRESH TASK - Communication Failure Retrying(#{refresh_count})", ex, self.default_ougai_items)
|
252
252
|
if ex.code == 401
|
253
253
|
self.refresh_oauth
|
254
254
|
end
|
@@ -525,7 +525,8 @@ module ZuoraConnect
|
|
525
525
|
end
|
526
526
|
rescue *(ZuoraAPI::Login::CONNECTION_EXCEPTIONS + ZuoraAPI::Login::CONNECTION_READ_EXCEPTIONS) => ex
|
527
527
|
if (refresh_oauth_count += 1) < 3
|
528
|
-
|
528
|
+
sleep(5)
|
529
|
+
ZuoraConnect.logger.debug("REFRESH OAUTH - Connection Failure Retrying(#{refresh_oauth_count})", ex, self.default_ougai_items)
|
529
530
|
retry
|
530
531
|
else
|
531
532
|
ZuoraConnect.logger.fatal("REFRESH OAUTH - Connection Failed", ex, self.default_ougai_items)
|
@@ -539,7 +540,7 @@ module ZuoraConnect
|
|
539
540
|
return if !self.oauth_expired?
|
540
541
|
|
541
542
|
if (refresh_oauth_count += 1) < 3
|
542
|
-
ZuoraConnect.logger.
|
543
|
+
ZuoraConnect.logger.debug("REFRESH OAUTH - Communication Failure Retrying(#{refresh_oauth_count})", ex, self.default_ougai_items)
|
543
544
|
retry
|
544
545
|
else
|
545
546
|
ZuoraConnect.logger.fatal("REFRESH OAUTH - Communication Failed #{ex.code}", ex, self.default_ougai_items)
|
@@ -88,35 +88,46 @@ 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']
|
91
93
|
zuora_host = request.headers["HTTP_X_FORWARDED_HOST"] || "apisandbox.zuora.com"
|
92
94
|
|
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
|
+
|
93
110
|
begin
|
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
|
-
}, :layout => false
|
104
|
-
return
|
105
|
-
end
|
106
111
|
zuora_instance_id = params[:sidebar_launch].to_s.to_bool ? nil : (params[:app_instance_id] || session["appInstance"])
|
107
112
|
|
108
113
|
#Identity blank or current entity different
|
109
|
-
|
114
|
+
different_zsession = session["ZSession"] != cookies['ZSession']
|
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}})
|
110
120
|
identity, response = zuora_client.rest_call(url: zuora_client.rest_endpoint("identity"))
|
111
121
|
session["ZuoraCurrentIdentity"] = identity
|
112
122
|
session["ZuoraCurrentEntity"] = identity['entityId']
|
113
123
|
session["ZSession"] = cookies['ZSession']
|
114
124
|
zuora_instance_id = nil
|
125
|
+
zuora_details["identity"]["entityId"] = identity['entityId']
|
115
126
|
|
116
127
|
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)}"})
|
117
128
|
session["ZuoraCurrentUserInfo"] = client_describe
|
118
129
|
|
119
|
-
raise ZuoraConnect::Exceptions::Error.new("Header entity id
|
130
|
+
raise ZuoraConnect::Exceptions::Error.new("Header entity id does not match identity call entity id.") if zuora_entity_id != identity['entityId']
|
120
131
|
end
|
121
132
|
|
122
133
|
#Find matching app instances.
|
@@ -261,12 +272,16 @@ module ZuoraConnect
|
|
261
272
|
end
|
262
273
|
|
263
274
|
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
|
264
279
|
session.clear
|
265
|
-
ZuoraConnect.logger.warn(ex)
|
280
|
+
ZuoraConnect.logger.warn(ex, zuora: zuora_details.merge({:error => final_error}))
|
266
281
|
redirect_to "https://#{zuora_host}/apps/newlogin.do?retURL=#{request.fullpath}"
|
267
282
|
return
|
268
283
|
rescue => ex
|
269
|
-
ZuoraConnect.logger.error(ex)
|
284
|
+
ZuoraConnect.logger.error(ex, zuora: zuora_details)
|
270
285
|
render "zuora_connect/static/error_unhandled", :locals => {:exception => ex}, :layout => false
|
271
286
|
return
|
272
287
|
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.
|
4
|
+
version: 2.0.5zi
|
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-09-
|
11
|
+
date: 2019-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|