Verified Commit d301f372 authored by ynerant's avatar ynerant
Browse files

Add *args and **kwargs to some functions

parent fdd2eb36
Pipeline #3234 passed with stage
in 3 minutes and 46 seconds
......@@ -871,7 +871,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
"""
self.moyen = self.moyen.title()
def end_payment(self, invoice, request, use_payment_method=True):
def end_payment(self, invoice, request, use_payment_method=True, *args, **kwargs):
"""
The general way of ending a payment.
......@@ -887,7 +887,7 @@ class Paiement(RevMixin, AclMixin, models.Model):
"""
payment_method = find_payment_method(self)
if payment_method is not None and use_payment_method:
return payment_method.end_payment(invoice, request)
return payment_method.end_payment(invoice, request, *args, **kwargs)
# So make this invoice valid, trigger send mail
invoice.valid = True
......
......@@ -101,7 +101,7 @@ But this payment method is not really usefull, since it does noting !
You have to redefine the `end_payment` method. Here is its prototype :
```python
def end_payment(self, invoice, request):
def end_payment(self, invoice, request, *args, **kwargs):
pass
```
......
......@@ -66,7 +66,7 @@ class BalancePayment(PaymentMethodMixin, models.Model):
verbose_name=_("allow user to credit their balance"), default=False
)
def end_payment(self, invoice, request):
def end_payment(self, invoice, request, *args, **kwargs):
"""Changes the user's balance to pay the invoice. If it is not
possible, shows an error and invalidates the invoice.
"""
......
......@@ -42,7 +42,7 @@ class ChequePayment(PaymentMethodMixin, models.Model):
editable=False,
)
def end_payment(self, invoice, request):
def end_payment(self, invoice, request, *args, **kwargs):
"""Invalidates the invoice then redirect the user towards a view asking
for informations to add to the invoice before validating it.
"""
......
......@@ -42,7 +42,7 @@ class FreePayment(PaymentMethodMixin, models.Model):
editable=False,
)
def end_payment(self, invoice, request):
def end_payment(self, invoice, request, *args, **kwargs):
"""Ends the payment normally.
"""
return invoice.paiement.end_payment(invoice, request, use_payment_method=False)
......
......@@ -23,10 +23,10 @@
class PaymentMethodMixin:
"""A simple mixin to avoid redefining end_payment if you don't need to"""
def end_payment(self, invoice, request):
def end_payment(self, invoice, request, *args, **kwargs):
"""Redefine this method in order to get a different ending to the
payment session if you whish.
Must return a HttpResponse-like object.
"""
return self.payment.end_payment(invoice, request, use_payment_method=False)
return self.payment.end_payment(invoice, request, use_payment_method=False, *args, **kwargs)
......@@ -49,7 +49,7 @@ class NotePayment(PaymentMethodMixin, models.Model):
port = models.PositiveIntegerField(blank=True, null=True)
id_note = models.PositiveIntegerField(blank=True, null=True)
def end_payment(self, invoice, request):
def end_payment(self, invoice, request, *args, **kwargs):
return redirect(
reverse(
"cotisations:note_kfet:note_payment", kwargs={"factureid": invoice.id}
......
......@@ -154,7 +154,7 @@ def new_facture(request, user, userid):
return new_invoice_instance.paiement.end_payment(
new_invoice_instance,request,
ipn_host=settings.ALLOWED_HOSTS[0] if request.path.contains("portail") else None,
ipn_host=settings.ALLOWED_HOSTS[0] if "portail" in request.path else None,
)
else:
messages.error(request, _("You need to choose at least one article."))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment