summaryrefslogtreecommitdiff
path: root/addons/payment_sips/models
diff options
context:
space:
mode:
authorDamien Bouvy <dbo@odoo.com>2020-03-30 09:46:41 +0000
committerDamien Bouvy <dbo@odoo.com>2020-03-30 12:00:25 +0000
commit1e5ab1b533f000b24b92c2bb0b4d5cd2abc54019 (patch)
tree20bddc17fb66e7c258c7040ff7dc6f2bdc504fb5 /addons/payment_sips/models
parent807ac811446836925092b7214fec004ef4ef4ca8 (diff)
[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>
Diffstat (limited to 'addons/payment_sips/models')
-rw-r--r--addons/payment_sips/models/payment.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/addons/payment_sips/models/payment.py b/addons/payment_sips/models/payment.py
index 186c82363fd..fafea220e75 100644
--- a/addons/payment_sips/models/payment.py
+++ b/addons/payment_sips/models/payment.py
@@ -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: