Reputation: 789
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)
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.
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.
Upvotes: 1
Views: 1224
Reputation: 1357
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.
Upvotes: 7