django-paypal IPN信号未收到 [英] django-paypal IPN signals not being received

查看:87
本文介绍了django-paypal IPN信号未收到的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在models.py的底部,我有:

At the bottom of models.py I have:

from paypal.standard.ipn.signals import payment_was_successful, payment_was_flagged
import pay

payment_was_successful.connect(pay.paypal_success)
payment_was_flagged.connect(pay.paypal_flagged)

我正在使用Paypal Developer IPN模拟器,它返回"IPN发送成功",但是pay.paypal_successpay.paypal_flagged中的代码未执行.

I'm using the Paypal Developer IPN simulator and it returns "IPN sent successfully", but the code in pay.paypal_success and pay.paypal_flagged isn't being executed.

正在填充paypal_ipn表,但是我注意到在flag_info下每一行都有:

The paypal_ipn table is being populated, however I noticed under flag_info every row has:

Invalid form. (<ul class="errorlist"><li>payment_date<ul class="errorlist">
<li>Enter a valid date/time.</li></ul></li></ul>)

我不知道这是否与信号不起作用有关.

I don't know if this has anything to do with the signals not working.

推荐答案

我遇到了同样的问题.

I've had the same problem.

显然,IPN模拟器发送的日期格式与django-paypal软件包接受的日期格式不同.

Apparently the date format the IPN simulator sends is different from the one the django-paypal package accepts.

转到paypal.standard.forms.py并添加PayPal发送的新格式日期".

Head over to paypal.standard.forms.py and add the 'new format date' PayPal sends.

PAYPAL_DATE_FORMAT = ("%H:%M:%S %b. %d, %Y PST",
                      "%H:%M:%S %b. %d, %Y PDT",
                      "%H:%M:%S %d %b %Y PST",    # note this
                      "%H:%M:%S %d %b %Y PDT",    # and that
                      "%H:%M:%S %b %d, %Y PST",
                      "%H:%M:%S %b %d, %Y PDT",)

我不喜欢这种解决方案,因为如果PayPal将来更改日期字符串格式怎么办?

I don't like this solution, because what if PayPal changes the date string format in the future?

这实际上是Python的datetime对象的一个​​警告,该对象不知道如何轻松地将字符串轻松转换为实际时间对象.

This is actually a caveat of Python's datetime object that does not know how to easily convert strings to actual time objects easily.

但是现在就可以了.

这篇关于django-paypal IPN信号未收到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