Exemplo n.º 1
0
 /**
  * {@inheritdoc}
  */
 public function validateForm(array &$form, FormStateInterface $form_state)
 {
     require_once drupal_get_path('module', 'uc_icepay') . '/api/ParameterValidation.php';
     if (!\Icepay_ParameterValidation::merchantID($form_state->getValue('uc_icepay_merchant_id'))) {
         $form_state->setErrorByName('uc_icepay_merchant_id', t('You have specified an invalid Icepay Merchant ID.'));
     }
     if (!\Icepay_ParameterValidation::secretCode($form_state->getValue('uc_icepay_secret_code'))) {
         $form_state->setErrorByName('uc_icepay_secret_code', t('You have specified an invalid Icepay Secret Code.'));
     }
 }
Exemplo n.º 2
0
 /**
  * Validate the merchant settings
  *
  * @since 1.0.0
  * @throws Exception
  */
 private function validateSettings()
 {
     // Validate Merchant ID
     if (!Icepay_ParameterValidation::merchantID($this->getMerchantID())) {
         throw new Exception('Merchant ID not set, use the setMerchantID() method', 1001);
     }
     // Validate SecretCode
     if (!Icepay_ParameterValidation::secretCode($this->getSecretCode())) {
         throw new Exception('Secretcode ID not set, use the setSecretCode() method', 1002);
     }
 }
Exemplo n.º 3
0
 /**
  * Set the Secret Code field
  * @since 1.0.0
  * @access public
  * @param (string) $secretCode
  */
 public function setSecretCode($secretCode)
 {
     if (!Icepay_ParameterValidation::secretCode($secretCode)) {
         throw new Exception('Secretcode not valid');
     }
     $this->_secretCode = (string) $secretCode;
     return $this;
 }