function process_auth() { // response fields indicating status of transaction $approval_code = $_POST["approval_code"]; $status = $_POST["status"]; $oid = $_POST["oid"]; // get cvv/avs codes from approval code $check_code = get_result_from_code($approval_code); if (!check_ccv_code($check_code)) { echo "<strong>CVV code was not verified, transaction could not be processed</strong><br><br>"; // echo "ACode: $approval_code<br>"; // echo "OID: $oid<br>"; report_blocked_transaction(); return; } if (!check_avs_code($check_code)) { echo "<strong>Address was not verified</strong>"; } // ok, we have valid transaction. echo "Processing transaction<br><br>"; // make postauth transaction $post_data['txntype'] = 'postauth'; $post_data['oid'] = $oid; // add passed params as well $post_data['chargetotal'] = $_POST["chargetotal"]; $post_data['userid'] = $_POST["userid"]; $post_data['itemid'] = $_POST["itemid"]; $post_data['x_payment'] = urldecode($_POST["x_payment"]); $post_data['x_addr'] = urldecode($_POST["x_addr"]); $post_data['x_aprcode'] = $approval_code; $post_data['x_email'] = urldecode($_POST["x_email"]); $post_data['x_ccshort'] = $_POST["x_ccshort"]; exec_shop_call($post_data); exit; }
function check_transaction_answer($ans) { $rc = $ans->ReturnCode; if ($rc == "0") { return true; } if ($rc == "1") { // transaction declined; echo "<strong>Transaction declined!</strong><br>"; echo "Status: " . $ans->TransactionResult . "<br>"; echo "Message: " . $ans->ErrorMessage . "<br>"; echo "<br>"; //echo "If you feel this is an error, please contact support@thewarinc.com"; echo "Note for our international customers: If you'll get fraud decline, please try again in few days - we're investigating why that is happening"; report_blocked_transaction(); return false; } if ($rc == "2") { // declined by CCV code echo "<strong>CCV code was not verified, transaction could not be processed</strong><br><br>"; echo "Message: " . $ans->ErrorMessage . "<br>"; report_blocked_transaction(); return false; } if ($rc == "3") { // game DB was down at the moment of transaction echo "<strong>There was error on our end, please contact support@thewarinc.com</strong><br><br>"; echo "<strong>Please include OrderID " . $ans->OrderId . "</strong><br><br>"; return false; } echo "<strong>Gateway error</strong><br><br>"; echo "Code: {$rc}, Message: {$ans->ErrorMessage}<br>"; //var_dump($ans); return false; }