/** * Action for the Confirmation of a successful direct debit Payment * * @return void */ public function ddconfirmationAction() { $pageSession = new Zend_Session_Namespace('landlords_insurance_quote'); $policyNumber = $this->getRequest()->getParam('pn'); $quoteNumber = str_replace('Q', 'P', $policyNumber); // Check to see if this quote has already been converted to a policy - if it has we don't want to do any of the below $policyManager = new Manager_Insurance_LegacyPolicy(); $policy = $policyManager->getByPolicyNumber($policyNumber); // My HomeLet registration/login form and processing $this->view->form = $this->registrationFormProcess($policyNumber); // Set the completed status of the quote to true $this->view->completed = true; if (is_null($policy)) { $refNo = $this->_customerReferenceNumber; // Set up the validators and filters $filters = array(); $validators = array(); $request = $this->getRequest(); $input = new Zend_Filter_Input($filters, $validators, $request->getParams()); if ($input->isValid()) { // Update Pay Status $quoteManager = new Manager_Insurance_LandlordsPlus_Quote($this->_quoteID); $quoteNumber = $quoteManager->getPolicyNumber(); $schedule = new Manager_Insurance_Schedule(); $schedule->save($refNo, $quoteManager); $quoteToPolicyManager = new Manager_Insurance_LandlordsPlus_QuoteToPolicy(); $quoteToPolicyManager->changeQuoteToPolicy($quoteNumber); //Update the WebLeads $session = new Zend_Session_Namespace('landlords_insurance_quote'); $webLeadManager = new Manager_Core_WebLead(); $webLeadSummary = $webLeadManager->getSummary($session->webLeadSummaryId); $webLeadSummary->quoteNumber = $policyNumber; $webLeadSummary->status = Model_Core_WebLeadStatus::COMPLETE; $webLeadSummary->completedTime = $this->_offsetDate(); $webLeadManager->updateSummary($webLeadSummary); $agentSchemeNumber = Manager_Core_Agent::filterAsn($quoteManager->getAgentSchemeNumber()); // Document management stuff, only runs on first conversion of quote -> policy $documentManager = new Manager_Insurance_Document(); $documentManager->createAndPostDocument($policyNumber, Model_Insurance_LandlordsPlus_DocumentTypes::NEW_POLICY_DOCS); $documentArray = $documentManager->getDocuments($policyNumber, Model_Insurance_LandlordsPlus_DocumentTypes::NEW_POLICY_DOCS); $firstDocument = $documentArray[0]; // Put the document number into session so that it can be displayed from this action and later in // the registration confirmation action if (!is_null($firstDocument)) { $pageSession->documentNumber = $firstDocument->request_hash; } } // If a document number exists from before, pass it into the view if (isset($pageSession->documentNumber)) { $this->view->documentNumber = $pageSession->documentNumber; } // Extra values passed into view for Google Analytics commerce tracking: if (is_null($policy)) { $policy = $policyManager->getByPolicyNumber($policyNumber); } $this->view->policy = $policy; // Policy object // todo: Fix disgusting way of passing additional data through two chained views. $extraVars = new stdClass(); $monthMultiplier = strtolower($policy->paySchedule) == 'monthly' ? 12 : 1; $extraVars->quoteAnnual = $policy->quote * $monthMultiplier; $extraVars->iptAnnual = $policy->ipt * $monthMultiplier; $this->view->extraVars = $extraVars; } else { $agentSchemeNumber = Manager_Core_Agent::filterAsn($policy->agentSchemeNumber); } // Put Policy number in the view $this->view->policyNumber = $policyNumber; // Fetch the HOMELETUK.COM legacy domain // Please don't change this again it is SUPPOSED to be the old crappy php4 box // Put domain name of the legacy server in the view $this->view->domain = $this->_params->homelet->legacyDomain; $whiteLabelManager = new Manager_Core_WhiteLabel(); $whiteLabelData = new Model_Core_WhiteLabel(); $whiteLabelData = $whiteLabelManager->fetchByAgentSchemeNumber($agentSchemeNumber); $this->view->companyName = $whiteLabelData->companyName; $this->view->companyName = "HomeLet"; }
/** * Action for the Confirmation of a Successful Credit card Payment * * @return void * @todo The company name need to be fetched from branding * */ public function ddconfirmationAction() { $policyNumber = $this->getRequest()->getParam("pn") ? $this->getRequest()->getParam("pn") : $this->_policyNumber; $quoteNumber = str_replace('P', 'Q', $policyNumber); // Check to see if this quote has already been converted to a policy - if it has we don't want to do any of the below $policyManager = new Manager_Insurance_LegacyPolicy(); $policy = $policyManager->getByPolicyNumber($policyNumber); if (is_null($policy)) { $refNo = $this->_customerReferenceNumber; $params = Zend_Registry::get('params'); // Set up the validators and filters $filters = array(); $validators = array(); $request = $this->getRequest(); $input = new Zend_Filter_Input($filters, $validators, $request->getParams()); if ($input->isValid()) { // Update Pay Status $quote = new Manager_Insurance_TenantsContentsPlus_Quote(null, null, $this->_policyNumber); $quoteObject = new Model_Insurance_LegacyQuote(); $quoteObject = $quote->getQuoteObject(); $quoteObject->startTime = date("h:j:s"); $quoteObject->payStatus = "UpToDate"; $quote->update($quoteObject); /*$quoteObject->startTime = date("h:j:s"); $quoteObject->payStatus = "UpToDate"; $quote->update($quoteObject);*/ $schedule = new Manager_Insurance_Schedule(); $schedule->save($refNo, $quote); $quoteToPolicyManager = new Manager_Insurance_TenantsContentsPlus_QuoteToPolicy(); $quoteToPolicyManager->changeQuoteToPolicy($quoteNumber); //Update the WebLeads $webLeadManager = new Manager_Core_WebLead(); $webLeadSummary = $webLeadManager->getSummary($this->_webLeadSummaryId); $webLeadSummary->quoteNumber = $policyNumber; $webLeadSummary->status = Model_Core_WebLeadStatus::COMPLETE; $webLeadSummary->completedTime = $this->_offsetDate(); $webLeadManager->updateSummary($webLeadSummary); $agentSchemeNumber = Manager_Core_Agent::filterAsn($quote->getAgentSchemeNumber()); // Transaction is complete unset the Session to prevent navigation to other steps again Zend_Session::namespaceUnset('tenants_insurance_quote'); // Document management stuff, only runs on first conversion of quote -> policy $documentManager = new Manager_Insurance_Document(); $documentManager->createAndPostDocument($policyNumber, Model_Insurance_TenantsContentsPlus_DocumentTypes::NEW_POLICY_DOCS); $documentArray = $documentManager->getDocuments($policyNumber, Model_Insurance_TenantsContentsPlus_DocumentTypes::NEW_POLICY_DOCS); $firstDocument = $documentArray[0]; // Put document number in the view, on any later page loads to the same URL this part will not be available for better security if (!is_null($firstDocument)) { $this->view->documentNumber = $firstDocument->request_hash; } } } else { $agentSchemeNumber = Manager_Core_Agent::filterAsn($policy->agentSchemeNumber); } $disbursement = new Manager_Core_Disbursement(); $disbursement->createTermImage($policyNumber); $params = Zend_Registry::get('params'); // Put domain name of the legacy server in the view $this->view->domain = $params->homelet->legacyDomain; $whiteLabelManager = new Manager_Core_WhiteLabel(); $whiteLabelData = new Model_Core_WhiteLabel(); $whiteLabelData = $whiteLabelManager->fetchByAgentSchemeNumber($agentSchemeNumber); $this->view->companyName = $whiteLabelData->companyName; $this->view->companyName = "HomeLet"; // Put Policy number in the view $this->view->policyNumber = $policyNumber; $this->view->openingTimes = $params->cms->openingtimes->insurance->tenants; // Extra values passed into view for Google Analytics commerce tracking: if (is_null($policy)) { $policy = $policyManager->getByPolicyNumber($policyNumber); } $this->view->policy = $policy; // Policy object // todo: Fix disgusting way of passing additional data through two chained views. $extraVars = new stdClass(); $monthMultiplier = strtolower($policy->paySchedule) == 'monthly' ? 12 : 1; $extraVars->quoteAnnual = $policy->quote * $monthMultiplier; $extraVars->iptAnnual = $policy->ipt * $monthMultiplier; $this->view->extraVars = $extraVars; }
/** * Displays the customer and policy summary + dynamic options for a policy * plucked from the legacy DB by its policyno taken from a GET parameter. * * @return void */ public function showPolicyAction() { // Agents with wrong FSA status cannot access insurance functionality. $this->view->pageTitle = 'Policy Details'; $baseInsuranceUrl = $this->_params->connect->baseUrl->insurance; // Non SSL URL must be used for document production. :-/ $baseInsuranceUrlNoSsl = preg_replace('/^https?(.*)/i', 'http$1', $baseInsuranceUrl); $request = $this->getRequest(); // See if there's a GET-based policyno if ($request->isGet() && !is_null($request->getParam('policyno'))) { $usermanager = new Manager_Core_Agent_User(); $user = $usermanager->getUser($this->_agentId); // Fetch policy by policyno using the Insurance MUNT Manager class $insMuntManager = new Manager_Insurance_Munt(); $policyResults = $insMuntManager->getPolicy($request->getParam('policyno')); if ($policyResults['companyschemenumber'] == $this->_agentSchemeNumber) { if (in_array($this->_fsastatusabbr, $this->_blockFsaStatus)) { return; } $coverResults = $insMuntManager->getCover($request->getParam('policyno')); $customerResults = $insMuntManager->getCustomer($policyResults['refno']); // Update start/end dates for Zend Dates if ($policyResults['startdate'] == '0000-00-00') { $policyResults['startdate'] = null; } else { $policyResults['startdate'] = new Zend_Date($policyResults['startdate']); } if ($policyResults['enddate'] == '0000-00-00') { $policyResults['enddate'] = null; } else { $policyResults['enddate'] = new Zend_Date($policyResults['enddate']); } $documentManager = new Manager_Insurance_Document(); $docHistoryResults = $documentManager->getDocuments($request->getParam('policyno'), null, array('holder', 'agent')); // Show user search results $this->view->policy = $policyResults; $this->view->cover = $coverResults; $this->view->customer = $customerResults; $this->view->baseUrl = $baseInsuranceUrl; $this->view->baseUrlNoSsl = $baseInsuranceUrlNoSsl; $this->view->agentsEmail = $user->email->emailAddress; $this->view->docHistoryResults = $docHistoryResults; } else { // Not the agents policy, protect the display of data, report an error $this->view->policynumber = $policyResults['policynumber']; $this->render('show-policy-denied'); } } }