if (!$testonly) {
                    $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<br>Cannot execute query");
                }
                $nextRecurCharge = $transactionInfo['chargeAmount'];
                $suboutput .= "Old Transaction Rebilling Disabled.\n\r";
                $newTransId = $response['transactionId'];
                $suboutput .= "New Transaction (ID={$newTransId}) Created Successfully.\n\r";
                $suboutput .= "Customer Charged successfully.\n\r";
            } else {
                $try_again_date = date("Y-m-d", time() + 1 * 60 * 60 * 24);
                $newTransId = $response['transactionId'];
                $sql = "UPDATE `cs_transactiondetails` SET `td_recur_next_date` = '{$try_again_date}', `td_recur_processed` = '0', `td_recur_attempts` = `td_recur_attempts`+1 WHERE `transactionId` = '{$oldTransId}' LIMIT 1";
                if (!$testonly) {
                    $result = mysql_query($sql, $cnn_cs) or dieLog(mysql_errno() . ": " . mysql_error() . "<br>Cannot execute query");
                }
                $suboutput .= "Transaction Declined (ID={$newTransId}), Error: " . $response['errormsg'];
                if (intval($transaction['td_recur_attempts']) >= $attempts_max) {
                    $suboutput .= "No more rebilling attempts. Attempt #" . intval($transaction['td_recur_attempts']) . " >= {$attempts_max}.\n\r";
                    sendTransactionEmail($newTransId, "customer_rebill_decline_confirmation", $testonly);
                } else {
                    $suboutput .= "Will try billing again on {$try_again_date}. Attempt #" . intval($transaction['td_recur_attempts']) . "\n\r";
                }
            }
            //die($sql);
            // Charge customer here.
        }
    }
    toLog('rebill', 'system', $suboutput, $newTransId);
    $output .= $suboutput;
}
print nl2br($output);
Example #2
0
<?php

die;
include 'includes/sessioncheckuser.php';
require_once "includes/dbconnection.php";
$headerInclude = "transactions";
include 'includes/header.php';
require_once 'includes/function.php';
beginTable();
?>
	<table border="1" cellspacing="0" width="100%" class="report"  cellpadding="3">
<?php 
$sessionlogin = isset($HTTP_SESSION_VARS["sessionlogin"]) ? $HTTP_SESSION_VARS["sessionlogin"] : "";
if ($_POST['action'] && $_POST['refid']) {
    echo "<tr><td align='center' colspan='2'>";
    $res = sendTransactionEmail($_POST['refid'], $_POST['action'], $_POST['testmode'], 'reference_number');
    echo "<h3>E-Mail Sent To:</h3><table>";
    foreach ($res as $email) {
        echo "<tr><td>" . $email['email'] . "</td><td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td>" . $email['copy'] . "</td></tr>";
    }
    echo "</table>";
}
?>

    <tr>
	  <td width="50%"><b>Enter Transaction Reference ID: </b></input></td>
  	  <td width="50%"><input type=text name="refid"></td>
    </tr>
    <tr>
   		 <td width="50%">
			<b>Select Notification: </b></td>