require("/home/sites/123bill.com/includes/config.php");
require("$basepath/includes/subs.php");
/*************************************
refund1.php
Prompt user to verify refund
trans_id, recur_id passed in via GET
*************************************/
require("$basepath/merch/auth_merch.php");
$tid = $_GET['tid'];
$rid = $_GET['rid'];
$mid = $merch_id;
do_header('M', "Issue Refund");
db_connect();
// Get transaction
$query = "SELECT * FROM trans WHERE trans_id='$tid'";
$result = db_query($query,__LINE__ ,__FILE__);
$number = MYSQL_NUMROWS($result);
if($number < 1) {
do_error("No Transaction Found for Trans_id=$tid ");
}
$row = mysql_fetch_assoc($result);
extract($row);
if($merch_id <> $mid) { do_error("Access Denied."); }
if($status == 'R') { do_error("Transaction has Already Been Refunded on $r_date - Ref Trans $ref_trans_id"); }
if($auth_lvl >= $adm_auth) {
if(($trans_type != 'S') && ($trans_type != 'R') && ($trans_type != 'F')) {
do_error("This Transaction cannot be refunded");
}
} else {
if(($trans_type != 'S') && ($trans_type != 'R')) {
do_error("This Transaction cannot be refunded");
}
}
// Get Cust Info
$query = "SELECT f_name, m_name, l_name, gen_code FROM cust WHERE cust_id='$cust_id'";
$cresult = db_query($query,__LINE__ ,__FILE__);
$cnumber = MYSQL_NUMROWS($cresult);
if($cnumber < 1) { do_error("Internal Error - Cust_id invalid in trans rec for trans_id=$trans_id"); }
list($f_name, $m_name, $l_name, $gen_code) = mysql_fetch_row($cresult);
// Get recur record
$rcr = '';
if((($trans_type == 'S') || ($trans_type == 'R')) && ($is_recurring == 'Y')) {
$query = "SELECT is_recurring, recur_amt, recur_per, last_rcr_trans_id, last_rcr_trans_date, last_rcr_amount, recur_count, recur_total, next_recur, cancel_date, cancel_trans_id FROM recur WHERE recur_id='$ref_recur_id'";
$rresult = db_query($query,__LINE__ ,__FILE__);
$rnumber = MYSQL_NUMROWS($rresult);
if($rnumber < 1) { do_error("Internal Error - Ref_recur_id invalid in trans rec for trans_id=$trans_id"); }
list($isr, $ra, $rp, $last_rcr_trans_id, $last_rcr_trans_date, $last_rcr_amount, $recur_count, $recur_total, $next_recur, $cancel_date, $cancel_trans_id) = mysql_fetch_row($rresult);
if($isr = 'Y') {
$rcr = "Next Rebill on $next_recur for $ra
";
} else {
$rcr = "Rebilling Canceled on $cancel_date
";
}
}
$descp = get_descp($merch_id,$site_id,$item_id,$trans_id);
print "
| Issue Refund | |
|---|---|
| Trans ID - $trans_id $descp Purchased on $trans_date By Customer # $cust_id - $f_name $m_name $l_name $gen_code $rcr |