コード例 #1
0
 def fulfill(self, transaction):
     """
     Fulfill the transaction
     """
     if not self.can_fulfill(transaction):
         raise StregForbudError
     self.balance += transaction.change()
コード例 #2
0
    def can_fulfill(self, transaction):
        """
        Can the member fulfill the transaction
        """

        if self.balance + transaction.change() < 0:
            return False
        return True
コード例 #3
0
 def rollback(self, transaction):
     """
     Rollback transaction
     """
     self.balance -= transaction.change()