Beispiel #1
0
        // field name recurring_payment_id instead of txn_id for recurring profiles (PayPal)
        if (!$txn_id) {
            $txn_id = isset($_POST['recurring_payment_id']) ? $dbSocket->escapeSimple($_POST['recurring_payment_id']) : "";
        }
        // sadly, on some txn_type's like subscribe and not payment the field name will be subscr_id and on recurring payments it
        // will be recurring_payments_id, though both of those fields are idential, just differ in the different transactions types
        // being made.
        if (!$txn_id) {
            $txn_id = isset($_POST['subscr_id']) ? $dbSocket->escapeSimple($_POST['subscr_id']) : "";
        }
        provisionUser($dbSocket, $txnId, $txn_id);
        include 'library/closedb.php';
    } else {
        // log for manual investigation
        logToFile();
        saveToDb();
    }
    fclose($fp);
}
/*****************************************************************************************
 * logToFile()
 * logs all post variables to file
 *
 * $customMsg		custom text to be written to the log file
 *****************************************************************************************/
function logToFile($customMsg = "")
{
    include 'library/config_read.php';
    $fh = fopen($configValues['CONFIG_LOG_MERCHANT_IPN_FILENAME'], 'a');
    if ($fh) {
        // only if the file size is 0 (meaning it's a new file) then we shuld
Beispiel #2
0
// Check validity and write it down.
if ($my2CO->validateIpn()) {
    $logFile = $configValues['CONFIG_LOG_MERCHANT_IPN_FILENAME'];
    logToFile("\n", $logFile);
    saveToDb($my2CO->ipnData, "Completed");
    include 'library/opendb.php';
    require_once 'include/common/provisionUser.php';
    // the payment is valid, we activate the user by adding him to freeradius's set of tables (radcheck etc)
    // get transaction id from 2checkout ipn POST
    $txnId = $dbSocket->escapeSimple($my2CO->ipnData['custom']);
    provisionUser($dbSocket, $txnId);
    include 'library/closedb.php';
} else {
    $logFile = $configValues['CONFIG_LOG_MERCHANT_IPN_FILENAME'];
    logToFile("\n", $logFile);
    saveToDb($my2CO->ipnData, "Failed");
}
/*****************************************************************************************
 * saveToDb()
 * saves the 2co session variables (in POST) to database table billing_merchant
 *****************************************************************************************/
function saveToDb($postData, $status)
{
    include 'library/opendb.php';
    $txnId = $dbSocket->escapeSimple($postData['custom']);
    $planId = $dbSocket->escapeSimple($postData['cart_order_id']);
    $business_id = $dbSocket->escapeSimple($postData['sid']);
    $payment_total = $dbSocket->escapeSimple($postData['total']);
    $payer_email = $dbSocket->escapeSimple($postData['email']);
    $payer_phone = $dbSocket->escapeSimple($postData['phone']);
    $payer_address_street = $dbSocket->escapeSimple($postData['street_address']);