summaryrefslogtreecommitdiff
path: root/postgresqleu/stripepayment/models.py
diff options
context:
space:
mode:
authorMagnus Hagander2019-07-05 20:42:30 +0000
committerMagnus Hagander2019-07-08 09:47:03 +0000
commit00adf6940d1fb86bce899ee023ae4793d0bdd817 (patch)
treeb7a47191a23272d5b864f4672ffc257c3b03d96c /postgresqleu/stripepayment/models.py
parent758be702a4ea3bf2f68738178a1f1764d49f6868 (diff)
Initial support for Stripe payments
No support for payout tracking yet, since Stripe makes it impossible to test that until 7 days after you sign up for the test account...
Diffstat (limited to 'postgresqleu/stripepayment/models.py')
-rw-r--r--postgresqleu/stripepayment/models.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/postgresqleu/stripepayment/models.py b/postgresqleu/stripepayment/models.py
new file mode 100644
index 00000000..fad11b73
--- /dev/null
+++ b/postgresqleu/stripepayment/models.py
@@ -0,0 +1,42 @@
+from django.db import models
+
+from postgresqleu.invoices.models import InvoicePaymentMethod, InvoiceRefund
+
+
+class StripeCheckout(models.Model):
+ paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False)
+ createdat = models.DateTimeField(null=False, blank=False)
+ invoiceid = models.IntegerField(null=False, blank=False, unique=True)
+ amount = models.DecimalField(decimal_places=2, max_digits=20, null=False)
+ sessionid = models.CharField(max_length=200, null=False, blank=False, unique=True)
+ paymentintent = models.CharField(max_length=200, null=False, blank=False, unique=True)
+ completedat = models.DateTimeField(null=True, blank=True)
+ fee = models.DecimalField(decimal_places=2, max_digits=20, null=True)
+
+ class Meta:
+ ordering = ('-id', )
+
+
+class StripeRefund(models.Model):
+ paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False)
+ chargeid = models.CharField(max_length=200, null=False, blank=False)
+ refundid = models.CharField(max_length=200, null=False, blank=False, unique=True)
+ invoicerefundid = models.OneToOneField(InvoiceRefund, null=False, blank=False, unique=True)
+ amount = models.DecimalField(decimal_places=2, max_digits=20, null=False)
+ completedat = models.DateTimeField(null=True, blank=True)
+
+
+class ReturnAuthorizationStatus(models.Model):
+ checkoutid = models.IntegerField(null=False, blank=False, primary_key=True)
+ seencount = models.IntegerField(null=False, default=0)
+
+
+class StripeLog(models.Model):
+ timestamp = models.DateTimeField(null=False, blank=False, auto_now_add=True)
+ message = models.TextField(null=False, blank=False)
+ error = models.BooleanField(null=False, blank=False, default=False)
+ sent = models.BooleanField(null=False, blank=False, default=False)
+ paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False)
+
+ class Meta:
+ ordering = ('-id', )