Paynova Aero for Django
Implementation of Paynova Aero work flow for Django. Using Paynova API python library: paynova-api-python-client.
Installation
Install django-paynova:
pip install django-paynova
Python 2.7, 3.3, 3.4, PyPy are supported Django 1.6, 1.7 are supported
Add django-paynova to INSTALLED_APPS:
INSTALLED_APPS = ( ... 'django_paynova', ... )Configure settings:
PAYNOVA_MERCHANT_ID = 'MERCHANT_ID' PAYNOVA_PASSWORD = 'PASSWORD' PAYNOVA_SECRET = 'SECRET' PAYNOVA_CALLBACK_URL = 'http://mysite.com'For production:
PAYNOVA_LIVE = TrueRun ./manage migrate
Add urls to handle Paynova’s callbacks:
urlpatterns = patterns('', url(r'^(?i)payments/paynova/', include('django_paynova.urls')), )
Usage
Create order and init payment with default params:
from django_paynova import create_order, PaynovaException try: pp = create_order({ 'orderNumber': '0001', 'currencyCode': 'EUR', 'totalAmount': 10 }) # TODO: redirect to pp.url except PaynovaException as e: # TODO: handle exceptioncreate_order takes dictionary with Create Order parameters
Handle Event Hook Notifications:
from django.dispatch import receiver from django_paynova.signals import paynova_payment @receiver(paynova_payment) def paynova_payment_signal(sender, status, params, **kwargs): # TODO: handle paynova payment notificationwhere
sender - PaynovaPayment model
status - status of payment
params - payment params from Paynova
Advanced
Also you can create order and initialize payment separately:
from django_paynova import create_order, initialize_payment, PaynovaException
try:
# create order
pp = create_order({
'orderNumber': '0005',
'currencyCode': 'EUR',
'totalAmount': 10
}, init_payment=False)
# init payment. http://docs.paynova.com/display/API/Initialize+Payment
pp = initialize_payment({'orderId': pp.order_id})
# TODO: redirect to pp.url
except PaynovaException as e:
# TODO: handle exception
create_order takes dictionary with Create Order parameters
initialize_payment takes dictionary with Initialize Payment parameters
Errors
If Paynova return an error, PaynovaException will be raised
from django-paynova import create_order, PaynovaException
try:
pp = create_order()
except PaynovaException as e:
# process exception
# e.errorNumber, e.statusKey, e.statusMessage, e.errors
pass
Tests
At first make sure that you are in virtualenv.
Install all dependencies:
make setup
To run tests:
make test
License
Metadata
Release files for django-paynova 0.1.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django-paynova-0.1.6.tar.gz | 10.0 kB | Without provenance | Details for django-paynova-0.1.6.tar.gz |
Release files / django-paynova-0.1.6.tar.gz
| Download URL | django-paynova-0.1.6.tar.gz |
|---|---|
| Size | 10.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
252b7b8a00a01b08e1f0a145f9b58450b365f1b10bee50dc009241b67c4c0d7f
|
|
BLAKE2b-256 checksum How to use checksums |
6bfe52093ffbdaf9c5d03e8740a354346a41e9225fd23f044b88e8a1069a6716
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-paynova 0.1.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.