/**
  * View quote documents
  *
  * @return void
  */
 public function quotesViewDocumentsAction()
 {
     $quoteDocuments = array();
     $this->_setMetaTitle('View Documents');
     $this->view->isAjaxRequest = $this->getRequest()->isXmlHttpRequest();
     if ($this->view->isAjaxRequest) {
         $this->_helper->getHelper('layout')->disableLayout();
     }
     $request = $this->getRequest();
     $quoteNumber = base64_decode($request->getParam('policy_number'));
     // Get the customer session
     $customerSession = $this->auth->getStorage()->read();
     // Get the request policy
     $legacyPolicies = new Datasource_Insurance_LegacyQuotes();
     $quote = $legacyPolicies->getByPolicyNumber($quoteNumber);
     if ($quote) {
         // Check the policy customer refno is linked to the customer id through mapping
         $customerMaps = new Datasource_Core_CustomerMaps();
         $customerMap = $customerMaps->getMap(Model_Core_Customer::LEGACY_IDENTIFIER, $quote->refNo);
         // Confirm the policy number belongs to the logged in customer
         if ($customerMap !== false && $customerMap->getIdentifier() == $customerSession->id) {
             // Customer map found and customer is mapped to refno
             $documentHistory = new Datasource_Insurance_DocumentHistory();
             $quoteDocuments = $documentHistory->getDocumentsAll($quoteNumber, array('holder'));
         }
     }
     $this->view->policyNumber = $quoteNumber;
     $this->view->policyDocuments = $quoteDocuments;
     $this->render('view-document-history');
 }
 /**
  * Fetch one or more quotes by a customer's email address.
  *
  * @param string $email
  * @return array Array of Model_Insurance_LegacyQuote
  */
 public function getQuotesByEmail($email)
 {
     if (null == $this->_legacyQuotes) {
         $this->_legacyQuotes = new Datasource_Insurance_LegacyQuotes();
     }
     return $this->_legacyQuotes->getByEmail($email);
 }
 /**
  * Will convert all quote identifiers to policy identifiers, for a given
  * quote number, in all appropriate datasources.
  *
  * @param $string $quoteNumber The full QHLI number.
  *
  * @param string $policyNumber Optional. The full PHLI number. If not provided, then it will be assumed that the 'QHLI' should be changed to 'PHLI'.
  *
  * @return void
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //Test to see if a test account was used to enter the policy
     $tester = new Manager_Core_Test();
     if ($tester->isTestPolicy($quoteNumber)) {
         //Populate a TestPolicy object into the datasource.
         $testPolicy = new Model_Core_TestPolicy();
         $legacyQuoteDatasource = new Datasource_Insurance_LegacyQuotes();
         $quote = $legacyQuoteDatasource->getByPolicyNumber($quoteNumber);
         $testPolicy->agentschemeno = $quote->agentSchemeNumber;
         $testPolicy->csuid = 87;
         $testPolicy->isTestPolicy = "Yes";
         $testPolicy->policynumber = $quoteNumber;
         $testPolicyDatasource = new Datasource_Insurance_Policy_TestPolicy();
         $testPolicyDatasource->insertTestPolicy($testPolicy);
     }
     // We only have a legacy quote number so we need to find the new quote number
     $quoteDatasource = new Datasource_Insurance_Quotes();
     $quoteID = $quoteDatasource->getIDByLegacyID($quoteNumber);
     $changeableArray = array();
     $changeableArray[] = new Datasource_Insurance_Answers();
     $changeableArray[] = new Datasource_Insurance_Endorsements();
     $changeableArray[] = new Datasource_Insurance_AdditionalInformation();
     $changeableArray[] = new Datasource_Insurance_Policy_Term();
     $changeableArray[] = new Datasource_Core_UnderwritingEmailLog();
     $changeableArray[] = new Datasource_Core_DirectDebit_Payment();
     $changeableArray[] = new Datasource_Core_CreditCard_Transaction();
     $changeableArray[] = new Datasource_Core_CreditCard_Payment();
     $changeableArray[] = new Datasource_Insurance_Schedules();
     $changeableArray[] = new Manager_Insurance_LandlordsPlus_Quote($quoteID);
     $changeableArray[] = new Datasource_Core_CustomerContactPreferences();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_DocumentHistory();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_PolicyNotes();
     $changeableArray[] = new Datasource_Insurance_Policy_Cover();
     $changeableArray[] = new Datasource_Insurance_Policy_PolicyTermItemHist();
     $changeableArray[] = new Datasource_Insurance_LandlordsPlus_Legacy_Sivalue();
     $changeableArray[] = new Datasource_Insurance_LandlordsPlus_Legacy_PolicyVariables();
     $changeableArray[] = new Datasource_Insurance_LegacyBankInterest();
     $changeableArray[] = new Datasource_Insurance_IddSupport();
     $changeableArray[] = new Datasource_Insurance_CompletionNotes();
     $changeableArray[] = new Datasource_Insurance_Channel();
     foreach ($changeableArray as $currentChangeable) {
         $currentChangeable->changeQuoteToPolicy($quoteNumber, $policyNumber);
     }
 }
 /**
  * Full description given in the IChangeable interface.
  *
  * Will convert all quote identifiers to policy identifiers, for a given
  * quote number, in all appropriate datasources.
  *
  * @param $string $quoteNumber
  * The full QHLI number.
  *
  * @param string $policyNumber
  * Optional. The full PHLI number. If not provided, then it will be assumed that
  * the 'QHLI' should be changed to 'PHLI'.
  *
  * @return void
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //Test to see if a test account was uesed to enter the policy
     $tester = new Manager_Core_Test();
     if ($tester->isTestPolicy($quoteNumber)) {
         //Populate a TestPolicy object into the datasource.
         $testPolicy = new Model_Core_TestPolicy();
         $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
         $quote = $quoteDatasource->getByPolicyNumber($quoteNumber);
         $testPolicy->agentschemeno = $quote->agentSchemeNumber;
         $testPolicy->csuid = 87;
         $testPolicy->isTestPolicy = "Yes";
         $testPolicy->policynumber = $quoteNumber;
         $testPolicyDatasource = new Datasource_Insurance_Policy_TestPolicy();
         $testPolicyDatasource->insertTestPolicy($testPolicy);
     }
     $changeableArray = array();
     $changeableArray[] = new Datasource_Insurance_Answers();
     $changeableArray[] = new Datasource_Insurance_Endorsements();
     $changeableArray[] = new Datasource_Insurance_AdditionalInformation();
     $changeableArray[] = new Datasource_Insurance_TenantsContentsPlus_Sharers();
     $changeableArray[] = new Datasource_Insurance_Policy_Term();
     $changeableArray[] = new Datasource_Core_UnderwritingEmailLog();
     $changeableArray[] = new Datasource_Core_DirectDebit_Payment();
     $changeableArray[] = new Datasource_Core_CreditCard_Transaction();
     $changeableArray[] = new Datasource_Core_CreditCard_Payment();
     $changeableArray[] = new Datasource_Insurance_Schedules();
     $changeableArray[] = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $quoteNumber);
     $changeableArray[] = new Datasource_Core_CustomerContactPreferences();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_DocumentHistory();
     $changeableArray[] = new Datasource_Insurance_DocumentQueue();
     $changeableArray[] = new Datasource_Insurance_PolicyNotes();
     $changeableArray[] = new Datasource_Insurance_Policy_Cover();
     $changeableArray[] = new Datasource_Insurance_Policy_Cycles(null, $quoteNumber);
     $changeableArray[] = new Datasource_Insurance_Policy_SpecPossessions($quoteNumber);
     $changeableArray[] = new Datasource_Insurance_Policy_Term();
     $changeableArray[] = new Datasource_Insurance_IddSupport();
     $changeableArray[] = new Datasource_Insurance_CompletionNotes();
     foreach ($changeableArray as $currentChangeable) {
         $currentChangeable->changeQuoteToPolicy($quoteNumber, $policyNumber);
     }
 }
示例#5
0
 /**
  * Set Channel Name
  *
  * @param string $policynumber
  * @param string $channel
  * @param int $isNewQuote  
  *
  * @return boolean true/false
  */
 public function setChannel($policyNumber, $channelOn, $isNewQuote)
 {
     $quote = new Datasource_Insurance_LegacyQuotes();
     $quoteDetails = $quote->getByPolicyNumber($policyNumber);
     $params = Zend_Registry::get('params');
     $rateStartdate = $params->lip->rateStartdate;
     if ($quoteDetails->issueDate >= $rateStartdate) {
         $channelManager = new Datasource_Insurance_Channel();
         if (!$isNewQuote || !is_null($this->getChannelName($policyNumber))) {
             if (strcasecmp($channelOn, 'Web') == 0) {
                 $channelManager->updateChannel($policyNumber, 'web');
             }
             if (strcasecmp($channelOn, 'IAS') == 0 || strcasecmp($channelOn, 'Connect') == 0) {
                 // Do Nothing;
             }
         } else {
             $channelManager->insertChannel($policyNumber, $channelOn);
         }
         return true;
     }
     return false;
 }
 /**
  * Quote list action
  * 
  * @return void
  */
 public function quotesAction()
 {
     $this->_setMetaTitle('My HomeLet | Quotes');
     $this->_setBreadcrumbs(array('/' => 'Home', '/my-homelet' => 'My HomeLet', '/my-homelet/quotes' => 'My Quotes'));
     $request = $this->getRequest();
     // Get the customer session
     $customerSession = $this->auth->getStorage()->read();
     // Search and ordering
     $filteredOrderBy = array();
     $orderBy = $request->getParam('order');
     $quoteNumberSearch = $request->getParam('id');
     // Validate order by to restricted fields to those displayed on the front end
     if (is_array($orderBy)) {
         foreach ($orderBy as $orderByField => $orderByDirection) {
             if (in_array($orderByField, array('policynumber', 'policyname', 'startdate', 'premium', 'validuntildate'))) {
                 // Copy field into new array
                 $filteredOrderBy[$orderByField] = $orderByDirection;
             }
         }
     }
     // Get list of linked customer reference numbers
     $policyCoverDatasource = new Datasource_Insurance_LegacyPolicyCovers();
     $legacyCustomerMap = new Datasource_Core_CustomerMaps();
     $legacyIDs = $legacyCustomerMap->getLegacyIDs($customerSession->id);
     // Retrieve all quotes for the linked customer reference numbers
     $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
     $quotes = $quoteDatasource->getActiveQuotes($legacyIDs, $quoteNumberSearch, $filteredOrderBy);
     // Build the list of policy covers.
     // Should be done in a manager, but the quote manager has been written with the row data gateway
     // design pattern in mind.
     foreach ($quotes as $quote) {
         // Create list of policy covers
         $policyCoverList = array();
         $policyOptionsplit = explode('|', $quote->policyOptions);
         $sumInsuredSplit = explode('|', $quote->amountsCovered);
         for ($i = 0; $i < count($policyOptionsplit); $i++) {
             if ($sumInsuredSplit[$i] == 'yes' || floatval($sumInsuredSplit[$i]) > 0) {
                 // A sum insured value has been set so assume cover is in force
                 $policyCover = $policyCoverDatasource->getPolicyCoverByLabel($policyOptionsplit[$i]);
                 if ($policyCover) {
                     array_push($policyCoverList, array('cover' => $policyOptionsplit[$i], 'name' => $policyCover->getName()));
                 }
             }
         }
         $quote->policyCovers = $policyCoverList;
     }
     $this->view->quotes = $quotes;
 }
 /**
  * Display a list of quotes that can be retrieved after a user has identified themselves with an auth token via
  * retrieveQuoteAction().  Having this separate action allows an end user to press "Back" for up to an hour if they
  * have chosen to continue the wrong quote.
  *
  * @return void
  */
 public function retrieveMultipleQuotesAction()
 {
     if ($this->getRequest()->getParam('auth') != '') {
         $params = Zend_Registry::get('params');
         $mac = $this->getRequest()->getParam('auth');
         $securityManager = new Application_Core_Security($params->myhomelet->retrieveWithoutAccount->macSecret, $params->myhomelet->retrieveWithoutAccount->macTimestampVariance != 0, $params->myhomelet->retrieveWithoutAccount->macTimestampVariance);
         $dataKeys = array('customerEmail');
         $securityCheck = $securityManager->authenticate($mac, $dataKeys);
         if (isset($securityCheck['result']) && $securityCheck['result']) {
             // Customer has multiple quotes associated with their email address - look them up and generate a set of
             // auth tokens, show user the selection
             $email = $securityCheck['data']['customerEmail'];
             $policyCoverDatasource = new Datasource_Insurance_LegacyPolicyCovers();
             $customerManager = new Manager_Core_Customer();
             // Get all legacy quote IDs by customer e-mail address
             $legacyIDs = array();
             // Try to look up a customer record's quotes' IDs by the e-mail provided
             $newCustomer = $customerManager->getCustomerByEmailAddress($email);
             if ($newCustomer) {
                 $legacyCustomerMap = new Datasource_Core_CustomerMaps();
                 $legacyIDs = $legacyCustomerMap->getLegacyIDs($newCustomer->getIdentifier(Model_Core_Customer::IDENTIFIER));
             }
             // Also check in the legacy DB only to ensure landlords quotes are found
             $customer = $customerManager->getLegacyCustomerByEmailAddress($email);
             if ($customer) {
                 $legacyCustomerId = $customer->getIdentifier(Model_Core_Customer::LEGACY_IDENTIFIER);
                 if (!in_array($legacyCustomerId, $legacyIDs)) {
                     $legacyIDs[] = $legacyCustomerId;
                 }
             }
             // Retrieve all quotes for the linked customer reference numbers
             $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
             $quotes = $quoteDatasource->getActiveQuotes($legacyIDs, '', array('policynumber', 'startdate'));
             // Build the list of policy covers and generate auth tokens for each policy
             // Should be done in a manager, but the quote manager has been written with the row data gateway
             // design pattern in mind.
             $authTokens = array();
             foreach ($quotes as $quote) {
                 // Create list of policy covers
                 $policyCoverList = array();
                 $policyOptionsplit = explode('|', $quote->policyOptions);
                 $sumInsuredSplit = explode('|', $quote->amountsCovered);
                 for ($i = 0; $i < count($policyOptionsplit); $i++) {
                     if ($sumInsuredSplit[$i] == 'yes' || floatval($sumInsuredSplit[$i]) > 0) {
                         // A sum insured value has been set so assume cover is in force
                         $policyCover = $policyCoverDatasource->getPolicyCoverByLabel($policyOptionsplit[$i]);
                         if ($policyCover) {
                             array_push($policyCoverList, array('cover' => $policyOptionsplit[$i], 'name' => $policyCover->getName()));
                         }
                     }
                 }
                 $quote->policyCovers = $policyCoverList;
                 // Generate a policy-specific authentication token
                 $securityManager = new Application_Core_Security($params->myhomelet->retrieveWithoutAccount->macSecret, $params->myhomelet->retrieveWithoutAccount->macTimestampVariance != 0, $params->myhomelet->retrieveWithoutAccount->macTimestampVariance);
                 $securityData = array('quoteNumber' => $quote->policyNumber);
                 $authTokens[$quote->policyNumber] = $securityManager->generate($securityData);
             }
             // Pass quotes and auth tokens into view and finish
             $this->view->quotes = $quotes;
             $this->view->authTokens = $authTokens;
             return;
         }
     }
     // Failover for non-auth or other issue - go to main retrieve quote form
     $this->_helper->redirector->gotoUrl('/my-homelet/retrieve-quote');
 }
