コード例 #1
0
 /**
  * Constructor
  */
 public function __construct($cachePath, $cacheTagPrefix, $cacheLifetime)
 {
     $this->cachePath = $cachePath;
     $this->cacheTagPrefix = $cacheTagPrefix;
     $this->cacheLifetime = $cacheLifetime;
     $container = new LegacyContainer();
     $this->searchClient = $container->get('rrp.legacy.datasource.search');
 }
コード例 #2
0
 /**
  * Constructor
  */
 public function __construct($mtaDatasourceIdentifier)
 {
     $this->container = new LegacyContainer();
     $this->legacyMta = $this->container->get($mtaDatasourceIdentifier);
     $this->rrpMta = $this->container->get(self::LEGACY_RENT_RECOVERY_PLUS_DATASOURCE);
     $this->legacyMtaData = $this->container->get(str_replace('.datasource.', '.', $mtaDatasourceIdentifier));
     $this->rrpMtaData = $this->container->get(str_replace('.datasource.', '.', self::LEGACY_RENT_RECOVERY_PLUS_DATASOURCE));
 }
コード例 #3
0
 /**
  * @inheritdoc
  */
 public function saveAnswers()
 {
     if ($this->source == self::SOURCE_NOT_SET) {
         throw new UnderwritingSourceNotSetException();
     }
     $answers = array();
     $isUpdateNeeded = false;
     foreach ($this->databaseQuestionIds as $questionNumber => $questionId) {
         /** @var \Model_Insurance_Answer $answer */
         $answer = $this->container->get('rrp.legacy.underwriting_answers');
         $answer->setPolicyNumber($this->policyNumber);
         $answer->setQuestionNumber($questionId);
         $answer->setDateAnswered($this->dateAnswered);
         $existingAnswer = $this->underwritingAnswers->getExistingAnswer($answer);
         if ($this->isUpdateNeeded($questionNumber)) {
             $answer->setAnswer($this->getYesNoAnswer($questionNumber));
             if (!$existingAnswer) {
                 $isUpdateNeeded = true;
             } else {
                 if ($existingAnswer != $this->getYesNoAnswer($questionNumber)) {
                     $isUpdateNeeded = true;
                 }
             }
         } else {
             $answer->setAnswer($existingAnswer);
         }
         $answers[] = clone $answer;
     }
     if ($isUpdateNeeded) {
         $this->underwritingAnswers->removeAllAnswers($this->policyNumber);
         $this->underwritingAnswers->insertUnderwritingAnswers($answers);
     }
     return $this;
 }
コード例 #4
0
 /**
  * Performs the logo transfer cron
  *
  * @throws \Exception
  */
 public function run()
 {
     $legacyContainer = new LegacyContainer();
     $rrpContainer = new RRPContainer();
     /** @var \Datasource_Core_Agents $agentClient */
     $agentClient = $legacyContainer->get('rrp.legacy.datasource.agent');
     $sftpLogoPath = $rrpContainer->get('rrp.config.sftp_logo_path');
     // Login to the SFTP server
     $sftp = $rrpContainer->get('rrp.sftp_client');
     if (!$sftp) {
         error_log(__FILE__ . ':' . __LINE__ . ':Remote Login Failed');
         throw new \Exception('Remote Login Failed');
     }
     // Get the list of logos to transfer
     $transferList = $agentClient->getAllDocumentLogoTransfers();
     // Attempt to put each file then check the size on the remote server matches to validate the transfer
     $successList = array();
     $failureList = array();
     foreach ($transferList as $sftpFileName => $uploadFileName) {
         $uploadFile = $sftpLogoPath . $sftpFileName;
         $sftp->put($sftpFileName, $uploadFile, NET_SFTP_LOCAL_FILE);
         $uploadSize = filesize($uploadFile);
         $sftpSize = $sftp->size($sftpFileName);
         if ($uploadSize == $sftpSize) {
             $successList[] = $sftpFileName;
         } else {
             $failureList[] = $sftpFileName;
         }
     }
     // Update the list of successful transfers
     if (count($successList) > 0) {
         if (!$agentClient->updateDocumentLogoTransfers($successList)) {
             $message = 'Failed to mark the successful logo transfers';
             error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
             throw new \Exception($message);
         }
     }
     if (count($failureList) > 0) {
         $message = 'Failed to transfer files: ' . implode(', ', $failureList);
         error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
         throw new \Exception($message);
     }
 }
