summaryrefslogtreecommitdiff
path: root/postgresqleu/transferwise/models.py
diff options
context:
space:
mode:
authorMagnus Hagander2019-09-06 20:40:13 +0000
committerMagnus Hagander2019-09-06 20:40:13 +0000
commitb7373584836749588e2a47f915a6d7cd56ab4e9f (patch)
treedb8f8a458b8ade0375a7d87098352694e9ed35bb /postgresqleu/transferwise/models.py
parentf11d4a1e41c7641a8643416b04fd67512e3c18bf (diff)
Add function to send TransferWise monthly statements to treasurer
TransferWise doesn't send statements automatically, and downloading them is limited by the single-user-per-account-system. But since their API allows downloading of a PDF statement between arbitrary dates, use that to download the statements once per month and email them as an attachment. The function is optional and turned on/off on a per-paymentmethod basis.
Diffstat (limited to 'postgresqleu/transferwise/models.py')
-rw-r--r--postgresqleu/transferwise/models.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/postgresqleu/transferwise/models.py b/postgresqleu/transferwise/models.py
index 4c4382d3..fbca49ad 100644
--- a/postgresqleu/transferwise/models.py
+++ b/postgresqleu/transferwise/models.py
@@ -52,3 +52,15 @@ class TransferwisePayout(models.Model):
sentat = models.DateTimeField(null=True, blank=True)
completedat = models.DateTimeField(null=True, blank=True)
completedtrans = models.ForeignKey(TransferwiseTransaction, blank=True, null=True)
+
+
+class TransferwiseMonthlyStatement(models.Model):
+ paymentmethod = models.ForeignKey(InvoicePaymentMethod, blank=False, null=False)
+ month = models.DateField(null=False, blank=False)
+ downloaded = models.DateTimeField(null=False, blank=False, auto_now_add=True)
+ contents = models.BinaryField(null=False)
+
+ class Meta:
+ unique_together = (
+ ('month', 'paymentmethod'),
+ )