예제 #1
0
파일: Server.php 프로젝트: academe/sagepay
 public function validate($server)
 {
     $this->clearErrors();
     $metaData = Transaction::get('array');
     // Check the currency is a valid one
     if (!Metadata\Iso4217::checkCurrency($server->getField('Currency'))) {
         $this->addError('Currency', $this->CURRENCY_INVALID);
     }
     $this->validateAmount($server->getField('Amount'));
     // Perform some general validations and return ourself
     return parent::validate($server);
 }
예제 #2
0
파일: Address.php 프로젝트: academe/sagepay
 public function validate($addr)
 {
     $this->clearErrors();
     // Do our special validations first
     // State should only be set for the US
     if ($addr->getField('Country') != 'US' && v::notEmpty()->validate($addr->getField('State'))) {
         $this->addError('State', $this->STATE_ONLY_FOR_US);
     }
     // Country must be an ISO3166-1 Country Code
     if (!array_key_exists($addr->getField('Country'), Iso3166::get())) {
         $this->addError('Country', $this->COUNTRY_VALID_CODE);
     }
     // Perform some general validations and return ourself
     return parent::validate($addr);
 }