Add a dummy backend

This commit is contained in:
Frédéric Péters 2011-04-30 19:06:19 +02:00
parent f9c5ca3a01
commit b7507de11a
2 changed files with 33 additions and 0 deletions

View File

@ -8,6 +8,7 @@ from common import URL, HTML
__all__ = [ 'Payment', 'URL', 'HTML' ]
DUMMY = 'dummy'
SIPS = 'sips'
SYSTEMPAY = 'systempayv2'
SPPLUS = 'spplus'

32
eopayment/dummy.py Normal file
View File

@ -0,0 +1,32 @@
'''
Dummy payment backend module for debugging
'''
from decimal import Decimal
import string
import urllib2
import urlparse
from common import PaymentCommon, URL
__all__ = [ 'Payment' ]
class Payment(PaymentCommon):
def __init__(self, options):
self.options = options
def request(self, amount, email=None, next_url=None):
transaction_id = self.transaction_id(6, string.digits, 'dummy')
print 'next url:', next_url
dest_url = 'http://perso.entrouvert.org/~fred/paiement/?return=%s&tid=%s&amount=%s' % (
urllib2.quote(next_url),
transaction_id,
str(Decimal(amount)*100))
return (transaction_id, URL, dest_url)
def response(self, query_string):
form = urlparse.parse_qs(query_string)
return (True, form.get('tid')[0], '', None)