You are here

private static function Braintree_CreditCard::_validateId in Commerce Braintree 7

verifies that a valid credit card token is being used @ignore

Parameters

string $token:

Throws

InvalidArgumentException

5 calls to Braintree_CreditCard::_validateId()
Braintree_CreditCard::credit in braintree_php/lib/Braintree/CreditCard.php
create a credit on the card for the passed transaction
Braintree_CreditCard::delete in braintree_php/lib/Braintree/CreditCard.php
Braintree_CreditCard::find in braintree_php/lib/Braintree/CreditCard.php
find a creditcard by token
Braintree_CreditCard::sale in braintree_php/lib/Braintree/CreditCard.php
create a new sale for the current card
Braintree_CreditCard::update in braintree_php/lib/Braintree/CreditCard.php
updates the creditcard record

File

braintree_php/lib/Braintree/CreditCard.php, line 511

Class

Braintree_CreditCard
Creates and manages Braintree CreditCards

Code

private static function _validateId($token = null) {
  if (empty($token)) {
    throw new InvalidArgumentException('expected credit card id to be set');
  }
  if (!preg_match('/^[0-9A-Za-z_-]+$/', $token)) {
    throw new InvalidArgumentException($token . ' is an invalid credit card id.');
  }
}