Exemplo n.º 1
0
def handler(event, context):
    amount = json.loads(event['body'])
    new_balance = DBHelper.update_balance(amount["amount"], credit=True)
    transaction = DBHelper.deposit(credit=amount["amount"],
                                   balance=new_balance)
    print("Transaction: {0}".format(transaction))
    return {"statusCode": 200, "body": json.dumps(transaction)}
Exemplo n.º 2
0
    def post(self):
        amount = Deposit.parser.parse_args()
        new_balance = DBHelper.update_balance(amount["amount"], credit=True)
        transaction = DBHelper.deposit(credit=amount["amount"],
                                       balance=new_balance)

        return transaction