- /**
- * Validate response data. Needed in controllers.
- *
- * @return bool true in case of validation success.
- * @throws \Magento\Framework\Exception\LocalizedException In case of validation error
- */
- public function validateResponse()
- {
- $response = $this->getResponse();
- //md5 check
- if (!$this->getConfigData('trans_md5')
- || !$this->getConfigData('login')
- || !$response->isValidHash($this->getConfigData('trans_md5'), $this->getConfigData('login'))
- ) {
- throw new \Magento\Framework\Exception\LocalizedException(
- __('The transaction was declined because the response hash validation failed.')
- );
- }
- return true;
- }