Пример #1
0
$res = curl_exec($ch);
if (curl_errno($ch) != 0) {
    curl_close($ch);
    exit;
} else {
    curl_close($ch);
}
$tokens = explode("\r\n\r\n", trim($res));
$res = trim(end($tokens));
if (strcmp($res, "VERIFIED") == 0) {
    // check that payment_amount/payment_currency are correct
    // process payment and mark item as paid.
    if ($_POST['payment_status'] == "Completed") {
        if (IPN . CheckPaymentEmail($_POST['receiver_email'])) {
            if (IPN . CheckTXNID($_POST['txn_id'])) {
                // Log the payment
                IPN . ProcessPayment($_POST['txn_id'], $_POST['payer_email'], $_POST['custom'], $_POST['mc_currency'], $_POST['mc_gross'], $_POST['first_name'], $_POST['last_name'], $_POST['address_street'], $_POST['address_zip'], $_POST['address_country']);
            } else {
                error_log(date('[Y-m-d H:i e] ') . "Recieved IPN for processed payment (" . $_POST['txn_id'] . ")" . PHP_EOL, 3, LOG_FILE);
            }
        } else {
            error_log(date('[Y-m-d H:i e] ') . "Recieved IPN for " . $_POST['receiver_email'] . ", rather than " . PAYPAL_EMAIL . PHP_EOL, 3, LOG_FILE);
        }
    } else {
        error_log(date('[Y-m-d H:i e] ') . "Recieved IPN for a " . $_POST['payment_status'] . " payment" . PHP_EOL, 3, LOG_FILE);
    }
} else {
    if (strcmp($res, "INVALID") == 0) {
        error_log(date('[Y-m-d H:i e] ') . "Invalid IPN: {$req}" . PHP_EOL, 3, LOG_FILE);
    }
}
Пример #2
0
// programmer:	b.mahdipour
// Date:		94.11
//---------------------------
require_once '../../../header.inc.php';
require_once '../class/payment_calculation.class.php';
require_once '../class/payments.class.php';
require_once '../class/payment_cancel.class.php';
require_once '../../../baseInfo/class/salary_item_report.class.php';
require_once '../class/arrear_pay_calculation.class.php';
require_once inc_QueryHelper;
require_once inc_response;
require_once inc_dataReader;
$task = isset($_REQUEST["task"]) ? $_REQUEST["task"] : "";
switch ($task) {
    case "ProcessPayment":
        ProcessPayment();
    case "getProgress":
        getProgress();
    case "confirmation":
        confirmation();
    case "Remove":
        Remove();
        //-----------------------------
    //-----------------------------
    case "registerDoc":
        registerDoc();
    case "deleteDoc":
        deleteDoc();
    case "DifferSalaryItems":
        DifferSalaryItems();
    case "ProcessArrearPayment":