function sendTransactionEmail($transid, $emailtemplate, $testonly = false) { //exit($transid . " " . $emailtemplate); dieLog("SHOULD NOT BE USED!"); $transactionInfo = getTransactionInfo($transid); $data = array(); switch ($emailtemplate) { case "customer_rebill_decline_confirmation": case "customer_expire_confirmation": $data['site_URL'] = $transactionInfo['cs_URL']; $data['process_msg'] = $transactionInfo['td_process_msg']; $data['reference_number'] = $transactionInfo['reference_number']; $data['full_name'] = $transactionInfo['surname'] . ", " . $transactionInfo['name']; $data['customer_email'] = $transactionInfo['email']; $data['amount'] = "\$" . formatMoney($transactionInfo['amount'] - $transactionInfo['td_customer_fee']) . " USD"; $data['customer_fee'] = "\$" . formatMoney($transactionInfo['td_customer_fee']) . " USD"; $data['final_amount'] = "\$" . formatMoney($transactionInfo['amount']) . " USD"; $data['transaction_date'] = date("F j, Y", strtotime($transactionInfo['transactionDate'])); $data['customer_support_email'] = $transactionInfo['cs_support_email']; $data['password'] = $transactionInfo['td_password']; $data['payment_schedule'] = $transactionInfo['payment_schedule']; $data["gateway_select"] = $transactionInfo['gateway_id']; $sendto['email'][] = array("email" => $transactionInfo['email']); break; case "customer_cancel_confirmation": $data['site_URL'] = $transactionInfo['cs_URL']; $data['reference_number'] = $transactionInfo['reference_number']; $data['full_name'] = $transactionInfo['name'] . " " . $transactionInfo['surname']; $data['cancel_reference_number'] = $transactionInfo['cancel_refer_num']; $data["gateway_select"] = $transactionInfo['gateway_id']; $sendto['email'][] = array("email" => $transactionInfo['email'], "copy" => ""); break; case "customer_refund_confirmation": $data['site_URL'] = $transactionInfo['cs_URL']; $data['reference_number'] = $transactionInfo['reference_number']; $data['full_name'] = $transactionInfo['name'] . " " . $transInfo['surname']; $data['cancel_reference_number'] = $transactionInfo['cancel_refer_num']; $data["gateway_select"] = $transactionInfo['gateway_id']; $sendto['email'][] = array("email" => $transactionInfo['email'], "copy" => ""); $sendto['email'][] = array("email" => $bankInfo['bank_email'], "copy" => "( Bank Copy )"); break; } if ($transactionInfo['cd_recieve_order_confirmations']) { $sendto['email'][] = array("email" => $transactionInfo['cd_recieve_order_confirmations'], "copy" => "( Merchant Copy )"); } //$sendto['email'][] = array("email" => "*****@*****.**", "copy" => "( Merchant Copy )"); foreach ($sendto['email'] as $email) { $data['email'] = $email['email']; if (!$testonly) { send_email_template($emailtemplate, $data, $email['copy']); } // Send Customer Email. } }
function exec_refund_request($transID, $service_notes = "Administrator Refund", $customer_notes = "") { $trans = new transaction_class(false); $trans->pull_transaction($transID); $error_msg = $trans->process_refund_request(array("actor" => $service_notes, 'notes' => "{$customer_notes}")); return $error_msg['status']; die; $error_msg = "Refund Request Created Successfully"; $sql = "SELECT td.`transactionId`, td.`reference_number`, cd.`companyname`,cd.`username`,\r\n\t\t\t\t\tcd.`password`,cd.`ReferenceNumber`, cd.`email`, td.`email` as customer_email, `note_id`,cs_URL, name, surname\r\n\t\t\t\t\r\n\t\t\t\tFROM `cs_transactiondetails` AS td\r\n\t\t\t\tLEFT JOIN `cs_callnotes` AS cn ON cn.`transaction_id` = td.`transactionId` AND cn.cn_type = 'refundrequest'\r\n\t\t\t\tLEFT JOIN `cs_companydetails` AS cd ON td.`userId` = cd.`userId` \r\n\t\t\t\tLEFT JOIN `cs_company_sites` AS cs ON td.td_site_ID = cs.cs_ID \r\n\t\t\t\tWhere `transactionId` = '{$transID}'"; $result = sql_query_read($sql); if (mysql_num_rows($result) == 0) { return "Error: Transaction {$transID} Not Found"; } $statusInfo = mysql_fetch_assoc($result); if (!$statusInfo['note_id']) { $sql = "REPLACE INTO `cs_callnotes` (`transaction_id` , `call_date_time` , `service_notes` , `cancel_status` , `customer_notes` , `solved` , `is_bill_date_changed` , `call_duration` , `customer_service_id` , `prev_bill_date` , `dnc`, `cn_type` )\r\n\t\t\tVALUES ( '{$transID}', NOW() , '{$service_notes}', '', '{$customer_notes}', '' , '', '', '', '', '', 'refundrequest');"; $qry_callnotes = sql_query_write($sql) or dieLog("Cannot execute query "); $data['companyname'] = $statusInfo['companyname']; $data['Reference_ID'] = $statusInfo['ReferenceNumber']; $data['reference_number'] = $statusInfo['reference_number']; $data['username'] = $statusInfo['username']; $data['password'] = $statusInfo['password']; $data['cancel_reference_number'] = $statusInfo['ReferenceNumber']; $data['email'] = $statusInfo['email']; $data['reason'] = $service_notes . ": " . $customer_notes; $data["gateway_select"] = $statusInfo['gateway_id']; $data['site_URL'] = $statusInfo['cs_URL']; $data['full_name'] = $statusInfo['name'] . " " . $statusInfo['surname']; send_email_template('merchant_refund_request_notification_email', $data); $data['email'] = $statusInfo['customer_email']; send_email_template('customer_refund_confirmation', $data); } else { $error_msg = "Refund Request Already Exists"; } return $error_msg; }
} } } } $emaildata['email'] .= ', ' . $ed['en_email']; $emaildata['companyname'] = $access['Data']['en_company']['Value']; $emaildata['full_name'] = $access['Data']['en_company']['Value']; $emaildata['username'] = $access['Data']['en_username']['Value']; $emaildata['Reference_ID'] = $access['Data']['en_ref']['Value']; $emaildata["gateway_select"] = $access['Data']['en_gateway_ID']['Value']; if ($_POST['submit_access'] == 'Submit' && $curUserInfo['en_access'][ACCESS_AUTH_RATES]) { if ($_POST['Email_Contract_Notification']) { send_email_template('contract_notification_email', $emaildata); } if ($_POST['Email_Active_Notification']) { send_email_template('active_notification_email', $emaildata); } $result = processAccessForm(&$access); if ($result) { $msg = "Company Updated Successfully (" . $result['cnt'] . " Field(s))"; $log = $adminInfo['en_username'] . " Updates " . $access['Data']['en_company']['Value'] . " with "; foreach ($result['updateInfo'] as $name => $value) { $log .= "{$name} (Old:'" . $value['old'] . "') = '" . $value['new'] . "' "; } toLog('misc', 'merchant', $log, $company_id); } else { $msg = "No Updates Detected"; } } $access['HeaderMessage'] .= $msg; if ($access['Data']['en_pay_data']['Value']) {
function send_email($useEmailTemplate, $additional_data = NULL) { $email_to = $this->row['subscriptionTable']['ss_cust_email']; if (!$email_to) { $email_to = $this->row['transactionTable']['email']; } //$email_to = '*****@*****.**'; //$useEmailTemplate = "customer_recur_subscription_confirmation_cc"; //$useEmailTemplate = "customer_order_confirmation_cc"; //if($this->transInfo['td_one_time_subscription']) $useEmailTemplate = "customer_subscription_confirmation_cc"; //if($this->transInfo['td_is_a_rebill'] == 1) $useEmailTemplate = "customer_rebill_confirmation_cc"; $data = array(); $data['payment_type'] = $this->row['transactionTable']['cardtype']; $data['billing_descriptor'] = $this->row['transactionTable']['billing_descriptor']; $data['site_URL'] = $this->row['websiteTable']['cs_URL']; $data['site_name'] = $this->row['websiteTable']['cs_name']; $data['reference_number'] = $this->row['transactionTable']['reference_number']; $data['subscription_id'] = $this->row['subscriptionTable']['ss_subscription_ID']; $data['full_name'] = $this->row['transactionTable']['surname'] . ", " . $this->row['transactionTable']['name']; $data['first_name'] = $this->row['transactionTable']['name']; $pInfo = $this->row['transactionTable']['td_product_id']; $data['product_info'] = $pInfo . ($pInfo ? ": " : '') . $this->row['transactionTable']['productdescription']; $data['email'] = $email_to; $data['customer_email'] = $email_to; $data['credit_card_formatted'] = $this->row['Custom']['CreditCardFormatted']; if (!$data['credit_card_formatted']) { $data['credit_card_formatted'] = $this->row['Custom']['CheckAccountFormatted']; } $data['amount'] = "\$" . formatMoney($this->row['transactionTable']['amount'] - $this->row['transactionTable']['td_customer_fee']) . " USD"; $data['customer_fee'] = "\$" . formatMoney($this->row['transactionTable']['td_customer_fee']) . " USD"; $data['final_amount'] = "\$" . formatMoney($this->row['transactionTable']['amount']) . " USD"; $data['username'] = $this->row['transactionTable']['td_username']; $data['password'] = $this->row['transactionTable']['td_password']; $data['payment_schedule'] = $this->rebill['schedule']; if (!$data['payment_schedule']) { $data['payment_schedule'] = 'No Schedule'; } $data['transaction_date'] = date("F j, Y G:i:s", strtotime($this->row['transactionTable']['transactionDate'])); $data['next_bill_date'] = $this->rebill['nextDateInfo']; $data['site_access_URL'] = $this->row['websiteTable']['cs_member_url']; $data['customer_support_email'] = $this->row['websiteTable']['cs_support_email']; $data['tmpl_language'] = $_SESSION['tmpl_language']; $data['gateway_select'] = $this->row['companydetailsTable']['gateway_id']; if ($additional_data) { foreach ($additional_data as $key => $add) { $data[$key] = $add; } } //$str_is_test = "THIS IS A TEST TRANSACTION "; //if($this->mode=="Live") $str_is_test = ""; //print_r($data); send_email_template($useEmailTemplate, $data, $str_is_test); // Send Customer Email. }
$email_subject = "Registration Confirmation"; $transactiontype = func_get_merchant_name($transaction_type); $email_message = func_getreplymailbody_admin($companyname, $username, $password, $user_reference_num, $transactiontype, $how_about_us, $voulmeNumber); if (!func_send_mail($email_from, $email_to, $email_subject, $email_message)) { print "An error encountered while sending the mail."; } if ($mail_sent == 1) { $emailData["full_name"] = $ResellerCompanyName; $emailData["email"] = $email; $emailData["resellername"] = $ResellerCompanyName; $emailData["companyname"] = $companyname; $emailData["username"] = $username; $emailData["password"] = $password; $emailData["gateway_select"] = $companyInfo['gateway_id']; $emailContents = get_email_template("merchant_referral_letter", $emailData); send_email_template("merchant_referral_letter", $emailData); $msgtodisplay = $emailContents['et_htmlformat']; } } } // is suceess ends here } } } //print func_getreplymailbody_htmlformat($companyname,$username,$password); print $msgtodisplay; etel_smarty_display("main_footer.tpl"); function func_reseller_merchant_loginletter_htmlformat() { $str_mail_string = "<html><head><title>::eTelegate.com::</title><style>"; $str_mail_string .= ".TextBox{font-family:verdana;font-size:14px}</style></head><body topmargin='0' leftmargin='0'>";
exit; } $data = $curUserInfo; $data['email'] = $curUserInfo['contact_email']; if (!$data['email']) { $data['email'] = $curUserInfo['email']; } $data['companyname'] = $curUserInfo['companyname']; $data['full_name'] = $curUserInfo['companyname']; $data['phone'] = $curUserInfo['phonenumber']; $data['fax'] = $curUserInfo['fax_number']; $data['comments'] = $questions_charge; $data['contact_type'] = $curUserInfo['transaction_type']; $data['edit_link'] = $_SESSION['gw_domain'] . "/admin/editCompanyProfile1.php?company_id=" . $curUserInfo['userId']; $data["gateway_select"] = $curUserInfo['gateway_id']; send_email_template('merchant_request_rates', $data); mysql_query("update `cs_companydetails` set cd_completion=3 where userId = '" . $curUserInfo['userId'] . "'") or dieLog(mysql_error()); toLog('requestrates', 'merchant', '', $curUserInfo['userId']); echo "\n\t\t\t\t<script>\n\t\t\t\t\tlocation.href='Listdetails.php?msg=Your Rates have been requested successfully.'\n\t\t\t\t</script>\n\t\t\t\t"; exit; } beginTable(); ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#FFFFFF"><table width="100%" border="0" cellspacing="1" cellpadding="3"> <input type="hidden" name="act" value="mail"> <tr > <td align="left" colspan="2"><strong><font class="tx2">Use this form to request rates from <?php echo $_SESSION['gw_title'];
$emailData = array(); $emailData["companyname"] = $invoiceInfo['companyname']; $emailData["username"] = $invoiceInfo['username']; $emailData["password"] = $invoiceInfo['password']; $emailData["Reference_ID"] = $invoiceInfo['ReferenceNumber']; $emailData["email"] = $invoiceInfo['email']; $emailData["wiredate"] = $invoiceInfo['mi_paydate']; $emailData["mi_title"] = $invoiceInfo['mi_title']; $emailData["mi_deduction"] = $invoiceInfo['mi_deduction']; $emailData["mi_status"] = $mi_status; $emailData["mi_balance"] = $invoiceInfo['mi_balance']; $emailData["mi_notes"] = $mi_notes; if ($mi_status == 'WireFailure') { send_email_template('merchant_wire_failure', $emailData); } else { send_email_template('merchant_wire_success', $emailData); } } } if ($_REQUEST['action'] == 'reverse' && $mi_ID && $adminInfo['li_level'] == 'full' && $etel_debug_mode) { $response = reverseCompanyInvoice(intval($mi_ID)); if ($response) { $msg = "Invoice #{$mi_ID} has been reversed successfully."; } else { $msg = "Invoice #{$mi_ID} could not be reversed. It may not exist."; } } else { $invoice_sql = "select * from cs_merchant_invoice where mi_ID ='{$mi_ID}'"; $result = sql_query_read($invoice_sql, $cnn_cs) or dieLog("Cannot execute query"); if ($invoiceDetails = mysql_fetch_assoc($result)) { $mi_pay_info = unserialize($invoiceDetails['mi_pay_info']);
function lazerPay_refund_integration($transInfo, $bankInfo, $companyInfo) { $response['cancelstatus'] = 'Y'; $response['success'] = true; // Email $useEmailTemplate = 'customer_refund_confirmation'; $data['site_URL'] = $companyInfo['cs_URL']; $data['reference_number'] = $transInfo['reference_number']; $data['full_name'] = $transInfo['name'] . " " . $transInfo['surname']; $data['email'] = "*****@*****.**"; $data['cancel_reference_number'] = $ref_number; $data["gateway_select"] = $companyInfo['gateway_id']; send_email_template($useEmailTemplate, $data, "(LP Copy) Please Refund " . $data['reference_number'] . " - "); return $response; }
/** Chase / Remind customers * @author Paul Heaney * @note Moved from htdocs/auto/chase_customer.php by INL for 3.40 */ function saction_ChaseCustomers() { global $CONFIG, $now, $sit; global $dbIncidents, $dbUpdates; $success = TRUE; /** * @author Paul Heaney */ function not_auto_type($type) { if ($type != 'auto_chase_email' and $type != 'auto_chase_phone' and $type != 'auto_chase_manager') { return TRUE; } return FALSE; } if ($CONFIG['auto_chase'] == TRUE) { // if 'awaiting customer action' for more than $CONFIG['chase_email_minutes'] and NOT in an auto state, send auto email //$sql = "SELECT incidents.id, contacts.forenames,contacts.surname,contacts.id AS managerid FROM incidents,contacts WHERE status = ".STATUS_CUSTOMER." AND contacts.notify_contactid = contacts.id"; $sql = "SELECT * FROM `{$dbIncidents}` AS i WHERE status = " . STATUS_CUSTOMER; $result = mysql_query($sql); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); $success = FALSE; } while ($obj = mysql_fetch_object($result)) { if (!in_array($obj->maintenanceid, $CONFIG['dont_chase_maintids'])) { // only annoy these people $sql_update = "SELECT * FROM `{$dbUpdates}` WHERE incidentid = {$obj->id} ORDER BY timestamp DESC LIMIT 1"; $result_update = mysql_query($sql_update); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_WARNING); $success = FALSE; } $obj_update = mysql_fetch_object($result_update); if ($CONFIG['chase_email_minutes'] != 0) { //if (not_auto_type($obj_update->type) AND $obj_update->timestamp <= ($now-$CONFIG['chase_email_minutes']*60)) if (not_auto_type($obj_update->type) and ($obj->timeofnextaction == 0 and calculate_working_time($obj_update->timestamp, $now) >= $CONFIG['chase_email_minutes'] or $obj->timeofnextaction != 0 and calculate_working_time($obj->timeofnextupdate, $now) >= $CONFIG['chase_email_minutes'])) { $paramarray = array('incidentid' => $obj->id, 'triggeruserid' => $sit[2]); send_email_template($CONFIG['chase_email_template'], $paramarray); $sql_insert = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, currentowner, currentstatus, bodytext, timestamp, customervisibility) VALUES ('{$obj_update->incidentid}','{$sit['2']}', 'auto_chase_email', '{$obj->owner}', '{$obj->status}', 'Sent auto chase email to customer','{$now}','show')"; mysql_query($sql_insert); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } $sql_update = "UPDATE `{$dbIncidents}` SET lastupdated = '{$now}', nextactiontime = 0 WHERE id = {$obj->id}"; mysql_query($sql_update); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } } } if ($CONFIG['chase_phone_minutes'] != 0) { //if ($obj_update->type == 'auto_chase_email' AND $obj_update->timestamp <= ($now-$CONFIG['chase_phone_minutes']*60)) if ($obj_update->type == 'auto_chase_email' and ($obj->timeofnextaction == 0 and calculate_working_time($obj_update->timestamp, $now) >= $CONFIG['chase_phone_minutes'] or $obj->timeofnextaction != 0 and calculate_working_time($obj->timeofnextupdate, $now) >= $CONFIG['chase_phone_minutes'])) { $sql_insert = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, currentowner, currentstatus, bodytext, timestamp, customervisibility) VALUES ('{$obj_update->incidentid}','{$sit['2']}','auto_chase_phone', '{$obj->owner}', '{$obj->status}', 'Status: Awaiting Customer Action -> <b>Active</b><hr>Please phone the customer to get an update on this call as {$CONFIG['chase_phone_minutes']} have passed since the auto chase email was sent. Once you have done this please use the update type \"Chased customer - phone\"','{$now}','hide')"; mysql_query($sql_insert); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } $sql_update = "UPDATE `{$dbIncidents}` SET lastupdated = '{$now}', "; $sql_update .= "nextactiontime = 0, status = " . STATUS_ACTIVE . " WHERE id = {$obj->id}"; mysql_query($sql_update); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } } } if ($CONFIG['chase_manager_minutes'] != 0) { //if ($obj_update->type == 'auto_chased_phone' AND $obj_update->timestamp <= ($now-$CONFIG['chase_manager_minutes']*60)) if ($obj_update->type == 'auto_chased_phone' and ($obj->timeofnextaction == 0 and calculate_working_time($obj_update->timestamp, $now) >= $CONFIG['chase_manager_minutes'] or $obj->timeofnextaction != 0 and calculate_working_time($obj->timeofnextupdate, $now) >= $CONFIG['chase_manager_minutes'])) { $update = "Status: Awaiting Customer Action -> <b>Active</b><hr>"; $update .= "Please phone the customers MANAGER to get an update on this call as " . $CONFIG['chase_manager_minutes'] . " have passed since the auto chase email was sent.<br />"; $update .= "The manager is <a href='contact_details.php?id={$obj->managerid}'>{$obj->forenames} {$obj->surname}</a><br />"; $update .= " Once you have done this please email the actions to the customer and select the \"Was this a customer chase?\"'"; $sql_insert = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, currentowner, currentstatus, bodytext, timestamp, customervisibility) VALUES ('{$obj_update->incidentid}','{$sit['2']}','auto_chase_manager', '{$obj->owner}', '{$obj->status}', {$update},'{$now}','hide')"; mysql_query($sql_insert); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } $sql_update = "UPDATE `{$dbIncidents}` SET lastupdated = '{$now}', nextactiontime = 0, status = " . STATUS_ACTIVE . " WHERE id = {$obj->id}"; mysql_query($sql_update); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } } } if ($CONFIG['chase_managers_manager_minutes'] != 0) { //if ($obj_update->type == 'auto_chased_manager' AND $obj_update->timestamp <= ($now-$CONFIG['chase_managers_manager_minutes']*60)) if ($obj_update->type == 'auto_chased_manager' and ($obj->timeofnextaction == 0 and calculate_working_time($obj_update->timestamp, $now) >= $CONFIG['chase_amanager_manager_minutes'] or $obj->timeofnextaction != 0 and calculate_working_time($obj->timeofnextupdate, $now) >= $CONFIG['chase_amanager_manager_minutes'])) { $sql_insert = "INSERT INTO `{$dbUpdates}` (incidentid, userid, type, currentowner, currentstatus, bodytext, timestamp, customervisibility) VALUES ('{$obj_update->incidentid}','{$sit['2']}','auto_chase_managers_manager','{$obj->owner}', '{$obj->status}', 'Status: Awaiting Customer Action -> <b>Active</b><hr>Please phone the customers managers manager to get an update on this call as {$CONFIG['chase_manager_minutes']} have passed since the auto chase email was sent. Once you have done this please email the actions to the customer and manager and select the \"Was this a manager chase?\"','{$now}','hide')"; mysql_query($sql_insert); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } $sql_update = "UPDATE `{$dbIncidents}` SET lastupdated = '{$now}', nextactiontime = 0, status = " . STATUS_ACTIVE . " WHERE id = {$obj->id}"; mysql_query($sql_update); if (mysql_error()) { trigger_error("MySQL Query Error " . mysql_error(), E_USER_ERROR); $success = FALSE; } } } } } } return $success; }
function add_new_merchant($companyInfo, $sendmail = true, $getmail = false) { $returnInfo = array('status' => true, 'msg' => 'Company Created Successfully'); //foreach($companyInfo as $key=>$data) // $companyInfo[$key] = quote_smart($data); $res = check_merchant_conflict($companyInfo); if (!$res['status']) { return $res; } if ($res['res']['ref']) { $companyInfo['en_ref'] = substr(strtoupper(md5(time() + rand(1, 1000000))), 0, 8); } $qry_insert_user = "******"; $qry_insert_user .= " values('" . $companyInfo['en_username'] . "','" . $companyInfo['en_password'] . "','" . $companyInfo['en_company'] . "','" . $companyInfo['en_ref'] . "','" . $companyInfo['en_email'] . "','" . $companyInfo['volumenumber'] . "',0,'" . $companyInfo['transaction_type'] . "','" . $companyInfo['how_about_us'] . "',NOW(),'" . $companyInfo['phonenumber'] . "','" . $companyInfo['contact_phone'] . "','" . $companyInfo['cd_contact_im'] . "','" . $companyInfo['en_gateway_ID'] . "','" . $companyInfo['url1'] . "','" . $companyInfo['cd_timezone'] . "')"; $show_sql = sql_query_write($qry_insert_user) or dieLog(mysql_error() . " ~ {$str_qry}"); $is_success = 0; $user_id = mysql_insert_id(); $user_reference_num = func_User_Ref_No($user_id); $is_success = func_update_single_field('cs_companydetails', 'ReferenceNumber', $user_reference_num, false, 'userId', $user_id); $sql = "Insert into cs_entities\r\n\t\t\tset \r\n\t\t\t\ten_username = '******'en_username'] . "',\r\n\t\t\t\ten_password = MD5('" . ($companyInfo['en_username'] . $companyInfo['en_password']) . "'),\r\n\t\t\t\ten_ref = '" . $companyInfo['en_ref'] . "',\r\n\t\t\t\ten_email = '" . $companyInfo['en_email'] . "',\r\n\t\t\t\ten_company = '" . $companyInfo['en_company'] . "',\r\n\t\t\t\ten_gateway_ID = '" . $companyInfo['en_gateway_ID'] . "',\r\n\t\t\t\ten_signup = NOW(),\r\n\t\t\t\ten_type = 'merchant',\r\n\t\t\t\ten_type_id = '" . quote_smart($user_id) . "'\r\n\t\t\t"; sql_query_write($sql) or dieLog(mysql_error() . " ~ {$str_qry}"); $en_ID = mysql_insert_id(); $returnInfo['en_ID'] = $en_ID; $sql = "insert into cs_company_banks set cb_en_ID = '{$en_ID}',bank_id=0;"; $result = sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}"); $cb_ID = mysql_insert_id(); if ($companyInfo['etel_reseller_ref']) { $sql = "SELECT \r\n\t\t\t\ten_ID,en_info from cs_entities where\r\n\t\t\t\ten_ref = '" . $companyInfo['etel_reseller_ref'] . "'"; $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}"); $resellerInfo = mysql_fetch_assoc($result); $resellerInfo['en_info'] = etel_unserialize($resellerInfo['en_info']); $returnInfo['ea_affiliate_ID'] = $resellerInfo['en_ID']; set_affiliate($en_ID, $resellerInfo['en_ID'], 'Reseller', array('Disc_Markup' => $resellerInfo['en_info']['Reseller']['Default_Disc_Markup'], 'Trans_Markup' => $resellerInfo['en_info']['Reseller']['Default_Trans_Markup'])); } if ($companyInfo['etel_affiliate_ref']) { $sql = "SELECT \r\n\t\t\t\ten_ID from cs_entities where\r\n\t\t\t\ten_ref = '" . $companyInfo['etel_affiliate_ref'] . "'"; $result = sql_query_read($sql) or dieLog(mysql_error() . " ~ {$sql}"); $affiliateMerchantInfo = mysql_fetch_assoc($result); set_affiliate($affiliateMerchantInfo['en_ID'], $en_ID, 'Affiliate', array('Disc_Markup' => $companyInfo['discount_markup'], 'Trans_Markup' => $companyInfo['transaction_markup'])); } if ($sendmail || $getmail) { $emailData["email"] = $companyInfo['en_email']; $emailData["full_name"] = "Merchant"; $emailData["companyname"] = $companyInfo['en_company']; $emailData["username"] = $companyInfo['en_username']; $emailData["password"] = $companyInfo['en_password']; $emailData["Reference_ID"] = $companyInfo['en_ref']; $emailData["gateway_select"] = $companyInfo['en_gateway_ID']; $emailData['tmpl_custom_id'] = $companyInfo['en_gateway_ID']; $letterTempate = 'merchant_welcome_letter'; } if ($sendmail) { send_email_template($letterTempate, $emailData); } if ($getmail) { $returnInfo['email_info'] = get_email_template($letterTempate, $emailData); } return $returnInfo; }
etel_smarty_display('main_footer.tpl'); exit; } $user_mailidexist = func_checkEmailExistInAnyTable($email, $cnn_cs); if ($user_mailidexist == 1) { message("Existing email id. Please Enter a different Email." . $postback, "", "Email", "content.php?show=main_resellers", false); etel_smarty_display('main_footer.tpl'); exit; } $current_date_time = func_get_current_date_time(); $user_reference_num = substr(md5(time() + rand(1, 9999)), 0, 8); $sql = "Insert into cs_entities\r\n\t\tset \r\n\t\t\ten_ref = '" . $user_reference_num . "',\r\n\t\t\ten_username = '******',\r\n\t\t\ten_password = MD5('" . ($username . $password) . "'),\r\n\t\t\ten_email = '" . quote_smart($email) . "',\r\n\t\t\ten_gateway_ID = '" . quote_smart($rd_gateway_id) . "',\r\n\t\t\ten_type = 'reseller',\r\n\t\t\ten_signup = NOW(),\r\n\t\t\ten_type_id = '" . quote_smart($user_id) . "'\r\n\t\t"; sql_query_write($sql) or dieLog(mysql_error() . " ~ {$sql}"); //$email_from = "*****@*****.**"; $email_subject = "Registration Confirmation"; $email_message = $msgtodisplay; $email_to = $email; $emailData["email"] = $email; $emailData["full_name"] = $contactname; $emailData["companyname"] = $companyname; $emailData["username"] = $username; $emailData["password"] = $password; $emailData["gateway_select"] = $companyInfo['rd_gateway_id']; $emailContents = get_email_template("reseller_welcome_letter", $emailData); send_email_template("reseller_welcome_letter", $emailData); print $emailContents['et_htmlformat']; etel_smarty_display('main_footer.tpl'); } ?>
function execute_transaction() { global $cnn_cs; global $etel_fraud_limit; ignore_user_abort(true); set_time_limit(500); if (!$_SESSION['tmpl_language']) { $_SESSION['tmpl_language'] = 'eng'; } $rates = new rates_fees(); $gw_emails_sales = $_SESSION['gw_emails_sales']; if (!$etel_fraud_limit) { $etel_fraud_limit = floatval($this->companyInfo['cd_fraudscore_limit']); } $this->transInfo['td_bank_recieved'] = 'no'; $this->transInfo['companyname'] = $this->companyInfo['companyname']; $this->transInfo['cs_enable_passmgmt'] = $this->companyInfo['cs_enable_passmgmt']; if (!$this->transInfo['billing_descriptor']) { $this->transInfo['billing_descriptor'] = $this->bankInfo['bk_descriptor_visa']; } $this->transInfo['cardtype'] = $this->bankInfo['bk_trans_types']; if (!$this->transInfo['td_send_email'] == 'no') { $this->transInfo['td_send_email'] = 'yes'; } if (!$this->transInfo['td_gcard']) { $this->transInfo['td_gcard'] = "NULL"; } $this->transInfo['td_fraud_score'] = -1; //if($this->transInfo['td_customer_fee']) $this->transInfo['amount'] += $this->transInfo['td_customer_fee']; // INCORRECT. customer fee is already included in amount $_SESSION['etel_trans_pending'] = true; $_SESSION['etel_trans_pending_ref'] = $this->transInfo['reference_number']; $start_transaction = microtime_float(); if ($this->mode == "Live") { $this->response = $this->fraud->execute_scrub_tests($this->transInfo, $this->bankInfo, $this->companyInfo); if ($this->response == -1) { $int_func = $this->int_function; $int_func_response = $int_func($this->transInfo, $this->bankInfo, $this->companyInfo); $log = "Transaction '" . $this->transInfo['reference_number'] . "' Integration Response: " . $int_func_response['td_process_result'] . " ~ Integration Query: " . $int_func_response['td_process_query'] . " ~ Response Info: " . serialize($int_func_response); $this->sanitizeChargeInfo($log); toLog('order', 'customer', $log, $this->trans_id); $this->response = $int_func_response; } $this->response['success'] = true; $this->transInfo['td_process_result'] = $int_func_response['td_process_result']; $this->transInfo['td_process_query'] = $int_func_response['td_process_query']; $this->transInfo['td_bank_transaction_id'] = $int_func_response['td_bank_transaction_id']; if ($int_func_response['td_gcard']) { $this->transInfo['td_gcard'] = $int_func_response['td_gcard']; } if (!$this->transInfo['td_gcard']) { $this->transInfo['td_gcard'] = "NULL"; } $this->transInfo['td_bank_recieved'] = $int_func_response['td_bank_recieved']; } else { $this->response['errormsg'] = "Success"; $this->response['success'] = true; $this->response['status'] = "A"; $this->transInfo['td_process_result'] = "test"; $this->transInfo['td_process_query'] = "test"; $this->transInfo['td_bank_recieved'] = 'no'; } $this->transInfo['status'] = $this->response['status']; $this->transInfo['td_process_msg'] = $this->response['td_process_msg']; if (!$this->transInfo['td_process_msg']) { $this->transInfo['td_process_msg'] = $this->response['errormsg']; } if ($this->transInfo['status'] == "D") { $this->transInfo['td_username'] = ""; $this->transInfo['td_password'] = ""; } else { if (!$this->transInfo['td_ss_ID'] && $this->transInfo['td_rebillingID'] > 1 && $this->mode == "Live" && $this->transInfo['status'] != "D") { $this->createSubscription(); $this->set_transaction_subid(); //$this->transInfo['td_ss_ID'] = $subsciption->transInfo['td_ss_ID']; } } $int_table = "cs_test_transactiondetails"; if ($this->mode == "Live") { $int_table = "cs_transactiondetails"; } $this->transInfo['td_process_duration'] = microtime_float() - $start_transaction; $this->transInfo['td_non_unique'] = $this->fraud->check_unique($int_table, $this->transInfo); $this->sanitizeChargeInfo($this->transInfo['td_process_query']); $this->sanitizeChargeInfo($this->transInfo['td_process_result']); $qrt_update_details = "\r\n\t\t\tupdate \r\n\t\t\t\t{$int_table} \r\n\t\t\tset \r\n\t\t\t\t`td_gcard` = '" . $this->transInfo['td_gcard'] . "', \r\n\t\t\t\t`td_bank_recieved` = '" . $this->transInfo['td_bank_recieved'] . "',\r\n\t\t\t\t`td_fraud_score` = '" . $this->transInfo['td_fraud_score'] . "',\r\n\t\t\t\t`status` = '" . $this->transInfo['status'] . "',\r\n\t\t\t\t`td_username` = '" . $this->transInfo['td_username'] . "',\r\n\t\t\t\t`td_process_msg` = '" . quote_smart($this->transInfo['td_process_msg']) . "',\r\n\t\t\t\t`td_password` = '" . $this->transInfo['td_password'] . "',\r\n\t\t\t\t`td_bank_transaction_id` = '" . $this->transInfo['td_bank_transaction_id'] . "',\r\n\t\t\t\t`td_process_query` = '" . quote_smart($this->transInfo['td_process_query']) . "',\r\n\t\t\t\t`td_process_result` = '" . quote_smart($this->transInfo['td_process_result']) . "',\r\n\t\t\t\t`td_process_duration` = '" . quote_smart($this->transInfo['td_process_duration']) . "',\r\n\t\t\t\t`td_non_unique` = '" . quote_smart($this->transInfo['td_non_unique']) . "',\r\n\t\t\t\t`td_ss_ID` = '" . quote_smart($this->transInfo['td_ss_ID']) . "'\r\n\t\t\twhere \r\n\t\t\t\ttransactionId = '" . $this->trans_id . "'\r\n\t\t\tLIMIT 1\t\r\n\t\t\t;\r\n\t\t\t"; toLog('order', 'customer', "Transaction '" . $this->transInfo['reference_number'] . "' Update Query: " . $qrt_update_details, $this->trans_id); $show_insert_run = sql_query_write($qrt_update_details) or dieLog(mysql_errno() . ": " . mysql_error() . "<pre>{$qrt_update_details}</pre>"); $rates->update_transaction_profit($this->trans_id, true); if ($this->response['success'] == true) { $this->response['transactionId'] = $this->trans_id; if ($this->transInfo['status'] == 'A' || $this->transInfo['status'] == 'P' && $this->transInfo['checkorcard'] == 'C') { if ($this->transInfo['td_send_email'] == 'yes') { // Email $email_to = $this->transInfo['email']; //$useEmailTemplate = "customer_recur_subscription_confirmation_cc"; $useEmailTemplate = "customer_order_confirmation_cc"; //if($this->transInfo['td_one_time_subscription']) $useEmailTemplate = "customer_subscription_confirmation_cc"; //if($this->transInfo['td_is_a_rebill'] == 1) $useEmailTemplate = "customer_rebill_confirmation_cc"; $data = array(); $data['payment_type'] = $this->payment_type; $data['billing_descriptor'] = $this->transInfo['billing_descriptor']; $data['site_URL'] = $this->companyInfo['cs_URL']; $data['reference_number'] = $this->transInfo['reference_number']; $data['subscription_id'] = $this->transInfo['td_subscription_id']; $data['full_name'] = $this->transInfo['surname'] . ", " . $this->transInfo['name']; $pInfo = $this->transInfo['td_product_id']; $data['product_info'] = $pInfo . ($pInfo ? ": " : '') . $this->transInfo['productdescription']; $data['email'] = $email_to; $data['customer_email'] = $email_to; $data['credit_card_formatted'] = $this->credit_card_formatted; $data['amount'] = "\$" . formatMoney($this->transInfo['amount'] - $this->transInfo['td_customer_fee']) . " USD"; $data['customer_fee'] = "\$" . formatMoney($this->transInfo['td_customer_fee']) . " USD"; $data['final_amount'] = "\$" . formatMoney($this->transInfo['amount']) . " USD"; $data['username'] = $this->transInfo['td_username']; $data['password'] = $this->transInfo['td_password']; $data['payment_schedule'] = $this->transInfo['payment_schedule']; if (!$data['payment_schedule']) { $data['payment_schedule'] = 'No Schedule'; } $data['transaction_date'] = date("F j, Y G:i:s", strtotime($this->transInfo['transactionDate'])); $data['next_bill_date'] = $this->transInfo['nextDateInfo']; $data['site_access_URL'] = $this->companyInfo['cs_member_url']; $data['customer_support_email'] = $this->companyInfo['cs_support_email']; $data['tmpl_language'] = $_SESSION['tmpl_language']; $data['gateway_select'] = $this->companyInfo['gateway_id']; $str_is_test = "THIS IS A TEST TRANSACTION "; if ($this->mode == "Live") { $str_is_test = ""; } if ($this->transInfo['td_is_a_rebill']) { $useEmailTemplate = "customer_recur_subscription_confirmation_cc"; } if (!$this->transInfo['td_is_a_rebill']) { send_email_template($useEmailTemplate, $data, $str_is_test); } // Send Customer Email. if ($this->mode == "Live" && $this->bankInfo['bk_cc_bank_enabled'] == 1) { $data['email'] = $this->bankInfo['bank_email']; send_email_template($useEmailTemplate, $data, "(Bank Copy) "); } if ($this->companyInfo['cd_recieve_order_confirmations']) { $data['email'] = $this->companyInfo['cd_recieve_order_confirmations']; send_email_template($useEmailTemplate, $data, $str_is_test . "(Merchant Copy) "); } } } if ($mode != "Live") { $sql = "\r\n\t\t\t\t\tUPDATE \r\n\t\t\t\t\t\tcs_companydetails \r\n\t\t\t\t\tset \r\n\t\t\t\t\t\t`cd_completion` = 7 \r\n\t\t\t\t\tWHERE \r\n\t\t\t\t\t\t`cd_completion` = 6 \r\n\t\t\t\t\t\tAND `userId` = '" . $this->transInfo['userId'] . "'\r\n\t\t\t\t\t"; if ($this->companyInfo['cd_completion'] == 6) { sql_query_write($sql) or dieLog(mysql_error() . "<pre>{$sql}</pre>"); } $this->transInfo['td_product_id'] = "TEST MODE"; $this->transInfo['amount'] = "TEST MODE"; } $_SESSION['etel_trans_pending'] = true; // Post Notification $notify = 'decline'; if ($this->transInfo['status'] == 'A' || $this->transInfo['status'] == 'P' && $this->transInfo['checkorcard'] == 'C') { if ($this->transInfo['td_is_a_rebill']) { $notify = 'rebill'; } else { $notify = 'approve'; } } Process_Transaction($this->transInfo['reference_number'], $notify, $this->mode != "Live"); //approved or declined } $this->transInfo['transactionId'] = $this->trans_id; $this->response['transactionId'] = $this->transInfo['transactionId']; $this->response['reference_number'] = $this->transInfo['reference_number']; $this->response['td_subscription_id'] = $this->transInfo['td_subscription_id']; $this->response['watchInfo'] = $this->fraud->check_watchlist($this->transInfo); $_SESSION['etel_trans_pending'] = false; }
function execute_transaction($transInfo, $mode) { global $cnn_cs; global $etel_fraud_limit; $process_trans = new rates_fees(); ignore_user_abort(true); set_time_limit(500); if (!$_SESSION['tmpl_language']) { $_SESSION['tmpl_language'] = 'eng'; } $response = ""; $response['errormsg'] = "No Error"; $response['success'] = false; $gw_emails_sales = $_SESSION['gw_emails_sales']; foreach ($transInfo as $key => $data) { $transInfo[$key] = str_replace("'", "`", urldecode($data)); } if (!$transInfo['checkorcard']) { dieLog("Error. No Transaction Type Selected. " . serialize($transInfo)); } if (!$transInfo['reference_number']) { $transInfo['reference_number'] = genRefId("transaction", $transInfo['checkorcard']); } if (!$transInfo['td_subscription_id']) { $transInfo['td_subscription_id'] = genRefId("subscription", "S"); } if (!$transInfo['reference_number']) { $response['errormsg'] = "Invalid Reference Number"; return $response; } if (!$transInfo['userId']) { $response['errormsg'] = "Invalid Merchant Id #" . $transInfo['userId']; return $response; } if (!$transInfo['checkorcard']) { $response['errormsg'] = "Invalid Payment Type"; return $response; } $sql = "SELECT * FROM `cs_companydetails` as c left join `etel_dbsmain`.`cs_company_sites` as s on s.cs_company_id = c.`userId` WHERE c.`userId` = '" . $transInfo['userId'] . "' and s.`cs_ID` = '" . $transInfo['td_site_ID'] . "'"; $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>Cannot execute query"); if (mysql_num_rows($result) < 1 && $mode == "Live") { $response['errormsg'] = "Invalid Company/Website"; return $response; } $companyInfo = mysql_fetch_assoc($result); ////// find a valid bank that the merchant is using that can process for the cardtype $bank_ids = merchant_getBanksForTransType($transInfo['userId'], $transInfo['cardtype']); if (sizeof($bank_ids) == 0) { $response['errormsg'] = "Invalid Card Type"; return $response; } $company_bank_id = $bank_ids[0]; $transInfo['bank_id'] = $company_bank_id; /////////// //todo: if (isset($transInfo['wallet_additional_funds'])) { //addtowallet $transInfo['wallet_additional_funds'] $transInfo['wallet_id'] $transInfo['wallet_pass'] } // if (!$etel_fraud_limit) { $etel_fraud_limit = floatval($companyInfo['cd_fraudscore_limit']); } $sql = "SELECT b.* FROM `cs_bank` as b where b.bank_id = {$company_bank_id} "; $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "User: "******", checkorcard=" . $transInfo['checkorcard']); if (mysql_num_rows($result) < 1 && $mode == "Live") { $response['errormsg'] = "Invalid Bank. Use Credit Card Ordering instead."; toLog('erroralert', 'misc', $sql . "User: "******", checkorcard=" . $transInfo['checkorcard']); return $response; } $bankInfo = mysql_fetch_assoc($result); if (!$bankInfo['bk_int_function'] && $mode == "Live") { $response['errormsg'] = "Invalid Bank Integration"; return $response; } $transInfo['companyname'] = $companyInfo['companyname']; $transInfo['cs_enable_passmgmt'] = $companyInfo['cs_enable_passmgmt']; $transInfo['billing_descriptor'] = $bankInfo['bk_descriptor_visa']; if ($transInfo['cardtype'] == "Master") { $transInfo['billing_descriptor'] = $bankInfo['bk_descriptor_master']; } if (!$transInfo['td_is_a_rebill']) { if ($transInfo['cs_enable_passmgmt'] && $transInfo['td_rebillingID'] != -1) { if (strlen($transInfo['td_username']) < 6) { $response['errormsg'] = "Invalid UserName (Must be greater than 5 characters)"; return $response; } if (strlen($transInfo['td_password']) < 6) { $response['errormsg'] = "Invalid Password (Must be greater than 5 characters)"; return $response; } } if (!$transInfo['name']) { $response['errormsg'] = "Invalid Name"; return $response; } if (!$transInfo['surname']) { $response['errormsg'] = "Invalid Last Name"; return $response; } if (!$transInfo['address']) { $response['errormsg'] = "Invalid Address"; return $response; } if (!$transInfo['city']) { $response['errormsg'] = "Invalid City"; return $response; } if (!$transInfo['phonenumber']) { $response['errormsg'] = "Invalid Phone Number"; return $response; } //if(!$transInfo['state']) {$response['errormsg'] = "Invalid State"; return $response;} if (!$transInfo['zipcode']) { $response['errormsg'] = "Invalid ZipCode"; return $response; } if (!$transInfo['country']) { $response['errormsg'] = "Invalid Country"; return $response; } if (!$transInfo['email']) { $response['errormsg'] = "Invalid Email"; return $response; } $email_info = infoListEmail($transInfo['email']); if ($email_info['cnt'] > 0) { $response['errormsg'] = "Unsubscribed Email Address " . $transInfo['email'] . ".<BR>Reason: " . $email_info['ec_reason'] . ".<BR>Please use a different email address."; return $response; } if (!$transInfo['amount']) { $response['errormsg'] = "Invalid Charge Amount"; return $response; } if (!$transInfo['ipaddress']) { $response['errormsg'] = "Invalid IP Address"; return $response; } if (!$transInfo['productdescription']) { $response['errormsg'] = "Invalid Product Description"; return $response; } //if(!$transInfo['td_product_id']) {$response['errormsg'] = "Invalid Transaction Tracking ID"; return $response;} } $credit_card_formatted = "Payment"; $payment_type = "-"; //Credit Card $trans_mode = NULL; //$process_trans->array_print($transInfo); if ($transInfo['checkorcard'] == 'H') { $trans_mode = 'cc'; if ($transInfo['cardtype'] != 'wallet') { $credit_card_formatted = substr($transInfo['CCnumber'], -4, 4); $payment_type = "Credit Card (Last 4 Digits)"; if (!$transInfo['td_is_a_rebill']) { if (!$transInfo['td_bank_number'] && $transInfo['country'] == "US") { $response['errormsg'] = "Invalid Bank Phone Number"; return $response; } if (!$transInfo['CCnumber']) { $response['errormsg'] = "Invalid Credit Card Number"; return $response; } if (!$transInfo['validupto']) { $response['errormsg'] = "Invalid cvv Number"; return $response; } } } } //Check if ($transInfo['checkorcard'] == 'C') { $trans_mode = 'ch'; $credit_card_formatted = substr($transInfo['bankaccountnumber'], -4, 4); $payment_type = "Account Number (Last 4 Digits)"; if (!$transInfo['td_is_a_rebill']) { if (!$transInfo['bankname']) { $response['errormsg'] = "Invalid Name on Account"; return $response; } if (!$transInfo['bankaccountnumber']) { $response['errormsg'] = "Invalid Bank Account Number"; return $response; } if (!$transInfo['bankroutingcode']) { $response['errormsg'] = "Invalid Routing Code"; return $response; } } } if (!$trans_mode) { $response['errormsg'] = "Invalid Payment Method. "; return $response; } if ($transInfo['amount'] > $companyInfo['cd_max_transaction'] && $companyInfo['cd_max_transaction'] > 0) { $response['errormsg'] = "Invalid Charge Amount. Charges may be no higher than " . $companyInfo['cd_max_transaction'] . "."; return $response; } if (!$transInfo['td_send_email'] == 'no') { $transInfo['td_send_email'] = 'yes'; } if (!$transInfo['td_gcard']) { $transInfo['td_gcard'] = "NULL"; } $transInfo['td_fraud_score'] = -1; if ($transInfo['td_customer_fee']) { $transInfo['amount'] += $transInfo['td_customer_fee']; } $response = array(); $ap_limit = intval($companyInfo['cd_approve_timelimit']); if ($ap_limit < 1) { $ap_limit = 1; } if (cc_check_previous_24h_approve(&$transInfo, $ap_limit)) { //$response['errormsg'] = "Credit Card has been used in the last ".$companyInfo['cd_approve_timelimit']." hours. The order was successful. If you did not get an order confirmation email, or you have any other questions about your order, please contact Etelegate Customer Service. Otherwise, please wait until ".$companyInfo['cd_approve_timelimit']." hours has passed since your last purchase."; //$response['success'] = true; //$response['td_process_result']="Credit Card Previously Approved in the last ".$companyInfo['cd_approve_timelimit']." hours. Will not try again so soon."; //$response['td_process_query']="Checking for Previous Approves"; //$response['status'] = "D"; //$response['td_bank_recieved'] = 'approvelimit'; $response['errormsg'] = "Credit Card has been used in the last {$ap_limit} hour(s). The order was successful. If you did not get an order confirmation email, or you have any other questions about your order, please contact Etelegate Customer Service. Otherwise, please wait until {$ap_limit} hour(s) has passed since your last purchase."; return $response; } if ($_SESSION['etel_trans_pending'] == true && !$transInfo['td_is_a_rebill']) { $response['errormsg'] = "Error: Transaction Pending. Please wait until current transaction has completed."; return $response; } $_SESSION['etel_trans_pending'] = true; $_SESSION['etel_trans_pending_ref'] = $transInfo['reference_number']; // Start Pending Trans $transInfo = $process_trans->update_TransactionRates($transInfo['userId'], $transInfo, $trans_mode, $mode); $trans_id = $process_trans->insert_TransactionWithRates($transInfo, $mode); $int_table = "cs_test_transactiondetails"; if ($mode == "Live") { $int_table = "cs_transactiondetails"; } /* $qrt_insert_details = "insert into $int_table set `status` = 'P',`Invoiceid` = '".$transInfo['Invoiceid']."', `transactionDate` = NOW(), `name` = '".$transInfo['name']."', `surname` = '".$transInfo['surname']."', `phonenumber` = '".$transInfo['phonenumber']."', `address` = '".$transInfo['address']."', `CCnumber` = '".etelEnc($transInfo['CCnumber'])."', `cvv` = '".$transInfo['cvv']."', `checkorcard` = '".$transInfo['checkorcard']."', `country` = '".$transInfo['country']."', `city` = '".$transInfo['city']."', `td_bank_number` = '".$transInfo['td_bank_number']."', `state` = '".$transInfo['state']."', `zipcode` = '".$transInfo['zipcode']."', `amount` = '".$transInfo['amount']."', `memodet` = '".$transInfo['memodet']."', `signature` = '".$transInfo['signature']."', `bankname` = '".$transInfo['bankname']."', `bankroutingcode` = '".$transInfo['bankroutingcode']."', `bankaccountnumber` = '".etelEnc($transInfo['bankaccountnumber'])."', `accounttype` = '".$transInfo['accounttype']."', `misc` = '".$transInfo['misc']."', `email` = '".$transInfo['email']."', `cancelstatus` = '".$transInfo['cancelstatus']."', `userId` = '".$transInfo['userId']."', `Checkto` = '".$transInfo['Checkto']."', `cardtype` = '".$transInfo['cardtype']."', `checktype` = '".$transInfo['checktype']."', `validupto` = '".$transInfo['validupto']."', `reason` = '".$transInfo['reason']."', `other` = '".$transInfo['other']."', `ipaddress` = '".$transInfo['ipaddress']."', `cancellationDate` = NULL, `voiceAuthorizationno` = '".$transInfo['voiceAuthorizationno']."', `shippingTrackingno` = '".$transInfo['shippingTrackingno']."', `socialSecurity` = '".$transInfo['socialSecurity']."', `driversLicense` = '".$transInfo['driversLicense']."', `billingDate` = NOW(), `passStatus` = '".$transInfo['passStatus']."', `chequedate` = '".$transInfo['chequedate']."', `pass_count` = '".$transInfo['pass_count']."', `approvaldate` = '".$transInfo['approvaldate']."', `nopasscomments` = '".$transInfo['nopasscomments']."', `licensestate` = '".$transInfo['licensestate']."', `approval_count` = '".$transInfo['approval_count']."', `declinedReason` = '".$transInfo['declinedReason']."', `service_user_id` = '".$transInfo['service_user_id']."', `admin_approval_for_cancellation` = '".$transInfo['admin_approval_for_cancellation']."', `company_usertype` = '".$transInfo['company_usertype']."', `company_user_id` = '".$transInfo['company_user_id']."', `callcenter_id` = '".$transInfo['callcenter_id']."', `productdescription` = '".$transInfo['productdescription']."', `reference_number` = '".$transInfo['reference_number']."', `currencytype` = '".$transInfo['currencytype']."', `r_reseller_discount_rate` = '".$transInfo['r_reseller_discount_rate']."', `r_total_discount_rate` = '".$transInfo['r_total_discount_rate']."', `td_ca_ID` = '".$transInfo['td_ca_ID']."', `td_fraud_score` = '".$transInfo['td_fraud_score']."',`r_chargeback` = '".$transInfo['r_chargeback']."', `r_credit` = '".$transInfo['r_credit']."', `r_transactionfee` = '".$transInfo['r_transactionfee']."', `r_reserve` = '".$transInfo['r_reserve']."', `r_merchant_discount_rate` = '".$transInfo['r_merchant_discount_rate']."', `r_total_trans_fees` = '".$transInfo['r_total_trans_fees']."', `r_reseller_trans_fees` = '".$transInfo['r_reseller_trans_fees']."', `r_discountrate` = '".$transInfo['r_discountrate']."', `r_merchant_trans_fees` = '".$transInfo['r_merchant_trans_fees']."', `cancel_refer_num` = '".$transInfo['cancel_refer_num']."', `cancel_count` = '".$transInfo['cancel_count']."', `return_url` = '".$transInfo['return_url']."', `from_url` = '".$transInfo['from_url']."', `bank_id` = '".$transInfo['bank_id']."', `td_rebillingID` = '".$transInfo['td_rebillingID']."', `td_is_a_rebill` = '".$transInfo['td_is_a_rebill']."', `td_enable_rebill` = '".$transInfo['td_enable_rebill']."', `td_voided_check` = '".$transInfo['td_voided_check']."', `td_returned_checks` = '".$transInfo['td_returned_checks']."', `td_site_ID` = '".$transInfo['td_site_ID']."', `td_is_affiliate` = '".$transInfo['td_is_affiliate']."', `td_send_email` = '".$transInfo['td_send_email']."', `td_customer_fee` = '".$transInfo['td_customer_fee']."', `td_is_pending_check` = '".$transInfo['td_is_pending_check']."', `td_is_chargeback` = '".$transInfo['td_is_chargeback']."', `td_recur_processed` = '".$transInfo['td_recur_processed']."', `td_recur_next_date` = '".$transInfo['td_recur_next_date']."', `td_username` = '".$transInfo['td_username']."', `td_password` = '".$transInfo['td_password']."', `td_product_id` = '".$transInfo['td_product_id']."', `td_non_unique` = '".$transInfo['td_non_unique']."', td_merchant_fields = '" . $transInfo['td_merchant_fields'] . "', td_subscription_id = '" . $transInfo['td_subscription_id'] . "' ;"; //die($qrt_insert_details); $show_insert_run =mysql_query($qrt_insert_details) or dieLog(mysql_errno().": ".mysql_error()."<BR>".$qrt_insert_details); $trans_id = mysql_insert_id(); $transInfo['transactionId'] = $trans_id; func_update_rate($transInfo['userId'],&$transInfo,$cnn_cs,$trans_mode,$mode); */ toLog('order', 'customer', "Pending Transaction '" . $transInfo['reference_number'] . "' Created.", $trans_id); // End Pending Trans if ($mode == "Live") { $start_transaction = microtime_float(); $int_op = $bankInfo['bk_int_function']; if (function_exists($int_op)) { $response = $int_op($transInfo, $bankInfo, $companyInfo); } else { $response['errormsg'] = "Integration Function '{$int_op}' not found"; $response['success'] = false; } toLog('order', 'customer', "Transaction '" . $transInfo['reference_number'] . "' Integration Response: " . $response['td_process_result'] . " ~ Integration Query: " . $response['td_process_query'] . " ~ Response Info: " . serialize($response), $trans_id); $transInfo['status'] = $response['status']; $transInfo['td_process_result'] = $response['td_process_result']; $transInfo['td_process_query'] = $response['td_process_query']; $transInfo['td_bank_transaction_id'] = $response['td_bank_transaction_id']; if ($response['td_gcard']) { $transInfo['td_gcard'] = $response['td_gcard']; } //$transInfo['td_gcard'] = $transInfo['td_gcard']; if (!$transInfo['td_gcard']) { $transInfo['td_gcard'] = "NULL"; } $transInfo['td_bank_recieved'] = $response['td_bank_recieved']; } else { $response['errormsg'] = "Success"; $response['success'] = true; $transInfo['Invoiceid'] = $response['Invoiceid']; $transInfo['td_process_result'] = $response['td_process_result']; $transInfo['td_process_query'] = $response['td_process_query']; $response['status'] = "A"; $transInfo['td_bank_recieved'] = 'no'; //$transInfo['td_gcard'] = substr($transInfo['td_gcard'],0,4)."********".substr($transInfo['td_gcard'],0,-4); } $transInfo['status'] = $response['status']; $transInfo['td_process_msg'] = $response['errormsg']; if ($transInfo['status'] != "A") { $transInfo['td_username'] = ""; $transInfo['td_password'] = ""; } $transInfo['td_process_duration'] = microtime_float() - $start_transaction; $transInfo['td_non_unique'] = cc_check_unique($int_table, &$transInfo); $transInfo['declinedReason'] = $transInfo['errormsg']; $qrt_update_details = "update {$int_table} set \n\t\t\t`td_gcard` = " . $transInfo['td_gcard'] . ", \n\t\t\t`td_bank_recieved` = '" . $transInfo['td_bank_recieved'] . "',\n\t\t\t`td_fraud_score` = '" . $transInfo['td_fraud_score'] . "',\n\t\t\t`status` = '" . $transInfo['status'] . "',\n\t\t\t`td_username` = '" . $transInfo['td_username'] . "',\n\t\t\t`td_process_msg` = '" . $transInfo['td_process_msg'] . "',\n\t\t\t`td_password` = '" . $transInfo['td_password'] . "',\n\t\t\t`td_bank_transaction_id` = '" . $transInfo['td_bank_transaction_id'] . "',\n\t\t\t`td_process_query` = '" . quote_smart($transInfo['td_process_query']) . "',\n\t\t\t`td_process_result` = '" . quote_smart($transInfo['td_process_result']) . "',\n\t\t\t`td_process_duration` = '" . quote_smart($transInfo['td_process_duration']) . "' \n\t\t\twhere transactionId = '{$trans_id}';"; //die($qrt_insert_details); toLog('order', 'customer', "Transaction '" . $transInfo['reference_number'] . "' Update Query: " . $qrt_update_details, $trans_id); $show_insert_run = mysql_query($qrt_update_details) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>" . $qrt_update_details); if ($response['success'] == true) { //if($transInfo['status'] != 'A') $transInfo['status'] = 'D'; //func_ins_bankrates($trans_id,$bank_CreditcardId,$cnn_cs); $response['transactionId'] = $trans_id; // Update Rates here? if (!$trans_id) { $response['errormsg'] = "Failed to store Transaction in Database"; $response['success'] = false; } $email_to = $transInfo['email']; if ($transInfo['status'] == 'A' || $transInfo['status'] == 'P' && $transInfo['checkorcard'] == 'C') { // Email $useEmailTemplate = "customer_recur_subscription_confirmation_cc"; if ($transInfo['td_enable_rebill'] == 0) { $useEmailTemplate = "customer_order_confirmation_cc"; } if ($transInfo['td_one_time_subscription']) { $useEmailTemplate = "customer_subscription_confirmation_cc"; } if ($transInfo['td_is_a_rebill'] == 1) { $useEmailTemplate = "customer_rebill_confirmation_cc"; } $data = array(); $data['payment_type'] = $payment_type; $data['billing_descriptor'] = $transInfo['billing_descriptor']; $data['site_URL'] = $companyInfo['cs_URL']; $data['reference_number'] = $transInfo['reference_number']; $data['full_name'] = $transInfo['surname'] . ", " . $transInfo['name']; $data['product_info'] = $transInfo['td_product_id'] . ": " . $transInfo['productdescription']; $data['email'] = $email_to; $data['customer_email'] = $email_to; $data['credit_card_formatted'] = $credit_card_formatted; $data['amount'] = "\$" . formatMoney($transInfo['amount'] - $transInfo['td_customer_fee']) . " USD"; $data['customer_fee'] = "\$" . formatMoney($transInfo['td_customer_fee']) . " USD"; $data['final_amount'] = "\$" . formatMoney($transInfo['amount']) . " USD"; $data['username'] = $transInfo['td_username']; $data['password'] = $transInfo['td_password']; $data['payment_schedule'] = $transInfo['payment_schedule']; $data['transaction_date'] = date("F j, Y", strtotime($transInfo['transactionDate'])); $data['next_bill_date'] = $transInfo['nextDateInfo']; $data['site_access_URL'] = $companyInfo['cs_member_url']; $data['customer_support_email'] = $companyInfo['cs_support_email']; $data['tmpl_language'] = $_SESSION['tmpl_language']; $data['gateway_select'] = $companyInfo['gateway_id']; if ($transInfo['td_send_email'] == 'yes') { $str_is_test = "THIS IS A TEST TRANSACTION "; if ($mode == "Live") { $str_is_test = ""; } if (!$transInfo['td_is_a_rebill']) { send_email_template($useEmailTemplate, $data, $str_is_test); } // Send Customer Email. if ($mode == "Live" && $bankInfo['bk_cc_bank_enabled'] == 1) { $data['email'] = $bankInfo['bank_email']; send_email_template($useEmailTemplate, $data, "(Bank Copy) "); } if ($companyInfo['cd_recieve_order_confirmations']) { $data['email'] = $companyInfo['cd_recieve_order_confirmations']; send_email_template($useEmailTemplate, $data, $str_is_test . "(Merchant Copy) "); } } // End Email } if ($mode != "Live") { $sql = "UPDATE cs_companydetails set `cd_completion` = 7 WHERE `cd_completion` = 6 AND `userId` = '" . $transInfo['userId'] . "'"; if ($companyInfo['cd_completion'] == 6) { mysql_query($sql) or dieLog(mysql_error()); } $transInfo['td_product_id'] = "TEST MODE"; $transInfo['amount'] = "TEST MODE"; } $_SESSION['etel_trans_pending'] = true; // Post Notification $notify = 'decline'; if ($transInfo['status'] == 'A' || $transInfo['status'] == 'P' && $transInfo['checkorcard'] == 'C') { $notify = 'approve'; if ($transInfo['td_is_a_rebill']) { $notify = 'rebill'; } } Process_Transaction($transInfo['reference_number'], $notify, $mode != "Live"); //approved or declined } $response['transactionId'] = $transInfo['transactionId']; $_SESSION['etel_trans_pending'] = false; return $response; }
etel_smarty_display('main_header.tpl'); $email = isset($HTTP_POST_VARS['email']) ? $HTTP_POST_VARS['email'] : ""; $invalidlogin = ""; $headers = ""; if ($email != "") { $show_sql = mysql_query("select password,username,companyname from cs_companydetails where email='{$email}'", $cnn_cs); if (mysql_num_rows($show_sql) == 0) { $invalidlogin = "******"; } else { while ($sql_res = mysql_fetch_array($show_sql)) { $password = $sql_res[0]; $username = $sql_res[1]; $name = $sql_res[2]; $invalidlogin = "******"; $useEmailTemplate = "password_retrieval"; $data['site_access_URL'] = $_SESSION['gw_domain']; $data['site_URL'] = $_SESSION['gw_title']; $data['full_name'] = $name; $data['email'] = $email; $data['username'] = $username; $data['password'] = $password; $data["gateway_select"] = $companyInfo['gateway_id']; send_email_template($useEmailTemplate, $data); break; } } } else { $invalidlogin = "******"; } message('<font face="verdana" size="2" color="red">' . $invalidlogin . '</font><BR>Enter Your Email Address: <input type="text" name="email" style="font-family:arial;font-size:10px;width:190px">', "", "Forgot Password", "forgotpassword.php", false); etel_smarty_display('main_footer.tpl');
exit; } else { $is_success = 0; $user_id = mysql_insert_id(); $user_reference_num = func_User_Ref_No($user_id); $is_success = func_update_single_field('cs_companydetails', 'ReferenceNumber', $user_reference_num, NULL, 'userId', $user_id, $cnn_cs); $sql = "Insert into cs_entities\n\t\t\t\tset \n\t\t\t\t\ten_username = '******',\n\t\t\t\t\ten_password = MD5('" . ($username . $password) . "'),\n\t\t\t\t\ten_email = '" . quote_smart($email) . "',\n\t\t\t\t\ten_gateway_ID = '" . quote_smart($gateway_id) . "',\n\t\t\t\t\ten_type = 'merchant',\n\t\t\t\t\ten_signup = NOW(),\n\t\t\t\t\ten_type_id = '" . quote_smart($user_id) . "'\n\t\t\t\t"; sql_query_write($sql) or dieLog(mysql_error() . " ~ {$str_qry}"); $letterTempate = 'merchant_referral_letter'; $emailData["email"] = $email_to; $emailData["reselleremail"] = $resellerInfo['reseller_email']; $emailData["full_name"] = "Merchant"; $emailData["companyname"] = $companyname; $emailData["resellername"] = $resellerInfo['reseller_companyname']; $emailData["username"] = $username; $emailData["password"] = $password; $emailData["Reference_ID"] = $user_reference_num; send_email_template($letterTempate, $emailData); $emailInfo = get_email_template($letterTempate, $emailData); /*************************************************************************/ $msgtodisplay = "New merchant registered successfully. Confirmation Email sent to '" . $email . "'"; $outhtml = "Y"; message($msgtodisplay, $outhtml, $headerInclude); exit; } } } include "includes/footer.php"; ?>
send_email_template('active_notification_email', $data); } if ($send_merchant_rates_email == 1 && $companyInfo['send_mail'] == 1) { $data['resellername'] = $companyInfo['reseller_companyname']; send_email_template('merchant_rates_notification_email', $data); $updateRateRequest = "cd_reseller_rates_request = '1', "; } if ($send_reseller_rates_email == 1 && $companyInfo['reseller_sendmail'] == 1) { $data['email'] = $companyInfo['reseller_email']; $data['resellername'] = $companyInfo['reseller_companyname']; $data['companyname'] = $companyInfo['companyname']; $data['full_name'] = $companyInfo['reseller_contactname']; $data['username'] = $companyInfo['reseller_username']; $data['password'] = $companyInfo['reseller_password']; $data['Reference_ID'] = $companyInfo['ReferenceNumber']; send_email_template('reseller_rates_notification_email', $data); $updateRateRequest = "cd_reseller_rates_request = '1', "; } // End Email if ($cd_custom_orderpage) { $cd_custom_orderpage = "'" . $cd_custom_orderpage . "'"; } else { $cd_custom_orderpage = "NULL"; } $cd_has_been_active = ""; if ($trans_activity) { $cd_has_been_active = "cd_has_been_active=1, "; } $qry_update_user = "******"; if ($adminInfo['li_level'] == 'full') { $qry_update_user .= ",activeuser='******'";
$useEmailTemplate = "customer_tracking_confirmation"; $data['site_URL'] = $transactionInfo['cs_URL']; $data['reference_number'] = $transactionInfo['reference_number']; $data['full_name'] = $transactionInfo['surname'] . ", " . $transactionInfo['name']; $data['email'] = $transactionInfo['email']; $data['tracking_ID'] = $transactionInfo['td_tracking_id']; $data['tracking_link'] = $transactionInfo['td_tracking_link']; $data['tracking_info'] = $transactionInfo['td_tracking_info'] ? $transactionInfo['td_tracking_info'] : "None"; $data['tracking_ship_date'] = $transactionInfo['td_tracking_ship_date'] ? date("F j, Y, g:i a", strtotime($transactionInfo['td_tracking_ship_date'])) : "No Date Available"; $data['tracking_ship_est'] = $transactionInfo['td_tracking_ship_est'] ? date("F j, Y, g:i a", strtotime($transactionInfo['td_tracking_ship_est'])) : "No Estimate Available"; $data["gateway_select"] = $companyInfo['gateway_id']; send_email_template($useEmailTemplate, $data, ""); // Send Customer Email. if ($transactionInfo['cd_recieve_order_confirmations']) { $data['email'] = $transactionInfo['cd_recieve_order_confirmations']; send_email_template($useEmailTemplate, $data, "( Merchant Copy) "); } $success++; } else { $failed++; } } } } } } } if (strlen($log) > 0) { $log .= "{$success}/" . ($failed + $success) . " Transactions Updated Successfully. {$failed} Failed.\n"; echo "<div align='center' style='font-size:10'>" . nl2br($log) . "</div>"; include "includes/footer.php";
$emailInfo['body'] = $asciiText->convert(); } $new_ticket = createNewTicket(&$emailInfo, $tickets_users_username, $tickets_thread, $account['category']); if ($new_ticket['tickets_id']) { $log .= " Created New Ticket '{$new_ticket}' on thread '" . $new_ticket['tickets_reference'] . "'\n"; } if (!$new_ticket['tickets_reference']) { dieLog("Invalid Reference ID", "Invalid Reference ID"); } if ($send_auto_response) { $data = array(); $data['ticket_id'] = $new_ticket['tickets_reference']; $data['subject'] = $emailInfo['Subject']; $data['category'] = $category; $data['full_name'] = $emailInfo['FromEmail']; $data['email'] = $emailInfo['FromEmail']; $data['gateway_select'] = $gw_id; $data['ticket_email_address'] = "Ticket-" . $data['ticket_id'] . "@" . $domain; send_email_template('support_ticket_response', $data); $log .= " Sent Email Successfully.\n"; } } else { $log .= " Ignored Email.\n"; } } } $log .= $imap->error; $imap->close(); } echo nl2br($log); toLog('email', 'system', $log, '');