Yohann D'ANELLO
5 years ago
No known key found for this signature in database
GPG Key ID: 3A75C55819C8CF85
2 changed files with
8 additions and
5 deletions
-
cotisations/payment_methods/comnpay/models.py
-
portail/views.py
|
|
|
@ -73,7 +73,7 @@ class ComnpayPayment(PaymentMethodMixin, models.Model): |
|
|
|
else: |
|
|
|
return "https://secure.homologation.comnpay.com" |
|
|
|
|
|
|
|
def end_payment(self, invoice, request): |
|
|
|
def end_payment(self, invoice, request, accept_host=None, refuse_host=None, ipn_host=None): |
|
|
|
""" |
|
|
|
Build a request to start the negociation with Comnpay by using |
|
|
|
a facture id, the price and the secret transaction data stored in |
|
|
|
@ -84,12 +84,12 @@ class ComnpayPayment(PaymentMethodMixin, models.Model): |
|
|
|
str(self.payment_credential), |
|
|
|
str(self.payment_pass), |
|
|
|
"https://" |
|
|
|
+ host |
|
|
|
+ (accept_host or host) |
|
|
|
+ reverse( |
|
|
|
"cotisations:comnpay:accept_payment", kwargs={"factureid": invoice.id} |
|
|
|
), |
|
|
|
"https://" + host + reverse("cotisations:comnpay:refuse_payment"), |
|
|
|
"https://" + host + reverse("cotisations:comnpay:ipn"), |
|
|
|
"https://" + (refuse_host or host) + reverse("cotisations:comnpay:refuse_payment"), |
|
|
|
"https://" + (ipn_host or host) + reverse("cotisations:comnpay:ipn"), |
|
|
|
"", |
|
|
|
"D", |
|
|
|
) |
|
|
|
|
|
|
|
@ -30,6 +30,7 @@ to redirect all requests to /portail/. |
|
|
|
The app provides new views to sign in and buy articles, to avoid |
|
|
|
accessing to the full Re2o. |
|
|
|
""" |
|
|
|
from django.conf import settings |
|
|
|
|
|
|
|
from cotisations.models import Facture, Vente |
|
|
|
from cotisations.utils import find_payment_method |
|
|
|
@ -103,7 +104,9 @@ class SignUpView(CreateView): |
|
|
|
|
|
|
|
# POOP CODE, pliz Re2o |
|
|
|
# End the payment process, it mays redirect to ComNPay |
|
|
|
return payment_method.end_payment(invoice, self.request) |
|
|
|
# We don't assume that the captive portal can be accessed from the whole web, |
|
|
|
# then we provide to ComNPay another domain to validate the invoice |
|
|
|
return payment_method.end_payment(invoice, self.request, settings.ALLOWED_HOSTS[0]) |
|
|
|
|
|
|
|
def get_success_url(self): |
|
|
|
return reverse_lazy("users:profil", args=(self.object.pk,)) |
|
|
|
|