From 7c35571237bc6d7b363191748b1a17b4e0840562 Mon Sep 17 00:00:00 2001 From: Maxime Bombar Date: Tue, 28 Aug 2018 04:37:21 +0200 Subject: [PATCH] Invoice is sent iif payment is Ok --- cotisations/payment_methods/comnpay/views.py | 3 +++ cotisations/views.py | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/cotisations/payment_methods/comnpay/views.py b/cotisations/payment_methods/comnpay/views.py index 2383f1e9..e823898b 100644 --- a/cotisations/payment_methods/comnpay/views.py +++ b/cotisations/payment_methods/comnpay/views.py @@ -38,6 +38,7 @@ from cotisations.models import Facture from .comnpay import Transaction from .models import ComnpayPayment +from cotisations.utils import send_mail_invoice @csrf_exempt @login_required @@ -133,6 +134,8 @@ def ipn(request): facture.valid = True facture.save() + send_mail_invoice(facture) + # Everything worked we send a reponse to Comnpay indicating that # it's ok for them to proceed return HttpResponse("HTTP/1.0 200 OK") diff --git a/cotisations/views.py b/cotisations/views.py index a4a35825..10fc5114 100644 --- a/cotisations/views.py +++ b/cotisations/views.py @@ -148,8 +148,6 @@ def new_facture(request, user, userid): p.facture = new_invoice_instance p.save() - send_mail_invoice(new_invoice_instance) - return new_invoice_instance.paiement.end_payment( new_invoice_instance, request