Hi everyone,
Nixak just wanted to tell you that you are doing a great service to a lot of people.
Just came across something and wanted to share with everyone.
The PHP base64_decode sometimes does not decrypt the encrypted message correctly (due to white spaces) thereby causing problems.
After going through Sage Pay Form sample code they provide on their website I found the following function which they use to decrpyt the encrypted response.
PHP Code:
function base64Decode($scrambled) {
$output = "";
$scrambled = str_replace(" ","+",$scrambled);
$output = base64_decode($scrambled);
return $output;
}
If you add the above function to your class in the includes/modules/payment/sagepay_form.php and make the following change then I think this can help people who may encounter problems while decrypting the encrypted string.
On line 222 where you have the line
PHP Code:
$Decoded = $this->SimpleXor(base64_decode($crypt),MODULE_PAYMENT_SAGEPAY_FORM_PASSWORD);
you can change it to
PHP Code:
$Decoded = $this->SimpleXor($this->base64Decode($crypt),MODULE_PAYMENT_SAGEPAY_FORM_PASSWORD);
Hope it helps.
Kind Regards,
Adeel
Bookmarks