summaryrefslogtreecommitdiffstats
path: root/eopayment/systempayv2.py
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2012-09-24 13:43:34 (GMT)
committerroot <root@au-quotidien.com>2012-09-24 13:43:55 (GMT)
commit1002b95117ca83ccf7577f4a084c244e558b5f03 (patch)
tree9135bcfe30f2ddc31e8934e39dbbd25f31d759af /eopayment/systempayv2.py
parent9db43f448cd486daf94804421e72e40cd4e2b96a (diff)
downloadeopayment-1002b95117ca83ccf7577f4a084c244e558b5f03.zip
eopayment-1002b95117ca83ccf7577f4a084c244e558b5f03.tar.gz
eopayment-1002b95117ca83ccf7577f4a084c244e558b5f03.tar.bz2
augment the number of arguments accepted by the request method
Diffstat (limited to 'eopayment/systempayv2.py')
-rw-r--r--eopayment/systempayv2.py24
1 files changed, 20 insertions, 4 deletions
diff --git a/eopayment/systempayv2.py b/eopayment/systempayv2.py
index 22eab59..dda78fa 100644
--- a/eopayment/systempayv2.py
+++ b/eopayment/systempayv2.py
@@ -22,6 +22,11 @@ VADS_AUTH_RESULT = 'vads_auth_result'
VADS_RESULT = 'vads_result'
VADS_EXTRA_RESULT = 'vads_extra_result'
VADS_CUST_EMAIL = 'vads_cust_email'
+VADS_CUST_NAME = 'vads_cust_name'
+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_URL_RETURN = 'vads_url_return'
VADS_AMOUNT = 'vads_amount'
VADS_SITE_ID = 'vads_site_id'
@@ -249,7 +254,8 @@ class Payment(PaymentCommon):
self.options = options
self.logger = logger
- def request(self, amount, email=None, next_url=None, **kwargs):
+ def request(self, amount, name=None, email=None, telephone=None,
+ info1=None, info2=None, info3=None, next_url=None, **kwargs):
'''
Create a dictionary to send a payment request to systempay the
Credit Card payment server of the NATIXIS group
@@ -257,14 +263,24 @@ class Payment(PaymentCommon):
self.logger.debug('%s amount %s email %s next_url %s, kwargs: %s',
__name__, amount, email, next_url, kwargs)
# amount unit is cents
- amount = 100 * amount
+ amount = '%.0f' % (100 * amount)
kwargs.update(add_vads({'amount': amount}))
- if Decimal(kwargs[VADS_AMOUNT]) < 0:
+ if amount < 0:
raise ValueError('amount must be an integer >= 0')
- if email:
+ if email is not None:
kwargs[VADS_CUST_EMAIL] = email
if next_url:
kwargs[VADS_URL_RETURN] = next_url
+ if name is not None:
+ kwargs[VADS_CUST_NAME] = name
+ if phone is not None:
+ kwargs[VADS_CUST_PHONE] = phone
+ if info1 is not None:
+ kwargs[VADS_CUST_INFO1] = info1
+ if info2 is not None:
+ kwargs[VADS_CUST_INFO2] = info2
+ if info3 is not None:
+ kwargs[VADS_CUST_INFO3] = info3
transaction_id = self.transaction_id(6,
string.digits, 'systempay', self.options[VADS_SITE_ID])