patch for multiple WPP accounts

18 views
Skip to first unread message

llonchj

unread,
Jan 28, 2011, 9:27:18 PM1/28/11
to django-paypal
Hello,

I'm planning to use django-paypal in a website as a service, the users
will have paypal bussiness accounts and the website will create paypal
transactions to them as receiver. This is why WPP parameters may be
different on each call.

I have not found this feature in django-paypal, so, I changed 2 lines
in paypal/pro/helpers.py, here's the patch:

-------------------------------
CUT_HERE--------------------------------------------------------------
--- paypal/pro/helpers.old.py 2011-01-29 09:25:09.000000000 +1100
+++ paypal/pro/helpers.py 2011-01-29 13:11:19.000000000 +1100
@@ -57,7 +57,8 @@
self.endpoint = SANDBOX_ENDPOINT
else:
self.endpoint = ENDPOINT
- self.signature_values = params
+ paypal_params = getattr(self.request, "PAYPAL_WPP", params)
+ self.signature_values = paypal_params
self.signature = urlencode(self.signature_values) + "&"

def doDirectPayment(self, params):
-------------------------------
CUT_HERE--------------------------------------------------------------



An implementation example can be:

-------------------------------
CUT_HERE--------------------------------------------------------------
from paypal.pro.helpers import VERSION as WPP_VERSION
wpp_user = "***********************************"
wpp_password = "***********************************"
wpp_signature = "***********************************"

wpp = dict(USER=wpp_user , PWD=wpp_password, SIGNATURE=wpp_signature,
VERSION=WPP_VERSION)
request.PAYPAL_WPP = wpp

ppp = PayPalPro(**kw)
result = ppp(request)
-------------------------------
CUT_HERE--------------------------------------------------------------


And I have 2 questions:

1) Can be this patch included in the repository?

2) Anyone has a good idea on how to implement a similar feature for
the PAYPAL_RECEIVER_EMAIL setting?

Regards,
Jordi
Reply all
Reply to author
Forward
0 new messages