- /**
- * Check the gateway MD5 response to make sure that this is a proper
- * gateway response
- *
- * @param string $responseMD5
- * MD5 hash generated by the gateway.
- * @param string $transaction_id
- * Transaction id generated by the gateway.
- * @param string $amount
- * Purchase amount.
- *
- * @param bool $ipn
- *
- * @return bool
- */
- public function checkMD5($responseMD5, $transaction_id, $amount, $ipn = FALSE) {
- // cannot check if no MD5 hash
- $md5Hash = $this->_getParam('md5Hash');
- if (empty($md5Hash)) {
- return TRUE;
- }
- $loginid = $this->_getParam('apiLogin');
- $hashString = $ipn ? ($md5Hash . $transaction_id . $amount) : ($md5Hash . $loginid . $transaction_id . $amount);
- $result = strtoupper(md5($hashString));
-
- if ($result == $responseMD5) {
- return TRUE;
- }
- else {
- return FALSE;
- }
- }
-