Add a dummy backend
This commit is contained in:
parent
f9c5ca3a01
commit
b7507de11a
|
@ -8,6 +8,7 @@ from common import URL, HTML
|
|||
|
||||
__all__ = [ 'Payment', 'URL', 'HTML' ]
|
||||
|
||||
DUMMY = 'dummy'
|
||||
SIPS = 'sips'
|
||||
SYSTEMPAY = 'systempayv2'
|
||||
SPPLUS = 'spplus'
|
||||
|
|
|
@ -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)
|
Loading…
Reference in New Issue