From b8e60c72d2f994eac74c69d69576144b1d78a10b Mon Sep 17 00:00:00 2001 From: Serghei Mihai Date: Tue, 5 Jul 2016 13:22:11 +0200 Subject: [PATCH] systempayv2, sips2: update fields for passing user full name (#12447) Log input params at backends initialization. --- eopayment/__init__.py | 4 ++++ eopayment/sips2.py | 6 ++++-- eopayment/systempayv2.py | 15 ++++++++++++--- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/eopayment/__init__.py b/eopayment/__init__.py index cacd137..6f620c0 100644 --- a/eopayment/__init__.py +++ b/eopayment/__init__.py @@ -1,5 +1,7 @@ # -*- coding: utf-8 -*- +import logging + from common import (URL, HTML, FORM, RECEIVED, ACCEPTED, PAID, DENIED, CANCELED, CANCELLED, ERROR, ResponseError) @@ -17,6 +19,7 @@ OGONE = 'ogone' PAYBOX = 'paybox' PAYZEN = 'payzen' +logger = logging.getLogger(__name__) def get_backend(kind): '''Resolve a backend name into a module object''' @@ -98,6 +101,7 @@ class Payment(object): - the third is the URL or the HTML form to contact the payment server, which must be sent to the customer browser. ''' + logger.debug(u'%r' % kwargs) return self.backend.request(amount, **kwargs) def response(self, query_string, **kwargs): diff --git a/eopayment/sips2.py b/eopayment/sips2.py index 06f24e0..e7b5b8f 100644 --- a/eopayment/sips2.py +++ b/eopayment/sips2.py @@ -160,8 +160,9 @@ class Payment(PaymentCommon): def get_url(self): return self.URL[self.platform] - def request(self, amount, name=None, address=None, email=None, phone=None, - orderid=None, info1=None, info2=None, info3=None, next_url=None, **kwargs): + def request(self, amount, name=None, first_name=None, last_name=None, + address=None, email=None, phone=None, orderid=None, + info1=None, info2=None, info3=None, next_url=None, **kwargs): data = self.get_data() transaction_id = self.transaction_id(6, string.digits, 'sips2', data['merchantId']) data['transactionReference'] = unicode(transaction_id) @@ -171,6 +172,7 @@ class Payment(PaymentCommon): data['billingContact.email'] = email if 'captureDay' in kwargs: data['captureDay'] == kwargs.get('captureDay') + data['customerId'] = unicode(name or ' '.join(filter(None, [first_name, last_name]))) normal_return_url = self.normal_return_url if next_url and not normal_return_url: warnings.warn("passing next_url to request() is deprecated, " diff --git a/eopayment/systempayv2.py b/eopayment/systempayv2.py index f7030be..63f062d 100644 --- a/eopayment/systempayv2.py +++ b/eopayment/systempayv2.py @@ -25,6 +25,8 @@ VADS_CUST_PHONE = 'vads_cust_phone' VADS_CUST_INFO1 = 'vads_order_info' VADS_CUST_INFO2 = 'vads_order_info2' VADS_CUST_INFO3 = 'vads_order_info3' +VADS_CUST_FIRST_NAME = 'vads_cust_first_name' +VADS_CUST_LAST_NAME = 'vads_cust_last_name' VADS_URL_RETURN = 'vads_url_return' VADS_AMOUNT = 'vads_amount' VADS_SITE_ID = 'vads_site_id' @@ -138,6 +140,8 @@ PARAMETERS = [ Parameter('vads_url_return', 'ans', 28, max_length=127), Parameter('vads_user_info', 'ans', 61, max_length=255), Parameter('vads_contracts', 'ans', 62, max_length=255), + Parameter(VADS_CUST_FIRST_NAME, 'an', 104, max_length=63), + Parameter(VADS_CUST_LAST_NAME, 'an', 104, max_length=63), ] PARAMETER_MAP = dict(((parameter.name, parameter) for parameter in PARAMETERS)) @@ -260,9 +264,9 @@ class Payment(PaymentCommon): options = add_vads(options) self.options = options - def request(self, amount, name=None, address=None, email=None, phone=None, - orderid=None, info1=None, info2=None, info3=None, - next_url=None, **kwargs): + def request(self, amount, name=None, first_name=None, last_name=None, + address=None, email=None, phone=None, orderid=None, info1=None, + info2=None, info3=None, next_url=None, **kwargs): ''' Create the URL string to send a request to SystemPay ''' @@ -284,6 +288,11 @@ class Payment(PaymentCommon): kwargs[VADS_URL_RETURN] = unicode(normal_return_url) if name is not None: kwargs['vads_cust_name'] = unicode(name) + if first_name is not None: + kwargs[VADS_CUST_FIRST_NAME] = unicode(first_name) + if last_name is not None: + kwargs[VADS_CUST_LAST_NAME] = unicode(last_name) + if address is not None: kwargs['vads_cust_address'] = unicode(address) if email is not None: