[Zope] Payment Processors.

Rick St Jean rstjean@internet.look.ca
Fri, 22 Jun 2001 18:49:40 -0400


I mentioned the other day that the company I work for makes a modular 
interface for payment
processors.  We are also integrating paypal, a few other sites that operate 
like it.  I have python
code that one of our developers wrote to integrate out solution into a 
python site.  I am still
fumbling my way though phython and ZOPE, but this can be code that will be 
useful to people
wishing to have transactions through their sites.  Would anyone be 
interested in helping me
develop a zope module from the code.  Basically I would like to see this 
available to all platforms.
if you decide to change payment processors you simply drop in the new files 
get a new key and
you are now up and running with a new processor.  no coding or fiddling.  I 
posted the python
snippet if anyone is interested in starting ahead of me.

Rick


This is example code for implementing an oPAYc transaction using Python.
(Python v1.5.2 on Linux-2.2-i386-glibc2.1). The code snippet should work
on any version of Unix.

The modules "DateTime" and "ODBC" must be installed.

The ODBC.unixODBC module does not come within the ODBC package, and
the existing ODBC.iODBC one must be modified to link to unixODBC's libraries.
Also the include paths must be changed to those of unixODBC's include 
directory.
Finally, "sql.h" and "sqlext.h" must be #included.


#!/usr/bin/python

import ODBC
import ODBC.unixODBC
import DateTime
import random

dsn = 'opayc-o19'
user = 'opayc-user'
passwd = 'opayc-password'

account = '4111 1111 1111 1111'
expiry = '0101'
amount = '0.50'
address1 = '612 Curry Avenue'
postal = 'L2T2L7'
country = 'Canada'
city = 'St. Catharine'
state = 'on'
type = 'sale'
trans = repr(random.randrange(9999))
firstname = 'Marsh'
lastname = 'Melon'
clientip = '205.210.228.203'
email = 'nobody@cybersource.com'
currency = 'usd'
phone = '555-555-5555'

query = "SELECT * FROM transactions WHERE account = '%s' AND expiry = '%s' 
AND amount = '%s' AND
add1 = '%s' AND postal = '%s' AND country = '%s' AND city = '%s' AND state 
= '%s' AND type = '%s' AND
trans = '%s' AND fname = '%s' AND lname = '%s' AND clientIP = '%s' AND 
email = '%s' AND Currency = '%s'
AND phone = '%s'" % (account, amount, address1, postal, country, city, 
state, type, trans, firstname,
lastname, clientip, email, currency, phone)

db = ODBC.unixODBC.Connect(dsn, user, passwd)
cur = db.cursor()
cur.execute(query)
result = cur.fetchall()
if result:
     for data in result:
         print f

cur.close()
db.close()




##########################################################
#  Rick St Jean,
#  rstjean@internet.look.ca
#  President of Design Shark,
#  http://www.designshark.com/,  http://www.phpmailer.com/
#  Quick Contact:  http://www.designshark.com/messaging.ihtml
#  Tel: 905-684-2952
##########################################################