コード例 #5
0
 /**
  * Creates a transaction
  *
  * @param string $transactionDate
  * @param float $premium
  * @param float $insuranceNetAmount
  * @param int|null $previousId
  * @return bool
  */
 protected function createTransaction($transactionDate, $premium, $insuranceNetAmount, $previousId = null)
 {
     $product = $this->container->get('rrp.legacy.datasource.product');
     $productData = $product->getProductByName($this->appData->getProductName());
     $ipt = round($premium * $this->iptPercent / 100.0, 2);
     $this->transData->setId(0)->setPreviousId($previousId)->setEnquiryId(0)->setAmount($premium + $ipt)->setStatusId($this->transStatusLive)->setInsuranceNetAmount($insuranceNetAmount)->setTransactionDate($transactionDate)->setTermId($this->termId)->setMtaId($this->mtaId);
     $transId = $this->transaction->createTransaction($this->transData);
     $this->tsData->setTransId($transId)->setEnquiryId(0)->setProductId($productData->key)->setAgentTypeId(0)->setDealAgentTypeId(0)->setGuarantor(0)->setBand($this->band)->setDuration($this->appData->getPolicyLength())->setRunningAmount($premium + $ipt)->setInsurance($insuranceNetAmount)->setIpt($ipt)->setIncome($premium - $insuranceNetAmount)->setInvoiced(0)->setTransDate($transactionDate);
     if ($previousId) {
         $this->tsData->setStatusChangeDate($this->currentDateAt->format('Y-m-d'));
     }
     $this->transactionAmount += $premium + $ipt;
     return $this->transactionSupport->createTransactionSupport($this->tsData);
 }
コード例 #6
0
 /**
  * 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;
 }
 /**
  * Send the migration report
  */
 private function sendReport()
 {
     $subject = $this->rrpContainer->get('rrp.config.migration_report.email_subject');
     $message = '';
     $lineBreak = "\r\n";
     for ($type = self::POLICY_TYPE_MIGRATED; $type <= self::POLICY_TYPE_EXCEPTION; $type++) {
         if (count($this->reportPolicies[$type]) > 0) {
             $message .= $this->reportDescriptions[$type] . $lineBreak;
             foreach ($this->reportPolicies[$type] as $rrpPolicyNumber => $newPolicyNumber) {
                 if ($newPolicyNumber) {
                     $message .= sprintf('%s => %s%s', $rrpPolicyNumber, $newPolicyNumber, $lineBreak);
                 } else {
                     $message .= sprintf('%s error in database or rates not set up%s', $rrpPolicyNumber, $lineBreak);
                 }
             }
             $message .= $lineBreak . $lineBreak;
         }
     }
     if (empty($message)) {
         $message = 'No policies were migrated today.';
     }
     $mailManager = $this->legacyContainer->get('rrp.legacy.mailer');
     $mailManager->setTo($this->rrpContainer->get('rrp.config.migration_report.email_to_address'), $this->rrpContainer->get('rrp.config.migration_report.email_to_name'))->setFrom($this->rrpContainer->get('rrp.config.migration_report.email_from_address'), $this->rrpContainer->get('rrp.config.migration_report.email_from_name'))->setSubject($subject)->setBodyText($message)->send();
 }
