/** * Specifies whether a TAT is applicable to the reference. * * TATs are not always applicable for various reasons, and this method holds the business * rules to identify this. Should be called before any other TAT-related action, so that * additional actions can be averted if a TAT is not applicable. * * TATs are not applicable to some products, cannot be used if the reference subject (tenant) does * not have an email address, cannot be used if older than 30 days, cannot be used if the * agent has opted out of the TAT facility, and cannot be used if the reference subject * is a guarantor. * * @param void * * @return boolean * True if a TAT is applicable, false otherwise. * * @todo * Currently uses the legacy missing information manager. Should use the new one when the new * missing information manager is built. */ public function isTatApplicable() { //First test: is the reference cancelled? if ($this->_reference->status->state == Model_Referencing_ReferenceStates::CANCELLED) { return false; } //Next test: does the product merit a TAT? $product = $this->_reference->productSelection->product; if (empty($product->variables)) { return false; } else { if (isset($product->variables[Model_Referencing_ProductVariables::CREDIT_REFERENCE])) { return false; } } //Next test: only tenants can login. if ($this->_reference->referenceSubject->type != Model_Referencing_ReferenceSubjectTypes::TENANT) { return false; } //Next test: is the reference over >= 30 days? if ($this->isTatExpired()) { return false; } //Next test: has the agent opted out of the TAT? $tatOptedStatusDatasource = new Datasource_Referencing_TatOptedStatus(); $tatOptedStatus = $tatOptedStatusDatasource->getOptedStatus($this->_reference->customer->customerId); if ($tatOptedStatus == Model_Referencing_TatOptedStates::OPTED_OUT) { return false; } return true; }
/** * Sets whether the agent is opted in or out of the TAT service. * * @param string $agentSchemeNumber * The unique agent identifier. * * @param string $optedStatus * The opted status to set. Must correspond to one of the consts * exposed by the Model_Referencing_TatOptedStates class. * * @return void */ public function setAgentOptedStatus($agentSchemeNumber, $optedStatus) { $datasource = new Datasource_Referencing_TatOptedStatus(); if ($optedStatus == Model_Referencing_TatOptedStates::OPTED_OUT) { $datasource->setOptedOut($agentSchemeNumber); } else { $datasource->setOptedIn($agentSchemeNumber); } }