1 |
1 |
# -*- coding: utf-8 -*-
|
2 |
2 |
|
3 |
3 |
import datetime as dt
|
4 |
4 |
import hashlib
|
5 |
5 |
import logging
|
6 |
6 |
import string
|
7 |
7 |
import urlparse
|
8 |
|
import urllib
|
9 |
8 |
from gettext import gettext as _
|
|
9 |
import cgi
|
10 |
10 |
|
11 |
|
from common import PaymentCommon, PaymentResponse, URL, PAID, ERROR
|
|
11 |
from common import PaymentCommon, PaymentResponse, PAID, ERROR, FORM, Form
|
12 |
12 |
from cb import CB_RESPONSE_CODES
|
13 |
13 |
|
14 |
14 |
__all__ = ['Payment']
|
15 |
15 |
|
16 |
16 |
SERVICE_URL = "https://paiement.systempay.fr/vads-payment/"
|
17 |
17 |
LOGGER = logging.getLogger(__name__)
|
18 |
18 |
VADS_TRANS_DATE = 'vads_trans_date'
|
19 |
19 |
VADS_AUTH_NUMBER = 'vads_auth_number'
|
... | ... | |
298 |
298 |
if name not in fields and parameter.default is not None:
|
299 |
299 |
if callable(parameter.default):
|
300 |
300 |
fields[name] = parameter.default()
|
301 |
301 |
else:
|
302 |
302 |
fields[name] = parameter.default
|
303 |
303 |
check_vads(fields)
|
304 |
304 |
fields[SIGNATURE] = self.signature(fields)
|
305 |
305 |
self.logger.debug('%s request contains fields: %s', __name__, fields)
|
306 |
|
url = '%s?%s' % (SERVICE_URL, urllib.urlencode(fields))
|
307 |
|
self.logger.debug('%s return url %s', __name__, url)
|
308 |
306 |
transaction_id = '%s_%s' % (fields[VADS_TRANS_DATE], transaction_id)
|
309 |
307 |
self.logger.debug('%s transaction id: %s', __name__, transaction_id)
|
310 |
|
return transaction_id, URL, url
|
|
308 |
form = Form(
|
|
309 |
url=SERVICE_URL,
|
|
310 |
method='POST',
|
|
311 |
fields=[{'type': 'hidden',
|
|
312 |
'name': name,
|
|
313 |
'value': value} for name, value in fields.iteritems()])
|
|
314 |
return transaction_id, FORM, form
|
311 |
315 |
|
312 |
316 |
def response(self, query_string):
|
313 |
317 |
fields = urlparse.parse_qs(query_string, True)
|
314 |
318 |
for key, value in fields.iteritems():
|
315 |
319 |
fields[key] = value[0]
|
316 |
320 |
copy = fields.copy()
|
317 |
321 |
bank_status = []
|
318 |
322 |
if VADS_AUTH_RESULT in fields:
|
319 |
|
-
|