django-ogone

Python implementation for the ogone payment interface aimed at Django
Download

django-ogone Ranking & Summary

Advertisement

  • Rating:
  • License:
  • GPL
  • Publisher Name:
  • Thierry Schellenbach
  • Publisher web site:
  • http://github.com/tschellenbach/

django-ogone Tags


django-ogone Description

Python implementation for the ogone payment interface aimed at Django django-ogone is a Django app that aims to provide an easy to use client interface in python to the Ogone payment interface.It is Django specific in nature, but hopefully the clean seperation will allow for easy porting to other frameworks.Installation instructions:Step 1 - settingsLook at the ogone settings file and define the required settings in your django settings file- OGONE_PSPID- OGONE_SHA_PRE_SECRET- OGONE_SHA_POST_SECRETThe secrets are just for hashing purposes. Fill in the same random value here as in the ogone admin. While you are in the ogone admin set the sha method to sha512. Furthermore enable the send parameters option for the payment feedback.Step 2 - adding the formThe form needs to be integrated in your checkout page.Ogone's manual explains this quite well.Note though that you need to be able to sign the data in the form.Therefore your form must be generated dynamically.This project provides an easy dynamic form to help you with that.Here an example implementation:from django_ogone import forms as ogone_formsfrom django_ogone.ogone import Ogonefrom django_ogone import ogone_settingsdef checkout(request): data = {} #transaction data data = '1' data = '500' data = 'EUR' data = 'en' data = Ogone.sign(data) context = {} context = ogone_forms.OgoneForm(data) if ogone_settings.PRODUCTION: request.context = 'https://secure.ogone.com/ncol/test/orderstandard.asp' else: request.context = 'https://secure.ogone.com/ncol/prod/orderstandard.asp'This form enables you to send a secured payment request to ogone.The Ogone.sign call is responsible for the hashing.To support more form field requests to ogone simply add them to the data dict.Step 3 - handling paymentsAfter the user pays you he is redirected back to your page. If you enabled the send parameters option in the ogone admin the payment status will be sent to your system. Usually you would want to use this data to mark the transaction as payed.Here an example implementation. Use this to roll your own.from django_ogone.ogone import Ogonedef order_status_update(request): ''' Updates the order status with ogone data. There are two ways of reaching this flow - payment redirect (user gets redirected through this flow) - ogone server side call (in case of problems ogone will post to our server with an updated version ofo the payment status) ''' params = request.POST or request.GET ogone = Ogone(params) if ogone.is_valid(): #update the order data, different for each site #need the ogone data and custom logic, use signals for this ogone_signals.ogone_update_order.send(sender=Ogone, ogone=ogone) #redirect to the appropriate view order_id = ogone.get_order_id() url = '%s?transaction_id=%s' % (reverse('checkout'), order_id) return HttpResponseRedirect(url)ogone_signals.ogone_update_order.connect(models.Transaction.objects.update_order)You will probably want to adjust the redirection behaviour in this view. Furthermore you should write a function to connect to the ogone_update_order signal. This signal allows you to automatically update the payment informationResources:This one made my life easier.](http://github.com/jsmits/django-payment-ogone) Requirements: · Python · Django


django-ogone Related Software