def post(self, order_id): order = Order.get_by_id(long(order_id)) if order is None: self.error(404) return # TODO: `purchaese' should be the received json object purchases = order.get_purchases() balance = UserBalance() for p in purchases: balance.pay_for(p.customer, p.item.price) self.redirect('/u/mine/profile')
def get_balances(self, user): user_balance = UserBalance(user.who) balances, total_amount, max_amount = user_balance.get_balances() total = Balance(amount=total_amount, name="Total", max_amount=max_amount) balances.append(total) return balances