JourneyJoker/payment/sepa/models.py

22 lines
557 B
Python
Raw Normal View History

from payment.models import InvoicePayment, Invoice
from django.db import models
import random
import string
from .functions import generate_reference
class SepaPaymentReference(models.Model):
invoice = models.ForeignKey(Invoice, models.CASCADE)
reference = models.IntegerField(default=generate_reference)
class SepaInvoicePayment(InvoicePayment):
@property
def gateway(self):
return "Bank Transfer"
@staticmethod
def initiate(subscription):
SepaPaymentReference.objects.get_or_create(subscription=subscription)