Skip to content

Commit

Permalink
algorithm updated to v 3
Browse files Browse the repository at this point in the history
  • Loading branch information
Matti S committed Oct 17, 2013
1 parent 8056885 commit 6bd1be8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions checkoutfinland.php
Expand Up @@ -47,7 +47,7 @@ public function submit()
$post['DEVICE'] = "10";
$post['CONTENT'] = "1";
$post['TYPE'] = "0";
$post['ALGORITHM'] = "2";
$post['ALGORITHM'] = "3";
$post['DELIVERY_DATE'] = date('Ymd', strtotime("+".get_option('checkoutfinland_delivery_time')." days"));
$post['FIRSTNAME'] = "".substr($this->cart_data['billing_address']['first_name'], 0, 40);
$post['FAMILYNAME'] = "".substr($this->cart_data['billing_address']['last_name'], 0, 40);
Expand Down Expand Up @@ -180,6 +180,8 @@ public function process_gateway_notification()
$expected_mac = strtoupper(md5("$version+$stamp+$reference+$payment+$status+$algorithm+$secret"));
elseif($algorithm == 2)
$expected_mac = strtoupper(md5("$secret&$version&$stamp&$reference&$payment&$status&$algorithm"));
elseif($algorithm == 3)
$expected_mac = strtoupper(hash_hmac("sha256","$version&$stamp&$reference&$payment&$status&$algorithm", $secret));
else throw new Exception('Unsuported algorithm: '.$algorithm);

if($expected_mac == $mac)
Expand Down Expand Up @@ -211,7 +213,7 @@ public function process_gateway_notification()
}

status_header(302);
wp_redirect(get_option('transact_url')."&sessionid=".$_GET['sessionid']);
wp_redirect(get_option('transact_url')."&sessionid=".$_GET['sessionid']."?status=$status");
}
else
{
Expand Down

0 comments on commit 6bd1be8

Please sign in to comment.