public function setTerminalCapabilityCode($value)
 {
     $value = TerminalCapabilityCode::memberByValue($value)->value();
     return $this->setParameter('TerminalCapabilityCode', $value);
 }
示例#2
0
 /**
  * Model validation ensures that any data that is present in the model is
  * formatted correctly. No business logic validation is performed at this
  * level.
  *
  * @throws InvalidRequestException if validation fails.
  */
 public function validate()
 {
     if (strlen($this['TerminalID']) && !preg_match('/^.{1,40}$/', $this['TerminalID'])) {
         throw new InvalidRequestException('TerminalID should have 40 or fewer characters');
     }
     if (isset($this['TerminalType'])) {
         try {
             TerminalType::memberByValue($this['TerminalType']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for TerminalType');
         }
     }
     if (isset($this['TerminalCapabilityCode'])) {
         try {
             TerminalCapabilityCode::memberByValue($this['TerminalCapabilityCode']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for TerminalCapabilityCode');
         }
     }
     if (isset($this['TerminalEnvironmentCode'])) {
         try {
             TerminalEnvironmentCode::memberByValue($this['TerminalEnvironmentCode']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for TerminalEnvironmentCode');
         }
     }
     if (isset($this['CardPresentCode'])) {
         try {
             CardPresentCode::memberByValue($this['CardPresentCode']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for CardPresentCode');
         }
     }
     if (isset($this['CVVPresenceCode'])) {
         try {
             CVVPresenceCode::memberByValue($this['CVVPresenceCode']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for CVVPresenceCode');
         }
     }
     if (isset($this['CardInputCode'])) {
         try {
             CardInputCode::memberByValue($this['CardInputCode']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for CardInputCode');
         }
     }
     if (isset($this['CardholderPresentCode'])) {
         try {
             CardholderPresentCode::memberByValue($this['CardholderPresentCode']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for CardholderPresentCode');
         }
     }
     if (isset($this['MotoECICode'])) {
         try {
             MotoECICode::memberByValue($this['MotoECICode']);
         } catch (\Exception $e) {
             throw new InvalidRequestException('Invalid value for MotoECICode');
         }
     }
     if (strlen($this['TerminalSerialNumber']) && !preg_match('/^.{1,40}$/', $this['TerminalSerialNumber'])) {
         throw new InvalidRequestException('TerminalSerialNumber should have 40 or fewer characters');
     }
 }