Ejemplo n.º 1
0
 /**
  * Set payment storage credit card attributes
  * @return bool
  * @param string $ccType
  * @param string $ccOwner
  * @param string $ccNumber
  * @param string $ccExpiresYear
  * @param string $ccExpiresMonth
  * @param string $ccCvv
  * @param string $cc_issue_year[optional]
  * @param string $cc_expires_month[optional]
  */
 public function setCreditCard($ccType, $ccOwner, $ccNumber, $ccExpiresYear, $ccExpiresMonth, $ccCvv, $ccIssueYear = null, $ccIssueMonth = null)
 {
     if (empty($ccType) || empty($ccNumber) || empty($ccExpiresYear) || empty($ccExpiresMonth)) {
         Axis::message()->addError(Axis::translate('checkout')->__('Set full Credit Card Information'));
         return false;
     }
     $validator = new Zend_Validate_CreditCard();
     $allowedCcTypes = $this->getCCTypes();
     $validator->setType($allowedCcTypes);
     if (!$validator->isValid($ccNumber)) {
         foreach ($validator->getMessages() as $message) {
             Axis::message()->addError($message);
         }
         return false;
     }
     return $this->getCreditCard()->setCcType($ccType)->setCcOwner($ccOwner)->setCcNumber($ccNumber)->setCcExpiresYear($ccExpiresYear)->setCcExpiresMonth($ccExpiresMonth)->setCcIssueYear($ccIssueYear)->setCcIssueMonth($ccIssueMonth)->setCcCvv($ccCvv) instanceof Axis_CreditCard;
 }
 /**
  * @group ZF-9477
  */
 public function testMultiInstitute()
 {
     $validator = new Zend_Validate_CreditCard(array('type' => Zend_Validate_CreditCard::MASTERCARD));
     $this->assertFalse($validator->isValid('4111111111111111'));
     $message = $validator->getMessages();
     $this->assertContains('not from an allowed institute', current($message));
 }
Ejemplo n.º 3
0
 /**
  * Ensures that getMessages() returns expected default value
  *
  * @return void
  */
 public function testGetMessages()
 {
     $validator = new Zend_Validate_CreditCard();
     $this->assertEquals(array(), $validator->getMessages());
 }