summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenjamin Dauvergne <bdauvergne@entrouvert.com>2020-10-10 11:06:22 (GMT)
committerBenjamin Dauvergne <bdauvergne@entrouvert.com>2020-10-12 22:32:44 (GMT)
commit258f2aaf1d0f091016e3b573c6b4bbfa2b0d23cf (patch)
treec3954d24b02b2674203aa030b722b6cc9a4ce06e
parent77087b200f185745eb4f580e129c38262fcb5110 (diff)
downloadeopayment-258f2aaf1d0f091016e3b573c6b4bbfa2b0d23cf.zip
eopayment-258f2aaf1d0f091016e3b573c6b4bbfa2b0d23cf.tar.gz
eopayment-258f2aaf1d0f091016e3b573c6b4bbfa2b0d23cf.tar.bz2
sips2: use uuid4() or given transaction_id for transactionReference (#47535)
https://documentation.sips.worldline.com/fr/WLSIPS.801-MG-Presentation-generale-de-la-migration-vers-Sips-2.0.html#ariaid-title20
-rw-r--r--eopayment/sips2.py14
1 files changed, 7 insertions, 7 deletions
diff --git a/eopayment/sips2.py b/eopayment/sips2.py
index ee8b7d1..8e7291d 100644
--- a/eopayment/sips2.py
+++ b/eopayment/sips2.py
@@ -16,13 +16,11 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import datetime
-from decimal import Decimal
from gettext import gettext as _
import collections
import hashlib
import hmac
import json
-import string
import uuid
import warnings
@@ -196,11 +194,13 @@ class Payment(PaymentCommon):
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):
+ info1=None, info2=None, info3=None, next_url=None, transaction_id=None, **kwargs):
data = self.get_data()
- transaction_id = self.transaction_id(10, string.digits, 'sips2', data['merchantId'])
- data['transactionReference'] = force_text(transaction_id)
- data['orderId'] = orderid or force_text(uuid.uuid4()).replace('-', '')
+ # documentation:
+ # https://documentation.sips.worldline.com/fr/WLSIPS.801-MG-Presentation-generale-de-la-migration-vers-Sips-2.0.html#ariaid-title20
+ transactionReference = transaction_id or uuid.uuid4().hex
+ data['transactionReference'] = transactionReference
+ data['orderId'] = orderid or transactionReference
if info1:
data['statementReference'] = force_text(info1)
else:
@@ -238,7 +238,7 @@ class Payment(PaymentCommon):
},
])
self.logger.debug('emitting request %r', data)
- return transaction_id, FORM, form
+ return transactionReference, FORM, form
def decode_data(self, data):
data = data.split('|')