Example #1
0
 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);
 }
Example #2
0
 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);
 }