You are here

public function Braintree_Result_Error::__construct in Commerce Braintree 7

overrides default constructor @ignore

Parameters

array $response gateway response array:

Overrides Braintree::__construct

File

braintree_php/lib/Braintree/Result/Error.php, line 69

Class

Braintree_Result_Error
Braintree Error Result

Code

public function __construct($response) {
  $this->_attributes = $response;
  $this
    ->_set('errors', new Braintree_Error_ErrorCollection($response['errors']));
  if (isset($response['verification'])) {
    $this
      ->_set('creditCardVerification', new Braintree_Result_CreditCardVerification($response['verification']));
  }
  else {
    $this
      ->_set('creditCardVerification', null);
  }
  if (isset($response['transaction'])) {
    $this
      ->_set('transaction', Braintree_Transaction::factory($response['transaction']));
  }
  else {
    $this
      ->_set('transaction', null);
  }
  if (isset($response['subscription'])) {
    $this
      ->_set('subscription', Braintree_Subscription::factory($response['subscription']));
  }
  else {
    $this
      ->_set('subscription', null);
  }
}