8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-12-27 09:23:47 +00:00
re2o/cotisations/payment_methods/comnpay/models.py
2018-06-28 22:46:16 +02:00

30 lines
841 B
Python

from django.db import models
from django.shortcuts import render
from cotisations.models import Paiement as BasePayment
from .aes_field import AESEncryptedField
from .views import comnpay
class ComnpayPayment(models.Model):
"""
The model allowing you to pay with COMNPAY. It redefines post_payment
method. See `cotisations.models.Paiement for further details.
"""
payment = models.OneToOneField(BasePayment, related_name='payment_method')
payment_credential = models.CharField(
max_length=255,
default='',
blank=True
)
payment_pass = AESEncryptedField(
max_length=255,
null=True,
blank=True,
)
def end_payment(self, invoice, request):
content = comnpay(invoice, request)
return render(request, 'cotisations/payment.html', content)