views:

28

answers:

1

I'm using dcramer's fork of django-paypal and I've been successful in setting it up until now. I tried to connect 'paypal.pro.signals.payment_was_successful' to a listener I wrote but it sends the signal multiple times which is causing errors in my application. I've tried adding the 'dispatch_uid' to my connect statement but it still sends it multiple times... What am i doing wrong? Should I even be using this signal?

A: 

It's pretty straightforward at the moment. I registered the signal in my app's init.py

in init.py

from paypal.pro.signals import payment_was_successful
from listeners import paypal_payment_processed

payment_was_successful.connect(paypal_payment_processed)

in listeners.py

def paypal_payment_processed(sender, **kwargs):
   print 'signal called'

then my view for the django-paypal wrapper contains the following:

def apartment_store_lease_step_4_content(request, apartment_id, lease_obj):

item = {
    "amt": total,
    "custom": lease_obj.id ,
    "cancelurl" : "OMITTED",
    "returnurl" : "OMITTED"
}

ctx = {        
    "lease_purchase" : lease_obj,
    "contract" : contract
}
ctx.update(locals())


kw = {
    "item" : item,
    "payment_template" : "OMITTED",
    "confirm_template" : "OMITTED",
    "success_url" :  "OMITTED",
    "context": ctx
}

ppp = PayPalPro(**kw)
return ppp(request)
kaleb
Once PayPal responds, I see "signal called" twice in the output.
kaleb