/** * Get policy details of a rent guarantee policy * * @param string $policynumber Rent guarantee policy number * @return Model_Insurance_Quote Quote object, representing the policy, populated with data */ public function getPolicyDetails($policynumber) { return $this->_policyModel->getByPolicyNumber($policynumber); }
private function _calculateTax() { $policyDisb = new Datasource_Insurance_LegacyPolicies(); $policy = $policyDisb->getByPolicyNumber($this->_policynumber); $postcode = $policy->propertyPostcode; $taxInfo = new Datasource_Core_Tax(); $tax = $taxInfo->getTaxbyTypeAndPostcode('IPT', $postcode, $this->_startdate); $taxrate = $tax['rate']; $this->_iptOption = round($this->_premOption * ($taxrate / 100), 4); }
/** * Retrieve the document * * @param string $policyNumber Policy number * @param string $documentId Unique document request hash * @return string null or PDF contents */ private function _fetchDocument($policyNumber, $documentId) { // Get the customer session $customerSession = $this->auth->getStorage()->read(); // Get the request policy if ($policyNumber[0] == 'Q') { // Quotes $legacyPolicies = new Datasource_Insurance_LegacyQuotes(); } else { // Policies $legacyPolicies = new Datasource_Insurance_LegacyPolicies(); } $policy = $legacyPolicies->getByPolicyNumber($policyNumber); if (!$policy) { return null; } // 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, $policy->refNo); // Confirm the policy number belongs to the logged in customer if ($customerMap == false || $customerMap->getIdentifier() != $customerSession->id) { // Customer map not found or customer is not mapped to refno, render error message return null; } // Get all document details $documentHistory = new Datasource_Insurance_DocumentHistory(); $document = $documentHistory->getDocument($documentId, $policyNumber); if (!$document) { return null; } // Retrieve document from store $documentFulfillmentService = new Service_Insurance_Document(); return $documentFulfillmentService->retrieveDocumentFromStore($documentId, $document->template_name, Service_Insurance_Document::DOCUMENT_AND_ATTACHMENTS); }