Projet

Général

Profil

Development #41323

Stocker et utiliser transaction_date dans les objects Transaction

Ajouté par Benjamin Dauvergne il y a presque 4 ans. Mis à jour il y a presque 4 ans.

Statut:
Fermé
Priorité:
Normal
Assigné à:
Version cible:
-
Début:
03 avril 2020
Echéance:
% réalisé:

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Copié de #41317 :

  • ajouter un attribut transaction_date sur Transaction (peut être None)
  • le renseigner avec transaction_date quand la réponse eopayment en contient une
  • envoyer « transaction_date = Transaction.transaction_date or Transaction.end_date » lors du pay_invoice

Fichiers

0002-lingo-store-received-transaction_date-41323.patch (1,51 ko) 0002-lingo-store-received-transaction_date-41323.patch Benjamin Dauvergne, 04 avril 2020 12:04
0004-lingo-use-transaction_date-instead-of-end_date-when-.patch (1,06 ko) 0004-lingo-use-transaction_date-instead-of-end_date-when-.patch Benjamin Dauvergne, 04 avril 2020 12:04
0005-REMOVE-ME-use-eopayment-from-branch-REMOVE-ME.patch (639 octets) 0005-REMOVE-ME-use-eopayment-from-branch-REMOVE-ME.patch Benjamin Dauvergne, 04 avril 2020 12:04
0003-lingo-force-transaction_date-to-UTC-in-pay_invoice-4.patch (1,63 ko) 0003-lingo-force-transaction_date-to-UTC-in-pay_invoice-4.patch Benjamin Dauvergne, 04 avril 2020 12:04
0001-lingo-add-Transaction.transaction_date-41323.patch (1,81 ko) 0001-lingo-add-Transaction.transaction_date-41323.patch Benjamin Dauvergne, 04 avril 2020 12:04
0006-REMOVE-ME-use-eopayment-from-branch-REMOVE-ME.patch (639 octets) 0006-REMOVE-ME-use-eopayment-from-branch-REMOVE-ME.patch Benjamin Dauvergne, 07 avril 2020 13:48
0002-lingo-store-received-transaction_date-41323.patch (1,51 ko) 0002-lingo-store-received-transaction_date-41323.patch Benjamin Dauvergne, 07 avril 2020 13:48
0001-lingo-add-Transaction.bank_transaction_date-41323.patch (1,91 ko) 0001-lingo-add-Transaction.bank_transaction_date-41323.patch Benjamin Dauvergne, 07 avril 2020 13:48
0003-lingo-force-transaction_date-to-UTC-in-pay_invoice-4.patch (1,63 ko) 0003-lingo-force-transaction_date-to-UTC-in-pay_invoice-4.patch Benjamin Dauvergne, 07 avril 2020 13:48
0005-lingo-send-bank_transaction_date-when-notifying-trig.patch (1,16 ko) 0005-lingo-send-bank_transaction_date-when-notifying-trig.patch Benjamin Dauvergne, 07 avril 2020 13:48
0004-lingo-use-bank_transaction_date-instead-of-end_date-.patch (1,07 ko) 0004-lingo-use-bank_transaction_date-instead-of-end_date-.patch Benjamin Dauvergne, 07 avril 2020 13:48
0002-lingo-store-received-transaction_date-41323.patch (1,5 ko) 0002-lingo-store-received-transaction_date-41323.patch Benjamin Dauvergne, 04 mai 2020 15:26
0001-lingo-add-Transaction.bank_transaction_date-41323.patch (1,9 ko) 0001-lingo-add-Transaction.bank_transaction_date-41323.patch Benjamin Dauvergne, 04 mai 2020 15:26
0003-lingo-force-transaction_date-to-UTC-in-pay_invoice-4.patch (2,05 ko) 0003-lingo-force-transaction_date-to-UTC-in-pay_invoice-4.patch Benjamin Dauvergne, 04 mai 2020 15:26
0005-lingo-send-bank_transaction_date-when-notifying-trig.patch (1,15 ko) 0005-lingo-send-bank_transaction_date-when-notifying-trig.patch Benjamin Dauvergne, 04 mai 2020 15:26
0004-lingo-use-bank_transaction_date-instead-of-end_date-.patch (1,06 ko) 0004-lingo-use-bank_transaction_date-instead-of-end_date-.patch Benjamin Dauvergne, 04 mai 2020 15:26

Demandes liées

Lié à Combo - Development #42565: transaction_date n'est pas sauvegardéFermé06 mai 2020

Actions
Bloque Publik - Development #41317: système de paiment : gestion de la date de la transactionFermé03 avril 2020

Actions

Révisions associées

Révision 1482ec59 (diff)
Ajouté par Benjamin Dauvergne il y a presque 4 ans