示例#8
0
 /**
  * Converts quote to policy
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //If policyNumber is empty then assume the QHLI should be replaced with PHLI.
     if (empty($policyNumber)) {
         $policyNumber = preg_replace('/^Q/', 'P', $quoteNumber);
     }
     //Create a policy object from the data passed in.
     $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
     $quote = $quoteDatasource->getByPolicyNumber($quoteNumber);
     $quote->policyNumber = $policyNumber;
     $quote->status = "Policy";
     if ($this->getPayFrequency() == "ANNUALLY") {
         $quote->payBy = "Annually";
     }
     if ($this->getPayMethod() == "DD") {
         $quote->payMethod = "DirectDebit";
     } elseif ($this->getPayMethod() == "CC") {
         $quote->payMethod = "CreditCard";
     }
     //Set the issueDate and timecompleted fields (which oddly record the same value but
     //in different formats).
     $issueDate = Zend_Date::now();
     $quote->issueDate = $issueDate->toString(Zend_Date::ISO_8601);
     $quote->timeCompleted = $issueDate->toString(Zend_Date::TIMESTAMP);
     $quote->payStatus = "UpToDate";
     // Update the optionpremiums field in the database
     /* if($quote->payBy=="Annually") {
         $optionPremiums = explode('|',$quote->optionPremiums);
         for($i=0;$i<count($optionPremiums);$i++){
          $optionPremiums[$i] = round($optionPremiums[$i]*$quote->policyLength,2);
           }
         $optionPremiums = implode('|', $optionPremiums);
         $quote->optionPremiums = $optionPremiums;
        }*/
     //Write the policy to the datasource
     $policyDatasource = new Datasource_Insurance_LandlordsPlus_Policies();
     $policyDatasource->save($quote);
     //Delete the legacy quote.
     $quoteDatasource->remove(array(Manager_Insurance_TenantsContentsPlus_Quote::POLICY_NUMBER => $quoteNumber));
     // And finally - remove the new quote as well
     $this->delete();
 }
