/** * 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; }
/** * Constructor * * @todo * This constructor calls the _save() method. Not necessarily something calling code will want, if the * calling code just wants to use one of the class methods, e.g. changeQuoteToPolicy(). */ public function __construct($refNumber = null, $agentSchemeNumber = null, $policyNumber = null) { Application_Core_Logger::log('Quote Manager Instantiated', 'info'); $quoteDatasource = new Datasource_Insurance_LegacyQuotes(); $policyDatasource = new Datasource_Insurance_TenantsContentsPlus_Policies(); // Try to load the quote from the datasource - if it doesn't exist we just get a blank object back if ($policyNumber != null) { $this->_quoteModel = $quoteDatasource->getByPolicyNumber($policyNumber); $this->_rateSetID = $this->_quoteModel->rateSetID; } else { $this->_quoteModel = new Model_Insurance_LegacyQuote(); } if (!is_null($agentSchemeNumber)) { $this->_quoteModel->agentSchemeNumber = $agentSchemeNumber; // Create an Agent Model $agent = new Datasource_Core_Agents(); $this->_quoteModel->agentRateSetID = $agent->getRatesetID($this->_quoteModel->agentSchemeNumber); } /* We also need to set the value of the white label whitelabelID, NOTE: this field is a char(2) part of a multiple index and defaults to zero (0) */ $whiteLabelManager = new Manager_Core_WhiteLabel(); $whiteLabelData = new Model_Core_WhiteLabel(); $whiteLabelData = $whiteLabelManager->fetchByAgentSchemeNumber($this->_quoteModel->agentSchemeNumber); $this->_quoteModel->whiteLabelID = !is_null($whiteLabelData) ? $whiteLabelData->twoLetterCode : 'HL'; if (!isset($this->_quoteModel->policyNumber) || $this->_quoteModel->policyNumber == '') { // Fetch the available policy options for tenantsp $policyOptionsManager = new Manager_Insurance_TenantsContentsPlus_Policy_Options(); $policyOptions = $policyOptionsManager->getOptions(); // Get the next policy number $policyNumberDatasource = new Datasource_Core_NumberTracker(); $policyNumber = $policyNumberDatasource->getNextPolicyNumber(); $policyNumber = "QHLI" . $policyNumber . "/01"; $this->_quoteModel->refNo = $refNumber; $this->_quoteModel->policyNumber = $policyNumber; $this->_quoteModel->policyName = 'tenantsp'; $this->_quoteModel->policyOptions = implode('|', $policyOptions); $this->_quoteModel->policyType = 'T'; } $idd = new Datasource_Insurance_IddSupport(); if (!$idd->isIddSupport($this->_quoteModel->policyNumber)) { $inserArray = array(); $insertArray['policynumber'] = $this->_quoteModel->policyNumber; $insertArray['agentschemeno'] = $this->_quoteModel->agentSchemeNumber; $insertArray['csuid'] = 0; $fsaAgentStatusDatasource = new Datasource_Fsa_AgentStatus(); $fsaStatus = $fsaAgentStatusDatasource->getAgentFsaStatus($this->_quoteModel->agentSchemeNumber); if (isset($fsaStatus['status_abbr'])) { $insertArray['FSA_status'] = $fsaStatus['status_abbr']; } else { $insertArray['FSA_status'] = ""; } $insertArray['origsaleid'] = 9; $insertArray['callerid'] = 2; $idd->setIddSupport($insertArray); } // Now need to push this object into the legacy quote datastore and save it $this->_save(); Application_Core_Logger::log(print_r($this->_quoteModel, true), 'info'); }