$customerPhone = isset($HTTP_POST_VARS['CUSTOMER_PHONE']) ? trim($HTTP_POST_VARS['CUSTOMER_PHONE']) : ""; $customerIp = isset($HTTP_POST_VARS['CUSTOMER_IP']) ? trim($HTTP_POST_VARS['CUSTOMER_IP']) : ""; $productName = isset($HTTP_POST_VARS['PRODUCT_NAME']) ? trim($HTTP_POST_VARS['PRODUCT_NAME']) : ""; $transactAmount = isset($HTTP_POST_VARS['TRANSAC_AMOUNT']) ? trim($HTTP_POST_VARS['TRANSAC_AMOUNT']) : ""; $currencyCode = isset($HTTP_POST_VARS['CURRENCY_CODE']) ? trim($HTTP_POST_VARS['CURRENCY_CODE']) : ""; $cardType = isset($HTTP_POST_VARS['CB_TYPE']) ? trim($HTTP_POST_VARS['CB_TYPE']) : ""; $cardNumber = isset($HTTP_POST_VARS['CB_NUMBER']) ? trim($HTTP_POST_VARS['CB_NUMBER']) : ""; $cardExpire = isset($HTTP_POST_VARS['CB_EXPIRE']) ? trim($HTTP_POST_VARS['CB_EXPIRE']) : ""; $cardCvcNumber = isset($HTTP_POST_VARS['CB_CVC']) ? trim($HTTP_POST_VARS['CB_CVC']) : ""; if ($currencyCode == "") { $currencyCode = "USD"; } $xml_string = "<epxml><header>\n\t\t\t<responsetype>direct</responsetype>\n\t\t\t\t<mid>{$UserId}</mid>\n\t\t\t\t<password>{$UserPassword}</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>{$TransNumber}</etan>\n\t\t\t<card>\n\t\t\t\t<cctype>{$cardType}</cctype>\n\t\t\t\t<cc>{$cardNumber}</cc>\n\t\t\t\t<expire>{$cardExpire}</expire>\n\t\t\t\t<cvv>{$cardCvcNumber}</cvv>\n\t\t\t</card>\n\t\t\t<cardholder>\n\t\t\t\t<name>{$customerFirstName}</name>\n\t\t\t\t<surname>{$customerLastName}</surname>\n\t\t\t\t<street>{$customerAddress}</street>\n\t\t\t\t<housenumber>123</housenumber>\n\t\t\t\t<zip>{$customerZipCode}</zip>\n\t\t\t\t<city>{$customerCity}</city>\n\t\t\t\t<country>{$customerCountry}</country>\n\t\t\t\t<telephone>{$customerPhone}</telephone>\n\t\t\t\t<state>{$customerState}</state>\n\t\t\t\t<email>{$customerEmail}</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>"; $is_existTransId = func_get_value_of_field($cnn_cs, "cs_volpay", "trans_id", "trans_id", $TransNumber); if ($is_existTransId == "") { $data = func_volpaybank_integration_result($xml_string); } else { $strMessage = "<h3>The Order number already exist.</h3>Please process with a new transaction."; } $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); } // Gets infomation from tag siblings. for ($i = 0; $i < $count; $i++) { $headerCode = GetElementByName($Nodes[$i], "<header>", "</header>");
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; }
$cardExpire = "12/04"; $cardCvv = "121"; $cardHolderName = "Abish"; $cardHolderSurName = "Asharaf"; $cardHolderStreet = "Kaloor"; $cardHolderHouseNumber = "GCDA Shopping Complex"; $cardHolderZip = "686537"; $cardHolderCity = "Cochin"; $cardHolderCountry = "IN"; $cardHolderState = "OT"; $cardHolderEmail = "*****@*****.**"; $paymentCurrency = "EUR"; $paymentAmount = "100"; $customerPhone = "6574567456"; $xml_string = "<epxml>\n\t<header>\n\t\t<responsetype>direct</responsetype>\n\t\t<mid>67</mid>\n\t\t<password>yu54gh0</password>\n\t\t<type>refund</type>\n\t</header>\n\t<request>\n\t\t<refund>\n\t\t\t<etan>{$transId}</etan>\n\t\t\t<tan>104805</tan>\n\t\t\t<card>\n\t\t\t\t<cctype>{$cardType}</cctype>\n\t\t\t\t<cc>{$cardNumber}</cc>\n\t\t\t\t<expire>{$cardExpire}</expire>\n\t\t\t\t<cvv>{$cardCvv}</cvv>\n\t\t\t</card>\n\t\t\t<cardholder>\n\t\t\t\t<name>{$cardHolderName}</name>\n\t\t\t\t<surname>{$cardHolderSurName}</surname>\n\t\t\t\t<street>{$cardHolderStreet}</street>\n\t\t\t\t<housenumber>{$cardHolderHouseNumber}</housenumber>\n\t\t\t\t<zip>{$cardHolderZip}</zip>\n\t\t\t\t<city>{$cardHolderCity}</city>\n\t\t\t\t<country>{$cardHolderCountry}</country>\n\t\t\t\t<telephone>{$customerPhone}</telephone>\n\t\t\t\t<state>{$cardHolderState}</state>\n\t\t\t\t<email>{$cardHolderEmail}</email>\n\t\t\t</cardholder>\n\t\t\t<amount>\n\t\t\t\t<currency>{$paymentCurrency}</currency>\n\t\t\t\t<value>{$paymentAmount}</value>\n\t\t\t</amount>\n\t\t</refund>\n\t</request>\n\t</epxml>"; $return_value = func_volpaybank_integration_result($xml_string); print $return_value . "<br><br>"; /*************************XML Return values*********************************/ $data = $return_value; $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); } // Gets infomation from tag siblings. for ($i = 0; $i < $count; $i++) { $headerCode = GetElementByName($Nodes[$i], "<header>", "</header>");