from django.contrib.sites.models import Site
from django.db import models
from django.urls import reverse
+from django.utils.timezone import now
from django.utils.translation import ugettext_lazy as _
from . import POSS
('CANCELED', _('Canceled')),
('REJECTED', _('Rejected')),
])
+ completed_at = models.DateTimeField(null=True, blank=True)
class Meta:
abstract = True
token.save()
# else?
+ if 'orderId' not in response:
+ raise ValueError("Expecting dict with `orderId` key, got: %s" % response)
self.order_id = response['orderId']
self.save()
status = self.get_status()
if self.order.status not in (status, 'COMPLETED'):
self.order.status = status
+ if status == 'COMPLETED':
+ self.order.completed_at = now()
self.order.save()
self.order.status_updated()