/**
  * Sets the data using the application as the source
  *
  * @param RentRecoveryPlusApplication $application
  * @param float $premium
  */
 public function setFromApplication(RentRecoveryPlusApplication $application, $premium)
 {
     $this->hasPossibleClaimCircumstances = $application->getHasPossibleClaimCircumstances();
     $this->hasPermittedOccupiersOnly = $application->getHasPermittedOccupiersOnly();
     $this->hasTenancyDisputes = $application->getHasTenancyDisputes();
     $this->hasPaidRentInAdvance = $application->getHasPaidRentInAdvance();
     $this->hasPriorClaims = $application->getHasPriorClaims();
     $this->isDepositSufficient = $application->getIsDepositSufficient();
     $this->propertyRental = $application->getPropertyRental();
     $this->propertyDeposit = $application->getPropertyDeposit();
     $this->isAssuredShortholdTenancy = TenancyAgreementTypes::isAssuredShortholdTenancy($application->getTenancyAgreementType());
     $this->claimInfo = $application->getClaimInfo();
     $this->otherProvider = $application->getOtherProvider();
     $this->referenceType = $application->getReferenceType();
     $this->isContinuationOfExistingPolicy = $application->getIsContinuationOfExistingPolicy();
     $this->policyStartAt = $application->getPolicyStartAt();
     $this->premium = $premium;
     $this->hasProviderBeenChecked = false;
     $this->source = self::SOURCE_APPLICATION;
 }
 /**
  * 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;
 }
 /**
  * Validation function for optional constraints
  *
  * @param RentRecoveryPlusApplication $application
  * @param ExecutionContextInterface $context
  */
 public function checkRateBandLimits($application, ExecutionContextInterface $context)
 {
     if (ReferenceTypes::isOnlyAllowBandA($application->getReferenceType()) && $application->getPropertyRental() > RentRecoveryPlus::BAND_A_LIMIT) {
         $context->addViolationAt('propertyRental', 'Monthly rental amount cannot be greater than £' . RentRecoveryPlus::BAND_A_LIMIT . ' for the selected reference type', array(), null);
     } else {
         if ($application->getPropertyRental() > RentRecoveryPlus::BAND_B_LIMIT) {
             $context->addViolationAt('propertyRental', 'Monthly rental amount cannot be greater than £' . RentRecoveryPlus::BAND_B_LIMIT, array(), null);
         }
     }
 }