mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-21 19:03:11 +00:00
Add *args and **kwargs to some functions
This commit is contained in:
parent
fdd2eb363a
commit
d301f37203
8 changed files with 10 additions and 10 deletions
|
@ -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."))
|
||||
|
|
Loading…
Reference in a new issue