Beispiel #1
0
 /**
  * Sanitize the card number .
  *
  * @param  string $card
  * @return string|false
  */
 public static function sanitize($card)
 {
     if (Master::isValid($card)) {
         return Master::sanitize($card);
     } elseif (Visa::isValid($card)) {
         return Visa::sanitize($card);
     } elseif (Amex::isValid($card)) {
         return Amex::sanitize($card);
     }
     return false;
 }
Beispiel #2
0
 /**
  * @see \Tbs\Helper\CreditCard\Visa::mask()
  */
 public function testUnMask()
 {
     $rs = Visa::unMask('1111 2222 3333 4444');
     $this->assertInternalType('string', $rs);
     $this->assertEquals('1111222233334444', $rs);
 }
Beispiel #3
0
 /**
  * @see \Tbs\Helper\CreditCard::sanitize()
  */
 public function testSanitazeTagsVisaUnMasked()
 {
     $visa = '4556518283874759';
     $rs = Card::sanitize($visa . '<script>alert("some content");</script>');
     $this->assertEquals(Visa::mask($visa), $rs);
 }