コード例 #8
0
 /**
  * @param int $agentRateId
  * @param int $riskArea
  * @param float $iptPercent
  * @param float $sumInsured
  * @param bool $isNilExcess
  * @param string $referenceType
  * @param int $policyLength
  * @param bool $isPayMonthly
  * @param \DateTime $policyStartDate
  * @param bool $isRentInAdvance
  */
 public function __construct($agentRateId, $riskArea, $iptPercent, $sumInsured, $isNilExcess, $referenceType, $policyLength, $isPayMonthly, \DateTime $policyStartDate, $isRentInAdvance = false)
 {
     $this->agentRate = $agentRateId;
     $this->riskArea = $riskArea;
     $this->iptPercent = $iptPercent;
     $container = new LegacyContainer();
     /** @var \Datasource_Insurance_RentRecoveryPlus_Rates $ratesDataSource */
     $ratesDataSource = $container->get('rrp.legacy.datasource.rrp_rates');
     $rateSet = $ratesDataSource->getRateSet($agentRateId, $riskArea, $policyStartDate);
     /** @var RentRecoveryPlusRate $rates */
     $rates = RentRecoveryPlusRate::hydrate($rateSet);
     $this->rateSetId = $rates->getRateSetId();
     $this->fullReferenceRates = array();
     // For full references   policy length
     //                        |  is Nil Excess
     //                        |  |  Band A/B
     $this->fullReferenceRates[6][0][self::BAND_A] = $rates->getRentGuaranteeRrpFullRef6mBandA();
     $this->fullReferenceRates[6][0][self::BAND_B] = $rates->getRentGuaranteeRrpFullRef6mBandB();
     $this->fullReferenceRates[12][0][self::BAND_A] = $rates->getRentGuaranteeRrpFullRef12mBandA();
     $this->fullReferenceRates[12][0][self::BAND_B] = $rates->getRentGuaranteeRrpFullRef12mBandB();
     $this->fullReferenceRates[6][1][self::BAND_A] = $rates->getRentGuaranteeRrpFullRef6mBandA() + $rates->getRentGuaranteeRrpFullRef6mNilExcessBandA();
     $this->fullReferenceRates[6][1][self::BAND_B] = $rates->getRentGuaranteeRrpFullRef6mBandB() + $rates->getRentGuaranteeRrpFullRef6mNilExcessBandB();
     $this->fullReferenceRates[12][1][self::BAND_A] = $rates->getRentGuaranteeRrpFullRef12mBandA() + $rates->getRentGuaranteeRrpFullRef12mNilExcessBandA();
     $this->fullReferenceRates[12][1][self::BAND_B] = $rates->getRentGuaranteeRrpFullRef12mBandB() + $rates->getRentGuaranteeRrpFullRef12mNilExcessBandB();
     $this->creditCheckRates = array();
     // For credit checks   policy length
     //                      |  Band A/B
     $this->creditCheckRates[12] = $rates->getRentGuaranteeRrpCreditCheck12m();
     $this->creditCheckRates[6] = $rates->getRentGuaranteeRrpCreditCheck6m();
     $this->setCoverAmounts($sumInsured, $isNilExcess, $referenceType, $policyLength, $isPayMonthly, $isRentInAdvance)->calculatePremium();
 }
コード例 #9
0
 /**
  * Validation function for optional constraints
  *
  * @param RentRecoveryPlusApplication $application
  * @param ExecutionContextInterface $context
  */
 public function checkPostcodes($application, ExecutionContextInterface $context)
 {
     $container = new LegacyContainer();
     $postcodeFields = array('propertyPostcode', 'landlordPostcode');
     foreach ($postcodeFields as $fieldName) {
         $getter = sprintf('get%s', ucfirst($fieldName));
         $submittedPostcode = $application->{$getter}();
         if ('' != $submittedPostcode) {
             /** @var \Application_Core_Postcode $validatorClass */
             $validatorClass = $container->get('rrp.legacy.postcode_validator.class');
             $newPostcode = $validatorClass::validate($submittedPostcode);
             if ('' == $newPostcode) {
                 $context->addViolationAt($fieldName, 'Postcode invalid, must be e.g. NE63 9UD', array(), null);
             } else {
                 $setter = sprintf('set%s', ucfirst($fieldName));
                 $application->{$setter}($newPostcode);
             }
         }
     }
 }
