[FIX] payment_sips: datetime parsing
SIPS date format can be somewhat variable, some sanitation is required before using the data raw for the ORM. opw-2224926 closes odoo/odoo#48604 X-original-commit: db998d39d7d692779a64522e168bba29b82f1d03 Signed-off-by: Damien Bouvy (dbo) <dbo@odoo.com>
This commit is contained in:
@@ -2,8 +2,10 @@
|
||||
|
||||
# Copyright 2015 Eezee-It
|
||||
|
||||
import datetime
|
||||
import json
|
||||
import logging
|
||||
import pytz
|
||||
import re
|
||||
import time
|
||||
from hashlib import sha256
|
||||
@@ -180,10 +182,13 @@ class TxSips(models.Model):
|
||||
def _sips_form_validate(self, data):
|
||||
data = self._sips_data_to_object(data.get('Data'))
|
||||
status = data.get('responseCode')
|
||||
date = data.get('transactionDateTime')
|
||||
if date:
|
||||
date = datetime.datetime.fromisoformat(date)
|
||||
date = date.astimezone(pytz.utc).replace(tzinfo=None)
|
||||
data = {
|
||||
'acquirer_reference': data.get('transactionReference'),
|
||||
'date': data.get('transactionDateTime',
|
||||
fields.Datetime.now())
|
||||
'date': date or fields.Datetime.now(),
|
||||
}
|
||||
res = False
|
||||
if status in self._sips_valid_tx_status:
|
||||
|
||||
Reference in New Issue
Block a user