コード例 #1
0
ファイル: ApplicationDetails.php プロジェクト: erzeghi/pingyo
 public function validate()
 {
     if (!is_null($this->logger)) {
         $this->logger->debug("ApplicationDetails::validate() called");
     }
     if ($this->employername == "") {
         $this->employername = "unemployed";
     }
     $validator = new ExtendedValidator(array('title' => $this->title, 'firstname' => $this->firstname, 'lastname' => $this->lastname, 'dateofbirth' => $this->dateofbirth, 'email' => $this->email, 'homephonenumber' => $this->homephonenumber, 'mobilephonenumber' => $this->mobilephonenumber, 'workphonenumber' => $this->workphonenumber, 'employername' => $this->employername, 'jobtitle' => $this->jobtitle, 'employmentstarted' => $this->employmentstarted, 'employerindustry' => $this->employerindustry, 'incomesource' => $this->incomesource, 'payfrequency' => $this->payfrequency, 'payamount' => $this->payamount, 'incomepaymenttype' => $this->incomepaymenttype, 'nextpaydate' => $this->nextpaydate, 'followingpaydate' => $this->followingpaydate, 'loanamount' => $this->loanamount, 'nationalidentitynumber' => $this->nationalidentitynumber, 'nationalidentitynumbertype' => $this->nationalidentitynumbertype, 'consenttocreditsearch' => $this->consenttocreditsearch, 'consenttomarketingemails' => $this->consenttomarketingemails, 'residentialstatus' => $this->residentialstatus, 'housenumber' => $this->housenumber, 'housename' => $this->housename, 'addressstreet1' => $this->addressstreet1, 'addresscity' => $this->addresscity, 'addresscounty' => $this->addresscounty, 'addressmovein' => $this->addressmovein, 'addresspostcode' => $this->addresspostcode, 'bankaccountnumber' => $this->bankaccountnumber, 'bankcardtype' => $this->bankcardtype, 'bankroutingnumber' => $this->bankroutingnumber, 'monthlymortgagerent' => $this->monthlymortgagerent, 'monthlycreditcommitments' => $this->monthlycreditcommitments, 'otherexpenses' => $this->otherexpenses, 'minimumcommissionamount' => $this->minimumcommissionamount, 'maximumcommissionamount' => $this->maximumcommissionamount, 'applicationextensions' => $this->applicationextensions, 'usesonlinebanking' => $this->usesonlinebanking, 'term' => $this->term, 'transport' => $this->transport, 'food' => $this->food, 'utilities' => $this->utilities, 'confirmedbyapplicant' => $this->confirmedbyapplicant, 'maritalstatus' => $this->maritalstatus, 'loanproceeduse' => $this->loanproceeduse, 'numberofdependents' => $this->numberofdependents, 'combinedmonthlyhouseholdincome' => $this->combinedmonthlyhouseholdincome));
     $validator->rules($this->getValidationRules());
     //custom messages
     $validator->rule('not_on_weekend', array('nextpaydate', 'followingpaydate'))->message('{field} cannot be Saturday or Sunday');
     $validator->rule('only_digits', array('mobilephonenumber', 'homephonenumber', 'workphonenumber'))->message('{field} should only contain digits 0-9');
     $startwith = '07';
     $validator->rule('start_with_string', array('mobilephonenumber'), $startwith)->message('{field} should start with ' . $startwith);
     if ($validator->validate()) {
         if (!is_null($this->logger)) {
             $this->logger->info("ApplicationDetails validation passed");
         }
         return true;
     } else {
         if (!is_null($this->logger)) {
             $this->logger->warning("ApplicationDetails validation errors found: ", array('errors' => $validator->errors()));
         }
         return $validator->errors();
     }
 }
