Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Response.php
Go to the documentation of this file.
1 <?php
7 
10 
15 {
25  public function generateHash($merchantMd5, $merchantApiLogin, $amount, $transactionId)
26  {
27  if (!$amount) {
28  $amount = '0.00';
29  }
30 
31  return strtoupper(md5($merchantMd5 . $merchantApiLogin . $transactionId . $amount));
32  }
33 
41  public function isValidHash($merchantMd5, $merchantApiLogin)
42  {
43  $hash = $this->generateHash($merchantMd5, $merchantApiLogin, $this->getXAmount(), $this->getXTransId());
44 
45  return Security::compareStrings($hash, $this->getData('x_MD5_Hash'));
46  }
47 
53  public function isApproved()
54  {
55  return $this->getXResponseCode() == \Magento\Authorizenet\Model\Directpost::RESPONSE_CODE_APPROVED;
56  }
57 }
getData($key='', $index=null)
Definition: DataObject.php:119
isValidHash($merchantMd5, $merchantApiLogin)
Definition: Response.php:41
$amount
Definition: order.php:14
generateHash($merchantMd5, $merchantApiLogin, $amount, $transactionId)
Definition: Response.php:25