Projet

Général

Profil

Development #53186

vérifier l'état réel des factures "remote" par rapport aux transactions connues

Ajouté par Benjamin Dauvergne il y a environ 3 ans. Mis à jour il y a environ 3 ans.

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

0%

Temps estimé:
Patch proposed:
Oui
Planning:
Non

Description

Actuellement on ne vérifie jamais si une facture a déjà été payé dans combo, on vérifie seulement auprès des WS de la régie.

Cf. #53174


Fichiers

Révisions associées

Révision ccb2cb85 (diff)
Ajouté par Benjamin Dauvergne il y a environ 3 ans

lingo: check real payment status of remote_item when shown or paid (#53186)

Currently the remote_item.paid attribute comes from what the remote
regie is providing through a web service. But a remote_item can be
already paid if a transaction with a paid status (eopayment.PAID or
eopayment.ACCEPTED) already exist.

This patch add a RemoteItem.update_paid(regie, remote_items) which
update bunch of remote_item(s) by querying the correponding paid
transactions.

The methods Regie.get_invoices() and Regie.get_invoice() get a new
parameter update_paid=False, which is set to true in cells and views
which display or allow paying a remote item.

Historique

#1

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

  • Sujet changé de vérifier l'état réelle des factures "remote" par rapport aux transactions connues à vérifier l'état réel des factures "remote" par rapport aux transactions connues
#3

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

Je pense qu'il y a assez de tests maintenant.

#4

Mis à jour par Lauréline Guérin il y a environ 3 ans

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

comment on avertit la régie pour qu'elle mette à jour la facturation de son côté ? ça passe par la méthode notify ?

#5

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

Benjamin Dauvergne sur le salon :

(10:48:11) bdauvergne: le mieux ça aurait été d'abandonner les RemoteItem pour en faire systématiquement des BasketItem (ce qu'on fait à la fin quand c'est payé désormais en plus, c'est dire si c'est pas marrant) mais je n'ai pas eu le courage de me lancer là dedans; reste que ça simplifierait pas mal le code de plus avoir à faire la différence entre BasketItem ou RemoteItem

Lauréline Guerin a écrit :

comment on avertit la régie pour qu'elle mette à jour la facturation de son côté ? ça passe par la méthode notify ?

Oui, un premier appel synchrone au retour du paiement à Transaction.first_notify_remote_items_of_payments() qui va notifier les identifiants de remote_item qui sont dans transaction.remote_items, en cas de foirage sur certains, ils sont restockés dans transaction.to_be_paid_remote_items ensuite ça passe par le cron hourly de l'application lingo qui va appeler Transaction.retry_notify_remote_items_of_payments() et vider progressivement transaction.to_be_paid_remote_items@ avec un timeout au bout de 4 jours, sans alerte particulière. Et pour les BasketItem c'est encore différent c'est dans AppConfig.notify_payments() on essaie de notifier wcs des BasketItem payés qui ont été il y a plus de 5 minutes et moins de 3h (et après on ne fait plus rien sans alerte particulière).

#6

Mis à jour par Benjamin Dauvergne il y a environ 3 ans

  • Statut changé de Solution validée à Résolu (à déployer)
commit ccb2cb8500494b4bcf75e9afd5987aa53ea605d1
Author: Benjamin Dauvergne <bdauvergne@entrouvert.com>
Date:   Thu Apr 15 20:43:33 2021 +0200

    lingo: check real payment status of remote_item when shown or paid (#53186)

    Currently the remote_item.paid attribute comes from what the remote
    regie is providing through a web service. But a remote_item can be
    already paid if a transaction with a paid status (eopayment.PAID or
    eopayment.ACCEPTED) already exist.

    This patch add a RemoteItem.update_paid(regie, remote_items) which
    update bunch of remote_item(s) by querying the correponding paid
    transactions.

    The methods Regie.get_invoices() and Regie.get_invoice() get a new
    parameter update_paid=False, which is set to true in cells and views
    which display or allow paying a remote item.
#7

Mis à jour par Frédéric Péters il y a environ 3 ans

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

Formats disponibles : Atom PDF