/** * Set items constraints * * @return void */ public function initRules() { $this->rules['no_certificado'] = V::numeric()->noWhitespace()->setName('Numero de certificado'); $this->rules['clave'] = V::notEmpty()->noWhitespace()->setName('Contraseña de la llave privada'); }
/** * init valid rule */ protected function initRule() { $this->validRule['id'] = v::numeric(); $this->validRule['name'] = v::stringType()->length(1, 10); $this->validRule['email'] = v::email(); $this->validRule['sex'] = v::intVal()->between(0, 1); }
/** * @param $cardNumber * @return array * @throws NumberValidateException */ public static function validate($cardNumber) { if (!v::numeric()->noWhitespace()->validate($cardNumber)) { throw new NumberValidateException(); } return ['valid' => true, 'type' => 'visa']; }
public function setZipCode($value) { $value = str_replace('-', '', $value); if (!v::numeric()->postalCode('BR')->validate($value)) { throw new FieldRequiredException("CEP é uma informação obrigatória"); } $this->_zipcode = $value; }
/** * init valid rule */ protected function initRule() { $this->validRule['uid'] = v::numeric(); $this->validRule['expid'] = v::numeric(); $this->validRule['firmName'] = v::stringType()->length(1, 32); $this->validRule['indCatNo'] = v::stringType()->length(1, 32); $this->validRule['jobName'] = v::stringType()->length(1, 32); $this->validRule['areaNo'] = v::stringType()->length(1, 32); }
/** * Validates that the input is a number and is between 0 and 100 inclusive. * * @param float $value * The value to validate. */ protected static function validatePercentage(&$value) { if (!isset(self::$percentage)) { self::$percentage = v::numeric()->min(0, TRUE)->max(100, TRUE); } if (is_numeric($value)) { $value = round($value, 3); } self::$percentage->assert($value); }
public function shortcode($shortcode) { if (!Validator::numeric()->length(5)->validate($shortcode)) { $this->objLogger->addError('Shortcode must be an integer exactly 5 numbers long'); throw new SMSMessageException('Shortcode must be an integer exactly 5 numbers long'); } $this->shortcode = $shortcode; $this->objLogger->addDebug('Shortcode has been set to ' . $shortcode); return $this; }
private function validateCVV($parameters) { $fieldName = "cvv"; if (array_key_exists($fieldName, $parameters)) { if (!v::numeric()->validate($parameters[$fieldName]) || !v::length(3, 3, true)->validate($parameters[$fieldName])) { $this->validationResponse->status = s::VALIDATION_ERROR; $this->validationResponse->errors[$fieldName] = "is required"; return false; } } return true; }
/** * init valid rule */ protected function initRule() { $this->validRule['uid'] = v::numeric(); $this->validRule['eduid'] = v::numeric(); $this->validRule['schoolName'] = v::stringType()->length(1, 32); $this->validRule['majorName'] = v::stringType()->length(1, 32); $this->validRule['majorCat'] = v::stringType()->length(1, 32); $this->validRule['area'] = v::stringType()->length(1, 32); $this->validRule['schoolCountry'] = v::stringType()->length(1, 32); $this->validRule['startDate'] = v::date('Y-m'); $this->validRule['endDate'] = v::date('Y-m'); $this->validRule['degreeStatus'] = v::intVal()->between(1, 3); }
function priceValidate(&$errors, $price) { $priceBlankError = "Вы не указали цену товара"; $priceNotValid = "Цена товара должна быть положительным числом"; if ($price != "") { $price = filter_var(trim(strip_tags($price)), FILTER_SANITIZE_NUMBER_INT); if (!v::string()->notEmpty()->validate($price) || !v::numeric()->validate($price) || $price <= 0) { $errors[] = $priceNotValid; } } else { $errors[] = $priceBlankError; } return $price; }
protected function postEdit($categoryId) { $editCategory = $this->collection[$categoryId]->fetch() ?: new stdClass(); foreach ($_POST as $k => $v) { $editCategory->{$k} = $v; } try { v::object()->attribute('name', v::string()->notEmpty()->length(1, 300))->attribute('enabled', v::numeric()->between(0, 1, true), false)->assert($editCategory); $this->collection->persist($editCategory); $this->collection->flush(); header('HTTP/1.1 303 See Other'); header('Location: ' . $_SERVER['REQUEST_URI']); } catch (NestedValidationExceptionInterface $e) { return ['editCategory' => $editCategory, 'messages' => $e->findMessages(['name' => 'Name must have between 1 and 300 chars', 'enabled' => 'Could not enable category'])]; } }
/** * Create a new RGB from the given red, green and blue channels. * * @param float $hue * Hue is a value between 0 and 360 representing the hue of this colour. If * a number outside this range is provided it will be wrapped to fit inside * this range. * @param float $saturation * Saturation of this colour. * @param float $lightness * Lightness of this colour. * @param Colour $original * A colour that this was transformed from. */ public function __construct($hue, $saturation, $lightness, Colour $original = NULL) { v::numeric()->assert($hue); Colour::validatePercentage($saturation); Colour::validatePercentage($lightness); $this->hue = self::bcfmod($hue, 360, self::$bcscale); if ($this->hue < 0) { $this->hue = bcadd($this->hue, 360, self::$bcscale); } $this->saturation = bcdiv($saturation, 100, self::$bcscale); $this->lightness = bcdiv($lightness, 100, self::$bcscale); $this->chroma = bcmul($this->saturation, bcsub(1, abs(bcmul(2, $this->lightness, self::$bcscale) - 1), self::$bcscale), self::$bcscale); $this->hsl = $this; if (isset($original)) { $this->rgb = $original->rgb; $this->hsb = $original->hsb; } }
/** * Método para atualizar o objeto * ClientesFornecedores informado * * @param Request $request * @return Response */ public function putClientesFornecedoresAction(Request $request, $id) { #Validando o id do parâmetro if (!v::numeric()->validate($id)) { throw new HttpException(400, "Parâmetro inválido"); } #Recuperando os serviços $ClientesFornecedoresRN = $this->get("clientes_fornecedores_rn"); $serializer = $this->get("jms_serializer"); #Recuperando o objeto ClientesFornecedores $objPessoa = $ClientesFornecedoresRN->find(ClientesFornecedores::class, $id); #Verificando se o objeto ClientesFornecedores existe if (!isset($objPessoa)) { throw new HttpException(400, "Solicitação inválida"); } #Verificando o método http if ($request->getMethod() === "PUT") { #Criando o formulário $form = $this->createForm(new ClientesFornecedoresType(), $objPessoa); #Repasando a requisição $form->submit($request); #Verifica se os dados são válidos if ($form->isValid()) { #Recuperando o objeto ClientesFornecedores $ClientesFornecedores = $form->getData(); #Tratamento de exceções try { #Atualizando o objeto $result = $ClientesFornecedoresRN->update($ClientesFornecedores); #Retorno return new Response($serializer->serialize($result, "json")); } catch (\Exception $e) { #Verificando se existe violação de unicidade. (campos definidos como únicos). if ($e->getPrevious()->getCode() == 23000) { throw new HttpException(400, "Já existe registros com os dados informados"); } } catch (\Error $e) { throw new HttpException(400, $e->getMessage()); } } } #Retorno throw new HttpException(400, "Solicitação inválida"); }
/** * Create a new RGB from the given red, green and blue channels. * * @param float $red * A value between 0 and 255 for the red channel. * @param float $green * A value between 0 and 255 for the green channel. * @param float $blue * A value between 0 and 255 for the blue channel. * @param Colour $original * A colour that this was transformed from. */ public function __construct($red, $green, $blue, Colour $original = NULL) { $channel = v::numeric()->numeric()->min(0, TRUE)->max(self::MAX_RGB, TRUE); $channel->assert($red); $channel->assert($green); $channel->assert($blue); // Store normalised values for channels. $this->red = bcdiv($red, self::MAX_RGB, self::$bcscale); $this->green = bcdiv($green, self::MAX_RGB, self::$bcscale); $this->blue = bcdiv($blue, self::MAX_RGB, self::$bcscale); // Store some helpful points of interest. $this->M = max($this->red, $this->green, $this->blue); $this->m = min($this->red, $this->green, $this->blue); $this->chroma = bcsub($this->M, $this->m, self::$bcscale); $this->rgb = $this; if (isset($original)) { $this->hsl = $original->hsl; $this->hsb = $original->hsb; } }
private function _validateEntries($valueArr) { $validUid = true; $validPage = true; $validName = true; $validState = true; $minNumericVal = $this->_uiConfig["card"]["minNumericLength"]; $maxNumericVal = $this->_uiConfig["card"]["maxNumericLength"]; $minStrVal = $this->_uiConfig["card"]["minStringLength"]; $maxStrVal = $this->_uiConfig["card"]["maxStringLength"]; $validateNumber = v::numeric()->noWhitespace()->length($minNumericVal, $maxNumericVal); $validateString = v::string()->noWhitespace()->length($minStrVal, $maxStrVal); if (array_key_exists(":UID", $valueArr) && $valueArr[":UID"] !== "%") { $validUid = $validateNumber->validate($valueArr[":UID"]); } if (!$validUid) { throw new \InvalidArgumentException('Invalid UID', \Native5\Core\Http\StatusCodes::NOT_ACCEPTABLE); } if (array_key_exists(":PAGE", $valueArr) && $valueArr[":PAGE"] !== "%") { $validPage = $validateString->validate($valueArr[":PAGE"]); } if (!$validPage) { throw new \InvalidArgumentException('Invalid Page', \Native5\Core\Http\StatusCodes::NOT_ACCEPTABLE); } if (array_key_exists(":NAME", $valueArr) && $valueArr[":NAME"] !== "%") { $validName = $validateString->validate($valueArr[":NAME"]); } if (!$validName) { throw new \InvalidArgumentException('Invalid Name', \Native5\Core\Http\StatusCodes::NOT_ACCEPTABLE); } if (array_key_exists(":STATE1", $valueArr) && $valueArr[":STATE1"] !== "%") { $validState = $validateString->validate($valueArr[":STATE1"]); } elseif (array_key_exists(":STATE", $valueArr) && $valueArr[":STATE"] !== "%") { $validState = $validateString->validate($valueArr[":STATE"]); } if (!$validState) { throw new \InvalidArgumentException('Invalid State', \Native5\Core\Http\StatusCodes::NOT_ACCEPTABLE); } return true; }
/** * 是否为非负数 * * @param string $value * @return bool */ public static function notNegative($value) { return !Validator::numeric()->negative()->validate($value); }
/** * @param int $max * * @return $this * @codeCoverageIgnore */ public function setMax($max) { $this->max = (double) $max; $this->attachValidator(Validator::numeric()->max($max), __METHOD__); return $this; }
/** * @PrePersist * @PreUpdate */ public function validate() { v::float()->assert($this->amount); v::numeric("+")->startsWith("+")->assert($this->phone); v::notEmpty()->assert($this->status); }
public function providerForInvalidNot() { return [[new IntVal(), 123], [new AllOf(new OneOf(new Numeric(), new IntVal())), 13.37], [new OneOf(new Numeric(), new IntVal()), 13.37], [Validator::oneOf(Validator::numeric(), Validator::intVal()), 13.37]]; }
/** * Get the VM disk space by passing her uuid. * * @param mixe $size the currency of size of disk space * * @return XenResponse $response */ function getDiskSpace($size = NULL) { $VBD = $this->getXenconnection()->VBD__get_all(); $memory = 0; foreach ($VBD->getValue() as $bd) { $responsevm = $this->getXenconnection()->VBD__get_VM($bd); $responsetype = $this->getXenconnection()->VBD__get_type($bd); if ($responsevm->getValue() == $this->getVmId() && $responsetype->getValue() == "Disk") { $VDI = $this->getXenconnection()->VBD__get_VDI($bd); $memory += intval($this->getXenconnection()->VDI__get_virtual_size($VDI->getValue())->getValue()); } } $response = NULL; if (Validator::numeric()->validate($memory)) { return new XenResponse(array('Value' => $memory, 'Status' => 'Success')); } else { return new XenResponse(array('Value' => 0, 'Status' => 'Failed')); } return $response; }
public function updateSettingsAction() { $name = $this->app->request->post('name'); $email = $this->app->request->post('email'); $twilio_sid = $this->app->request->post('twilio_sid'); $twilio_token = $this->app->request->post('twilio_token'); $twilio_phonenumber = $this->app->request->post('twilio_phonenumber'); $mail_host = $this->app->request->post('mail_host'); $mail_port = $this->app->request->post('mail_port'); $mail_username = $this->app->request->post('mail_username'); $mail_password = $this->app->request->post('mail_password'); $subject = $this->app->request->post('subject'); $msg_template = $this->app->request->post('msg_template'); $time_before = $this->app->request->post('time_before'); $rules = array('name' => v::string()->notEmpty()->setName('name'), 'email' => v::email()->notEmpty()->setName('email'), 'twilio_sid' => v::string()->setName('twilio_sid'), 'twilio_token' => v::string()->setName('twilio_token'), 'twilio_phonenumber' => v::phone()->setName('twilio_phonenumber'), 'mail_host' => v::string()->setName('mail_host'), 'mail_port' => v::numeric()->setName('mail_port'), 'mail_username' => v::string()->setName('mail_username'), 'mail_password' => v::string()->setName('mail_password'), 'subject' => v::string()->notEmpty()->setName('subject'), 'msg_template' => v::string()->notEmpty()->setName('msg_template'), 'time_before' => v::string()->notEmpty()->setName('time_before')); $data = $this->app->request->post(); $message = array('type' => 'success', 'text' => 'Successfully updated settings'); foreach ($data as $key => $value) { try { $rules[$key]->check($value); } catch (\InvalidArgumentException $e) { $message = array('type' => 'error', 'text' => $e->getMainMessage()); break; } } if ($message['type'] == 'success') { $id = 1; $settings = R::load('settings', $id); if ($settings) { $settings->name = $name; $settings->email = $email; $settings->twilio_sid = $twilio_sid; $settings->twilio_token = $twilio_token; $settings->twilio_phonenumber = $twilio_phonenumber; $settings->mail_host = $mail_host; $settings->mail_port = $mail_port; $settings->mail_username = $mail_username; $settings->mail_password = $mail_password; $settings->subject = $subject; $settings->msg_template = $msg_template; $settings->time_before = $time_before; R::store($settings); } else { $setting = R::dispense('settings'); $setting->name = $name; $setting->msg_template = $msg_template; $settings->time_before = $time_before; R::store($setting); } } $this->app->flash('message', $message); $this->app->redirect('/settings'); }
/** * @return boolean * @param stdClass $user */ public function isValid($user) { $userValidator = v::attribute('ID', v::numeric())->attribute('USUARIO', v::string()->notEmpty()->noWhitespace())->attribute('NOME', v::string()->notEmpty())->attribute('EMAIL', v::email())->attribute('CPF', v::cpf())->attribute('STATUS', v::numeric())->attribute('UNIDADES', v::arr()); return $userValidator->validate($user); }
<?php /** * Created by PhpStorm. * User: who * Date: 5/11/16 * Time: 1:13 PM */ require "../vendor/autoload.php"; use Respect\Validation\Validator as v; $number = '123456a'; $res = v::numeric()->validate($number); try { v::regex('/^[\\x{4e00}-\\x{9fa5}]{1,32}$/u')->setName('金额')->check('汉字d'); } catch (\Respect\Validation\Exceptions\ValidationException $exception) { echo $exception->getMainMessage(); }
/** * Validates input type * * @param string $hook "validate:type" * @param string $type "prototyper" * @param ValidationStatus $validation Current validation status * @param array $params Hook params * @return ValidationStatus */ function prototyper_validate_type($hook, $type, $validation, $params) { if (!$validation instanceof ValidationStatus) { $validation = new ValidationStatus(); } $field = elgg_extract('field', $params); if (!$field instanceof Field) { return $validation; } $rule = elgg_extract('rule', $params); if ($rule != "type") { return $validation; } $value = elgg_extract('value', $params); $expectation = elgg_extract('expectation', $params); switch ($expectation) { case 'text': case 'string': if (!v::string()->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:string', array($field->getLabel()))); } break; case 'alnum': case 'alphanum': if (!v::alnum()->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:alnum', array($field->getLabel()))); } break; case 'alpha': if (!v::alpha()->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:alpha', array($field->getLabel()))); } break; case 'number': case 'numeric': if (!v::numeric()->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:numeric', array($field->getLabel()))); } break; case 'integer': case 'int': if (!v::int()->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:int', array($field->getLabel()))); } break; case 'date': if (!v::date()->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:date', array($field->getLabel()))); } break; case 'url': if (!v::filterVar(FILTER_VALIDATE_URL, FILTER_FLAG_PATH_REQUIRED)->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:url', array($field->getLabel()))); } break; case 'email': if (!v::filterVar(FILTER_VALIDATE_EMAIL)->validate($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:email', array($field->getLabel()))); } break; case 'guid': case 'entity': if (!elgg_entity_exists($value)) { $validation->setFail(elgg_echo('prototyper:validate:error:type:guid', array($field->getLabel()))); } break; case 'image': $type = elgg_extract('type', $value); if (!$type || substr_count($type, 'image/') == 0) { $validation->setFail(elgg_echo('prototyper:validate:error:type:image', array($field->getLabel()))); } break; } return $validation; }
public function providerForInvalidNot() { return array(array(new IntVal(), 123), array(new AllOf(new OneOf(new Numeric(), new IntVal())), 13.37), array(new OneOf(new Numeric(), new IntVal()), 13.37), array(Validator::oneOf(Validator::numeric(), Validator::intVal()), 13.37)); }
/** * Set IBGE county code where service was realized * @param int $value * @throws InvalidArgumentException */ public function municipioPrestacaoServico($value) { if (!Validator::numeric()->intVal()->validate($value)) { throw new \InvalidArgumentException('Deve ser passado o código do IBGE.'); } $this->infMunicipioPrestacaoServico = $value; }
public function category($intCategory) { if (!Validator::numeric()->notEmpty()->length(3, 3)->validate($intCategory)) { $this->objLogger->addError('Category must be a numeric string with a length of 3.'); throw new SMSMessageException('Category must be a numeric string with a length of 3.'); } $this->intCategory = $intCategory; $this->objLogger->addDebug('Category has been set to ' . $intCategory); return $this; }
try { v::numeric()->setName('job_id')->check($job_id); } catch (ValidationExceptionInterface $e) { return $res->withStatus(400)->write($e->getMainMessage()); } try { $job = new \Pheanstalk\Job($job_id, []); $pheanstalk->delete($job); } catch (\Pheanstalk\Exception\ServerException $e) { return $res->withStatus(400)->write($e->getMessage()); } }); $app->post('/cmd/kick', function ($req, $res) use($pheanstalk) { $job_id = $req->getParam('job_id'); try { v::numeric()->setName('job_id')->check($job_id); } catch (ValidationExceptionInterface $e) { return $res->withStatus(400)->write($e->getMainMessage()); } try { $job = new \Pheanstalk\Job($job_id, []); $pheanstalk->kickJob($job); } catch (\Pheanstalk\Exception\ServerException $e) { return $res->withStatus(400)->write($e->getMessage()); } }); $app->post('/cmd/pause', function ($req, $res) use($pheanstalk) { $tube = $req->getParam('tube', 'default'); $duration = intval($req->getParam('duration', 60)); $pheanstalk->pauseTube($tube, $duration); });
public function testMoreComplexXmlValidationWithErrors() { $xml = '<person> <finally>22</finally> <email> <finally>33</finally> <sub> <finally>97</finally> <sub-sub> <finally>321</finally> </sub-sub> </sub> </email> </person>'; $this->setUpXmlPost($xml); $finallyValidator = v::numeric()->positive()->between(1, 200); $validators = array('email' => array('sub' => array('sub-sub' => array('finally' => $finallyValidator)))); $mw = new Validation($validators); $next = function ($req, $res) { return $res; }; $response = $mw($this->request, $this->response, $next); $errors = array('email.sub.sub-sub.finally' => array('"321" must be lower than or equals 200')); $this->assertEquals($errors, $mw->getErrors()); $this->assertEquals($validators, $mw->getValidators()); }
function grossSubscriberFee($contractNo, $checkStartDate, $checkDate) { //Get user details #Validate if (!v::numeric()->validate($contractNo)) { $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Fail</status> <msg>Invalid contract number</msg> </returnCall> _XML_; return $xmlstr; } if (!v::date()->validate($checkStartDate)) { $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Fail</status> <msg>Invalid date format</msg> </returnCall> _XML_; return $xmlstr; } if (!v::date()->validate($checkDate)) { $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Fail</status> <msg>Invalid date format</msg> </returnCall> _XML_; return $xmlstr; } #Get contract details $resultSet = mysqli_query($this->conn, "SELECT * FROM accountrecords WHERE contractNo = '" . mysqli_real_escape_string($this->conn, $contractNo) . "';", MYSQLI_STORE_RESULT); if (mysqli_errno($this->conn) != 0) { #Failed to run query $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Fail</status> <msg>Failed to execute query</msg> <errorMsg>{$this->conn}->error<errorMsgmsg> </returnCall> _XML_; return $xmlstr; } //$row_cnt = mysqli_num_rows($resultSet); //file_put_contents('log.log', print_r($resultSet)); $row_cnt = mysqli_num_rows($resultSet); if ($row_cnt === 0) { $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Fail</status> <msg>Contract does not exist</msg> </returnCall> _XML_; return $xmlstr; } $returnContractRow = mysqli_fetch_assoc($resultSet); //Check that the date passed is greater or equal to the subscriptionStartDate $date1 = new DateTime($checkDate); $date2 = $returnContractRow['subscriptionStartDate']; if ($date1 >= $date2) { //Pass, now check if all admin fees paid $resultPaymentSet = mysqli_query($this->conn, "SELECT sum(amount) as total FROM payments WHERE paymentDate < '" . substr($returnContractRow['subscriptionStartDate'], 0, 7) . "';", MYSQLI_STORE_RESULT); if (mysqli_errno($this->conn) != 0) { #Failed to run query $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Fail</status> <msg>Failed to execute query summing of payments</msg> <errorMsg>{$this->conn}->error<errorMsgmsg> </returnCall> _XML_; return $xmlstr; } $returnPaymentRow = mysqli_fetch_assoc($resultPaymentSet); if ($returnPaymentRow['total'] >= $returnContractRow['adminFeePayable']) { //Admin fee has been fully paid //Check that subscription amount was paid for this month $subscriptionFee = $returnContractRow['subscriptionBalance'] / $returnContractRow['noInstalmentsBalance']; $resultPaymentSubscriptionMonth = mysqli_query($this->conn, "SELECT sum(amount) as total FROM payments WHERE contractNo = '" . mysqli_real_escape_string($this->conn, $contractNo) . "' AND paymentDate >= '" . $checkStartDate . "' AND paymentDate <= '" . $checkDate . "';", MYSQLI_STORE_RESULT); //$resultPaymentSubscriptionMonth = mysqli_query($this->conn, "SELECT sum(amount) as total FROM payments WHERE paymentDate <= '".substr($returnContractRow['subscriptionStartDate'],0,7)."' AND paymentDate <= '".mysqli_real_escape_string($this->conn,$checkStartDate)."';",MYSQLI_STORE_RESULT); $returnPaymentSubscriptionMonthRow = mysqli_fetch_assoc($resultPaymentSubscriptionMonth); $totalPaidThisMonth = $returnPaymentSubscriptionMonthRow['total']; if ($returnPaymentSubscriptionMonthRow['total'] >= $subscriptionFee) { //This contract has paid a figure greate or equal to their monthly subscription $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Success</status> <grossSubFee>{$subscriptionFee}</grossSubFee> <totalPaidThisMonth>{$totalPaidThisMonth}</totalPaidThisMonth> <reason>Subscription fee paid</reason> </returnCall> _XML_; return $xmlstr; } else { //This contract has paid a figure less than their monthly subscription fee $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Success</status> <grossSubFee>0</grossSubFee> <totalPaidThisMonth>{$totalPaidThisMonth}</totalPaidThisMonth> <reason>Subscription fee NOT fully paid</reason> </returnCall> _XML_; return $xmlstr; } } else { //Fail $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Success</status> <grossSubFee>0</grossSubFee> <reason>Admin fee not fully paid</reason> </returnCall> _XML_; return $xmlstr; } } else { //Fail $xmlstr = <<<_XML_ <?xml version='1.0' standalone='yes'?> <returnCall> <status>Success</status> <grossSubFee>0</grossSubFee> <reason>Date parsed less than subscriptionStartDate</reason> </returnCall> _XML_; return $xmlstr; } }