/** * overrides default constructor * @ignore * @param array $response gateway response array */ public function __construct($response) { $this->_attributes = $response; $this->_set('errors', new ErrorCollection($response['errors'])); if (isset($response['verification'])) { $this->_set('creditCardVerification', new CreditCardVerification($response['verification'])); } else { $this->_set('creditCardVerification', null); } if (isset($response['transaction'])) { $this->_set('transaction', Transaction::factory($response['transaction'])); } else { $this->_set('transaction', null); } if (isset($response['subscription'])) { $this->_set('subscription', Subscription::factory($response['subscription'])); } else { $this->_set('subscription', null); } if (isset($response['merchantAccount'])) { $this->_set('merchantAccount', MerchantAccount::factory($response['merchantAccount'])); } else { $this->_set('merchantAccount', null); } }
/** * @ignore */ private function _verifyGatewayResponse($response) { if (isset($response['subscription'])) { return new Result\Successful(Subscription::factory($response['subscription'])); } else { if (isset($response['transaction'])) { // return a populated instance of Transaction, for subscription retryCharge return new Result\Successful(Transaction::factory($response['transaction'])); } else { if (isset($response['apiErrorResponse'])) { return new Result\Error($response['apiErrorResponse']); } else { throw new Exception\Unexpected("Expected subscription, transaction, or apiErrorResponse"); } } } }