コード例 #1
0
 /**
  * Determine if $reference satisfies this Criteria.
  *
  * @param RentRecoveryPlusReference $reference
  * @return bool
  */
 public function isSatisfiedBy(RentRecoveryPlusReference $reference)
 {
     if (EmploymentStatuses::EMPLOYED != $reference->getParent()->getEmploymentStatus()) {
         $this->setNotSatisfiedText(sprintf('Employment criteria is not met. Reference %s employment status is %d', $reference->getParent()->getReferenceNumber(), $reference->getParent()->getEmploymentStatus()))->setIsSatisfied(false);
         return false;
     }
     return true;
 }
コード例 #2
0
 /**
  * @test
  */
 public function criteria_is_not_satisfied_when_reference_has_adverse_credit()
 {
     $reference = new ReferencingApplication();
     $reference->setHasCCJ(true);
     $rrpReference = new RentRecoveryPlusReference();
     $rrpReference->setParent($reference);
     $this->assertFalse($this->criteria->isSatisfiedBy($rrpReference));
 }
コード例 #3
0
 /**
  * Determine if $reference satisfies this Criteria.
  *
  * @param RentRecoveryPlusReference $reference
  * @return bool
  */
 public function isSatisfiedBy(RentRecoveryPlusReference $reference)
 {
     if (ApplicationStatuses::COMPLETE != $reference->getParent()->getStatus()) {
         $this->setNotSatisfiedText(sprintf('Status criteria is not met. Reference %s status is %d', $reference->getParent()->getReferenceNumber(), $reference->getParent()->getStatus()))->setIsSatisfied(false);
         return false;
     }
     return true;
 }
コード例 #4
0
 /**
  * Determine if $reference satisfies this Criteria.
  *
  * @param RentRecoveryPlusReference $reference
  * @return bool
  */
 public function isSatisfiedBy(RentRecoveryPlusReference $reference)
 {
     if ($reference->getParent()->getHasCCJ()) {
         $this->setNotSatisfiedText(sprintf('Adverse credit criteria is not met. Reference %s has adverse credit', $reference->getParent()->getReferenceNumber()))->setIsSatisfied(false);
         return false;
     }
     return true;
 }
 /**
  * @test
  */
 public function displays_reference_number_after_transformation()
 {
     $transformer = new ReferenceNumberToReferenceObjectTransformer($this->mockDecisionDetailsRetriever, $this->mockSessionHolder, $this->mockRentRecoveryPlusReference);
     $parentReference = new ReferencingApplication();
     $parentReference->setReferenceNumber('HLT999');
     $transformedObject = new RentRecoveryPlusReference();
     $transformedObject->setParent($parentReference);
     $this->assertEquals('HLT999', $transformer->transform($transformedObject));
 }
コード例 #6
0
 /**
  * Determine if $reference satisfies this Criteria.
  *
  * @param RentRecoveryPlusReference $reference
  * @return bool
  */
 public function isSatisfiedBy(RentRecoveryPlusReference $reference)
 {
     $recommendationStatus = $reference->getDecisionDetails()->getRecommendation()->getStatus();
     if (RecommendationStatuses::ACCEPTABLE_WITH_GUARANTOR != $recommendationStatus && RecommendationStatuses::ACCEPTABLE_WITH_GUARANTOR_WITH_CONDITION != $recommendationStatus) {
         $this->setNotSatisfiedText(sprintf('Reference %s is not acceptable with a suitable guarantor', $reference->getParent()->getReferenceNumber()))->setIsSatisfied(false);
         return false;
     }
     return true;
 }
コード例 #7
0
 /**
  * Get a guarantor ReferencingApplication from IRIS, attach it to a RentRecoveryPlusReference and return it.
  *
  * @param RentRecoveryPlusReference $tenant
  * @return RentRecoveryPlusReference
  */
 private function createGuarantor(RentRecoveryPlusReference $tenant)
 {
     $guarantorCollection = $this->clientRegistry->getAgentContext()->getReferencingApplicationClient()->getReferencingApplicationGuarantors(array('referencingApplicationUuId' => $tenant->getParent()->getReferencingApplicationUuid()));
     // todo: Grab the first one for now - business will likely want to consider all Guarantors however.
     $guarantor = current($guarantorCollection->getAll());
     $this->rrpGuarantor = new RentRecoveryPlusReference();
     $this->rrpGuarantor->setParent($guarantor)->setDecisionDetails($this->decisionDetailsRetriever->getDecisionDetails($guarantor));
     return $this->rrpGuarantor;
 }
