/** * Sets the data using the mid-term adjustment as the source * * @param RentRecoveryPlusMta $mta * @param float $premium */ public function setFromMta(RentRecoveryPlusMta $mta, $premium) { $this->hasPossibleClaimCircumstances = $mta->getHasPossibleClaimCircumstances(); $this->hasPermittedOccupiersOnly = $mta->getHasPermittedOccupiersOnly(); $this->hasTenancyDisputes = $mta->getHasTenancyDisputes(); $this->hasPriorClaims = $mta->getHasPriorClaims(); $this->isDepositSufficient = $mta->getIsDepositSufficient(); $this->propertyRental = $mta->getPropertyRental(); $this->isAssuredShortholdTenancy = TenancyAgreementTypes::isAssuredShortholdTenancy($mta->getTenancyAgreementType()); $this->claimInfo = $mta->getClaimInfo(); $this->premium = $premium; $this->hasProviderBeenChecked = true; $this->source = self::SOURCE_MID_TERM; }
/** * Validation function for optional constraints * * @param RentRecoveryPlusMta $mta * @param ExecutionContextInterface $context */ public function checkRateBandLimits($mta, ExecutionContextInterface $context) { if (ReferenceTypes::isOnlyAllowBandA($mta->getReferenceType()) && $mta->getPropertyRental() > RentRecoveryPlus::BAND_A_LIMIT) { $context->addViolationAt('propertyRental', 'Monthly rental amount cannot be greater than £' . RentRecoveryPlus::BAND_A_LIMIT, array(), null); } else { if ($mta->getPropertyRental() > RentRecoveryPlus::BAND_B_LIMIT) { $context->addViolationAt('propertyRental', 'Monthly rental amount cannot be greater than £' . RentRecoveryPlus::BAND_B_LIMIT, array(), null); } } }