summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Péters <fpeters@entrouvert.com>2016-12-29 08:57:29 (GMT)
committerFrédéric Péters <fpeters@entrouvert.com>2016-12-29 08:57:29 (GMT)
commite8d556e5b24232691e192182ad873fe4fb652180 (patch)
treec76a7f8836992dd22e3fceeb8cd685c8bef08c43
parent6ebbb5aa9d7420adc14ef13900b30e02c238f758 (diff)
downloadeopayment-e8d556e5b24232691e192182ad873fe4fb652180.zip
eopayment-e8d556e5b24232691e192182ad873fe4fb652180.tar.gz
eopayment-e8d556e5b24232691e192182ad873fe4fb652180.tar.bz2
sips2: set statementReference with custom info or order id (#14454)v1.20
-rw-r--r--eopayment/sips2.py4
-rw-r--r--tests/test_sips2.py8
2 files changed, 12 insertions, 0 deletions
diff --git a/eopayment/sips2.py b/eopayment/sips2.py
index b3cfe20..6675781 100644
--- a/eopayment/sips2.py
+++ b/eopayment/sips2.py
@@ -174,6 +174,10 @@ class Payment(PaymentCommon):
transaction_id = self.transaction_id(6, string.digits, 'sips2', data['merchantId'])
data['transactionReference'] = unicode(transaction_id)
data['orderId'] = orderid or unicode(uuid.uuid4()).replace('-', '')
+ if info1:
+ data['statementReference'] = unicode(info1)
+ else:
+ data['statementReference'] = data['transactionReference']
data['amount'] = unicode(int(Decimal(amount) * 100))
if email:
data['billingContact.email'] = email
diff --git a/tests/test_sips2.py b/tests/test_sips2.py
index e2d77ba..a2250b4 100644
--- a/tests/test_sips2.py
+++ b/tests/test_sips2.py
@@ -9,6 +9,14 @@ def test_build_request():
data = [f for f in form.fields if f['name'] == 'Data']
assert not u'lix000000' in data[0]['value']
+ transaction, f, form = backend.request(amount=u'12')
+ data = [f for f in form.fields if f['name'] == 'Data']
+ assert 'statementReference=%s' % transaction in data[0]['value']
+
+ transaction, f, form = backend.request(amount=u'12', info1='foobar')
+ data = [f for f in form.fields if f['name'] == 'Data']
+ assert 'statementReference=foobar' in data[0]['value']
+
def test_options():
payment = eopayment.Payment('sips2', {'capture_mode': u'VALIDATION'})
assert payment.backend.get_data()['captureMode'] == 'VALIDATION'