コード例 #8
0
 /**
  * Determine if $reference satisfies this Criteria.
  *
  * @param RentRecoveryPlusReference $reference
  * @return bool
  */
 public function isSatisfiedBy(RentRecoveryPlusReference $reference)
 {
     $creditScore = $reference->getDecisionDetails()->getCreditReference()->getScore();
     if (CreditScoreCriteriaLimits::MINIMUM_INSIGHT_CREDIT_SCORE > $creditScore) {
         $this->setNotSatisfiedText(sprintf('Credit score criteria is not met. Reference %s credit score is %d', $reference->getParent()->getReferenceNumber(), $creditScore))->setIsSatisfied(false);
         return false;
     }
     return true;
 }
コード例 #9
0
 /**
  * Create the relevant criteria group.
  *
  * @param RentRecoveryPlusReference $reference
  * @return DefaultGuarantorCheckCriteriaGroup|DefaultNoGuarantorCheckCriteriaGroup
  */
 protected function createCriteria(RentRecoveryPlusReference $reference)
 {
     // Only need guarantor checks if tenant is not acceptable
     $decisionOutcome = $reference->getDecisionDetails()->getRecommendation()->getStatus();
     $needsGuarantorCheck = RecommendationStatuses::ACCEPTABLE != $decisionOutcome && RecommendationStatuses::ACCEPTABLE_WITH_CONDITION != $decisionOutcome;
     if ($needsGuarantorCheck) {
         return new DefaultGuarantorCheckCriteriaGroup(new StatusCriteria(), new SuitableGuarantorCriteria(), new GuarantorOutcomeCriteria($this->rrpGuarantorReferenceCreator));
     } else {
         return new DefaultNoGuarantorCheckCriteriaGroup(new StatusCriteria());
     }
 }
コード例 #10
0
 /**
  * Pre test set up.
  */
 public function setUp()
 {
     $this->criteria = new CreditScoreCriteria();
     $this->reference = new ReferencingApplication();
     $this->decisionDetails = new ReferencingDecisionDetails();
     $this->creditReference = new CreditReference();
     $this->rrpReference = new RentRecoveryPlusReference();
     $this->rrpReference->setParent($this->reference);
     $this->rrpReference->setDecisionDetails($this->decisionDetails);
     $this->decisionDetails->setCreditReference($this->creditReference);
 }
コード例 #11
0
 public function setUp()
 {
     $this->decisionDetails = new ReferencingDecisionDetails();
     $this->recommendation = new Recommendation();
     $this->guarantorRrpReference = new RentRecoveryPlusReference();
     $this->guarantorRrpReference->setParent(new ReferencingApplication());
     $this->guarantorRrpReference->setDecisionDetails($this->decisionDetails);
     $this->decisionDetails->setRecommendation($this->recommendation);
     $guarantorCreatorMock = $this->getMockBuilder('RRP\\Utility\\RrpGuarantorReferenceCreator')->disableOriginalConstructor()->getMock();
     $guarantorCreatorMock->expects($this->once())->method('getGuarantor')->willReturn($this->guarantorRrpReference);
     $this->criteria = new GuarantorOutcomeCriteria($guarantorCreatorMock);
 }
コード例 #12
0
 /**
  * @return array
  */
 public function getUnemployedReferences()
 {
     $unemployedStatuses = array('unemployed' => EmploymentStatuses::UNEMPLOYED, 'independent' => EmploymentStatuses::INDEPENDENT_MEANS, 'contract' => EmploymentStatuses::ON_CONTRACT, 'retired' => EmploymentStatuses::RETIRED, 'student' => EmploymentStatuses::STUDENT, 'self-employed' => EmploymentStatuses::SELF_EMPLOYED);
     $references = array();
     foreach ($unemployedStatuses as $key => $unemployedStatus) {
         $reference = new ReferencingApplication();
         $reference->setEmploymentStatus($unemployedStatus);
         $rrpReference = new RentRecoveryPlusReference();
         $rrpReference->setParent($reference);
         $references[$key] = $rrpReference;
     }
     return array(array($references['unemployed']), array($references['independent']), array($references['contract']), array($references['retired']), array($references['student']), array($references['self-employed']));
 }
コード例 #13
0
 /**
  * @return array
  */
 public function getIncompleteReferences()
 {
     $incompleteStatuses = array('incomplete' => ApplicationStatuses::INCOMPLETE, 'in_progress' => ApplicationStatuses::IN_PROGRESS, 'awaiting_application_details' => ApplicationStatuses::AWAITING_APPLICATION_DETAILS, 'cancelled' => ApplicationStatuses::CANCELLED, 'declined' => ApplicationStatuses::DECLINED, 'awaiting_agent_review' => ApplicationStatuses::AWAITING_AGENT_REVIEW);
     $references = array();
     foreach ($incompleteStatuses as $key => $incompleteStatus) {
         $reference = new ReferencingApplication();
         $reference->setStatus($incompleteStatus);
         $rrpReference = new RentRecoveryPlusReference();
         $rrpReference->setParent($reference);
         $references[$key] = $rrpReference;
     }
     return array(array($references['incomplete']), array($references['in_progress']), array($references['awaiting_application_details']), array($references['cancelled']), array($references['declined']), array($references['awaiting_agent_review']));
 }
