You are here

public static function Braintree_CreditCard::factory in Commerce Braintree 7

factory method: returns an instance of Braintree_CreditCard to the requesting method, with populated properties

@ignore

Return value

object instance of Braintree_CreditCard

6 calls to Braintree_CreditCard::factory()
Braintree_CreditCard::find in braintree_php/lib/Braintree/CreditCard.php
find a creditcard by token
Braintree_CreditCard::_verifyGatewayResponse in braintree_php/lib/Braintree/CreditCard.php
generic method for validating incoming gateway responses
Braintree_CreditCardTest::testGet_givesErrorIfInvalidProperty in braintree_php/tests/unit/CreditCardTest.php
Braintree_CreditCardTest::testIsDefault in braintree_php/tests/unit/CreditCardTest.php
Braintree_CreditCardTest::testMaskedNumber in braintree_php/tests/unit/CreditCardTest.php

... See full list

File

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

Class

Braintree_CreditCard
Creates and manages Braintree CreditCards

Code

public static function factory($attributes) {
  $defaultAttributes = array(
    'bin' => '',
    'expirationMonth' => '',
    'expirationYear' => '',
    'last4' => '',
  );
  $instance = new self();
  $instance
    ->_initialize(array_merge($defaultAttributes, $attributes));
  return $instance;
}