示例#9
0
 public function getPolicyName()
 {
     $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
     $quote = $quoteDatasource->getByPolicyNumber($this->_quoteModel->legacyID);
     return $quote->policyName;
 }
示例#10
0
 /**
  * Description given in the IChangeable interface.
  */
 public function changeQuoteToPolicy($quoteNumber, $policyNumber = null)
 {
     //If policyNumber is empty then assume the QHLI should be replaced with PHLI.
     if (empty($policyNumber)) {
         $policyNumber = preg_replace('/^Q/', 'P', $quoteNumber);
     }
     //Create a policy object from the data passed in.
     $quoteDatasource = new Datasource_Insurance_LegacyQuotes();
     $quote = $quoteDatasource->getByPolicyNumber($quoteNumber);
     $quote->policyNumber = $policyNumber;
     $quote->status = "Policy";
     //Set the issueDate and timecompleted fields (which oddly record the same value but
     //in different formats).
     $issueDate = Zend_Date::now();
     $quote->issueDate = $issueDate->toString(Zend_Date::ISO_8601);
     $quote->timeCompleted = $issueDate->toString(Zend_Date::TIMESTAMP);
     // Update the optionpremiums field in the database
     if ($quote->payBy == "Annually") {
         $optionPremiums = explode('|', $quote->optionPremiums);
         $optionPremiums[0] = round($optionPremiums[0] * $quote->policyLength, 2);
         $optionPremiums[1] = round($optionPremiums[1] * $quote->policyLength, 2);
         $optionPremiums[2] = round($optionPremiums[2] * $quote->policyLength, 2);
         $optionPremiums[3] = round($optionPremiums[3] * $quote->policyLength, 2);
         $optionPremiums = implode('|', $optionPremiums);
         $quote->optionPremiums = $optionPremiums;
     }
     //Write the policy to the datasource
     $policyDatasource = new Datasource_Insurance_TenantsContentsPlus_Policies();
     $policyDatasource->save($quote);
     //Finally, delete the quote.
     $quoteDatasource->remove(array(Manager_Insurance_TenantsContentsPlus_Quote::POLICY_NUMBER => $quoteNumber));
 }