django-paypal IPN signals not being received

为君一笑 提交于 2019-12-04 19:41:08
Amir Eldor

I've had the same problem.

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

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",)

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

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

But that works for now.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!