/**
  * 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;
 }