/** * Handle errors occurred * * @return void */ protected function _handleErrors() { parent::_handleErrors(); //handle errors if (isset($this->_response['errors']['su'])) { if (!isset($this->_response['errors']['su']['errors']['error'][0])) { $tmp = $this->_response['errors']['su']['errors']['error']; unset($this->_response['errors']['su']['errors']['error']); $this->_response['errors']['su']['errors']['error'][0] = $tmp; } foreach ($this->_response['errors']['su']['errors']['error'] as $error) { $this->errors['su'][] = $this->_getErrorBlock($error); } } //handle warnings if (isset($this->_response['new_transaction']['warnings']['su'])) { if (!isset($this->_response['new_transaction']['warnings']['su']['warnings']['warning'][0])) { $tmp = $this->_response['new_transaction']['warnings']['su']['warnings']['warning']; unset($this->_response['new_transaction']['warnings']['su']['warnings']['warning']); $this->_response['new_transaction']['warnings']['su']['warnings']['warning'][0] = $tmp; } foreach ($this->_response['new_transaction']['warnings']['su']['warnings']['warning'] as $warning) { $this->warnings['su'][] = $this->_getErrorBlock($warning); } } }
/** * Constructor for Ideal * * @param string $configKey * @param string $password * @param string $hashFunction (default sha1) */ public function __construct($configKey, $password, $hashFunction = 'sha1') { parent::__construct($configKey); list($userId, $projectId) = explode(':', $configKey); $this->_password = $password; $this->_userId = $this->_parameters['user_id'] = $userId; $this->_projectId = $this->_parameters['project_id'] = $projectId; $this->_hashFunction = strtolower($hashFunction); $this->_paymentUrl = $this->_getPaymentDomain(); }
/** * Handle errors occurred * * @return void */ protected function _handleErrors() { parent::_handleErrors(); if (isset($this->_response['refunds'])) { if (!isset($this->_response['refunds']['refund'][0])) { $tmp = $this->_response['refunds']['refund']; unset($this->_response['refunds']['refund']); $this->_response['refunds']['refund'][] = $tmp; } foreach ($this->_response['refunds']['refund'] as $response) { //handle errors if (isset($response['errors']['error'])) { if (!isset($response['errors']['error'][0])) { $tmp = $response['errors']['error']; unset($response['errors']['error']); $response['errors']['error'][0] = $tmp; } foreach ($response['errors']['error'] as $error) { $this->errors['global'][] = $this->_getErrorBlock($error); } } } } }
/** * Getter for refund's errors * * @param int $i (default 0) * @return bool|array */ public function getRefundError($i = 0) { if (isset($this->_response['refunds']) && isset($this->_response['refunds']['refund'])) { if (isset($this->_response['refunds']['refund'][$i]) && isset($this->_response['refunds']['refund'][$i]['errors'])) { $errorBlock = array(); foreach ($this->_response['refunds']['refund'][$i]['errors']['error'] as $error) { $errorBlock[] = $this->_getErrorBlock($error); } return parent::getError('all', array($errorBlock)); } } return false; }