*/ class Mage_Authorizenet_Model_Directpost_Response extends Varien_Object { /** * Generates an Md5 hash to compare against AuthNet's. * * @param string $merchantMd5 * @param string $merchantApiLogin * @param string $amount * @param string $transactionId * @return string */ public function generateHash($merchantMd5, $merchantApiLogin, $amount, $transactionId) { if (!$amount) { $amount = '0.00'; } return strtoupper(md5($merchantMd5 . $merchantApiLogin . $transactionId . $amount)); } /** * Return if is valid order id. * * @param string $merchantMd5 * @param string $merchantApiLogin * @return bool */ public function isValidHash($merchantMd5, $merchantApiLogin) { return $this->generateHash($merchantMd5, $merchantApiLogin, $this->getXAmount(), $this->getXTransId()) == $this->getData('x_MD5_Hash'); } /** * Return if this is approved response from Authorize.net auth request. * * @return bool */ public function isApproved() { return $this->getXResponseCode() == Mage_Authorizenet_Model_Directpost::RESPONSE_CODE_APPROVED; } }