$headerInclude = "home"; include 'includes/header.php'; $iShopNumber = $HTTP_GET_VARS["SHOP_NUMBER"]; $selectBankUpdates = "Select * from cs_scanorder where transactionId = {$iShopNumber}"; if (!($run_Select_Qry = mysql_query($selectBankUpdates))) { dieLog(mysql_errno() . ": " . mysql_error() . "<BR>"); } $str_status = ""; $str_decline_reason = ""; if (mysql_num_rows($run_Select_Qry) != 0) { $str_status = mysql_result($run_Select_Qry, 0, 3); $decline_reason = $str_status == "yes" ? "" : mysql_result($run_Select_Qry, 0, 4); } $approval_status = $str_status == "yes" ? "A" : "D"; $pass_status = "PA"; func_update_approval_status($cnn_cs, $iShopNumber, $approval_status, $pass_status, $decline_reason); $referenceNumber = func_get_value_of_field($cnn_cs, "cs_transactiondetails", "reference_number", "transactionId", $iShopNumber); if ($str_status == "yes") { $strMessage = "SUC"; $strMessage = "<center><br><br><h3>Thank-you for your order</h3>Your order number is {$referenceNumber}. Please refer to this in any correspondence.</center>"; } else { $strMessage = "DEC"; $strMessage = "<p style='margin-left:40;margin-right:40'><b>Sorry</b>, there was a mistake with your credit card details. Your Order Number {$referenceNumber} has been declined - " . $decline_reason . ".</p>"; } ?> <table border="0" cellpadding="0" width="100%" cellspacing="0" height="60%" > <tr><td width="83%" valign="top" align="center" height="333"> <table border="0" cellpadding="0" cellspacing="0" width="600" class="disbd"> <tr> <td width="100%" valign="top" align="center" bgcolor="#999999" height="20"> <img border="0" src="images/spacer.gif" width="1" height="1"></td>
// Who the email was sent from $headers .= "Reply-To: sales@etelegate.com\n"; // Reply to address $headers .= "X-Mailer: PHP\n"; // mailer $headers .= "X-Priority: 1\n"; // The priority of the mail $headers .= "Return-Path: <*****@*****.**>\n"; // Return path for errors $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; // Mime type $message = "Callback is working correctly" . "<br>shopnumber :" . $data1 . "<br>bardo number :" . $data2 . "<br>Transaction status :" . $data3 . "<br>Details : " . $data4; $data6 = func_get_current_date_time(); if ($data3 == "00") { $data7 = "S"; } else { $data7 = "F"; } $approval_status = $data7 == "S" ? "A" : "D"; $pass_status = "PA"; $qryInsert = "insert into cs_bardo (shop_number,bardo_number,transac_status,status_detailed,ds,trans_date,status) values "; $qryInsert .= " ({$data1},'{$data2}','{$data3}','{$data4}','{$data5}','{$data6}','{$data7}')"; if (!mysql_query($qryInsert, $cnn_cs)) { dieLog(mysql_errno() . ": " . mysql_error() . "<BR>"); } func_update_approval_status($cnn_cs, $data1, $approval_status, $pass_status, $data4); if ($data3 == "00") { func_send_transaction_success_mail($data1); } else { // func_send_transaction_failure_mail($data1, $data4); }
function func_volpay_bankprocess($bank_Username, $bank_Password, $ReferenceNo, $cardType, $CCnumber, $cardExpire, $cvv, $name, $surname, $address, $zipcode, $city, $country, $phonenumber, $state, $email, $currencyCode, $transactAmount, $cnn_connection, $transactionId, $i_company_id) { $data = ""; $xml_string = "<epxml><header>\n\t\t\t<responsetype>direct</responsetype>\n\t\t\t\t<mid>{$bank_Username}</mid>\n\t\t\t\t<password>{$bank_Password}</password>\n\t\t\t<type>charge</type>\n\t\t\t</header>\n\t\t\t<request><charge>\n\t\t\t\t<etan>{$ReferenceNo}</etan>\n\t\t\t<card>\n\t\t\t\t<cctype>{$cardType}</cctype>\n\t\t\t\t<cc>{$CCnumber}</cc>\n\t\t\t\t<expire>{$cardExpire}</expire>\n\t\t\t\t<cvv>{$cvv}</cvv>\n\t\t\t</card>\n\t\t\t<cardholder>\n\t\t\t\t<name>{$name}</name>\n\t\t\t\t<surname>{$surname}</surname>\n\t\t\t\t<street>{$address}</street>\n\t\t\t\t<housenumber>123</housenumber>\n\t\t\t\t<zip>{$zipcode}</zip>\n\t\t\t\t<city>{$city}</city>\n\t\t\t\t<country>{$country}</country>\n\t\t\t\t<telephone>{$phonenumber}</telephone>\n\t\t\t\t<state>{$state}</state>\n\t\t\t\t<email>{$email}</email>\n\t\t\t</cardholder>\n\t\t\t<amount>\n\t\t\t\t<currency>{$currencyCode}</currency>\n\t\t\t\t<value>{$transactAmount}</value>\n\t\t\t</amount>\n\t\t\t</charge>\n\t\t\t</request></epxml>"; $data = func_volpaybank_integration_result($xml_string); $Nodes = array(); $count = 0; $pos = 0; // Goes throw XML file and creates an array of all <XML_TAG> tags. while ($node = GetElementByName($data, "<epxml>", "</epxml>")) { $Nodes[$count] = $node; $count++; $data = substr($data, $pos); $pos++; } // Gets infomation from tag siblings. for ($i = 0; $i < $count; $i++) { $headerCode = GetElementByName($Nodes[$i], "<header>", "</header>"); $responseDesc = GetElementByName($Nodes[$i], "<response>", "</response>"); $responseType = GetElementByName($Nodes[$i], "<responsetype>", "</responsetype>"); $merchantId = GetElementByName($Nodes[$i], "<mid>", "</mid>"); $merchantType = GetElementByName($Nodes[$i], "<type>", "</type>"); if (strpos($responseDesc, "error")) { $returnCode = GetElementByName($Nodes[$i], "<errorcode>", "</errorcode>"); $returnMessage = GetElementByName($Nodes[$i], "<errormessage>", "</errormessage>"); $transNo = GetElementByName($Nodes[$i], "<etan>", "</etan>"); $strMessage = "<b>Sorry</b>, there was a mistake with your credit card details. Your Order Number {$ReferenceNo} has been declined. "; $strMessage .= $returnMessage . "-" . $returnCode; $transStatus = $returnMessage . "-" . $returnCode; } if (strpos($responseDesc, "success")) { $returnMessage = GetElementByName($Nodes[$i], "<message>", "</message>"); $returnCode = GetElementByName($Nodes[$i], "<tan>", "</tan>"); $transNo = GetElementByName($Nodes[$i], "<etan>", "</etan>"); $strMessage = "<h3>Thank-you for your order</h3>Your order number is {$ReferenceNo}.Your Order has been Approved and Please refer to this in any correspondence."; //$msgtodisplay .= $returnMessage."-".$returnCode ; $transStatus = "Success"; } } $qrt_insert_bankdetails = "insert into cs_volpay (trans_id,user_id,currency,amount,trans_status,return_code,return_message,reference_number) values({$transactionId},{$i_company_id},'{$currencyCode}',{$transactAmount},'{$transStatus}','{$returnCode}','{$returnMessage}','{$ReferenceNo}') "; // print($qrt_insert_bankdetails); if (!($show_sql = mysql_query($qrt_insert_bankdetails, $cnn_connection))) { print mysql_errno() . ": " . mysql_error() . "<BR>"; print "Cannot execute queryin"; exit; } $approval_status = $transStatus == "Success" ? "A" : "D"; $decline_reason = $transStatus == "Success" ? "" : $returnCode . " : " . $returnMessage; $pass_status = "PA"; func_update_approval_status($cnn_connection, $transactionId, $approval_status, $pass_status, $decline_reason); if ($transStatus == "Success") { // func_send_transaction_success_mail($transactionId); } return $transStatus; }
$transStatus = "Success"; } $qrt_insert_bankdetails = "insert into cs_volpay (trans_id,user_id,currency,amount,trans_status,return_code,return_message,reference_number) values({$transactionId},{$i_company_id},'{$currencyCode}',{$transactAmount},'{$transStatus}','{$returnCode}','{$returnMessage}','{$ReferenceNo}') "; // print($qrt_insert_bankdetails); if (!($show_sql = mysql_query($qrt_insert_bankdetails, $cnn_cs))) { print mysql_errno() . ": " . mysql_error() . "<BR>"; print "Cannot execute queryin"; exit; } $approval_status = $transStatus == "Success" ? "A" : "D"; $decline_reason = $transStatus == "Success" ? "" : $returnCode . " : " . $returnMessage; $pass_status = ""; if ($transactionType != "tele") { $pass_status = "PA"; } func_update_approval_status($cnn_cs, $transactionId, $approval_status, $pass_status, $decline_reason); if ($transStatus == "Success") { func_send_transaction_success_mail($transactionId); } } ?> <title>Volpay display result</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table border="0" cellpadding="0" width="100%" cellspacing="0" height="60%" > <tr><td width="83%" valign="top" align="center" height="333"> <table border="0" cellpadding="0" cellspacing="0" width="600" height="70%" class="disbd"> <tr> <td width="100%" valign="top" align="center" bgcolor="#448A99" height="20"> <img border="0" src="images/spacer.gif" width="1" height="1"></td>