/**
  * Get the difference in the number of tenants prescribed
  * and the actual number of applications logged
  *
  * @param string $applicationUuId
  * @param int $numberOfTenants
  * @return int
  */
 public function getApplicantCountDifference($applicationUuId, $numberOfTenants)
 {
     /** @var \Barbondev\IRISSDK\IndividualApplication\ReferencingApplication\Model\ReferencingApplication $application */
     $application = $this->context->getReferencingApplicationClient()->getReferencingApplication(array('referencingApplicationUuId' => $applicationUuId));
     $applications = $this->context->getReferencingCaseClient()->getApplications(array('referencingCaseUuId' => $application->getReferencingCaseUuId()));
     return $numberOfTenants - count($applications);
 }
 /**
  * {@inheritdoc}
  */
 public function addContext(ContextInterface $context)
 {
     if (isset($this->contexts[$context->getName()])) {
         throw new ContextAlreadyExistsException(sprintf('Context already exists in client registry with the name %s', $context->getName()));
     }
     $this->contexts[$context->getName()] = $context;
     return $this;
 }
Example #3
0
 /**
  * {@inheritdoc}
  */
 public function getProducts($rentGuaranteeOfferingType, $propertyLettingType)
 {
     $parameters = array('rentGuaranteeOfferingType' => (int) $rentGuaranteeOfferingType, 'propertyLettingType' => (int) $propertyLettingType);
     // Always merge context parameters as this cache is unique per agent branch
     $cacheKey = $this->buildCacheKey(array_merge($parameters, $this->context->getParameters()));
     if ($this->cache->has($cacheKey)) {
         return $this->cache->get($cacheKey);
     }
     /** @var \Guzzle\Common\Collection $products */
     $products = $this->context->getProductClient()->getProducts($parameters);
     $this->cache->set($cacheKey, $products, 500);
     // Longer TTL for products
     return $products;
 }
 /**
  * {@inheritdoc}
  */
 public function getProductPrice($agentSchemeNumber, $productId, $propertyLetType, $rentGuaranteeOfferingType, $shareOfRent, $policyLengthInMonths)
 {
     $parameters = array('productId' => (int) $productId, 'agentSchemeNumber' => (int) $agentSchemeNumber, 'propertyLetType' => (int) $propertyLetType, 'rentGuaranteeOfferingType' => (int) $rentGuaranteeOfferingType, 'shareOfRent' => (double) $shareOfRent, 'policyLengthInMonths' => (int) ($policyLengthInMonths ?: 0), 'guarantorSequenceNumber' => (int) 0, 'isRenewal' => (int) false);
     // Always merge context parameters as this cache is unique per agent branch
     $cacheKey = $this->buildCacheKey(array_merge($parameters, $this->context->getParameters()));
     if ($this->cache->has($cacheKey)) {
         return $this->cache->get($cacheKey);
     }
     /** @var \Barbondev\IRISSDK\IndividualApplication\Product\Model\ProductPrice $productPrice */
     try {
         $productPrice = $this->context->getProductClient()->getProductPrice($parameters);
     } catch (NotFoundException $e) {
         throw new ProductPriceNotFoundException(sprintf('Product price not found using parameters: ', print_r($parameters, true)));
     }
     $this->cache->set($cacheKey, $productPrice, 120);
     // Short TTL for this cache
     return $productPrice;
 }
 /**
  * Get referencing application
  *
  * @param string $applicationUuId
  * @return ReferencingApplication
  */
 private function getApplication($applicationUuId)
 {
     return $this->context->getReferencingApplicationClient()->getReferencingApplication(array('referencingApplicationUuId' => $applicationUuId));
 }