12 |
12 |
|
13 |
13 |
__all__ = ['Payment']
|
14 |
14 |
|
15 |
|
SERVICE_URL = "https://paiement.systempay.fr/vads-payment/"
|
16 |
|
LOGGER = logging.getLogger(__name__)
|
17 |
15 |
VADS_TRANS_DATE = 'vads_trans_date'
|
18 |
16 |
VADS_AUTH_NUMBER = 'vads_auth_number'
|
19 |
17 |
VADS_AUTH_RESULT = 'vads_auth_result'
|
... | ... | |
211 |
209 |
'vads_return_mode': 'NONE'})
|
212 |
210 |
|
213 |
211 |
'''
|
|
212 |
service_url = "https://paiement.systempay.fr/vads-payment/"
|
|
213 |
|
214 |
214 |
description = {
|
215 |
215 |
'caption': 'SystemPay, système de paiment du groupe BPCE',
|
216 |
216 |
'parameters': [
|
217 |
217 |
{'name': 'service_url',
|
218 |
|
'default': SERVICE_URL,
|
|
218 |
'default': service_url,
|
219 |
219 |
'caption': _(u'URL du service de paiment'),
|
220 |
220 |
'help_text': _(u'ne pas modifier si vous ne savez pas'),
|
221 |
221 |
'validation': lambda x: x.startswith('http'),
|
... | ... | |
243 |
243 |
'max_length': parameter.max_length}
|
244 |
244 |
description['parameters'].append(x)
|
245 |
245 |
|
246 |
|
def __init__(self, options, logger=LOGGER):
|
247 |
|
self.service_url = options.pop('service_url', SERVICE_URL)
|
|
246 |
def __init__(self, options, logger=None):
|
|
247 |
self.service_url = options.pop('service_url', self.service_url)
|
248 |
248 |
self.secret_test = options.pop('secret_test')
|
249 |
249 |
self.secret_production = options.pop('secret_production', None)
|
250 |
250 |
options = add_vads(options)
|
251 |
251 |
self.options = options
|
252 |
|
self.logger = logger
|
|
252 |
self.logger = logger or logging.getLogger(__name__)
|
253 |
253 |
|
254 |
254 |
def request(self, amount, name=None, address=None, email=None, phone=None,
|
255 |
255 |
info1=None, info2=None, info3=None, next_url=None, **kwargs):
|
... | ... | |
304 |
304 |
transaction_id = '%s_%s' % (fields[VADS_TRANS_DATE], transaction_id)
|
305 |
305 |
self.logger.debug('%s transaction id: %s', __name__, transaction_id)
|
306 |
306 |
form = Form(
|
307 |
|
url=SERVICE_URL,
|
|
307 |
url=self.service_url,
|
308 |
308 |
method='POST',
|
309 |
309 |
fields=[{'type': 'hidden',
|
310 |
310 |
'name': name,
|
... | ... | |
379 |
379 |
secret = getattr(self, 'secret_%s' % fields['vads_ctx_mode'].lower())
|
380 |
380 |
signed_data = '+'.join(ordered_fields)
|
381 |
381 |
signed_data = '%s+%s' % (signed_data, secret)
|
382 |
|
self.logger.debug('generating signature on «%s»' % signed_data)
|
|
382 |
self.logger.debug(u'generating signature on «%s»' % signed_data)
|
383 |
383 |
sign = hashlib.sha1(signed_data).hexdigest()
|
384 |
384 |
self.logger.debug('signature «%s»' % sign)
|
385 |
385 |
return sign
|
386 |
|
-
|