def fulfill(self, transaction): """ Fulfill the transaction """ if not self.can_fulfill(transaction): raise StregForbudError self.balance += transaction.change()
def can_fulfill(self, transaction): """ Can the member fulfill the transaction """ if self.balance + transaction.change() < 0: return False return True
def rollback(self, transaction): """ Rollback transaction """ self.balance -= transaction.change()