コード例 #2
0
ファイル: Application.php プロジェクト: papersky/pingyo
 public function validate($full_validation = true)
 {
     if (!is_null($this->logger)) {
         $this->logger->debug("Application::validate() called with full_validation={$full_validation}");
     }
     $validator = new ExtendedValidator(array('campaign' => $this->campaign, 'affiliateid' => $this->affiliateid, 'subaffiliate' => $this->subaffiliate, 'timeout' => $this->timeout, 'testonly' => $this->testonly, 'applicationdetails' => $this->applicationdetails, 'sourcedetails' => $this->sourcedetails));
     $validator->rules($this->validation_rules);
     if ($validator->validate()) {
         if ($full_validation) {
             if ($this->applicationdetails->validate() && $this->sourcedetails->validate()) {
                 if (!is_null($this->logger)) {
                     $this->logger->info("Application validation passed");
                 }
                 return true;
             } else {
                 if (!is_null($this->logger)) {
                     $this->logger->warning("Application validation errors found in child object");
                 }
                 return false;
             }
         } else {
             return true;
         }
     } else {
         if (!is_null($this->logger)) {
             $this->logger->warning("Application validation errors found in main object: ", array('errors' => $validator->errors()));
         }
         return $validator->errors();
     }
 }
コード例 #3
0
ファイル: SourceDetails.php プロジェクト: erzeghi/pingyo
 public function validate()
 {
     if (!is_null($this->logger)) {
         $this->logger->debug("SourceDetails::validate() called");
     }
     $validator = new ExtendedValidator(array('address' => $this->address, 'clientuseragent' => $this->clientuseragent, 'creationurl' => $this->creationurl, 'referringurl' => $this->referringurl, 'languagecodes' => $this->languagecodes));
     $validator->rules($this->validation_rules);
     if ($validator->validate()) {
         if (!is_null($this->logger)) {
             $this->logger->info("SourceDetails validation passed");
         }
         return true;
     } else {
         if (!is_null($this->logger)) {
             $this->logger->warning("SourceDetails validation errors found: ", array('errors' => $validator->errors()));
         }
         return $validator->errors();
     }
 }
コード例 #4
0
 public function validate()
 {
     if (!is_null($this->logger)) {
         $this->logger->debug("ApplicationDetails::validate() called");
     }
     $validator = new ExtendedValidator(array('title' => $this->title, 'firstname' => $this->firstname, 'lastname' => $this->lastname, 'dateofbirth' => $this->dateofbirth, 'email' => $this->email, 'homephonenumber' => $this->homephonenumber, 'mobilephonenumber' => $this->mobilephonenumber, 'workphonenumber' => $this->workphonenumber, 'employername' => $this->employername, 'jobtitle' => $this->jobtitle, 'employmentstarted' => $this->employmentstarted, 'employerindustry' => $this->employerindustry, 'incomesource' => $this->incomesource, 'payfrequency' => $this->payfrequency, 'payamount' => $this->payamount, 'incomepaymenttype' => $this->incomepaymenttype, 'nextpaydate' => $this->nextpaydate, 'followingpaydate' => $this->followingpaydate, 'loanamount' => $this->loanamount, 'nationalidentitynumber' => $this->nationalidentitynumber, 'nationalidentitynumbertype' => $this->nationalidentitynumbertype, 'consenttocreditsearch' => $this->consenttocreditsearch, 'consenttomarketingemails' => $this->consenttomarketingemails, 'residentialstatus' => $this->residentialstatus, 'housenumber' => $this->housenumber, 'housename' => $this->housename, 'addressstreet1' => $this->addressstreet1, 'addresscity' => $this->addresscity, 'addresscountrycode' => $this->addresscountrycode, 'addresscounty' => $this->addresscounty, 'addressmovein' => $this->addressmovein, 'addresspostcode' => $this->addresspostcode, 'bankaccountnumber' => $this->bankaccountnumber, 'bankcardtype' => $this->bankcardtype, 'bankroutingnumber' => $this->bankroutingnumber, 'monthlymortgagerent' => $this->monthlymortgagerent, 'monthlycreditcommitments' => $this->monthlycreditcommitments, 'otherexpenses' => $this->otherexpenses, 'minimumcommissionamount' => $this->minimumcommissionamount, 'maximumcommissionamount' => $this->maximumcommissionamount, 'applicationextensions' => $this->applicationextensions));
     $validator->rules($this->getValidationRules());
     if ($validator->validate()) {
         if (!is_null($this->logger)) {
             $this->logger->info("ApplicationDetails validation passed");
         }
         return true;
     } else {
         if (!is_null($this->logger)) {
             $this->logger->warning("ApplicationDetails validation errors found: ", array('errors' => $validator->errors()));
         }
         return $validator->errors();
     }
 }