X-Git-Url: https://git.mdrn.pl/wolnelektury.git/blobdiff_plain/d527b63f5320d32e5c598354fd60ebc00d88d7bb..f39c00ef647a7f625d9bd61c570b89d7b9762c61:/src/club/models.py diff --git a/src/club/models.py b/src/club/models.py index 40a413849..62c1069f2 100644 --- a/src/club/models.py +++ b/src/club/models.py @@ -205,11 +205,12 @@ class PayUOrder(payu_models.Order): def status_updated(self): if self.status == 'COMPLETED': since = self.schedule.expires_at - if since is None or since < self.received_at: - since = self.received_at + n = now() + if since is None or since < n: + since = n new_exp = self.schedule.plan.get_next_installment(since) if self.schedule.payed_at is None: - self.schedule.payed_at = self.received_at + self.schedule.payed_at = n if self.schedule.expires_at is None or self.schedule.expires_at < new_exp: self.schedule.expires_at = new_exp self.schedule.save()