Exemplo n.º 1
0
function func_insert_transactionCheckdata($array_transdetails, $company_id_val, $cnn_connection)
{
    $trans_id = "";
    $trans_insert_status = "";
    $reference_number = "NIL";
    $str_invalid_date = "";
    if (count($array_transdetails) > 0) {
        $authorisationno = $array_transdetails[16];
        $telephoneno = $array_transdetails[7];
        $format_split_date = split("/", $array_transdetails[21]);
        if (count($format_split_date) == 3) {
            $format_split_date[0] = strlen(trim($format_split_date[0])) == 1 ? "0" . $format_split_date[0] : $format_split_date[0];
            $format_split_date[1] = strlen(trim($format_split_date[1])) == 1 ? "0" . $format_split_date[1] : $format_split_date[1];
            $trans_date_enter = "{$format_split_date['0']}-{$format_split_date['1']}-{$format_split_date['2']}:00";
            $trans_date_enter = func_get_date_inyyyymmdd_time($trans_date_enter);
        } else {
            $trans_date_enter = "";
        }
        if ($trans_date_enter == "") {
            $str_invalid_date = "Invalid Date";
        } else {
            $name = trim($array_transdetails[0]);
            $surname = trim($array_transdetails[1]);
            $address = trim($array_transdetails[2]);
            $city = trim($array_transdetails[3]);
            $state = trim($array_transdetails[4]);
            $zipcode = trim($array_transdetails[5]);
            $country = trim($array_transdetails[6]);
            $phonenumber = trim($array_transdetails[7]);
            $email = trim($array_transdetails[8]);
            $amount = trim($array_transdetails[9]);
            $checkorcard = trim($array_transdetails[10]);
            $CCnumber = trim($array_transdetails[11]);
            $checkType = trim($array_transdetails[12]);
            $accounttype = trim($array_transdetails[13]);
            $bankname = trim($array_transdetails[14]);
            $bankroutingcode = trim($array_transdetails[15]);
            $bankaccountnumber = trim($array_transdetails[16]);
            $voiceAuthorizationno = trim($array_transdetails[17]);
            $shippingTrackingno = trim($array_transdetails[18]);
            $socialSecurity = trim($array_transdetails[19]);
            $licensestate = trim($array_transdetails[20]);
            $driversLicense = trim($array_transdetails[21]);
            $transactionDate = $trans_date_enter;
            $billingDate = trim($array_transdetails[22]);
            $misc = trim($array_transdetails[23]);
            $userid = trim($company_id_val);
            $qrt_insert_details = "insert into cs_transactiondetails (name,surname,address,city,state,zipcode,country,phonenumber,email,amount,checkorcard,CCnumber,checktype,accounttype,bankname,bankroutingcode,bankaccountnumber,voiceAuthorizationno,shippingTrackingno,socialSecurity,licensestate,driversLicense,transactionDate,billingDate,misc,userid,passStatus,pass_count,cancelstatus,status,declinedReason,productdescription,company_usertype,company_user_id) \n\t\t\t\tvalues('{$array_transdetails['0']}','{$array_transdetails['1']}','{$array_transdetails['2']}','{$array_transdetails['3']}','{$array_transdetails['4']}','{$array_transdetails['5']}','{$array_transdetails['6']}','{$array_transdetails['7']}','{$array_transdetails['8']}',{$array_transdetails['9']},'C','{$array_transdetails['10']}','{$array_transdetails['11']}','{$array_transdetails['12']}','{$array_transdetails['13']}','{$array_transdetails['14']}','{$array_transdetails['15']}','{$array_transdetails['16']}','{$array_transdetails['17']}','{$array_transdetails['18']}','{$array_transdetails['19']}','{$array_transdetails['20']}','{$trans_date_enter}','{$array_transdetails['22']}','{$array_transdetails['23']}',{$company_id_val},'PA',0,'N','D','Error in Data','Service',5,{$userid})";
        }
        if ($str_invalid_date == "") {
            $auth_status = func_isauthorisationno_check($authorisationno, $telephoneno, $company_id_val, $cnn_connection);
            if ($auth_status == "") {
                if ($authorisationno != "" || $telephoneno != "") {
                    if (!($sql_insert_data = mysql_query($qrt_insert_details))) {
                        $trans_insert_status = "failure";
                    } else {
                        $trans_id = mysql_insert_id();
                        $ref_number = func_Trans_Ref_No($trans_id);
                        $updateSuccess = "";
                        $updateSuccess = func_update_single_field('cs_transactiondetails', 'reference_number', $ref_number, 'transactionId', $trans_id, $cnn_connection);
                        func_update_rate($userid, $trans_id, $cnn_connection);
                        if ($updateSuccess = 1) {
                            $reference_number = $ref_number;
                        }
                        $trans_insert_status = "success";
                        $qrt_select_company = "Select processing_currency ,bank_check from cs_companydetails where userid='{$company_id_val}'";
                        if (!($show_sql_run = mysql_query($qrt_select_company))) {
                            dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
                        } else {
                            if (mysql_num_rows($show_sql_run) == 0) {
                                $msgtodisplay = "You are not a valid user";
                                $outhtml = "y";
                                message($msgtodisplay, $outhtml, "transactions");
                                exit;
                            } else {
                                $processing_currency = mysql_result($show_sql_run, 0, 0);
                                $bank_check = mysql_result($show_sql_run, 0, 1);
                                func_ins_bankrates($trans_id, $bank_check, $cnn_connection);
                                if ($processing_currency == "") {
                                    $processing_currency = "USD";
                                }
                                $updateSuccess = func_update_single_field('cs_transactiondetails', 'currencytype ', $processing_currency, 'transactionId', $trans_id, $cnn_connection);
                            }
                        }
                        if ($updateSuccess = 1) {
                            $trans_insert_status = "success";
                        }
                    }
                } else {
                    $trans_insert_status = "success";
                }
            } else {
                $trans_insert_status = "failure";
            }
        }
    } else {
        $trans_insert_status = $str_invalid_date;
    }
    print "<tr height='20'><td class='leftbottomright'><font face='verdana' size='1'>&nbsp;{$reference_number}</font></td><td class='leftbottomright'><font face='verdana' size='1'>&nbsp;{$array_transdetails['0']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['1']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['2']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['8']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['7']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$trans_insert_status}</font></td></tr>";
}
Exemplo n.º 2
0
function func_insert_transactionCreditdata($array_transdetails, $company_id_val, $cnn_connection)
{
    $trans_insert_status = "";
    $reference_number = "NIL";
    $str_invalid_date = "";
    if (count($array_transdetails) > 0) {
        $telephoneno = $array_transdetails[7];
        $format_split_date = split("/", $array_transdetails[15]);
        if (count($format_split_date) == 3) {
            $format_split_date[0] = strlen(trim($format_split_date[0])) == 1 ? "0" . $format_split_date[0] : $format_split_date[0];
            $format_split_date[1] = strlen(trim($format_split_date[1])) == 1 ? "0" . $format_split_date[1] : $format_split_date[1];
            $trans_date_enter = "{$format_split_date['0']}-{$format_split_date['1']}-{$format_split_date['2']}:00";
            $trans_date_enter = func_get_date_inyyyymmdd_time($trans_date_enter);
        } else {
            $trans_date_enter = "";
        }
        if ($trans_date_enter == "") {
            $str_invalid_date = "Invalid Date";
        } else {
            $name = trim($array_transdetails[0]);
            $surname = trim($array_transdetails[1]);
            $address = trim($array_transdetails[2]);
            $city = trim($array_transdetails[3]);
            $state = trim($array_transdetails[4]);
            $zipcode = trim($array_transdetails[5]);
            $country = trim($array_transdetails[6]);
            $phonenumber = trim($array_transdetails[7]);
            $email = trim($array_transdetails[8]);
            $amount = trim($array_transdetails[9]);
            $checkorcard = "H";
            $cardType = trim($array_transdetails[10]);
            $CCnumber = trim($array_transdetails[11]);
            $cvv = trim($array_transdetails[12]);
            $validupto = trim($array_transdetails[13]);
            $transactionDate = $trans_date_enter;
            $billingDate = trim($array_transdetails[14]);
            $firstnum = substr($CCnumber, 0, 1);
            if ($firstnum == "5") {
                $cardType = "Master";
            } else {
                $cardType = "Visa";
            }
            $userid = $company_id_val;
            $qrt_insert_details = "insert into cs_transactiondetails (name,surname,address,city,state,zipcode,country,phonenumber,email,amount,checkorcard,cardtype,CCnumber,cvv,validupto,transactionDate,billingDate,userid,passStatus,pass_count,cancelstatus,status)\n\t\t\t\t  values('{$array_transdetails['0']}','{$array_transdetails['1']}','{$array_transdetails['2']}','{$array_transdetails['3']}','{$array_transdetails['4']}','{$array_transdetails['5']}','{$array_transdetails['6']}','{$array_transdetails['7']}','{$array_transdetails['8']}',{$array_transdetails['9']},'H','{$cardType}','{$array_transdetails['11']}','{$array_transdetails['12']}','{$array_transdetails['13']}','{$trans_date_enter}','{$array_transdetails['14']}',{$company_id_val},'PA',0,'N','D')";
            // print $qrt_insert_details ."<br>";
        }
        if ($str_invalid_date == "") {
            // Credit card details.
            if (!($sql_insert_data = mysql_query($qrt_insert_details))) {
                $trans_insert_status = "failure";
            } else {
                $transactionId = mysql_insert_id();
                $ref_number = func_Trans_Ref_No($transactionId);
                $updateSuccess = "";
                $updateSuccess = func_update_single_field('cs_transactiondetails', 'reference_number', $ref_number, 'transactionId', $transactionId, $cnn_connection);
                if ($updateSuccess = 1) {
                    $reference_number = $ref_number;
                }
                $qrt_select_company = "Select companyname,transaction_type,billingdescriptor,email,send_mail,send_ecommercemail,bank_Creditcard,bank_shopId,bank_Username,bank_Password,processing_currency from cs_companydetails where userid='{$company_id_val}'";
                if (!($show_sql_run = mysql_query($qrt_select_company))) {
                    dieLog(mysql_errno() . ": " . mysql_error() . "<BR>");
                } else {
                    if (mysql_num_rows($show_sql_run) == 0) {
                        $msgtodisplay = "You are not a valid user";
                        $outhtml = "y";
                        message($msgtodisplay, $outhtml, $headerInclude);
                        exit;
                    } else {
                        $company_name = mysql_fetch_array($show_sql_run);
                        $transaction_type = mysql_result($show_sql_run, 0, 1);
                        $billingdescriptor = mysql_result($show_sql_run, 0, 2);
                        $fromaddress = mysql_result($show_sql_run, 0, 3);
                        $send_mails = mysql_result($show_sql_run, 0, 4);
                        $send_ecommercemail = mysql_result($show_sql_run, 0, 5);
                        $bank_CreditcardId = mysql_result($show_sql_run, 0, 6);
                        $bank_shopId = mysql_result($show_sql_run, 0, 7);
                        $bank_Username = mysql_result($show_sql_run, 0, 8);
                        $bank_Password = mysql_result($show_sql_run, 0, 9);
                        $processing_currency = mysql_result($show_sql_run, 0, 10);
                        $firstnum = "";
                        if ($processing_currency == "") {
                            $processing_currency = "USD";
                        }
                        $firstnum = substr($CCnumber, 0, 0);
                        if ($firstnum == "5") {
                            $cardType = "Master";
                        } else {
                            $cardType = "Visa";
                        }
                        $cardExpir = split("/", $validupto);
                        $year = $cardExpir[0];
                        $cardExpire = $cardExpir[1] . "/" . substr($year, 2, 3);
                        $abbrCountry = func_country_abbreviation($country);
                        $abbrState = func_state_abbreviation($state);
                        // function for submitting to bank
                        // print "func_volpay_bankprocess($bank_Username,$bank_Password,$reference_number,$cardType,$CCnumber,$cardExpire,$cvv,$name,$surname,$address,$zipcode,$city,$abbrCountry,$phonenumber,$abbrState,$email,$processing_currency,$amount,$cnn_connection,$transactionId)";
                        $trans_insert_status = func_volpay_bankprocess($bank_Username, $bank_Password, $reference_number, $cardType, $CCnumber, $cardExpire, $cvv, $name, $surname, $address, $zipcode, $city, $abbrCountry, $phonenumber, $abbrState, $email, $processing_currency, $amount, $cnn_connection, $transactionId, $company_id_val);
                    }
                }
            }
        } else {
            $trans_insert_status = $str_invalid_date;
        }
        print "<tr height='20'><td class='leftbottomright'><font face='verdana' size='1'>&nbsp;{$reference_number}</font></td><td class='leftbottomright'><font face='verdana' size='1'>&nbsp;{$array_transdetails['0']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['1']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['2']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['8']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$array_transdetails['7']}</font></td><td class='cl1'><font face='verdana' size='1'>&nbsp;{$trans_insert_status}</font></td></tr>";
    }
}