zuora_connect 2.0.5f → 2.0.5h
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/zuora_connect/controllers/helpers.rb +18 -12
- data/lib/zuora_connect/version.rb +1 -1
- data/lib/zuora_connect/views/helpers.rb +4 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f3ac4dedb3c0a45e3e06bdb5f896945c9133f73cc840ea1ee6e69f328a1d5b3d
|
4
|
+
data.tar.gz: adf9a515f860cf94c56b048cc9bde389640e1f6c4a46a9a4a4d599e3be18017f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7487348f4ed6b1d59c7ce62ea033fcc6192cac73e6cce67973ddd79340331061b580ef78dad182cebb92af66dd3fbba0ddac35a552c1ca0f58f57c6c04a52d4d
|
7
|
+
data.tar.gz: d41ba2be63158fdc5f12e2f06c3c2b09e44a40779cf9a989c477e75b9e450eb2f4e9e5eeef6ef7e62facf263e599a886e77cc71dee66c356753159c3956b6d98
|
@@ -162,18 +162,18 @@ module ZuoraConnect
|
|
162
162
|
@appinstance = ZuoraConnect::AppInstance.find(appinstances.to_h.keys.first)
|
163
163
|
|
164
164
|
#Add user/update
|
165
|
-
@
|
166
|
-
if @
|
165
|
+
@zuora_user = ZuoraConnect::ZuoraUser.where(:zuora_user_id => zuora_user_id).first
|
166
|
+
if @zuora_user.present?
|
167
167
|
ZuoraConnect.logger.debug("Current zuora user #{zuora_user_id}")
|
168
|
-
if @
|
169
|
-
@
|
170
|
-
@
|
168
|
+
if @zuora_user.updated_at < Time.now - 1.day
|
169
|
+
@zuora_user.zuora_identity_response[zuora_entity_id] = session["ZuoraCurrentIdentity"]
|
170
|
+
@zuora_user.save!
|
171
171
|
end
|
172
172
|
else
|
173
173
|
ZuoraConnect.logger.debug("New zuora user object for #{zuora_user_id}")
|
174
|
-
@
|
174
|
+
@zuora_user = ZuoraConnect::ZuoraUser.create!(:zuora_user_id => zuora_user_id, :zuora_identity_response => {zuora_entity_id => session["ZuoraCurrentIdentity"]})
|
175
175
|
end
|
176
|
-
@
|
176
|
+
@zuora_user.session = session
|
177
177
|
session["appInstance"] = @appinstance.id
|
178
178
|
|
179
179
|
#We have multiple, user must pick
|
@@ -193,14 +193,16 @@ module ZuoraConnect
|
|
193
193
|
}
|
194
194
|
return
|
195
195
|
end
|
196
|
+
|
197
|
+
user = (ENV['DEIS_APP'] || "Application").split('-').map(&:capitalize).join(' ')
|
196
198
|
|
197
199
|
body = {
|
198
200
|
'userId' => zuora_user_id,
|
199
201
|
'entityIds' => [zuora_entity_id.unpack("a8a4a4a4a12").join('-')],
|
200
202
|
'customAuthorities' => [],
|
201
203
|
'additionalInformation' => {
|
202
|
-
'description' =>
|
203
|
-
'name' =>
|
204
|
+
'description' => "This user is for #{user} application.",
|
205
|
+
'name' => "#{user} API User"
|
204
206
|
}
|
205
207
|
}
|
206
208
|
|
@@ -220,7 +222,7 @@ module ZuoraConnect
|
|
220
222
|
rescue Apartment::TenantExists => ex
|
221
223
|
ZuoraConnect.logger.debug("Tenant Already Exists")
|
222
224
|
end
|
223
|
-
|
225
|
+
available_entities = client_describe["accessibleEntities"].select {|entity| entity['id'] == client_describe['defaultEntityId']}
|
224
226
|
task_data = {
|
225
227
|
"id": next_id,
|
226
228
|
"name": client_describe["tenantName"],
|
@@ -234,9 +236,9 @@ module ZuoraConnect
|
|
234
236
|
"oauth_client_id": oauth_response['clientId'],
|
235
237
|
"oauth_secret": oauth_response['clientSecret'],
|
236
238
|
"authentication_type": "OAUTH",
|
237
|
-
"entities":
|
239
|
+
"entities": available_entities.map {|e| e.merge({'displayName' => client_describe["tenantName"]})}
|
238
240
|
},
|
239
|
-
"tenant_ids":
|
241
|
+
"tenant_ids": cavailable_entities.map{|e| e['entityId'] }.push(client_describe["tenantId"]).uniq,
|
240
242
|
}
|
241
243
|
|
242
244
|
@appinstance = ZuoraConnect::AppInstance.new(:id => next_id, :zuora_logins => task_data, :oauth_expires_at => Time.now + 1000.years)
|
@@ -312,6 +314,10 @@ module ZuoraConnect
|
|
312
314
|
return session["#{@appinstance.id}::admin"]
|
313
315
|
end
|
314
316
|
|
317
|
+
def zuora_user
|
318
|
+
return @zuora_user
|
319
|
+
end
|
320
|
+
|
315
321
|
private
|
316
322
|
def setup_instance_via_data
|
317
323
|
session.clear
|
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.5h
|
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-06-
|
11
|
+
date: 2019-06-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: apartment
|