Skip to content

Commit

Permalink
Registrar lançamento
Browse files Browse the repository at this point in the history
  • Loading branch information
epiresdasilva committed Dec 9, 2020
1 parent 3a76f4e commit d60a61d
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions registrar_lancamento.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,28 @@
import json
import boto3
import logging
import os
import uuid
from datetime import datetime


def main(event, context):
print(str(event))
body = event["detail"]

logger = logging.getLogger()
logger.setLevel(logging.INFO)

body = {
"mensagem": "Lançamento incluida com sucesso"
}
dynamodb = boto3.resource('dynamodb', region_name='us-east-1')
table_name = os.environ['LANCAMENTO_TABLE']

response = {
"statusCode": 200,
"body": json.dumps(body)
}
table = dynamodb.Table(table_name)

return response
return table.put_item(
Item={
'id': str(uuid.uuid4()),
'agencia': body["agencia"],
'numeroConta': body["numeroConta"],
'numeroCartao': body["numeroCartao"],
'valor': body["valor"],
'data': datetime.today().strftime('%Y-%m-%d')
}
)

0 comments on commit d60a61d

Please sign in to comment.