tipi: use Paris timezone for generating refdet (#46237)
This commit is contained in:
parent
af7a82ee09
commit
3ac360abe8
|
@ -14,9 +14,12 @@
|
|||
# You should have received a copy of the GNU Affero General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import datetime
|
||||
import re
|
||||
import random
|
||||
|
||||
import pytz
|
||||
|
||||
from .common import (PaymentCommon, PaymentResponse, URL, PAID, DENIED,
|
||||
CANCELLED, ERROR, ResponseError)
|
||||
from six.moves.urllib.parse import urlencode, parse_qs
|
||||
|
@ -25,8 +28,6 @@ from gettext import gettext as _
|
|||
import logging
|
||||
import warnings
|
||||
|
||||
from .systempayv2 import isonow
|
||||
|
||||
__all__ = ['Payment']
|
||||
|
||||
TIPI_URL = 'https://www.tipi.budget.gouv.fr/tpa/paiement.web'
|
||||
|
@ -85,7 +86,8 @@ class Payment(PaymentCommon):
|
|||
REFDET_RE = re.compile('^[a-zA-Z0-9]{6,30}$')
|
||||
|
||||
def _generate_refdet(self):
|
||||
return '%s%010d' % (isonow(), random.randint(1, 1000000000))
|
||||
return '%s%010d' % (datetime.datetime.now(pytz.timezone('Europe/Paris')).strftime('%Y%m%d%H%M%S'),
|
||||
random.randint(1, 1000000000))
|
||||
|
||||
def request(self, amount, next_url=None, exer=None, orderid=None,
|
||||
refdet=None, objet=None, email=None, saisie=None, **kwargs):
|
||||
|
|
|
@ -18,6 +18,8 @@ import datetime
|
|||
from decimal import Decimal
|
||||
from six.moves.urllib.parse import urlparse, parse_qs
|
||||
|
||||
import pytz
|
||||
|
||||
import eopayment
|
||||
import eopayment.tipi
|
||||
import pytest
|
||||
|
@ -70,7 +72,7 @@ def test_tipi_no_orderid_no_refdet():
|
|||
assert parsed_qs['mel'] == ['info@entrouvert.com']
|
||||
assert parsed_qs['numcli'] == ['12345']
|
||||
assert parsed_qs['exer'] == ['9999']
|
||||
assert parsed_qs['refdet'][0].startswith(datetime.datetime.now().strftime('%Y%m%d'))
|
||||
assert parsed_qs['refdet'][0].startswith(datetime.datetime.now(pytz.timezone('Europe/Paris')).strftime('%Y%m%d'))
|
||||
|
||||
|
||||
def test_tipi_orderid_refdef_compatible():
|
||||
|
|
Loading…
Reference in New Issue