function verifyhash($hash, $password) { $parts = explode("\$", $hash); $newhash = createhash($password, $parts[0]); if ($newhash == $hash) { return true; } return false; }
$hashcode = $hashcode . '&CustomerName=' . Tools::getValue('CustomerName'); $hashcode = $hashcode . '&Address1=' . Tools::getValue('Address1'); $hashcode = $hashcode . '&Address2=' . Tools::getValue('Address2'); $hashcode = $hashcode . '&Address3=' . Tools::getValue('Address3'); $hashcode = $hashcode . '&Address4=' . Tools::getValue('Address4'); $hashcode = $hashcode . '&City=' . Tools::getValue('City'); $hashcode = $hashcode . '&State=' . Tools::getValue('State'); $hashcode = $hashcode . '&PostCode=' . Tools::getValue('PostCode'); $hashcode = $hashcode . '&CountryCode=' . Tools::getValue('CountryCode'); $hashcode = $hashcode . '&EmailAddress=' . Tools::getValue('EmailAddress'); $hashcode = $hashcode . '&PhoneNumber=' . Tools::getValue('PhoneNumber'); return sha1($hashcode); } /* Check the passed HashDigest against our own to check the values passed are legitimate.*/ $str1 = Tools::getValue('HashDigest'); $hashcode = createhash(Configuration::get('PAYMENTSENSE_PSK'), Configuration::get('PAYMENTSENSE_GATEWAYPASS')); if ($hashcode != $str1) { $nOutputProcessedOK = 30; $szOutputMessage .= 'Hashes did not match'; } /* You should put your code that does any post transaction tasks (e.g. updates the order object, sends the customer an email etc) in this section */ if ($nOutputProcessedOK != 30) { $nOutputProcessedOK = 0; /* Alter this line once you've implemented the code. */ $szOutputMessage = $szMessage; try { switch ($nStatusCode) { /* transaction authorised */ case 0: $orderState = 2; break;