コード例 #14
0
 /**
  * @test
  * @covers RrpGuarantorReferenceCreator::getGuarantor
  * @covers RrpGuarantorReferenceCreator::createGuarantor
  */
 public function guarantor_is_only_retrieved_from_web_service_once_on_consecutive_calls()
 {
     $reference = new ReferencingApplication();
     $rrpReference = new RentRecoveryPlusReference();
     $rrpReference->setParent($reference);
     // Prepare the first call which will talk to web service
     $mockResult = new Collection(array(new ReferencingApplication()));
     $this->mockReferencingApplicationClient->expects($this->once())->method('getReferencingApplicationGuarantors')->willReturn($mockResult);
     $rrpGuarantorReferenceCreator = new RrpGuarantorReferenceCreator($this->mockClientRegistry, $this->mockDecisionDetailsRetriever);
     $rrpGuarantorReferenceCreator->getGuarantor($rrpReference);
     // Second time around, assert that we don't talk to web service, and still return a RentRecoveryPlusReference
     $this->mockClientRegistry->expects($this->never())->method($this->anything());
     $this->assertInstanceOf('RRP\\Model\\RentRecoveryPlusReference', $rrpGuarantorReferenceCreator->getGuarantor($rrpReference));
 }
 /**
  * Takes a reference of type ReferencingApplication and sets it as a parent of a RentRecoveryPlusReference.
  *
  * @param ReferencingApplication $referenceToConvert
  * @return RentRecoveryPlusReference
  */
 private function createRentRecoveryPlusReference(ReferencingApplication $referenceToConvert)
 {
     $decisionDetails = $this->decisionDetailsRetriever->getDecisionDetails($referenceToConvert);
     $this->convertedReference->setParent($referenceToConvert)->setDecisionDetails($decisionDetails);
     return $this->convertedReference;
 }
コード例 #16
0
 /**
  * Determine which strategy to use and create the appropriate criteria group through its factory.
  *
  * @param RentRecoveryPlusReference $reference
  * @return AbstractCriteria
  */
 protected function createCriteriaStrategy(RentRecoveryPlusReference $reference)
 {
     if ($reference->getParent()->getProductId() == ProductIds::INSIGHT) {
         $this->factory = new InsightCriteriaFactory();
     } else {
         $this->factory = new DefaultCriteriaFactory($this->rrpGuarantorReferenceCreator);
     }
     return $this->factory->create($reference);
 }
コード例 #17
0
 /**
  * @return array
  */
 public function getUnsuitableRecommendationStatuses()
 {
     $recommendationStatuses = array('acceptable' => RecommendationStatuses::ACCEPTABLE, 'acceptable_with_condition' => RecommendationStatuses::ACCEPTABLE_WITH_CONDITION, 'not_acceptable' => RecommendationStatuses::NOT_ACCEPTABLE, 'awaiting_further_information' => RecommendationStatuses::AWAITING_FURTHER_INFORMATION, 'awaiting_completion_of_lead_tenant' => RecommendationStatuses::AWAITING_COMPLETION_OF_LEAD_TENANT, 'zero_rent_cotenant_not_acceptable' => RecommendationStatuses::ZERO_RENT_COTENANT_NOT_ACCEPTABLE, 'zero_rent_cotenant_acceptable' => RecommendationStatuses::ZERO_RENT_COTENANT_ACCEPTABLE);
     $references = array();
     foreach ($recommendationStatuses as $key => $recommendationStatus) {
         $recommendation = new Recommendation();
         $recommendation->setStatus($recommendationStatus);
         $decisionDetails = new ReferencingDecisionDetails();
         $decisionDetails->setRecommendation($recommendation);
         $reference = new ReferencingApplication();
         $rrpReference = new RentRecoveryPlusReference();
         $rrpReference->setDecisionDetails($decisionDetails);
         $rrpReference->setParent($reference);
         $references[$key] = $rrpReference;
     }
     return array(array($references['acceptable']), array($references['acceptable_with_condition']), array($references['not_acceptable']), array($references['awaiting_further_information']), array($references['awaiting_completion_of_lead_tenant']), array($references['zero_rent_cotenant_not_acceptable']), array($references['zero_rent_cotenant_acceptable']));
 }