summaryrefslogtreecommitdiff
path: root/postgresqleu
diff options
context:
space:
mode:
authorMagnus Hagander2016-12-27 15:29:35 +0000
committerMagnus Hagander2016-12-27 15:29:35 +0000
commit0147465f7b53db8bd157cdf8d6a086662fb34aa7 (patch)
treed2eb4f2309589e3b8842c0855ed498c68496c970 /postgresqleu
parent0a66c34318aca7d1dfbc1efadee85aeaa70a43db (diff)
Some Trustly notifications can show up with no amount
Diffstat (limited to 'postgresqleu')
-rw-r--r--postgresqleu/trustlypayment/migrations/0002_nullamount.py19
-rw-r--r--postgresqleu/trustlypayment/models.py2
-rw-r--r--postgresqleu/trustlypayment/util.py2
3 files changed, 21 insertions, 2 deletions
diff --git a/postgresqleu/trustlypayment/migrations/0002_nullamount.py b/postgresqleu/trustlypayment/migrations/0002_nullamount.py
new file mode 100644
index 00000000..efda322d
--- /dev/null
+++ b/postgresqleu/trustlypayment/migrations/0002_nullamount.py
@@ -0,0 +1,19 @@
+# -*- coding: utf-8 -*-
+from __future__ import unicode_literals
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('trustlypayment', '0001_initial'),
+ ]
+
+ operations = [
+ migrations.AlterField(
+ model_name='trustlynotification',
+ name='amount',
+ field=models.DecimalField(null=True, max_digits=20, decimal_places=2, blank=True),
+ ),
+ ]
diff --git a/postgresqleu/trustlypayment/models.py b/postgresqleu/trustlypayment/models.py
index d64fa460..13dc54c2 100644
--- a/postgresqleu/trustlypayment/models.py
+++ b/postgresqleu/trustlypayment/models.py
@@ -26,7 +26,7 @@ class TrustlyNotification(models.Model):
notificationid = models.BigIntegerField(null=False, blank=False)
orderid = models.BigIntegerField(null=False, blank=False)
method = models.CharField(max_length=80, null=False, blank=False)
- amount = models.DecimalField(decimal_places=2, max_digits=20, null=False)
+ amount = models.DecimalField(decimal_places=2, max_digits=20, null=True, blank=True)
messageid = models.CharField(max_length=80, null=False, blank=False)
confirmed = models.BooleanField(null=False, default=False)
diff --git a/postgresqleu/trustlypayment/util.py b/postgresqleu/trustlypayment/util.py
index 702ac511..7fdbdb06 100644
--- a/postgresqleu/trustlypayment/util.py
+++ b/postgresqleu/trustlypayment/util.py
@@ -50,7 +50,7 @@ class Trustly(TrustlyWrapper):
method=method,
notificationid=data['notificationid'],
orderid=data['orderid'],
- amount=Decimal(data['amount']),
+ amount=data.has_key('amount') and Decimal(data['amount']) or None,
messageid=data['messageid'],
)
n.save()