Jump to content

Local payment module redirects guest to order history


Recommended Posts

Hello,

 

I have a local bank payment module, which works fine, the only thin is that after completing the payment it redirects the quest checkout customer back to order history and in order to do that asks the customer to log in (the module dates back to pre guest checkout some 3 years ago).

 

Here is the code for validation.php which seems to be responsible for redirect after the payment is complete. At the end there is a line ending with ....history.php. How to change that to modules/module_name/confirmation.tpl (for guest checkout only)? I would be very grateful if somebody could help, since the module works a bit unprofessionally right now.

 


<? ob_start(); ?>
<?php

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/banklinkswedbank.php');


function write_to_log($params,$filename){
 $cont = date("d.m.Y H:i:s").' :: ';
while (list($key, $val) = each($params)) {
$cont .= "[$key] => $val ";
 }
 $handle = fopen($filename, "a");
if ($handle){
  fwrite($handle, $cont."\n");
}
fclose($handle);
}


$_bankop=$_POST;
$_op=0;
$_sign=0;
$_ok=0;

$HP =& new SwedBankLink();
$_op=(intval($_POST['VK_SERVICE']) == '1101' ? 1 : 0);
$_sign =($_op ? $HP->verifySignature($_POST) : 0);
$_POST['SERVICE_OK'] = $_op;
$_POST['SERVICE_SIGNATURE_OK'] = $_sign;

write_to_log($_POST,dirname(__FILE__).'/banklink.log');

$errors = '';
$result = false;
$banklink = new Banklinkswedbank();

// Fill params
$params = 'cmd=_notify-validate';
foreach ($_POST AS $key => $value)
$params .= '&'.$key.'='.urlencode(stripslashes($value));



// Bank data
//if (($_sign)&&($_op))
// no Signature check
if ($_op)
{
 $cart = new Cart(intval($_POST['VK_STAMP']));
	if (!$cart->id)
		$errors = $banklink->getL('cart').'<br />';
	//elseif (Order::getOrderByCartId(intval($_POST['VK_STAMP'])))
	//	$errors = $banklink->getL('order').'<br />';
	else
	// Does order already exists ?
	if ( $cart->OrderExists() === 0)
	{
		$banklink->validateOrder($_POST['VK_STAMP'], _PS_OS_PAYMENT_, floatval($_POST['VK_AMOUNT']), $banklink->displayName, $banklink->getL('transaction').$_POST['VK_T_NO'].' '.$_POST['VK_SND_NAME'].'::'.$_POST['VK_SND_ACC']);
	}
}
else
$errors = $banklink->getL('verify_error');

if (!empty($errors) AND isset($_POST['VK_STAMP']))
$banklink->validateOrder(intval($_POST['VK_STAMP']), _PS_OS_ERROR_, 0, $banklink->displayName, $errors.'<br />');

header('Location: http://'.htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'history.php');
exit();
?>
<? ob_flush(); ?>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...