function cc_check_for_gkard($transInfo) { $sql = "SELECT td_gcard\nFROM `cs_transactiondetails`\nWHERE `CCnumber` LIKE '" . etelEnc($transInfo['CCnumber']) . "'\nAND (`status` = 'A' ) AND (`td_gcard` IS NOT NULL )"; $result = mysql_query($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>"); if (mysql_num_rows($result) <= 0) { return 0; } $td_gcard = mysql_fetch_assoc($result); return etelDec($td_gcard['td_gcard']); }
function getTransactionInfo($id, $test = false, $by = 'transactionId', $where_sql = "") { global $cnn_cs; $trans_table_name = "cs_transactiondetails"; if ($test) { $trans_table_name = "cs_test_transactiondetails"; } $sql = "\n\t\t\tSELECT \n\t\t\t\tt.*, DATE_FORMAT(t.transactionDate,'%M %D %Y at %r') as transaction_date_formatted,\n\t\t\t\tsub.*,\n\t\t\t\t\tc.contact_email,\n\t\t\t\t\tc.customer_service_phone,\n\t\t\t\t\tc.cc_billingdescriptor,\n\t\t\t\t\tc.ch_billingdescriptor,\n\t\t\t\t\tc.cc_visa_billingdescriptor,\n\t\t\t\t\tc.cc_master_billingdescriptor,\n\t\t\t\t\tc.we_billingdescriptor, \n\t\t\t\t\tc.cd_recieve_order_confirmations,\n\t\t\t\t\tc.we_billingdescriptor,\n\t\t\t\t\tc.companyname, \n\t\t\t\t\tc.cd_tracking_init_response, \n\t\t\t\t\tc.cd_enable_tracking, \n\t\t\t\t\tc.gateway_id, \n\t\t\t\t\tc.bank_Creditcard,\n\t\t\t\t\ts.*, \n\t\t\t\t\t(r.note_id is not null) as hasRefundRequest,\n\t\t\t\t\t r.call_date_time, \n\t\t\t\t\t r.service_notes \n\t\t\tFROM \n\t\t\t\t{$trans_table_name} as t\n\t\t\tLEFT JOIN `cs_subscription` as sub ON sub.`ss_ID` = t.`td_ss_ID`\n\t\t\tLEFT JOIN `cs_companydetails` as c ON c.`userId` = t.`userId`\n\t\t\tLEFT JOIN `cs_company_sites` as s ON `cs_ID` = `td_site_ID`\n\t\t\tleft join cs_callnotes as r on r.`transaction_id`=t.`transactionId` AND r.cn_type = 'refundrequest' \n\t\t\tWHERE \n\t\t\t\t`{$by}` = '{$id}' \n\t\t\t\t{$where_sql}\n\t\t\t\t"; $result = sql_query_read($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<BR>{$sql}<BR>"); if (mysql_num_rows($result) <= 0) { return -1; } $transactionInfo = mysql_fetch_assoc($result); $transactionInfo['CCnumber'] = etelDec($transactionInfo['CCnumber']); $transactionInfo['bankaccountnumber'] = etelDec($transactionInfo['bankaccountnumber']); $transactionInfo['bankaccountnumber'] = "XXXXXX" . substr($transactionInfo['bankaccountnumber'], -4, 4); $transactionInfo['CCnumber_format'] = "XXXXXXXXXXXX" . substr($transactionInfo['CCnumber'], -4, 4); $time = strtotime($transactionInfo['transactionDate']); $subAcc = getRebillInfo($transactionInfo['td_rebillingID'], $time, false); $transactionInfo['userActiveCode'] = UserActivity(&$transactionInfo); $transactionInfo['userRebillCode'] = UserRebill(&$transactionInfo); //Shipping if ($transactionInfo['cd_enable_tracking'] == 'on') { $transactionInfo['Tracking_Deadline'] = $time + $transactionInfo['cd_tracking_init_response'] * 24 * 60 * 60; $transactionInfo['Tracking_Days_Left'] = floor(($transactionInfo['Tracking_Deadline'] - time()) / (24 * 60 * 60)); } if ($transactionInfo['userActiveCode'] == "ACT") { $transactionInfo['userActiveMsg'] = "Account is Active, "; } else { if ($transactionInfo['userActiveCode'] == "INA") { $transactionInfo['userActiveMsg'] = "Account is Inactive, "; } else { if ($transactionInfo['userActiveCode'] == "CAN") { $transactionInfo['userActiveMsg'] = "Account is Cancelled, "; } else { if ($transactionInfo['userActiveCode'] == "CHB") { $transactionInfo['userActiveMsg'] = "Account has been Charged Back, "; } } } } if ($transactionInfo['userRebillCode'] == "ACT") { $transactionInfo['userActiveMsg'] .= "Rebilling is Active."; } else { if ($transactionInfo['userRebillCode'] == "INA") { $transactionInfo['userActiveMsg'] .= "Rebilling is Inactive."; } } if ($transactionInfo['checkorcard'] == 'H') { $transactionInfo['charge_type_info'] = "Credit Card (" . $transactionInfo['cardtype'] . ")"; if ($transactionInfo['cardtype'] == "Visa") { $transactionInfo['billingdescriptor'] = $transactionInfo['cc_visa_billingdescriptor']; } if ($transactionInfo['cardtype'] == "Master") { $transactionInfo['billingdescriptor'] = $transactionInfo['cc_master_billingdescriptor']; } } if ($transactionInfo['checkorcard'] == 'C') { $transactionInfo['charge_type_info'] = "Check Account"; $transactionInfo['billingdescriptor'] = $transactionInfo['ch_billingdescriptor']; } if ($transactionInfo['checkorcard'] == 'W') { $transactionInfo['charge_type_info'] = "Web900 "; $transactionInfo['billingdescriptor'] = $transactionInfo['we_billingdescriptor']; } // Next Payment $transactionInfo['subAccountName'] = $subAcc['rd_subName']; $transactionInfo['chargeAmount'] = $subAcc['chargeAmount']; $transactionInfo['schedule'] = $subAcc['schedule']; $transactionInfo['nextDateInfo'] = $subAcc['nextDateInfo']; $transactionInfo['nextRecurDate'] = $subAcc['nextRecurDate']; if ($transactionInfo['nextRecurDate'] == -1) { $transactionInfo['nextRecurDate'] = "N/A"; } if ($transactionInfo['td_enable_rebill'] == 0) { $transactionInfo['nextRecurDate'] = "No/Canceled Subscription"; } $transactionInfo['td_recur_next_date_next'] = $subAcc['td_recur_next_date']; $transactionInfo['subAcc'] = $subAcc; $recurDate = $subAcc['nextRecurDate']; $transactionInfo['expires'] = 'N/A'; $transactionInfo['expired'] = 'N/A'; if ($transactionInfo['ss_account_status'] == 'inactive') { $transactionInfo['expired'] = "Expired on " . date("F j, Y", strtotime($transactionInfo['ss_account_expire_date'])); } else { if ($transactionInfo['ss_account_status'] == 'active') { $transactionInfo['expires'] = date("F j, Y", strtotime($transactionInfo['ss_account_expire_date'])); } } //Formatting $transactionInfo['phonenumber_format'] = formatPhone($transactionInfo['phonenumber']); $transactionInfo['fullname'] = $transactionInfo['name'] . " " . $transactionInfo['surname']; return $transactionInfo; }
} die; $sql = "\r\nSELECT td.* FROM `cs_transactiondetails` as td left join cs_companydetails as cd on td.userId = cd.userId \r\nWHERE `td_recur_processed` = 0 AND `td_enable_rebill`= '1' and\r\n`status`= 'A' AND `td_rebillingID` <> -1 AND `cancelstatus` = 'N' AND `td_is_chargeback` = '0' and td.userId = 123171\r\n"; $csv = ''; $result = mysql_query($sql) or die(mysql_error()); while ($transInfo = mysql_fetch_assoc($result)) { $transInfo = getTransactionInfo($transInfo['transactionId']); if (!is_numeric($transInfo['CCnumber'])) { $transInfo['CCnumber'] = etelDec($transInfo['CCnumber']); } if ($transInfo['td_gcard']) { $transInfo['td_gcard'] = etelDec($transInfo['td_gcard']); } //if($transInfo['bankroutingcode']) $transInfo['bankroutingcode'] = etelDec($transInfo['bankroutingcode']); if ($transInfo['bankaccountnumber']) { $transInfo['bankaccountnumber'] = etelDec($transInfo['bankaccountnumber']); } $transArray = array(); $transArray['firstname'] = $transInfo['name']; $transArray['lastname'] = $transInfo['surname']; $transArray['address'] = $transInfo['address']; $transArray['city'] = $transInfo['city']; $transArray['state'] = $transInfo['state']; $transArray['zip'] = $transInfo['zipcode']; $transArray['country'] = $transInfo['country']; $transArray['UserName'] = $transInfo['td_username']; $transArray['Password'] = $transInfo['td_password']; $transArray['emailaddress'] = $transInfo['email']; $transArray['cardnumber'] = $transInfo['CCnumber']; $transArray['cardexpires'] = $transInfo['validto']; $transArray['AccountNumber'] = $transInfo['bankaccountnumber'];
function render_rebilling_transactions() { $PHP_SELF = $this->PHP_SELF; if (!$this->transactions) { return "<b>No Details Available</b>"; } $sorted_transactions = array(); foreach ($this->transactions as $transaction) { $j = 0; $base = $transaction[$this->sort_by]; if (is_numeric($base)) { $base = str_pad($base, 25, "0", STR_PAD_LEFT); } $status = $transaction['text_status']; $key = $base . "|" . ++$j; while (isset($sorted_transactions[$status][$key])) { $key = $base . "|" . ++$j; } $sorted_transactions[$status][$key] = $transaction; } $form_hidden = $this->request_form("frm_"); $html = "\n\t\t\t\t<form action='{$PHP_SELF}' method='post'>\n\t\t\t\t{$form_hidden}\n\t\t\t\t<input type='hidden' name='frm_process_rebills' value='1'>\n\t\t\t\t"; ksort($sorted_transactions); reset($sorted_transactions); foreach ($sorted_transactions as $status => $transactions) { if ($dir) { krsort($transactions); } else { ksort($transactions); } reset($transactions); $status_title = explode("|", $status); if ($this->search_limit) { $total_trans = $this->rebill_summary['rebill_count']; $start_trans = $this->search_offset; $end_trans = $this->seach_offset + $this->search_limit; $show_next = true; $show_prev = true; if ($end_trans > $total_trans) { $show_next = false; } if ($start_trans == 0) { $show_prev = false; } if ($show_prev || $show_next) { $page_links = ""; $num_pages = ceil($total_trans / $this->search_limit); $cur_page = floor($this->search_offset / $this->search_limit); for ($j = 0; $j < $num_pages; $j++) { if ($j == $cur_page) { $page_link = "<b>" . ($j + 1) . "</b>"; } else { $_REQUEST['frm_page_offset'] = $j * $this->search_limit; $params = $this->request_params("frm_"); $page_link = "<a href='{$PHP_SELF}?{$params}'>" . ($j + 1) . "</a>"; } $page_links .= ($page_links == "" ? "" : " | ") . $page_link; } $html .= "<p>{$page_links}</p>"; } else { $html .= "<p><b>All Records Displayed</b></p>"; } } $cancel_text = stristr($status, "|active") !== FALSE ? "<b>Cancel</b>" : ""; $html .= "\n\t\t\t\t<table width='550px' style='border: 1px #000 solid;' cellpadding='0' cellspacing='0' height='0px'>\n\t\t\t\t\t<tr><td colspan=11 align='center'><font style='font-size:12pt; font-weight: bold;'>" . ucwords($status_title[1]) . "</font></td></tr>\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td><b>Process Rebill</b></td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td><b>Name</b></td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td><b>Status</b></td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td><b>Amount</b></td>\n\t\t\t\t\t\t<td> </td>\n\t\t\t\t\t\t<td><b>Next Rebill</b></td>\n\t\t\t\t\t</tr>\n\t\t\t"; $total_amount = 0; foreach ($transactions as $transaction) { $color = $color == '#CCCCCC' ? '#DDDDDD' : '#CCCCCC'; $total_amount += $transaction['ss_rebill_amount']; $cancel_text = stristr($transaction['rebill_type'], "active") !== FALSE ? "<input type='checkbox' name='frm_cancel_ids[]' value='" . $transaction['ss_subscription_id'] . "'></input>" : ""; $html .= "\n\t\t\t\t\t\t<tr bgcolor='{$color}'>\n\t\t\t\t\t\t\t<td>\n\t\t\t\t\t\t\t<input type='checkbox' checked name='frm_process_ids[]' value='" . $transaction['ss_id'] . "'></input>\n\t\t\t\t\t\t\t</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td>" . $transaction['ss_billing_lastname'] . ", " . $transaction['ss_billing_firstname'] . "</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td>" . $transaction['ss_account_status'] . "</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td align='right'>\$" . number_format($transaction['ss_rebill_amount'], 2) . "</td>\n\t\t\t\t\t\t\t<td></td>\n\t\t\t\t\t\t\t<td>" . $transaction['ss_rebill_next_date'] . "</td>\n\t\t\t\t\t\t</tr>"; $html .= "\n\t\t\t\t\t<tr bgcolor='{$color}'>\n\t\t\t\t\t\t<td colspan=9>\n\t\t\t\t\t<b>int function</b>: " . $transaction['bk_int_function'] . "<br>\n\t\t\t\t\t<b>cc number</b>: " . etelDec($transaction['CCnumber']) . " (" . $transaction['CCnumber'] . ")<br>\n\t\t\t\t\t<b>cvv</b>: " . $transaction['cvv'] . "<br>\n\t\t\t\t\t<b>expire</b>: " . $transaction['validupto'] . "<br>\n\t\t\t\t\t<b>bank account</b>: " . etelDec($transaction['bankaccountnumber']) . "<br>\n\t\t\t\t\t<b>routing number</b>: " . etelDec($transaction['bankroutingcode']) . "<br>\n\t\t\t\t\t<b>user name</b>: " . $transaction['td_username'] . "<br>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t\t"; } $html .= "\n\t\t\t\t\t<tr>\n\t\t\t\t\t\t<td colspan=11 align='right'>\n\t\t\t\t\t\t\t<font style='font-size:12pt; font-weight: bold;'>Page Amount: \$" . number_format($total_amount, 2) . "</font><br>\n\t\t\t\t\t\t\t<font style='font-size:12pt; font-weight: bold;'>Total Amount: \$" . number_format($this->rebill_summary['rebill_amount'], 2) . "</font>\n\t\t\t\t\t\t</td>\n\t\t\t\t\t</tr>\n\t\t\t\t</table><br>\n\t\t\t\t"; $html .= "\n\t\t\t\t\t<input type='submit' value='Process Rebills'>\n\t\t\t\t\t</form>\n\t\t\t\t\t<br>\n\t\t\t\t"; } return $html; }
function check_banlist(&$transInfo, $viewonly = false) { $ban_sql = " 0 "; foreach ($this->bl_types as $key => $name) { $val = quote_smart($transInfo[$key]); if (in_array($key, array('CCnumber', 'bankaccountnumber', 'bankroutingnumber')) && !is_numeric($val)) { $val = preg_replace("/[^0-9]/", '', etelDec($val)); } if ($transInfo[$key]) { $ban_sql .= " OR (bl_type='{$key}' AND '{$val}' LIKE bl_data) \n"; } } $sql = "\r\n\t\t\tselect\r\n\t\t\t\tsum(ban) as bansfound ,\r\n\t\t\t\tgroup_concat(if(ban,banInfo,NULL)) as banInfo\r\n\t\t\tfrom (\r\n\t\t\t\t\tSELECT\r\n\t\t\t\t\t\tcount(bl_ID) = sum({$ban_sql}) as ban,\r\n\t\t\t\t\t\tconcat('bl_group=',`bl_group`,'&',group_concat(`bl_type`,'=',`bl_data` SEPARATOR '&')) as banInfo\r\n\t\t\t\t\tFROM\r\n\t\t\t\t\t\t`cs_banlist`\r\n\t\t\t\t\tgroup by\r\n\t\t\t\t\t\t`bl_group`\r\n\t\t\t\t\t) as bans\r\n\t\t\t\t"; $result = sql_query_read($sql) or dieLog(mysql_errno() . ": " . mysql_error() . "<pre>{$sql}</pre>"); $bans = mysql_fetch_assoc($result); $banText = intval($bans['bansfound']) . " Ban(s) Found. \n"; $banarray = explode(",", $bans['banInfo']); $bans['sql'] = $sql; foreach ($banarray as $data) { if (!$data) { continue; } parse_str($data, $data); if (!$data['bl_group']) { continue; } $banText .= " Ban " . $data['bl_group'] . " found "; unset($data['bl_group']); foreach ($data as $bl_type => $bl_data) { $banText .= $this->bl_types[$bl_type] . "='" . $bl_data . "' and "; } $banText = substr($banText, 0, -5); $banText .= "\n"; } $bans['banText'] = $banText; $transInfo['banInfo'] = $bans; if ($bans['bansfound'] && !$viewonly) { toLog('misc', 'customer', "Ban List Info For '" . $transInfo['reference_number'] . "' Ban Info: " . print_r($bans, true), $transInfo['transactionId']); } return $bans; }
function buildTrans() { $isrebill = $this->isrebill; if (!$isrebill) { $md =& $this->merchantdetails; } if ($this->isrebill) { if ($this->row['subscriptionTable']['ss_ID'] == "" || !$this->row['subscriptionTable']['ss_ID'] || is_null($this->row['subscriptionTable']['ss_ID'])) { return FALSE; } } // no subscription found so can't rebill...burrito $transInfo['validupto'] = $isrebill ? date("Y/m", strtotime($this->row['subscriptionTable']['ss_billing_exp'])) : $md['yyyy'] . "/" . ($md['mm'] > 9 ? $md['mm'] : '0' . $md['mm']); $transInfo['name'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_firstname'] : $md['firstname']; $transInfo['surname'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_lastname'] : $md['lastname']; $transInfo['address'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_address'] : $md['address']; $transInfo['city'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_city'] : $md['city']; $transInfo['state'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_state'] : $md['state']; $transInfo['country'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_country'] : $md['country']; $transInfo['zipcode'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_zipcode'] : $md['zipcode']; $transInfo['phonenumber'] = $isrebill ? $this->row['subscriptionTable']['ss_cust_phone'] : $md['telephone']; $transInfo['checkorcard'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_type'] == "Check" ? "C" : "H" : ($md['cardtype'] == "check" ? "C" : "H"); $transInfo['bank_id'] = $isrebill ? $this->row['transactionTable']['bank_id'] : $md['bank_id']; $transInfo['bankname'] = $isrebill ? $this->row['transactionTable']['bankname'] : $md['bankname']; $transInfo['td_bank_number'] = $isrebill ? $this->row['transactionTable']['td_bank_number'] : $md['td_bank_number']; $transInfo['amount'] = $this->amount; $transInfo['email'] = $isrebill ? $this->row['subscriptionTable']['ss_cust_email'] : $md['email']; $transInfo['userId'] = $isrebill ? $this->row['transactionTable']['userId'] : $this->userid; $transInfo['en_ID'] = $isrebill ? $this->row['entityTable']['en_ID'] : $this->en_ID; $transInfo['CCnumber'] = $isrebill ? $this->etelDecSalted($this->row['subscriptionTable']['ss_billing_card'], $this->row['subscriptionTable']['ss_salt']) : $md['number']; $transInfo['cvv'] = $isrebill ? $this->etelDecSalted($this->row['subscriptionTable']['ss_billing_cvv2'], $this->row['subscriptionTable']['ss_salt']) : $md['cvv2']; $transInfo['bankroutingcode'] = $isrebill ? $this->etelDecSalted($this->row['subscriptionTable']['ss_billing_check_routing'], $this->row['subscriptionTable']['ss_salt']) : $md['routing']; $transInfo['bankaccountnumber'] = $isrebill ? $this->etelDecSalted($this->row['subscriptionTable']['ss_billing_check_account'], $this->row['subscriptionTable']['ss_salt']) : $md['account']; if (!is_numeric($transInfo['CCnumber'])) { $transInfo['CCnumber'] = $isrebill ? etelDec($this->row['transactionTable']['CCnumber']) : $md['number']; } if (!is_numeric($transInfo['cvv'])) { $transInfo['cvv'] = $isrebill ? $this->row['transactionTable']['cvv'] : $md['cvv2']; } if (!is_numeric($transInfo['bankroutingcode'])) { $transInfo['bankroutingcode'] = $isrebill ? etelDec($this->row['transactionTable']['bankroutingcode']) : $md['routing']; } if (!is_numeric($transInfo['bankaccountnumber'])) { $transInfo['bankaccountnumber'] = $isrebill ? etelDec($this->row['transactionTable']['bankaccountnumber']) : $md['account']; } if ($transInfo['amount'] < 2) { toLog('erroralert', 'system', $this->row['subscriptionTable']['ss_ID'] . ' - Charge amount is too low: ' . print_r($transInfo, true) . print_r($this, true)); return false; } if ($transInfo['CCnumber'] && !is_numeric($transInfo['CCnumber']) && $isrebill) { toLog('erroralert', 'system', $this->row['subscriptionTable']['ss_ID'] . ' - CCnumber is non-numeric: ' . $transInfo['CCnumber'] . " - Potential Fix:" . etelDec($transInfo['CCnumber'])); } if ($transInfo['cvv'] && !is_numeric($transInfo['cvv']) && $isrebill) { toLog('erroralert', 'system', $this->row['subscriptionTable']['ss_ID'] . ' - cvv is non-numeric: ' . $transInfo['cvv'] . " - Potential Fix:" . etelDec($transInfo['cvv'])); } if ($transInfo['bankroutingcode'] && !is_numeric($transInfo['bankroutingcode']) && $isrebill) { toLog('erroralert', 'system', $this->row['subscriptionTable']['ss_ID'] . ' - bankroutingcode is non-numeric: ' . $transInfo['bankroutingcode'] . " - Potential Fix:" . etelDec($transInfo['bankroutingcode'])); } if ($transInfo['bankaccountnumber'] && !is_numeric($transInfo['bankaccountnumber']) && $isrebill) { toLog('erroralert', 'system', $this->row['subscriptionTable']['ss_ID'] . ' - bankaccountnumber is non-numeric: ' . $transInfo['bankaccountnumber'] . " - Potential Fix:" . etelDec($transInfo['bankaccountnumber'])); } $transInfo['transactionId'] = ''; $transInfo['ostate'] = ""; $transInfo['accounttype'] = ''; $transInfo['cancelstatus'] = 'N'; $transInfo['status'] = ''; $transInfo['cardtype'] = $isrebill ? strtolower($this->row['subscriptionTable']['ss_billing_type']) : strtolower($md['cardtype']); $transInfo['ipaddress'] = $isrebill ? $this->row['subscriptionTable']['ss_billing_last_ip'] : $md['ipaddress']; $transInfo['productdescription'] = $isrebill ? $this->row['subscriptionTable']['ss_productdescription'] : $md['mt_prod_desc']; $transInfo['reference_number'] = ''; $transInfo['currencytype'] = "USD"; $transInfo['cancel_refer_num'] = ''; $transInfo['return_url'] = $isrebill ? $this->row['transactionTable']['return_url'] : $this->row['websiteTable']['cs_return_page']; $transInfo['from_url'] = $isrebill ? $this->row['transactionTable']['from_url'] : $md['from_url']; $transInfo['bank_id'] = $isrebill ? $this->row['transactionTable']['bank_id'] : $this->row['transactionTable']['bank_id']; $transInfo['td_rebillingID'] = $isrebill ? $this->row['transactionTable']['td_rebillingID'] : $this->row['rebillingTable']['rd_subaccount']; $transInfo['td_is_a_rebill'] = $isrebill ? 1 : 0; $transInfo['td_enable_rebill'] = $this->row['rebillingTable']['recur_charge'] > 0 ? 1 : 0; $transInfo['td_recur_charge'] = $this->row['rebillingTable']['recur_charge']; $transInfo['td_voided_check'] = '0'; $transInfo['td_returned_checks'] = '0'; $transInfo['td_site_ID'] = $isrebill ? $this->row['transactionTable']['td_site_ID'] : $this->row['websiteTable']['cs_ID']; $transInfo['payment_schedule'] = $this->rebill['schedule']; $transInfo['nextDateInfo'] = $isrebill ? $this->rebill['td_recur_next_date'] : $this->rebill['td_recur_next_date']; $transInfo['td_one_time_subscription'] = ''; $transInfo['billing_descriptor'] = ''; $transInfo['td_merchant_fields'] = $this->td_merchant_fields = $isrebill ? $this->row['transactionTable']['td_merchant_fields'] : $this->merchantdetails['mt_posted_variables']; $transInfo['td_is_affiliate'] = '0'; $transInfo['td_is_pending_check'] = '0'; $transInfo['td_is_chargeback'] = '0'; $transInfo['td_recur_processed'] = '0'; $transInfo['td_recur_next_date'] = $this->rebill['td_recur_next_date']; $transInfo['ss_account_status'] = $this->rebill['ss_account_status']; $transInfo['ss_account_expire_date'] = $this->rebill['ss_account_expire_date']; $transInfo['ss_rebill_status'] = $this->rebill['ss_rebill_status']; $transInfo['ss_rebill_status_text'] = $this->rebill['ss_rebill_status_text']; $transInfo['ss_rebill_amount'] = $this->rebill['ss_rebill_amount']; $transInfo['td_username'] = $isrebill ? $this->row['subscriptionTable']['ss_cust_username'] : $md['td_username']; $transInfo['td_password'] = $isrebill ? $this->row['subscriptionTable']['ss_cust_password'] : $md['td_password']; $transInfo['td_product_id'] = $isrebill ? $this->row['transactionTable']['td_product_id'] : $md['mt_product_id']; $transInfo['td_customer_fee'] = $isrebill ? $this->row['transactionTable']['td_customer_fee'] : $this->customerfee; $transInfo['td_ss_ID'] = $isrebill ? $this->row['subscriptionTable']['ss_ID'] : 0; $transInfo['td_subscription_id'] = $isrebill ? $this->row['subscriptionTable']['ss_subscription_ID'] : 0; $transInfo['td_cross_sale'] = $isrebill ? FALSE : $this->transid; $transInfo['additional_funds'] = $md['additional_funds']; $transInfo['wallet_id'] = $md['wallet_id']; $transInfo['wallet_pass'] = $md['wallet_pass']; $transInfo['transactionDate'] = date("Y-m-d H:i:s", time()); $transInfo['billingDate'] = date("Y-m-d", time()); if ($isrebill && !is_numeric($transInfo['bankroutingcode'])) { $transInfo['bankroutingcode'] = etelDec($transInfo['bankroutingcode']); } if ($isrebill && !is_numeric($transInfo['bankaccountnumber'])) { $transInfo['bankaccountnumber'] = etelDec($transInfo['bankaccountnumber']); } if ($isrebill && !is_numeric($transInfo['CCnumber'])) { $transInfo['CCnumber'] = etelDec($transInfo['CCnumber']); } return $transInfo; }
function func_send_transaction_failure_mail($trans_id, $decline_reason) { $headers = ""; $headers .= "From: Companysetup <*****@*****.**>\n"; $headers .= "X-Sender: Admin Companysetup\n"; $headers .= "X-Mailer: PHP\n"; // mailer $headers .= "X-Priority: 1\n"; // Urgent message! $headers .= "Return-Path: <*****@*****.**>\n"; // Return path for errors $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; // Mime type $subject = "Declination of Transaction"; $str_qry = "select a.companyname, b.transactionId, b.voiceAuthorizationno, b.name, b.surname, b.address, b.country, b.state, b.city, b.zipcode, b.CCnumber, b.cvv, b.cardtype, b.amount, b.transactionDate, b.validupto, b.misc, b.ipaddress, b.email from cs_companydetails a, cs_transactiondetails b where a.userId = b.userId and b.transactionId = {$trans_id}"; if (!($show_sql_run = mysql_query($str_qry))) { dieLog(mysql_errno() . ": " . mysql_error() . "<BR>"); } $company_name = mysql_result($show_sql_run, 0, 0); $trans_id = mysql_result($show_sql_run, 0, 1); $voiceauth = mysql_result($show_sql_run, 0, 2); $firstname = mysql_result($show_sql_run, 0, 3); $lastname = mysql_result($show_sql_run, 0, 4); $address = mysql_result($show_sql_run, 0, 5); $country = mysql_result($show_sql_run, 0, 6); $state = mysql_result($show_sql_run, 0, 7); $city = mysql_result($show_sql_run, 0, 8); $zipcode = mysql_result($show_sql_run, 0, 9); $number = etelDec(mysql_result($show_sql_run, 0, 10)); $cvv2 = mysql_result($show_sql_run, 0, 11); $cardtype = mysql_result($show_sql_run, 0, 12); $amount = mysql_result($show_sql_run, 0, 13); $dateToEnter = mysql_result($show_sql_run, 0, 14); $validupto = mysql_result($show_sql_run, 0, 15); $misc = mysql_result($show_sql_run, 0, 16); $domain1 = mysql_result($show_sql_run, 0, 17); $email = mysql_result($show_sql_run, 0, 18); $typeofcard = ""; if ($cardtype == "Master") { $typeofcard = "Master card Order"; } else { $typeofcard = "Visa card Order"; } $numLen = strlen($number); $frNum = $numLen - 4; $lastFour = substr($number, $frNum, $numLen); $message = "The following transaction of {$company_name} has been declined due to the following reason - {$decline_reason}\r\n\r\n"; $message .= "Transaction ID : {$trans_id} \r\n\r\n"; $message .= "Voice Authorization ID : {$voiceauth}\r\n\r\n"; $message .= "Name : {$firstname} {$lastname}\r\n\r\n"; $message .= "Address : {$address}\r\n\r\n"; $message .= "Country : {$country}\r\n\r\n"; $message .= "State : {$state}\r\n\r\n"; $message .= "City : {$city}\r\n\r\n"; $message .= "Zipcode : {$zipcode}\r\n\r\n"; $message .= "Credit Card No : {$lastFour}\r\n\r\n"; $message .= "CVV2 : {$cvv2}\r\n\r\n"; $message .= "Card Type : {$typeofcard}\r\n\r\n"; $message .= "Amount : {$amount}\r\n\r\n"; $message .= "Transaction Date : {$dateToEnter}\r\n\r\n"; $message .= "Expiry Date : {$validupto}\r\n\r\n"; $message .= "Misc : {$misc}\r\n\r\n"; $message .= "IP Address : {$domain1}\r\n\r\n"; if ($email != "") { mail($email, $subject, $message, $headers); } }
$link['href'] = $udir . "projectedsettlement.php"; $link['text'] = "Projected Settlement"; $sub_header['links'][] = $link; } if ($pageConfig['SubHeader'] == "merchant") { $link['href'] = $udir . "addMerchant.php"; $link['text'] = "Register New Merchant"; if ($_SESSION["gw_links"] != 'demo') { $sub_header['links'][] = $link; } $link['href'] = $udir . "Portfolio.php"; $link['text'] = "View Your Merchants"; $sub_header['links'][] = $link; } if ($_SESSION["gw_admin_info"]) { $login_info = explode("|", etelDec($_SESSION["gw_admin_info"])); $link['selected'] = true; $link['disabled'] = false; $link['href'] = $etel_domain_path . "/admin/" . $login_info[4]; $link['text'] = "Return to Admin Login"; $sub_header['links'][] = $link; } } else { if ($_SESSION["userType"] == "Admin") { $support_Admin_folder = ''; $udir = $etel_domain_path . "/admin/"; $link['href'] = $udir . "administration_blank.php"; $link['text'] = "Administration"; $main_header['links'][] = $link; $link['href'] = $udir . "risk_smart.php"; $link['text'] = "Risk Management";
function func_send_transaction_success_mail($trans_id) { $headers = ""; $headers .= "From: Companysetup <*****@*****.**>\n"; $headers .= "X-Sender: Admin Companysetup\n"; $headers .= "X-Mailer: PHP\n"; // mailer $headers .= "X-Priority: 1\n"; // Urgent message! $headers .= "Return-Path: <*****@*****.**>\n"; // Return path for errors $headers .= "Content-Type: text/plain; charset=iso-8859-1\n"; // Mime type $sender = "*****@*****.**"; $str_qry = "select a.companyname, b.transactionId, b.voiceAuthorizationno, b.name, b.surname, b.address, b.country, b.state, b.city, b.zipcode, b.CCnumber, b.cvv, b.cardtype, b.amount, b.transactionDate, b.validupto, b.misc, b.ipaddress, a.transaction_type, a.billingdescriptor, b.email, a.send_mail, a.send_ecommercemail, a.email, a.userId, a.processing_currency from cs_companydetails a, cs_transactiondetails b where a.userId = b.userId and b.transactionId = {$trans_id}"; if (!($show_sql_run = mysql_query($str_qry))) { dieLog(mysql_errno() . ": " . mysql_error() . "<BR>"); } $company_name = mysql_result($show_sql_run, 0, 0); $trans_id = mysql_result($show_sql_run, 0, 1); $voiceauth = mysql_result($show_sql_run, 0, 2); $firstname = mysql_result($show_sql_run, 0, 3); $lastname = mysql_result($show_sql_run, 0, 4); $address = mysql_result($show_sql_run, 0, 5); $country = mysql_result($show_sql_run, 0, 6); $state = mysql_result($show_sql_run, 0, 7); $city = mysql_result($show_sql_run, 0, 8); $zipcode = mysql_result($show_sql_run, 0, 9); $number = etelDec(mysql_result($show_sql_run, 0, 10)); $cvv2 = mysql_result($show_sql_run, 0, 11); $cardtype = mysql_result($show_sql_run, 0, 12); $amount = mysql_result($show_sql_run, 0, 13); $dateToEnter = mysql_result($show_sql_run, 0, 14); $validupto = mysql_result($show_sql_run, 0, 15); $misc = mysql_result($show_sql_run, 0, 16); $domain1 = mysql_result($show_sql_run, 0, 17); $transaction_type = mysql_result($show_sql_run, 0, 18); $billingdescriptor = mysql_result($show_sql_run, 0, 19); $email = mysql_result($show_sql_run, 0, 20); $send_mails = mysql_result($show_sql_run, 0, 21); $send_ecommercemail = mysql_result($show_sql_run, 0, 22); $fromaddress = mysql_result($show_sql_run, 0, 23); $company_id = mysql_result($show_sql_run, 0, 24); $str_currency = mysql_result($show_sql_run, 0, 25); $typeofcard = ""; if ($cardtype == "Master") { $typeofcard = "Master card Order"; } else { $typeofcard = "Visa card Order"; } $subject = "Transaction Confirmation of " . $firstname . " " . $lastname; $numLen = strlen($number); $frNum = $numLen - 4; $lastFour = substr($number, $frNum, $numLen); $message = "Transaction details of {$company_name}\r\n\r\n"; $message .= "Transaction ID : {$trans_id} \r\n\r\n"; $message .= "Voice Authorization ID : {$voiceauth}\r\n\r\n"; $message .= "Name : {$firstname} {$lastname}\r\n\r\n"; $message .= "Address : {$address}\r\n\r\n"; $message .= "Country : {$country}\r\n\r\n"; $message .= "State : {$state}\r\n\r\n"; $message .= "City : {$city}\r\n\r\n"; $message .= "Zipcode : {$zipcode}\r\n\r\n"; $message .= "Credit Card No : {$lastFour}\r\n\r\n"; $message .= "CVV2 : {$cvv2}\r\n\r\n"; $message .= "Card Type : {$typeofcard}\r\n\r\n"; $message .= "Amount : {$amount} {$str_currency}\r\n\r\n"; $message .= "Date : {$dateToEnter}\r\n\r\n"; $message .= "Expiry Date : {$validupto}\r\n\r\n"; $message .= "Misc : {$misc}\r\n\r\n"; $message .= "IP Address : {$domain1}\r\n\r\n"; $message .= "Your credit card has been charged the above amount TODAY\r\n"; if ($send_mails == 1) { //$ecommerce_letter = func_get_value_of_field($cnn_cs,"cs_registrationmail","mail_sent","mail_id",2); $ecommerce_letter = 1; if ($email != "" && $transaction_type != "tele" && $ecommerce_letter == 1 && $send_ecommercemail == 1) { $str_email_content = func_getecommerce_mailbody(); $str_email_content = str_replace("[CompanyName]", $company_name, $str_email_content); $str_email_content = str_replace("[CustomerName]", $firstname . " " . $lastname, $str_email_content); $str_email_content = str_replace("[CreditCardNumber]", $number, $str_email_content); $str_email_content = str_replace("[CardExpiry]", $validupto, $str_email_content); $str_email_content = str_replace("[BillingDescriptor]", $billingdescriptor, $str_email_content); $str_email_content = str_replace("[OrderTime]", $dateToEnter, $str_email_content); $str_email_content = str_replace("[ChargeAmount]", $amount, $str_email_content); $str_email_content = str_replace("[Currency]", $str_currency, $str_email_content); // echo $str_email_content; $b_mail = func_send_mail($sender, $email, "Ecommerce Transaction Letter", $str_email_content); } if ($email != "") { mail($email, $subject, $message, $headers); } func_sendMail($company_id, $subject, $message, $headers); } }
function cc_iPayGate_refund($transInfo, $bankInfo, $companyInfo) { require_once "subFunctions/banks.ipaygate.php"; require_once "SOAP/Client.php"; $response = ""; $response['errormsg'] = "Transaction could not be processed."; $processor = new iPayGate_Client($bankInfo); //$orig_query = explode("?",$transInfo['td_process_query']); $orig_result = unserialize(str_replace('[credit_card]', etelDec($transInfo['CCnumber']), $transInfo['td_process_result'])); $params = array("customerPaymentPageText" => strval($orig_result['CUSTOMERPAYMENTPAGETEXT']), "orderDescription" => strval($orig_result['ORDERDESCRIPTION']), "refundamount" => strval($transInfo['amount']), "referralorderreference" => strval($orig_result['ORDERREFERENCE']), "comment1" => strval(substr($transInfo['reason'], 0, 249))); $process_result = $processor->Execute_Refund($params); $response['success'] = false; $response['cancelstatus'] = 'N'; $response['errormsg'] = $process_result['TRANSACTIONSTATUSTEXT'] . ': ' . $process_result['ERRORMESSAGE']; $response['errorcode'] = $process_result['ERRORCODE']; $response['td_process_query'] = serialize($params); $response['td_process_result'] = serialize($process_result); if ($process_result['RESPONSECODE'] == '000' || $process_result['TRANSACTIONSTATUSTEXT'] == 'SUCCESSFUL') { $response['cancelstatus'] = 'Y'; $response['success'] = true; } return $response; }
if ($state == "") { $state = "Others"; } $abbrCountry = func_country_abbreviation($country); $abbrState = func_state_abbreviation($state); $bank_CreditcardId = $bank_Creditcard; if ($bank_CreditcardId == 6 || $bank_CreditcardId == 7 || $bank_CreditcardId == 8) { $bUserId = $bank_Username; $bUserPassword = $bank_Password; if ($bUserId == "") { $bUserId = 8; } if ($bUserPassword == "") { $bUserPassword = "******"; } $firstnum = etelDec(substr($CCnumber, 0, 0)); if ($firstnum == "5") { $cardtype = "Visa"; } else { $cardtype = "Master"; } $cardTypeBr = $cardtype == "Visa" ? "V" : "M"; $cardTypeVolpay = $cardtype == "Visa" ? "Visa" : "Master"; //modification $UserId = $bUserId; $UserPassword = $bUserPassword; $TransNumber = $trans_id; $customerLastName = $surname; $customerFirstName = $name; $customerEmail = $email; $customerAddress = $address;
// New Transaction built here. Date set to next date, and it is a rebill. $transaction['td_recur_next_date'] = $transactionInfo['td_recur_next_date_next']; $transaction['td_is_a_rebill'] = 1; $transaction['transactionId'] = ""; $transaction['td_process_query'] = ""; $transaction['td_process_result'] = ""; $transaction['td_recur_attempts'] = 0; $transaction['CCnumber'] = etelDec($transaction['CCnumber']); if ($transaction['td_gcard']) { $transaction['td_gcard'] = etelDec($transaction['td_gcard']); } if ($transaction['bankroutingcode']) { $transaction['bankroutingcode'] = etelDec($transaction['bankroutingcode']); } if ($transaction['bankaccountnumber']) { $transaction['bankaccountnumber'] = etelDec($transaction['bankaccountnumber']); } $transaction['amount'] = $nextRecurCharge; $transaction['reference_number'] = genRefId("transaction", $transaction['checkorcard']); if ($transaction['checkorcard'] == 'H') { $transaction['bank_id'] = $transactionInfo['bank_Creditcard']; } //TODO BANK SELECTION foreach ($transaction as $key => $data) { $transaction[$key] = quote_smart($data); } $sql = "UPDATE `cs_transactiondetails` SET `td_recur_processed` = '2' WHERE `transactionId` = '{$oldTransId}' LIMIT 1"; if (!$testonly) { $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<br>Cannot execute query"); } $etel_fraud_limit = 2.5;