コード例 #1
0
ファイル: paypal_ipn.php プロジェクト: pratishshr/Aawaaj
    // assign posted variables to local variables
    $item_name = $_POST['item_name'];
    $item_number = $_POST['item_number'];
    $payment_status = $_POST['payment_status'];
    $r = $_POST['mc_gross'];
    $payment_currency = $_POST['mc_currency'];
    $txn_id = $_POST['txn_id'];
    $receiver_email = $_POST['receiver_email'];
    $payer_email = $_POST['payer_email'];
    //INSERT ACTIONS HERE
    if ($payment_status == "Completed") {
        $pay = new Paypal();
        $pay->set_item_name($item_name);
        $pay->set_payment_amount($payment_amount);
        $pay->set_txn_id($txn_id);
        $pay->set_receiver_email($receiver_email);
        $pay->set_payer_email($payer_email);
        $this->payrepository->insert($pay);
    }
    if (DEBUG == true) {
        error_log(date('[Y-m-d H:i e] ') . "Verified IPN: {$req} " . PHP_EOL, 3, LOG_FILE);
    }
} else {
    if (strcmp($res, "INVALID") == 0) {
        // log for manual investigation
        // Add business logic here which deals with invalid IPN messages
        if (DEBUG == true) {
            error_log(date('[Y-m-d H:i e] ') . "Invalid IPN: {$req}" . PHP_EOL, 3, LOG_FILE);
        }
    }
}