Ignore:
Timestamp:
4 Dec 2014, 04:01:49 (10 years ago)
Author:
uli
Message:

Add interface methods in Payment class.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/waeup.ikoba/branches/uli-payments/src/waeup/ikoba/payments/payment.py

    r12137 r12139  
    5858        return
    5959
     60    def approve(self, payment_date=None):
     61        """A payment was approved.
     62
     63        Successful ending; the payment is marked as payed.
     64
     65        If `payment_date` is given, it must be a datetime object
     66        giving a datetime in UTC timezone.
     67
     68        Raises ObjectModifiedEvent.
     69        """
     70        if payment_date is None:
     71            payment_date = datetime.utcnow()
     72        self.payment_date = payment_date
     73        self.payment_state = STATE_PAID
     74        notify(grok.ObjectModifiedEvent(self))
     75
     76    def mark_failed(self, reason=None):
     77        """Mark payment as failed.
     78
     79        Raises ObjectModifiedEvent.
     80        """
     81        self.payment_state = STATE_FAILED
     82        notify(grok.ObjectModifiedEvent(self))
     83
    6084
    6185class OnlinePayment(Payment):
Note: See TracChangeset for help on using the changeset viewer.