diff --git a/combo/apps/lingo/migrations/0006_transaction_status.py b/combo/apps/lingo/migrations/0006_transaction_status.py new file mode 100644 index 00000000..4d81b6c0 --- /dev/null +++ b/combo/apps/lingo/migrations/0006_transaction_status.py @@ -0,0 +1,20 @@ +# -*- coding: utf-8 -*- +from __future__ import unicode_literals + +from django.db import models, migrations + + +class Migration(migrations.Migration): + + dependencies = [ + ('lingo', '0005_auto_20150307_1242'), + ] + + operations = [ + migrations.AddField( + model_name='transaction', + name='status', + field=models.IntegerField(null=True), + preserve_default=True, + ), + ] diff --git a/combo/apps/lingo/models.py b/combo/apps/lingo/models.py index b1a4a017..ab32247a 100644 --- a/combo/apps/lingo/models.py +++ b/combo/apps/lingo/models.py @@ -94,6 +94,17 @@ class Transaction(models.Model): bank_data = JSONField(blank=True) order_id = models.CharField(max_length=200) user = models.ForeignKey(settings.AUTH_USER_MODEL) + status = models.IntegerField(null=True) + + def is_paid(self): + return self.status == eopayment.PAID + + def get_status_label(self): + return { + 0: _('Running'), + eopayment.PAID: _('Paid'), + eopayment.CANCELLED: _('Cancelled'), + }.get(self.status) or _('Unknown') @register_cell_class diff --git a/combo/apps/lingo/templates/lingo/combo/recent_transactions.html b/combo/apps/lingo/templates/lingo/combo/recent_transactions.html index c5ea12ef..bb44ebeb 100644 --- a/combo/apps/lingo/templates/lingo/combo/recent_transactions.html +++ b/combo/apps/lingo/templates/lingo/combo/recent_transactions.html @@ -4,11 +4,15 @@