mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-21 19:03:11 +00:00
Validate comnpay payments on another host
This commit is contained in:
parent
c9f22b43d3
commit
e28ad0ab2d
2 changed files with 8 additions and 5 deletions
|
@ -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,))
|
||||
|
|
Loading…
Reference in a new issue