You are here

private static function Braintree_Subscription::_verifyGatewayResponse in Commerce Braintree 7

@ignore

4 calls to Braintree_Subscription::_verifyGatewayResponse()
Braintree_Subscription::cancel in braintree_php/lib/Braintree/Subscription.php
Braintree_Subscription::create in braintree_php/lib/Braintree/Subscription.php
Braintree_Subscription::retryCharge in braintree_php/lib/Braintree/Subscription.php
Braintree_Subscription::update in braintree_php/lib/Braintree/Subscription.php

File

braintree_php/lib/Braintree/Subscription.php, line 226

Class

Braintree_Subscription
Braintree Subscription module

Code

private static function _verifyGatewayResponse($response) {
  if (isset($response['subscription'])) {
    return new Braintree_Result_Successful(self::factory($response['subscription']));
  }
  else {
    if (isset($response['transaction'])) {

      // return a populated instance of Braintree_Transaction, for subscription retryCharge
      return new Braintree_Result_Successful(Braintree_Transaction::factory($response['transaction']));
    }
    else {
      if (isset($response['apiErrorResponse'])) {
        return new Braintree_Result_Error($response['apiErrorResponse']);
      }
      else {
        throw new Braintree_Exception_Unexpected("Expected subscription, transaction, or apiErrorResponse");
      }
    }
  }
}