public function check()
 {
     parent::check();
     $methods = EnumTool::getConstants(CaptureMethod::class);
     if (!empty($this->captureMethod) && !in_array($this->captureMethod, array_values($methods))) {
         throw new ValidationException("Capture method '{$this->captureMethod}' has invalid value.");
     }
 }
 public function check()
 {
     $methods = array_values(EnumTool::getConstants(ConfigurationMethod::class));
     if (!in_array($this->method, $methods)) {
         throw new ValidationException("Unknown method {$this->method}.");
     }
     if (strlen($this->password) < 8) {
         throw new ValidationException("Password must be more than 8 characters.");
     }
     // TODO: Unimplemented validations:
     // - Made up of a combination of at least 2 of lowercase, uppercase, numeric and special characters.
     // - Dissimilar to the current password.
     // - Not too simplistic or repetitive.
     // - Not contain whole or partial words from the dictionary.
 }
 public function check()
 {
     if (empty($this->amount)) {
         throw new ValidationException('Amount is empty');
     }
     $supportedCurrencies = EnumTool::getConstants(Currency::class);
     $currency = $this->amount->getCurrency();
     $amount = $this->amount->getValue();
     if (!in_array($currency, array_values($supportedCurrencies))) {
         throw new ValidationException("Currency '{$currency}' isn't supported");
     }
     if (empty($amount)) {
         throw new ValidationException("Value of amount '{$amount}' has not valid");
     }
 }
 public function check()
 {
     $this->checkUrl($this->returnUrl, "ReturnUrl '{$this->returnUrl}' doesn't has valid format.");
     $this->checkUrl($this->expiryUrl, "ExpiryUrl '{$this->expiryUrl}' doesn't has valid format.");
     $this->checkSsl($this->expiryUrl, "A secure (https) ExpiryUrl must be provided. Got: '{$this->expiryUrl}'");
     if ($this->errorUrl) {
         $this->checkSsl($this->expiryUrl, "A secure (https) ErrorUrl must be provided. Got: '{$this->errorUrl}'");
     }
     $pagesSets = array_merge(array_values(EnumTool::getConstants(PageSet::class)), array_values(EnumTool::getConstants(TestPageSet::class)));
     if (!in_array($this->pageSetId, $pagesSets)) {
         throw new ValidationException("Unknown page set id '{$this->pageSetId}'. " . "Please check it or update PageSet or TestPageSet enums.");
     }
     $methods = EnumTool::getConstants(SetupMethod::class);
     if (!in_array($this->method, array_values($methods))) {
         throw new ValidationException("Unknown method '{$this->method}''");
     }
 }