Esempio n. 1
0
 public function binary($blBinary)
 {
     if (!Validator::boolType()->validate($blBinary)) {
         $this->objLogger->addError('Binary must be TRUE or FALSE');
         throw new SMSMessageException('Binary must be TRUE or FALSE');
     }
     $this->blBinary = (bool) $blBinary;
     $this->objLogger->addDebug('Binary has been set to ' . $blBinary);
     return $this;
 }
Esempio n. 2
0
 private function validate()
 {
     try {
         $validator = v::attribute('merchantAlias', v::stringType()->alnum('_')->noWhitespace()->length(1, 30))->attribute('macKey', v::stringType()->length(1))->attribute('transactionCode', v::stringType()->alnum()->noWhitespace()->length(1, 30))->attribute('requestType', v::oneOf(v::stringType()->equals(self::REQUEST_TYPE_FIRST_ATTEMPT), v::stringType()->equals(self::REQUEST_TYPE_RETRY_ATTEMPT)))->attribute('operationId', v::stringType()->digit()->noWhitespace()->length(1, 10))->attribute('operationType', v::oneOf(v::stringType()->equals(self::OPERATION_TYPE_CAPTURE), v::stringType()->equals(self::OPERATION_TYPE_VOID)))->attribute('originalAmount', v::stringType()->digit()->noWhitespace()->length(9, 9))->attribute('currency', v::stringType()->alnum()->noWhitespace()->length(3, 3))->attribute('authCode', v::stringType()->alnum()->noWhitespace()->length(1, 10))->attribute('operationAmount', v::stringType()->digit()->noWhitespace()->length(9, 9))->attribute('user', v::optional(v::stringType()->alnum()->length(0, 20)))->attribute('isTest', v::boolType());
         $validator->assert($this);
     } catch (NestedValidationException $e) {
         throw new ValidationException($e->getFullMessage());
     }
 }