summaryrefslogtreecommitdiff
path: root/postgresqleu/paypal/models.py
blob: 152ceff0718bf33dcd55a04fe1d11fc674a9bede (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from django.db import models

from postgresqleu.invoices.models import InvoicePaymentMethod


class TransactionInfo(models.Model):
    paypaltransid = models.CharField(max_length=20, null=False, blank=False, unique=True)
    timestamp = models.DateTimeField(null=False, blank=False)
    sender = models.CharField(max_length=200, null=False, blank=False)
    sendername = models.CharField(max_length=200, null=False, blank=False)
    amount = models.DecimalField(decimal_places=2, max_digits=10, null=False, blank=False)
    fee = models.DecimalField(decimal_places=2, max_digits=10, null=True, blank=True)
    transtext = models.CharField(max_length=1000, null=False, blank=False)
    matched = models.BooleanField(null=False, blank=False)
    matchinfo = models.CharField(max_length=1000, null=True, blank=True)
    paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False, on_delete=models.CASCADE)

    def setmatched(self, msg):
        self.matched = True
        self.matchinfo = msg
        self.save()


class ErrorLog(models.Model):
    timestamp = models.DateTimeField(null=False, blank=False)
    message = models.TextField(null=False, blank=False)
    sent = models.BooleanField(null=False, blank=False)
    paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=True, null=True, on_delete=models.CASCADE)