/** * Resume an existing quote for customers who either have a temporary auth token for a retrieval with no My HomeLet * account, or who are My HomeLet authenticated. Customers with no form of valid authentication are redirected to * the My HomeLet login page. * * @return void */ public function retrieveAction() { // Authorisation using no-account My HomeLet retrieval auth token if ($this->getRequest()->getParam('auth') != '') { $mac = $this->getRequest()->getParam('auth'); $securityManager = new Application_Core_Security($this->_params->myhomelet->retrieveWithoutAccount->macSecret, $this->_params->myhomelet->retrieveWithoutAccount->macTimestampVariance != 0, $this->_params->myhomelet->retrieveWithoutAccount->macTimestampVariance); $dataKeys = array('quoteNumber'); $securityCheck = $securityManager->authenticate($mac, $dataKeys); if (isset($securityCheck['result']) && $securityCheck['result']) { $quoteNumber = $securityCheck['data']['quoteNumber']; $quoteManager = new Manager_Insurance_LegacyQuote(); $customerManager = new Manager_Core_Customer(); $quote = $quoteManager->getQuoteByPolicyNumber($quoteNumber); $quoteRefNo = $quote->refNo; $customer = $customerManager->getCustomer(Model_Core_Customer::LEGACY_IDENTIFIER, $quoteRefNo); $customerID = $referenceNumber = $customer->getIdentifier(Model_Core_Customer::LEGACY_IDENTIFIER, $quoteRefNo); $quoteManager = new Manager_Insurance_LandlordsPlus_Quote(null, $quoteNumber, null, $customerID); $quote = $quoteManager->getModel(); $pageSession = new Zend_Session_Namespace('landlords_insurance_quote'); $pageSession->quoteID = $quote->ID; $pageSession->customerRefNo = $referenceNumber; //Retrieve the WebLead summary ID so that the WebLead can continue to be updated and important //details captured, such as the campaign code. $webLeadManager = new Manager_Core_WebLead(); $pageSession->webLeadSummaryId = $webLeadManager->getSummaryId($quoteNumber); $this->_helper->redirector->gotoUrl('/landlords/insurance-quote/step1'); return; } } // Authorisation using My HomeLet logged in details $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('homelet_customer')); if ($auth->hasIdentity()) { // Check to see if we have a reference number to load up if ($this->getRequest()->getParam('quote') != '') { $quoteNumber = $this->getRequest()->getParam('quote'); // Customer is logged in and is trying to retrieve a specific quote // We need to check to make sure they own it $customerID = $auth->getStorage()->read()->id; // Now we need to get their legacy ID $customerManager = new Manager_Core_Customer(); $customer = $customerManager->getCustomer(Model_Core_Customer::IDENTIFIER, $customerID); $referenceNumber = $customer->getIdentifier(Model_Core_Customer::LEGACY_IDENTIFIER); // Need to find the quote ID by the policy number $quotes = new Manager_Insurance_LandlordsPlus_Quote(null, $quoteNumber, null, $customerID); $quote = $quotes->getModel(); $legacyCustomerMap = new Datasource_Core_CustomerMaps(); $legacyIDs = $legacyCustomerMap->getLegacyIDs($customerID); if (in_array($quote->legacyCustomerID, $legacyIDs)) { // This customer does own this reference - so set the page session stuff up and redirect $pageSession = new Zend_Session_Namespace('landlords_insurance_quote'); $pageSession->quoteID = $quote->ID; $pageSession->customerRefNo = $referenceNumber; //Retrieve the WebLead summary ID so that the WebLead can continue to be updated and important //details captured, such as the campaign code. $webLeadManager = new Manager_Core_WebLead(); $pageSession->webLeadSummaryId = $webLeadManager->getSummaryId($quoteNumber); $this->_helper->redirector->gotoUrl('/landlords/insurance-quote/step1'); } } } $this->_helper->redirector->gotoUrl('/login?referrerUrl=/my-homelet/quotes'); }
/** * Resume an existing quote for authenticated customers. Customers * who are not authenticated are redirected to the login page. * * @return void */ public function retrieveAction() { $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('homelet_customer')); if ($auth->hasIdentity()) { // Check to see if we have a reference number to load up if ($this->getRequest()->getParam('quote') != '') { $quoteNumber = $this->getRequest()->getParam('quote'); // Customer is logged in and is trying to retrieve a specific quote // We need to check to make sure they own it $customerID = $auth->getStorage()->read()->id; // Get customers legacy IDs and confirm the refno of the quote // can be accessed by the customer. $legacyCustomerMap = new Datasource_Core_CustomerMaps(); $legacyIDs = $legacyCustomerMap->getLegacyIDs($customerID); $quoteManager = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $quoteNumber); $quote = $quoteManager->getQuoteObject(); if (in_array($quote->refNo, $legacyIDs)) { // This customer does own this reference - so set the page session stuff up and redirect if ($quote->policyType == 'T') { // Make sure this is a tenants quote $pageSession = new Zend_Session_Namespace('tenants_insurance_quote'); $pageSession->CustomerRefNo = $quote->refNo; $pageSession->PolicyNumber = $quote->policyNumber; //Retrieve the WebLead summary ID so that the WebLead can continue to be updated and important //details captured, such as the campaign code. $webLeadManager = new Manager_Core_WebLead(); $pageSession->webLeadSummaryId = $webLeadManager->getSummaryId($pageSession->PolicyNumber); $this->_helper->redirector->gotoUrl('/tenants/insurance-quote-b/step1'); } else { // This isn't a tenants quote! OOPS $this->render('retrieve-failed'); return; } } } } $this->_helper->redirector->gotoUrl('/login?referrerUrl=/my-homelet/quotes'); }
/** * Resume an existing quote for customers who either have a temporary auth token for a retrieval with no My HomeLet * account, or who are My HomeLet authenticated. Customers with no form of valid authentication are redirected to * the My HomeLet login page. * * @return void */ public function retrieveAction() { // Authorisation using no-account My HomeLet retrieval auth token if ($this->getRequest()->getParam('auth') != '') { $mac = $this->getRequest()->getParam('auth'); $securityManager = new Application_Core_Security($this->_params->myhomelet->retrieveWithoutAccount->macSecret, $this->_params->myhomelet->retrieveWithoutAccount->macTimestampVariance != 0, $this->_params->myhomelet->retrieveWithoutAccount->macTimestampVariance); $dataKeys = array('quoteNumber'); $securityCheck = $securityManager->authenticate($mac, $dataKeys); if (isset($securityCheck['result']) && $securityCheck['result']) { $quoteNumber = $securityCheck['data']['quoteNumber']; $quoteManager = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $quoteNumber); $quote = $quoteManager->getQuoteObject(); if ($quote->policyType == 'T') { // Make sure this is a tenants quote $pageSession = new Zend_Session_Namespace('tenants_insurance_quote'); $pageSession->CustomerRefNo = $quote->refNo; $pageSession->PolicyNumber = $quote->policyNumber; // Note that this user retrieved a quote, so that if they login in using the login action their // details don't get nulled out. $pageSession->RetrievedQuote = true; //Retrieve the WebLead summary ID so that the WebLead can continue to be updated and important //details captured, such as the campaign code. $webLeadManager = new Manager_Core_WebLead(); $pageSession->webLeadSummaryId = $webLeadManager->getSummaryId($pageSession->PolicyNumber); $this->_helper->redirector->gotoUrl('/tenants/insurance-quote/step1'); return; } else { // This isn't a tenants quote! OOPS $this->render('retrieve-failed'); return; } } } // Authorisation using My HomeLet logged in details $auth = Zend_Auth::getInstance(); $auth->setStorage(new Zend_Auth_Storage_Session('homelet_customer')); if ($auth->hasIdentity()) { // Check to see if we have a reference number to load up if ($this->getRequest()->getParam('quote') != '') { $quoteNumber = $this->getRequest()->getParam('quote'); // Customer is logged in and is trying to retrieve a specific quote // We need to check to make sure they own it $customerID = $auth->getStorage()->read()->id; // Get customers legacy IDs and confirm the refno of the quote // can be accessed by the customer. $legacyCustomerMap = new Datasource_Core_CustomerMaps(); $legacyIDs = $legacyCustomerMap->getLegacyIDs($customerID); $quoteManager = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $quoteNumber); $quote = $quoteManager->getQuoteObject(); if (in_array($quote->refNo, $legacyIDs)) { // This customer does own this reference - so set the page session stuff up and redirect if ($quote->policyType == 'T') { // Make sure this is a tenants quote $pageSession = new Zend_Session_Namespace('tenants_insurance_quote'); $pageSession->CustomerRefNo = $quote->refNo; $pageSession->PolicyNumber = $quote->policyNumber; //Retrieve the WebLead summary ID so that the WebLead can continue to be updated and important //details captured, such as the campaign code. $webLeadManager = new Manager_Core_WebLead(); $pageSession->webLeadSummaryId = $webLeadManager->getSummaryId($pageSession->PolicyNumber); $this->_helper->redirector->gotoUrl('/tenants/insurance-quote/step1'); } else { // This isn't a tenants quote! OOPS $this->render('retrieve-failed'); return; } } } } $this->_helper->redirector->gotoUrl('/login?referrerUrl=/my-homelet/quotes'); }