0

我正在使用 CI IPN 库,就它们的功能而言,一切运行顺利,所有 txn 信息都提交给数据库,这意味着脚本被调用并运行。但是,当我尝试在成功的 txn 的情况下添加我自己的指令时 - 即向客户发送电子邮件并将他的详细信息添加到数据库 - 它完全忽略了我的代码。我试图删除“如果成功”的条件,它仍然不起作用。重要的是要注意,当我通过来自另一个控制器的直接调用在 IPN 控制器之外运行这些模型时,它们运行良好。这是代码:

    class Ipn extends CI_Controller {

    // To handle the IPN post made by PayPal (uses the Paypal_Lib library).
    public function index()

    {

    $this->load->library('PayPal_IPN'); // Load the library

    // Try to get the IPN data.
    if ($this->paypal_ipn->validateIPN())
    {
        // Succeeded, now let's extract the order
        $this->paypal_ipn->extractOrder();

        // And we save the order now 
        $this->paypal_ipn->saveOrder();

        // Now let's check what the payment status is and act accordingly
        if ($this->paypal_ipn->orderStatus == PayPal_IPN::PAID)
        { 
            $this->load->model("register_model"); // my own code
            $this->register_model->insert(); // my own code
            $this->register_model->email_customer(); //my own code
        } // end if PAID
    } 
    else // Just redirect to the root URL
    {
        $this->load->helper('url');
        redirect('/', 'refresh');
    } // end if validates
  } // end function
 } // end class

TIA 为您提供帮助。马塔尼亚

4

1 回答 1

1

调试您的 Paypal IPN 代码可能是一场噩梦,我遇到了类似的麻烦,最终将控制器中的变量记录到文件中。

您确定您的“register_model”模型没有问题吗?也许尝试添加一些日志,检查您收到的变量。如果它记录并且一切看起来都正确,您需要查看您的“register_model”模型。

于 2012-05-20T06:46:05.610 回答