/**
  * Sets the data from the application
  *
  * @param RentRecoveryPlusApplication $application
  * @return $this;
  */
 public function setFromApplication(RentRecoveryPlusApplication $application)
 {
     $this->rrpData->setPolicyNumber($application->getPolicyNumber())->setReferenceType($application->getReferenceType())->setOtherProvider($application->getOtherProvider())->setExistingPolicyRef($application->getExistingPolicyRef())->setIsExistingPolicyToBeCancelled($application->getIsExistingPolicyToBeCancelled())->setCancellationObjections($application->getCancellationObjections())->setPropertyLetType($application->getPropertyLetType())->setHasLandlordPermission($application->getHasLandlordPermission())->setPropertyDeposit($application->getPropertyDeposit())->setHasNilDepositInsurance($application->getHasNilDepositInsurance())->setTenancyStartAt($application->getTenancyStartAt())->setClaimInfo($application->getClaimInfo());
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_CONTINUATION] = $application->getIsContinuationOfExistingPolicy();
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_RENT_IN_ADVANCE] = $application->getHasPaidRentInAdvance();
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_CLAIM_CIRCUMSTANCES] = $application->getHasPossibleClaimCircumstances();
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_PERMITTED_OCCUPIERS] = $application->getHasPermittedOccupiersOnly();
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_TENANCY_DISPUTES] = $application->getHasTenancyDisputes();
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_TENANCY_AST] = TenancyAgreementTypes::isAssuredShortholdTenancy($application->getTenancyAgreementType());
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_PRIOR_CLAIMS] = $application->getHasPriorClaims();
     $this->underwritingAnswers[RentRecoveryPlusAnswers::QUESTION_ID_DEPOSIT_SUFFICIENT] = $application->getIsDepositSufficient();
     $now = new \DateTime();
     $referenceNumberList = preg_split('/[\\n,]/', $application->getReferenceNumber());
     $this->rrpTenantReferenceData = array();
     $rrpTenantReferenceData = $this->container->get(str_replace('.datasource.', '.', self::LEGACY_RRP_TENANT_REFERENCE_DATASOURCE));
     foreach ($referenceNumberList as $referenceNumber) {
         $referenceNumber = trim($referenceNumber);
         if (!empty($referenceNumber)) {
             $rrpTenantReferenceData->setId(0)->setPolicyNumber($application->getPolicyNumber())->setReferenceNumber($referenceNumber)->setTermId(0)->setMtaId(0)->setDateCreatedAt($now);
             $this->rrpTenantReferenceData[] = clone $rrpTenantReferenceData;
         }
     }
     list($address1, $address2, $address3) = $this->splitAddress($application->getPropertyAddress1(), $application->getPropertyAddress2());
     $this->appData->setPolicyLength($application->getPolicyLength())->setStartDate($application->getPolicyStartAt())->setEndDate($application->getPolicyEndAt())->setPropertyAddress1($address1)->setPropertyAddress2($address2)->setPropertyAddress3($address3)->setPropertyPostcode($application->getPropertyPostcode());
     if ($application->getIsPayMonthly()) {
         $this->appData->setPayBy($this->container->get('rrp.legacy.const.pay_by_monthly'));
     } else {
         $this->appData->setPayBy($this->container->get('rrp.legacy.const.pay_by_annually'));
     }
     list($address1, $address2, $address3) = $this->splitAddress($application->getLandlordAddress1(), $application->getLandlordAddress2());
     $this->lliData->setTitle($application->getLandlordTitle())->setFirstName($application->getLandlordFirstName())->setLastName($application->getLandlordLastName())->setEmailAddress($application->getLandlordEmailAddress())->setPhoneNumber($application->getLandlordPhoneNumber())->setAddress1($address1)->setAddress2($address2)->setAddress3($address3)->setPostcode($application->getLandlordPostcode())->setCountry(Countries::getCountryName($application->getLandlordCountry()))->setIsForeignAddress($application->getLandlordCountry() != Countries::GB);
     if (Titles::isOther($application->getLandlordTitle())) {
         $this->lliData->setTitle($application->getLandlordOtherTitle());
     }
     return $this;
 }
 /**
  * Initialise $rateManager.
  *
  * @param RentRecoveryPlusApplication $application
  * @return \RRP\Rate\RateDecorators\RentRecoveryPlus
  */
 private function initialiseRateManager(RentRecoveryPlusApplication $application)
 {
     /** @var RRP\Rate\RateDecoratorFactory $rateDecoratorClass */
     $rateDecoratorClass = $this->getContainer()->get('rrp.rate.decorator.class');
     /** @var RRP\Rate\RateDecorators\RentRecoveryPlus $rateManager */
     $rateManager = $rateDecoratorClass::getDecorator('RentRecoveryPlus', $this->_agentsRateID, $this->_params->connect->settings->rentRecoveryPlus->riskArea, $this->_params->connect->settings->rentRecoveryPlus->iptPercent, $application->getPropertyRental(), $application->getIsNilExcess(), $application->getReferenceType(), $application->getPolicyLength(), $application->getIsPayMonthly(), $application->getPolicyStartAt());
     return $rateManager;
 }