Beispiel #1
0
 /**
  * 
  * @param LoanApplication $application
  * @param int $milestoneId
  * @param int $milestoneGroupId
  * @throws \Exception
  */
 public function setLoanMilestone(LoanApplication $application, $milestoneId, $milestoneGroupId)
 {
     try {
         $integrationSite = $this->losConnection->getSite();
         //print_r('Site ID: '. $integrationSite->getId() . ' | Milestone ID: '. $milestoneId . ' | Milestone Group ID: ' . $milestoneGroupId);
         $newMilestone = $this->em->getRepository('SudouxMortgageBundle:LoanMilestone')->findOneMilestoneByLosId($integrationSite, $milestoneId, $milestoneGroupId);
         //print_r('Milestone Name: ' . $newMilestone->getName());
         if (isset($newMilestone)) {
             // check for a change and send to the
             $currentMilestone = $application->getMilestone();
             if (isset($currentMilestone)) {
                 $sendNotifications = $application->getSite()->getSettings()->getInheritedSendMilestonesNotifications();
                 $user = $application->getUser();
                 if ($currentMilestone->getId() != $newMilestone->getId() && $sendNotifications && isset($user)) {
                     if ($user->hasRole('ROLE_MEMBER')) {
                         $email = new Email();
                         $email->setSubject("Your loan status has been updated");
                         $email->setMessage(sprintf("Your loan status for %s has been updated to %s.", $application->getPropertyLocation()->getAddress1(), $newMilestone->getName()));
                         $email->setRecipient($user->getEmail());
                         $email->setSite($application->getSite());
                         $application->addEmail($email);
                         $emailUtil = $this->container->get('sudoux.cms.message.email_util');
                         $emailUtil->logAndSend($email);
                     }
                 }
             }
             $application->setMilestone($newMilestone);
             $application->setMilestoneGroup($newMilestone->getMilestoneGroup());
         } else {
             $e = new \Exception("Milestone not found for loan " . $application->getId());
             $this->logger->crit($e->getMessage());
         }
     } catch (\Exception $e) {
         $this->logger->crit($e->getMessage());
     }
 }
 protected function formatVantage(LoanApplication $application)
 {
     $site = $application->getSite();
     $a = new \stdClass();
     $coBorrowers = $application->getCoBorrower();
     $borrower = $application->getBorrower();
     $a->isCurrentlyEmployed = False;
     $a->coIsCurrentlyEmployed = False;
     $a->firstName = $borrower->getFirstName();
     $a->lastName = $borrower->getLastName();
     $a->address1 = $borrower->getLocation()->getLocation()->getAddress1();
     $a->address2 = $borrower->getLocation()->getLocation()->getAddress2();
     $a->city = $borrower->getLocation()->getLocation()->getCity();
     $a->state = $borrower->getLocation()->getLocation()->getState()->getAbbreviation();
     $a->zipcode = $borrower->getLocation()->getLocation()->getZipcode();
     $a->email = $borrower->getEmail();
     $a->phoneHome = $borrower->getPhoneHome();
     $a->phoneCell = $borrower->getPhoneMobile();
     $a->ssn = $borrower->getSsn();
     $a->dependants = $borrower->getDependentsNumber();
     $a->dependantsAges = $borrower->getDependentsAges();
     $a->yearsOfResidence = $borrower->getLocation()->getYearsAtLocation();
     $a->monthsOfResidence = $borrower->getLocation()->getMonthsAtLocation();
     $a->isRenting = !$borrower->getLocation()->getOwnResidence();
     $a->hasCoborrower = !$coBorrowers->isEmpty();
     $a->yearsOfSchool = $borrower->getYearsOfSchool();
     switch ($borrower->getMaritalStatus()) {
         case '0':
             $a->maritalStatus = 3;
             break;
         case '1':
             $a->maritalStatus = 1;
             break;
         case '2':
             $a->maritalStatus = 4;
             break;
         default:
             $a->maritalStatus = 0;
     }
     foreach ($borrower->getEmployment() as $job) {
         if ($job->getEndDate()->add(new \DateInterval('P1D')) >= $application->getCreated() && $application->getBorrower()->getEmployed()) {
             $a->isCurrentlyEmployed = True;
             $job->setCurrent(True);
             $a->employer = $job->getEmployerName();
             $a->employerPhone = $job->getEmployerPhone();
             $a->employerAddress1 = $job->getLocation()->getAddress1();
             $a->employerAddress2 = $job->getLocation()->getAddress2();
             $a->employerCity = $job->getLocation()->getCity();
             $a->employerState = $job->getLocation()->getState()->getAbbreviation();
             $a->employerZipCode = $job->getLocation()->getZipcode();
             $a->employmentYearsOnJob = $job->getTimeAtJob()->years;
             $a->employmentMonthsOnJob = $job->getTimeAtJob()->months;
             $a->employmentTitle = $job->getTitle();
         } else {
             $job->setCurrent(False);
         }
     }
     foreach ($coBorrowers as $coBorrower) {
         $a->coFirstName = $coBorrower->getFirstName();
         $a->coLastName = $coBorrower->getLastName();
         $a->coAddress1 = $coBorrower->getLocation()->getLocation()->getAddress1();
         $a->coAddress2 = $coBorrower->getLocation()->getLocation()->getAddress2();
         $a->coCity = $coBorrower->getLocation()->getLocation()->getCity();
         $a->coState = $coBorrower->getLocation()->getLocation()->getstate()->getAbbreviation();
         $a->coZip = $coBorrower->getLocation()->getLocation()->getZipcode();
         $a->coPhoneHome = $coBorrower->getPhoneHome();
         $a->coPhoneCell = $coBorrower->getPhoneMobile();
         $a->coSSN = $coBorrower->getSsn();
         $a->coEmail = $coBorrower->getEmail();
         $a->coDependants = $coBorrower->getDependentsNumber();
         $a->coDependantsAges = $coBorrower->getDependentsAges();
         $a->coYearsOfResidence = $coBorrower->getLocation()->getYearsAtLocation();
         $a->coMonthsOfResidence = $coBorrower->getLocation()->getMonthsAtLocation();
         $a->coIsRenting = !$coBorrower->getLocation()->getOwnResidence();
         foreach ($coBorrower->getEmployment() as $job) {
             if ($job->getEndDate()->add(new \DateInterval('P1D')) >= $application->getCreated() && $application->getBorrower()->getEmployed()) {
                 $a->coIsCurrentlyEmployed = True;
                 $job->setCurrent(True);
                 $a->CoEmployer = $job->getEmployerName();
                 $a->CoEmployerPhone = $job->getEmployerPhone();
                 $a->CoEmployerAddress1 = $job->getLocation()->getAddress1();
                 $a->CoEmployerAddress2 = $job->getLocation()->getAddress2();
                 $a->CoEmployerCity = $job->getLocation()->getCity();
                 $a->CoEmployerState = $job->getLocation()->getState()->getAbbreviation();
                 $a->CoEmployerZipCode = $job->getLocation()->getZipcode();
                 $a->CoEmploymentYearsOnJob = $job->getTimeAtJob()->years;
                 $a->CoEmploymentMonthsOnJob = $job->getTimeAtJob()->months;
                 $a->CoEmploymentTitle = $job->getTitle();
             } else {
                 $job->setCurrent(False);
             }
         }
         switch ($coBorrower->getMaritalStatus()) {
             case '0':
                 $a->coMaritalStatus = 3;
                 break;
             case '1':
                 $a->coMaritalStatus = 1;
                 break;
             case '2':
                 $a->coMaritalStatus = 4;
                 break;
             default:
                 $a->coMaritalStatus = 0;
         }
     }
     $a->loanAmount = $application->getLoanAmount();
     $a->propertyMarketValue = $application->getSalePrice();
     $a->propertyAddress1 = $application->getPropertyLocation()->getAddress1();
     $a->propertyAddress2 = $application->getPropertyLocation()->getAddress2();
     $a->propertyCity = $application->getPropertyLocation()->getCity();
     $a->propertyState = $application->getPropertyLocation()->getState()->getAbbreviation();
     $a->propertyZipCode = $application->getPropertyLocation()->getZipcode();
     $a->realEstateBrokerPhone = $application->getRealtorPhone();
     $a->propertyUse = $application->getResidencyType() + 1;
     $a->vendorLeadPrice = '$5.00';
     $a->vendorLeadId = $application->getId();
     $a->vendorId = $site->getSettings()->getLos()->getUsername();
     $a->vendorPassword = $site->getSettings()->getLos()->getPassword();
     $a->orgId = $site->getSettings()->getLos()->getLicenseKey();
     $a->customerIp = $ip = getenv('HTTP_CLIENT_IP') ?: getenv('HTTP_X_FORWARDED_FOR') ?: getenv('HTTP_X_FORWARDED') ?: getenv('HTTP_FORWARDED_FOR') ?: getenv('HTTP_FORWARDED') ?: getenv('REMOTE_ADDR');
     $a->vendorWebProperty = $site->getPrimaryDomain()->getDomain();
     $a->vendorCampaign = $site->getSettings()->getLos()->getSettings();
     return $a;
 }
Beispiel #3
0
 public function setLoanMilestone(LoanApplication $application, $milestoneId, $milestoneGroupId)
 {
     $site = $application->getSite();
     $this->setLosSync($site);
     if (isset($this->losSync)) {
         return $this->losSync->setLoanMilestone($application, $milestoneId, $milestoneGroupId);
     }
 }