fundedbyme / django-paypal-adaptive Goto Github PK
View Code? Open in Web Editor NEWPaypal Adaptive API support for Django
Paypal Adaptive API support for Django
I get this import error:
from paypaladaptive.models import Payment
---------------------------------------------------------------------------
ImportError Traceback (most recent call last)
<ipython-input-5-00fc3784f2db> in <module>()
----> 1 from paypaladaptive.models import Payment
/home/nmundar/.virtualenvs/test/local/lib/python2.7/site-packages/paypaladaptive/models.py in <module>()
9 from django.utils import simplejson as json
10
---> 11 from money.contrib.django.models.fields import MoneyField
12
13 import settings
ImportError: No module named contrib.django.models.fields
I used pip to install your package which installed python-money as a dependency.
Django==1.5.4
django-paypal-adaptive==0.2.2
python-money==0.5
I have several cases where, when generating payments using a Preapproval, the IPN response will get a 400 Bad Request response, as seen in the IPN History of my PayPal account.
I was able to trace this down to https://github.com/FundedByMe/django-paypal-adaptive/blob/master/paypaladaptive/api/ipn/endpoints.py#L84
The reason being, PayPal is acting inconsistent from their documentation (surprise!). An example of a response they are sending looks like the following (censored for identifying details):
payment_request_date=Wed Jan 08 23:30:05 PST 2014&return_url=http://scottsmarketplace.com/paypal/adaptive/pay/return/14/xxxxxxxxxxxxxxxxxxxx/&fees_payer=EACHRECEIVER&ipn_notification_url=http://scottsmarketplace.com/paypal/adaptive/ipn/14/xxxxxxxxxxxxxxxxxxxx/&[email protected]&verify_sign=xxxxxxxxxxxxxxxxxxxx-xxxxxxxxxxxxxxxxxxxx&transaction[0].id_for_sender_txn=xxxxxxxxxxxxxxxxxxxx&transaction[0][email protected]&cancel_url=http://scottsmarketplace.com/paypal/adaptive/pay/cancel/14/xxxxxxxxxxxxxxxxxxxx/&transaction[0].is_primary_receiver=false&reason_code=CLEARED&pay_key=AP-xxxxxxxxxxxxxxxxxxxx&action_type=PAY&transaction[0].id=xxxxxxxxxxxxxxxxxxxx&transaction[0].status=Completed&transaction[0].paymentType=SERVICE&preapproval_key=PA-xxxxxxxxxxxxxxxxxxxx&transaction[0].status_for_sender_txn=Completed&transaction[0].pending_reason=NONE&transaction[0].amount=USD 9.99&status=COMPLETED&log_default_shipping_address_in_transaction=false&charset=windows-1252¬ify_version=UNVERSIONED&reverse_all_parallel_payments_on_error=false
Lots of censoring, obviously, but if you look carefully you will see that there is no transaction_type
provided. They only sent back an action_type
.
Has anybody else noticed this? My proposed solution so far would be defaulting the transaction_type
to "Adaptive Payment PAY" but I haven't yet found any documentation to support that decision.
Is this a change which would be open to a pull request?
No templates directory in package on PyPI.
I tried to install the django-paypal-adaptive Getting this error.
../django-paypal-adaptive-master$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 9, in
version=".".join(map(str, paypaladaptive.version)),
NameError: name 'paypaladaptive' is not defined
I have several cases where I need to perform actions upon receiving an IPN response, but I'm finding it somewhat difficult at the moment.
While I could attach to the individual model post_save signals (Preapproval, for instance) and figure out from there what state the instance is in, I would much prefer to simply listen to a signal such as "preapproval_approved", "preapproval_canceled" etc. so that I don't need to duplicate any logic for figuring out the state.
My primary use case for this is at the moment: When a user signs up on our site, we don't want their account to be active until they have a valid preapproval. However, there are some cases where PayPal doesn't respond immediately (or at all) with an IPN. We also need to be able to deactivate their account when an IPN is canceled.
Hi there.
I am trying to use this library you built for adaptive payments and have found a few missing libraries - but cannot find the last one which is the MoneyField.
from money.contrib.django.models.fields import MoneyField
Do you mind pointing out where you found this?
Regards
Quite a few NoReverseMatch's when trying to run it. Had to fix models.py to match the urls. So for instance.
urls.py
url(r'^cancel/pay/(?P<id>\d+)/$', payment_cancel, name="paypal-adaptive-payment-cancel"),
url(r'^return/pay/(?P<id>\d+)/(?P<secret_uuid>\w+)/$', payment_return, name="paypal-adaptive-payment-return"),
url(r'^cancel/pre/(?P<id>\d+)/$', preapproval_cancel, name="paypal-adaptive-preapproval-cancel"),
url(r'^return/pre/(?P<id>\d+)/(?P<secret_uuid>\w+)/$', preapproval_return, name="paypal-adaptive-preapproval-return"),
...
url(r'^ipn/(?P<id>\d+)/(?P<secret_uuid>\w+)/$', payment_ipn, name="paypal-adaptive-ipn"),
models.py:
ipn_url = request.build_absolute_uri(reverse('paypal-adaptive-ipn',
kwargs={'payment_id': self.id,
'payment_secret_uuid': self.secret_uuid}))
In urls.py the url has kwargs 'id' and 'secret_uuid' but in models.py its 'payment_id' and 'payment_secret_uuid'.
Also it looks for 'paypal-adaptive-return' but in url.spy it's 'paypal-adaptive-payment-return'
I am using Python 3.
when migrating i am getting this error.
Is "django-paypal-adaptive" is not support python 3 ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.