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
This commit is contained in:
parent
77087b200f
commit
258f2aaf1d
|
@ -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('|')
|
||||
|
|
Loading…
Reference in New Issue