iab-InsuranceBizLogic 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/processengine/engine.rb +24 -0
- metadata +1 -1
data/lib/processengine/engine.rb
CHANGED
@@ -145,6 +145,30 @@ class PEngine
|
|
145
145
|
raise "An error occurred during the authentication process"
|
146
146
|
end
|
147
147
|
|
148
|
+
when "SaveProfile"
|
149
|
+
begin
|
150
|
+
if params[:User] and params[:User][:User]
|
151
|
+
session[:user_email] = params[:User][:User]
|
152
|
+
params[:ProfilePersonalDetailsClientContact] = HashWithIndifferentAccess.new
|
153
|
+
params[:ProfilePersonalDetailsClientContact][:Email] = params[:User][:User]
|
154
|
+
end
|
155
|
+
eval(deriveActiveRecordDefinitionOfProduct(session[:product]))
|
156
|
+
xml = createXMLMessage(session[:product],params,false) { |k,v| "<#{k}>#{v}</#{k}>" }
|
157
|
+
open("#{File.dirname(__FILE__)}/../bizLogic/xquery2") {|f| @query = f.read }
|
158
|
+
results = persist.find(@query.gsub('EMAIL',session[:user_email]))
|
159
|
+
if !results
|
160
|
+
key = persist.create_key_and_doc(xml)
|
161
|
+
results = persist.find(@query.gsub('EMAIL',session[:user_email]))
|
162
|
+
end
|
163
|
+
prepareModels(session[:product],results[0])
|
164
|
+
rescue
|
165
|
+
if !session[:user_email]
|
166
|
+
raise "Credentials missing for new customer"
|
167
|
+
end
|
168
|
+
raise "An error occurred whilst saving a new profile"
|
169
|
+
end
|
170
|
+
|
171
|
+
|
148
172
|
when "SectionRating"
|
149
173
|
"1553.25"
|
150
174
|
|