lingo: add Transaction.bank_transaction_date (#41323)

Révision 4afe8c93 (diff)
Ajouté par Benjamin Dauvergne il y a presque 4 ans

lingo: store received transaction_date (#41323)

Révision 83a53952 (diff)
Ajouté par Benjamin Dauvergne il y a presque 4 ans

lingo: force transaction_date to UTC in pay_invoice() (#41323)

Révision eebae4cb (diff)
Ajouté par Benjamin Dauvergne il y a presque 4 ans

lingo: use bank_transaction_date instead of end_date when possible (#41323)

Révision 24dcabc6 (diff)
Ajouté par Benjamin Dauvergne il y a presque 4 ans

lingo: send bank_transaction_date when notifying triggers (#41323)

Historique

#1

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Bloque Development #41317: système de paiment : gestion de la date de la transaction ajouté
#2

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Sujet changé de Stocker transaction_date dans les objects Transaction à Stocker et utiliser transaction_date dans les objects Transaction
#3

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Description mis à jour (diff)
#4

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Assigné à mis à Benjamin Dauvergne
#5

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

Question: dans quel timezone le champ transaction_date balancé à un RemoteItem est-il ? Ça ne semble pas déterminé, à la lecture du code ça serait toujours UTC vu que DateTimeField retourne ça par défaut (mais j'aime pas l'implicite).

Je dis ça parce que le souci sous-jacent c'est la date (et pas l'heure) d'imputation dans Axel et pour ça il faudra que dans toulouse-axel on envoie je suppose date et heure dans le bon fuseau.

PS: en fait le datetime ne vient même pas de DateTimeField puisqu'il vient juste d'être créé lors de la réception du paiement, via timezone.now() qui est toujours dans la zone UTC.
Validé sur https://passerelle-moncompte.cutm-ea-dev-publik.nfrance.com/manage/toulouse-axel/test/logs/?q=transaction_date :

     {"transaction_id": "20200330162510_927460", "transaction_date": "2020-03-30T16:27:19"} 

La transaction 927460 a été notifiée vers 18:27 pas 16:27.

#6

Mis à jour par Thomas Noël il y a presque 4 ans

UTC d'un bout à l'autre, je confirme (réponse de SystemPay, API envoi de lingo vers passerelle, API envoi de passerelle vers Axel)

#8

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

Quelques changements :
  • renommage de Transaction.transaction_date en bank_transaction_date (c'est plus cohérent avec bank_transaction_id)
  • correction au changement de fuseau horaire (c'est tz.localize() sur un dt naïf, mais c'est dt.astimezone(tz) sur un dt aware :/)
  • envoie de transaction_date aux triggers w.c.s., y a pas de raison qu'ils en soient privés (et ça servira pour corrige la date de paiement de DPark à Toulouse).
#10

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

Patch 0006 retiré, eopayment sur pypi correspond maintenant.

#11

Mis à jour par Thomas Noël il y a presque 4 ans

0001: ok

0002: typo sur "logger.erorr"

0003: le truc que j'arrive jamais à savoir c'est si pytz fait partie de la stdlib ou pas. Mais sinon, à voir si tu veux conserver le "assert", on dit souvent que c'est pas bien dans du vrai code (autre que les tests), parce que les assert ne sont pas gérées avec python -O. Bref, si tu peux mettre un if, tout le monde il sera heureux.

0004 et 0005: ok

#12

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

Thomas Noël a écrit :

0003: le truc que j'arrive jamais à savoir c'est si pytz fait partie de la stdlib ou pas. Mais sinon, à voir si tu veux conserver le "assert", on dit souvent que c'est pas bien dans du vrai code (autre que les tests), parce que les assert ne sont pas gérées avec python -O. Bref, si tu peux mettre un if, tout le monde il sera heureux.

pytz est une dépendance implicite de django, django.utils.timezone.utc vaut pytz.utc, je vais mettre django.utils.timezone.utc pour qu'on se pose moins de questions.

0004 et 0005: ok

#14

Mis à jour par Thomas Noël il y a presque 4 ans

  • Statut changé de Solution proposée à Solution validée
#15

Mis à jour par Benjamin Dauvergne il y a presque 4 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit 24dcabc6532a58d9eb9dd66df4733df6761bb63d
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Tue Apr 7 12:21:15 2020 +0200

    lingo: send bank_transaction_date when notifying triggers (#41323)

commit eebae4cbbde107c024ca9c1d8d512ab3ced0de07
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Apr 3 20:09:01 2020 +0200

    lingo: use bank_transaction_date instead of end_date when possible (#41323)

commit 83a53952a4459b4510e527809dc5c445a3ff3e70
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Apr 3 20:08:44 2020 +0200

    lingo: force transaction_date to UTC in pay_invoice() (#41323)

commit 4afe8c930c50664b77f5cf2a65e8ba6ef65de57e
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Apr 3 19:14:21 2020 +0200

    lingo: store received transaction_date (#41323)

commit 1482ec599f623c748a68ca34d7de83b53c911cea
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Fri Apr 3 19:09:57 2020 +0200

    lingo: add Transaction.bank_transaction_date (#41323)
#16

Mis à jour par Frédéric Péters il y a presque 4 ans

  • Statut changé de Résolu (à déployer) à Solution déployée
#17

Mis à jour par Valentin Deniaud il y a presque 4 ans

Formats disponibles : Atom PDF