Has this been completed, as i am just getting this from HSBC and would like to use my own pages and dont want the customer to be diverted.
I am using 4.0.18 at the moment and my full code which is at shopcart/payment/cc_fuse.php is below.
Code:
<?php
#
# $Id: cc_fuse.php,v 1.13.2.2 2005/01/12 07:43:07 svowl Exp $
#
if (!defined('XCART_START')) { header("Location: ../"); die("Access denied"); }
@set_time_limit(100);
$pp_login = $module_params["param01"];
$pp_pass = $module_params["param02"];
$pp_client = $module_params["param03"];
$domen = ($module_params["testmode"]=="N" ? $module_params["param06"] : $module_params["param07"]);
# $port = ($module_params["testmode"]=="N" ? 443 : 11500);
$port = ($module_params["testmode"]=="N" ? 443 : 443);
$curr = $module_params["param08"];
switch($module_params["testmode"]) {
case "N": $pp_mode="P"; break;
case "A": $pp_mode="Y"; break;
default: $pp_mode="N"; break;
}
# Mod 1 - Added this line as per x-cart http://forum.x-cart.com/viewtopic.php?t=22246
if ($userinfo["card_type"] == "VISA") {
$card_type = "1";
} elseif ($userinfo["card_type"] == "MC") {
$card_type = "2";
} elseif ($userinfo["card_type"] == "SW") {
$card_type = "10";
} elseif ($userinfo["card_type"] == "SO") {
$card_type = "9";
} elseif ($userinfo["card_type"] == "UKE") {
$card_type = "11";
}
# Mod 1 - Finish Mode 1
$post = "";
$post[] = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>";
$post[] = "<EngineDocList><DocVersion>1.0</DocVersion><EngineDoc><ContentType>OrderFormDoc</ContentType>";
$post[] = "<User><Name>$pp_login</Name><Password>$pp_pass</Password><ClientId DataType=\"S32\">$pp_client</ClientId></User>";
$post[] = "<Instructions><Pipeline>Payment</Pipeline></Instructions><OrderFormDoc><Mode>$pp_mode</Mode>";
#$post[] = "<Instructions><Pipeline>PaymentNoFraud</Pipeline></Instructions><OrderFormDoc><Mode>Y</Mode>";
$post[] = "<Consumer>";
$post[] = "<Email>".$userinfo["email"]."</Email>";
$post[] = "<BillTo><Location><TelVoice>".$userinfo["phone"]."</TelVoice>";
$post[] = "<Address><Name>".$userinfo["b_firstname"]." ".$userinfo["b_lastname"]."</Name>";
$post[] = "<City>".$userinfo["b_city"]."</City><Street1>".$userinfo["b_address"]."</Street1>";
$post[] = "<StateProv>".$userinfo["b_state"]."</StateProv><PostalCode>".$userinfo["b_zipcode"]."</PostalCode></Address></Location></BillTo>";
$post[] = "<PaymentMech><CreditCard><Number>".$userinfo["card_number"]."</Number>";
$post[] = "<Expires DataType=\"ExpirationDate\" Locale=\"840\">".substr($userinfo["card_expire"],0,2)."/".substr($userinfo["card_expire"],2,2)."</Expires>";
# Mod 2 - Added another from xcart mod
if (($card_type == 9)||($card_type == 10)){
$post[] = "<IssueNum>".$userinfo["card_issue_no"]."</IssueNum>";
$post[] = "<StartDate DataType=\"StartDate\" Locale=\"840\">".substr($userinfo["card_valid_from"],0,2)."/".substr($userinfo["card_valid_from"],2,2)."</StartDate>";
}
# Mod2 - Finished adding mod 2
$post[] = "<Cvv2Val>".$userinfo["card_cvv2"]."</Cvv2Val>";
$post[] = "<Cvv2Indicator>".(!empty($userinfo["card_cvv2"])?1:2)."</Cvv2Indicator>";
$post[] = "</CreditCard></PaymentMech></Consumer>";
$post[] = "<Transaction><Type>Auth</Type><ChargeDesc1></ChargeDesc1>";
$post[] = "<CurrentTotals><Totals><Total DataType=\"Money\" Currency=\"".$curr."\">".(100*$cart["total_cost"])."</Total></Totals></CurrentTotals>";
$post[] = "</Transaction></OrderFormDoc></EngineDoc></EngineDocList>";
$pst = array("CLRCMRC_XML=".join("",$post));
list($a,$return)=func_https_request("POST","https://".$domen.":$port/",$pst);
$return=preg_replace("/\n/","",$return);
if (preg_match("/<CcReturnMsg(.*)>(.*)<\/CcReturnMsg>/",$return,$out))
$bill_output["billmes"] = $out[2];
if (preg_match("/<CcErrCode(.*)>(.*)<\/CcErrCode>/",$return,$out)) {
$bill_output["code"] = ($out[2] == "1") ? 1 : 2;
$bill_output["billmes"] .= " (CcErrCode: ".$out[2].")";
}
else
$bill_output["code"] = 0;
if ($bill_output["code"] == 1) {
preg_match("/<AuthCode(.*)>(.*)<\/AuthCode>/",$return,$out);
$bill_output["billmes"] .= " (AuthCode: ".$out[2].")";
preg_match("/<CardholderPresentCode(.*)>(.*)<\/CardholderPresentCode>/",$return,$out);
$bill_output["billmes"] .= " (CardholderPresentCode: ".$out[2].")";
preg_match("/<InputEnvironment(.*)>(.*)<\/InputEnvironment>/",$return,$out);
$bill_output["billmes"] .= " (InputEnvironment: ".$out[2].")";
preg_match("/<TerminalInputCapability(.*)>(.*)<\/TerminalInputCapability>/",$return,$out);
$bill_output["billmes"] .= " (TerminalInputCapability: ".$out[2].")";
preg_match("/<SecurityIndicator(.*)>(.*)<\/SecurityIndicator>/",$return,$out);
$bill_output["cvvmes"] = "SecurityIndicator: ".$out[2];
}
elseif ($bill_output["code"] == 2) {
preg_match("/<Text(.*)>(.*)<\/Text>/",$return,$out);
$bill_output["billmes"] .= $out[2];
preg_match("/<ResourceId(.*)>(.*)<\/ResourceId>/",$return,$out);
$bill_output["billmes"] .= " (ResourceID: ".$out[2].")";
preg_match("/<Sev(.*)>(.*)<\/Sev>/",$return,$out);
$bill_output["billmes"] .= " (Sev: ".$out[2].")";
}
else
{
$bill_output["code"] = 0;
}
if(preg_match("/<DocumentId(.*)>(.*)<\/DocumentId>/",$return,$out))
$bill_output["billmes"].= " (DocumentId: ".$out[2].")";
if(preg_match("/<FraudResultCode(.*)>(.*)<\/FraudResultCode>/",$return,$out))
$bill_output["avsmes"] = "FraudResultCode: ".$out[2];
?>