custom wizard Posted September 4, 2015 Share Posted September 4, 2015 we are trying to utilise sage pays form to integrate with world pay, this is a custom site and our web developer has joined another company and is not in a position to help us, and my knowledge is very limited, the page talks to wolrd pay ok put we need to get the total price into the correct line as it is it only charges the price we instert at the moment £50 <?phpinclude_once("dbfiles/db1.php");$vendor = 'XXXXXX';$key = '0000000';$live = 100;function sagepayform($orderid) { global $vendor,$key,$live; $_SESSION['orderID'] = $orderid; if ($live) $vspsite="https://secure-test.worldpay.com/wcc/purchase"; else $vspsite="https://secure-test.worldpay.com/wcc/purchase"; $sql = "SELECT * FROM orders1 WHERE id='{$orderid}'"; $result = mysql_query($sql) or die('ERROR:: '.$sql.'<br><br>'.mysql_error()); $sql2 = "SELECT * FROM config WHERE config_id=1"; $result2 = mysql_query($sql2) or die('ERROR:: '.$sql.'<br><br>'.mysql_error()); if (mysql_num_rows($result)==1 && mysql_num_rows($result2)==1) { $order = mysql_fetch_assoc($result); $config = mysql_fetch_assoc($result2); $data = array( 'VendorTxCode'=>$order['id'], 'Amount'=>number_format($order['grandtotal'],2,".",""), 'Currency'=>'GBP', 'Description'=>$config['store_name'].' Order', 'SuccessURL'=>'http://'.$_SERVER['HTTP_HOST'].str_replace('checkout','transok',$_SERVER['REQUEST_URI']), 'FailureURL'=>'http://'.$_SERVER['HTTP_HOST'].str_replace('checkout','transnotok',$_SERVER['REQUEST_URI']), 'CustomerEmail'=>$order['email'], 'VendorEmail'=>$config['store_owner_email_address'], 'CustomerName'=>$order['title']." ".$order['forename']." ".$order['surname'], 'DeliveryAddress'=>$order['d_street_address1']." ".$order['d_street_address2'], 'DeliveryPostCode'=>$order['postcode'], 'BillingAddress'=>$order['cardaddress'], 'BillingPostCode'=>$order['cardpostcode'], 'ContactNumber'=>$order['dayphone'] ); $crypt = base64Encode(SimpleXor(formatData($data),$key)); ?> <form action='https://secure-test.worldpay.com/wcc/purchase'method=post> <input type='hidden' name='instId' value='1056199'/> <input type="hidden" name="amount" value="90"> <input type='hidden' name='cartId' value='id'/> <input type='hidden' name='currency' value='GBP'/> <input type='hidden' name='testMode' value='100'/> <input type='submit' value='Submit Form'/> <script> window.onload=function() { setTimeout("document.SagePay.submit()",3000); } </script> </form> <?php }}function base64Encode($plain) { $output = ""; $output = base64_encode($plain); return $output;}function base64Decode($scrambled) { $output = ""; $output = base64_decode($scrambled); return $output;}function simpleXor($InString, $Key) { $KeyList = array(); $output = ""; for($i = 0; $i < strlen($Key); $i++){ $KeyList[$i] = ord(substr($Key, $i, 1)); } for($i = 0; $i < strlen($InString); $i++) { $output.= chr(ord(substr($InString, $i, 1)) ^ ($KeyList[$i % strlen($Key)])); } return $output;}function formatData($data){ $output = ""; foreach($data as $key => $value){ $output .= "&" . $key . "=". $value; } $output = substr($output,1); return $output;}function reformatData($data){ $items = spliti('&', $data); $mydatas = array(); if(is_array($items) and count($items)>0) { foreach( $items as $item ) { list($key, $value) = spliti('=', $item); $mydatas[$key] = $value; } } return $mydatas;}?> Link to comment Share on other sites More sharing options...
MrPhil Posted September 5, 2015 Share Posted September 5, 2015 this is a custom site and our web developer has joined another company So, how does all of this fit into the osCommerce product? You say you have one payment system working (World Pay), and want to somehow integrate it with another payment system (Sage Pays)? Is this something different from simply offering two different payment systems to customers (their choice which to use)? I'm afraid I'm a bit confused here about what you're trying to do. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.