コード例 #10
0
 /**
  * Run the cron job to process the survey results and send the emails
  *
  * @throws \Exception
  */
 public function run()
 {
     $this->initialiseParams();
     $container = new LegacyContainer();
     /** @var \Datasource_Insurance_RentRecoveryPlus_Search $searchClient */
     $searchClient = $container->get('rrp.legacy.datasource.search');
     $policyNotes = $container->get('rrp.legacy.datasource.policy_notes');
     /** @var \Datasource_Insurance_RentRecoveryPlus_RentRecoveryPlus $rrp */
     $rrp = $container->get('rrp.legacy.datasource.rent_recovery_plus');
     $policyNumberManager = $container->get('rrp.legacy.manager.policy_number');
     $now = new \DateTime();
     // initialise curl options
     $this->initialiseCurl();
     // Attempt login
     $this->loginQuery = str_replace('{$username}', $this->username, $this->loginQuery);
     $this->loginQuery = str_replace('{$password}', $this->password, $this->loginQuery);
     $result = $this->executeCurlRequest($this->loginUrl, $this->loginUrl, $this->loginQuery);
     // Get the title and validate we are on the right page
     preg_match('|<title>(.*)</title>|', $result, $matches);
     $title = $matches[1];
     if ($title == self::SURVEY_LOGIN_PAGE_TITLE) {
         // Back to login page means we failed to login
         $message = 'Login failure!';
         curl_close($this->curlResource);
         error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
         throw new \Exception($message);
     } else {
         if ($title != self::SURVEY_REPORT_PAGE_TITLE) {
             // Check we're on the right page - if not they've change something!
             $message = 'Unknown login response [' . $title . ']!';
             curl_close($this->curlResource);
             error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
             throw new \Exception($message);
         }
     }
     // Login was a success, now process the surveys
     $previousSurveyID = 0;
     $fileData = array();
     foreach ($this->surveyDetails as $surveyType => $surveyDetail) {
         if ($previousSurveyID != $surveyDetail['surveyID']) {
             $previousSurveyID = $surveyDetail['surveyID'];
             // Get the report ID
             $reportData = str_replace('{$surveyID}', $surveyDetail['surveyID'], $surveyDetail['reportData']);
             $result = $this->executeCurlRequest($this->reportUrl, $this->loginUrl, $reportData);
             // Below is an excerpt from the inception result so we can see what to match
             //"Exporting Data...","download.asp?r=119595&i=112064&TB_iframe=true&height=270&width=400",null);
             $reportMatch = str_replace('{$surveyID}', $surveyDetail['surveyID'], $surveyDetail['reportMatch']);
             preg_match($reportMatch, $result, $matches);
             if (count($matches) <= 0) {
                 $message = 'Failed to find report ID for survey :' . $surveyDetail['surveyID'];
                 curl_close($this->curlResource);
                 error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
                 throw new \Exception($message);
             }
             $reportID = $matches[1];
             if (!is_numeric($reportID)) {
                 $message = 'Invalid report ID:[' . $reportID . ']';
                 curl_close($this->curlResource);
                 error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
                 throw new \Exception($message);
             }
             // Have a quick snooze and a cuppa while we wait for the report
             sleep($this->sleepTime);
             // Now attempting to get the CSV file location
             $csvFileData = str_replace('{$surveyID}', $surveyDetail['surveyID'], $surveyDetail['csvFileData']);
             $csvFileData = str_replace('{$reportID}', $reportID, $csvFileData);
             $result = $this->executeCurlRequest($this->csvFileUrl, $this->reportUrl, $csvFileData);
             // Below is an excerpt from the inception result so we can see what to match
             //<body><h1>Object Moved</h1>This object may be found <a HREF="https://www.smartsurvey.co.uk/_files/data/RawData--112064-37124-19-08-2014.csv">here</a>.</body>
             preg_match($surveyDetail['csvFileMatch'], $result, $matches);
             if (count($matches) <= 0) {
                 $message = 'Failed to extract the CSV file location';
                 curl_close($this->curlResource);
                 error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
                 throw new \Exception($message);
             }
             // Extract the generated csv file name
             $remoteCsvUrl = $matches[1];
             // Do the actual download
             try {
                 $this->executeCurlDownload($remoteCsvUrl, $this->csvFile);
             } catch (\Exception $ex) {
                 curl_close($this->curlResource);
                 error_log(__FILE__ . ':' . __LINE__ . ':' . $ex->getMessage());
                 throw new \Exception($ex->getMessage());
             }
             // Download successful, now parse the file
             $header = NULL;
             $fileData = array();
             if (($fileResource = fopen($this->csvFile, 'r')) !== FALSE) {
                 while (($row = fgetcsv($fileResource, 1000, $surveyDetail['delimiter'], '"', '\\')) !== FALSE) {
                     if (!$header) {
                         $header = $row;
                     } else {
                         $fileData[] = array_combine($header, $row);
                     }
                 }
                 fclose($fileResource);
             } else {
                 $message = 'Failed to open CSV file';
                 error_log(__FILE__ . ':' . __LINE__ . ':' . $message());
                 throw new \Exception($message());
             }
         }
         // Parse the file and extract the policy numbers and dates
         $surveyDates = array();
         $line = 0;
         $policyColumnName = $surveyDetail['policyColumnName'];
         $completeColumnName = $surveyDetail['completeColumnName'];
         foreach ($fileData as $row) {
             $line++;
             $policyNumber = trim(urldecode($row[$policyColumnName]));
             $completeDate = \DateTime::createFromFormat($this->dateFormat, $row[$completeColumnName]);
             if ($policyNumberManager->isRentRecoveryPlusInsightPolicy($policyNumber)) {
                 //Ignore old Insight RRPI policies
             } else {
                 if (!$policyNumberManager->isRentRecoveryPlusPolicy($policyNumber)) {
                     $message = 'Bad Policy ID [' . $policyNumber . '] on line ' . $line;
                     error_log(__FILE__ . ':' . __LINE__ . ':' . $message);
                 } else {
                     $surveyDates[$policyNumber] = $completeDate->format('Y-m-d H:i:s');
                 }
             }
         }
         // Log the complete dates for any newly completed ones
         $policiesRequiringNotes = $searchClient->searchForUncompletedSurveys(array_keys($surveyDates));
         foreach ($policiesRequiringNotes as $details) {
             $policyNumber = $details['policyNumber'];
             // Log the survey date
             if (array_key_exists($policyNumber, $surveyDates)) {
                 $rrp->setSurveyCompletedAt($policyNumber, $surveyDates[$policyNumber]);
                 // Add a note to the policy
                 $policyNotes->addNote($policyNumber, $now->format('d/m/Y') . "\nSurvey sent to " . $details['emailAddress'] . " was completed\n");
             }
         }
         // Send the survey reminder emails
         foreach ($surveyDetail['emailDuration'] as $duration) {
             if (0 == $duration) {
                 continue;
             }
             //Select a list of email addresses where the survey has not been completed and the policy was
             // incepted {$duration} days ago
             $searchDate = clone $now;
             $searchDate->modify('-' . $duration . ' Day');
             $isInception = self::INCEPTION_SURVEY == $surveyType;
             $reminders = $searchClient->searchForSurveyEmails($searchDate, $isInception, array_keys($surveyDates));
             foreach ($reminders as $reminderDetails) {
                 $landlordName = $reminderDetails['landlordName'];
                 $lettingAgent = $reminderDetails['lettingAgent'];
                 $policyNumber = $reminderDetails['policyNumber'];
                 $surveyLink = str_replace('{$policyNumber}', urlencode($policyNumber), $surveyDetail['emailSurveyLink']);
                 $subject = str_replace('{$lettingAgent}', $lettingAgent, $surveyDetail['emailSubject']);
                 $mail = $container->get('rrp.legacy.mailer');
                 $mail->setTo($reminderDetails['emailAddress'], null);
                 $mail->setFrom($surveyDetail['emailFrom'], 'HomeLet');
                 $mail->setSubject($subject);
                 // Apply template
                 $mail->applyTemplate('rent-recovery-plus/survey-reminder', array('landlordName' => $landlordName, 'lettingAgent' => $lettingAgent, 'surveyLink' => $surveyLink), true);
                 $mail->applyTextTemplate('rent-recovery-plus/survey-reminder-txt', array('landlordName' => $landlordName, 'lettingAgent' => $lettingAgent, 'surveyLink' => $surveyLink), true);
                 // Send email
                 $mail->send();
                 $policyNotes->addNote($policyNumber, $now->format('d/m/Y') . "\nSurvey sent to " . $reminderDetails['emailAddress'] . "\n");
             }
         }
     }
     curl_close($this->curlResource);
 }