add email events
This commit is contained in:
@@ -15,6 +15,7 @@ from boto3clients import dynamodb_client, s3_client
|
||||
from config import BUCKET_NAME, ORDER_TABLE
|
||||
|
||||
WEASYPRINT_API = 'https://weasyprint.saladeaula.digital'
|
||||
TEMPLATE_S3_URI = 's3://saladeaula.digital/billing/template.html'
|
||||
|
||||
logger = Logger(__name__)
|
||||
order_layer = DynamoDBPersistenceLayer(ORDER_TABLE, dynamodb_client)
|
||||
@@ -38,20 +39,19 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||
limit=150,
|
||||
)
|
||||
|
||||
r = requests.post(
|
||||
WEASYPRINT_API,
|
||||
data=json.dumps(
|
||||
{
|
||||
'template_s3_uri': 's3://saladeaula.digital/billing/template.html',
|
||||
'template_vars': {
|
||||
'start_date': start_date,
|
||||
'end_date': end_date,
|
||||
'items': result['items'],
|
||||
},
|
||||
json_data = json.dumps(
|
||||
{
|
||||
'template_s3_uri': TEMPLATE_S3_URI,
|
||||
'template_vars': {
|
||||
'start_date': start_date,
|
||||
'end_date': end_date,
|
||||
'items': result['items'],
|
||||
},
|
||||
cls=Encoder,
|
||||
),
|
||||
},
|
||||
cls=Encoder,
|
||||
)
|
||||
# Send template URI and data to WeasyPrint API to generate a PDF
|
||||
r = requests.post(WEASYPRINT_API, data=json_data)
|
||||
r.raise_for_status()
|
||||
|
||||
object_key = f'billing/{org_id}/{start_date}_{end_date}.pdf'
|
||||
|
||||
@@ -17,7 +17,7 @@ SUBJECT = (
|
||||
REPLY_TO = ('Carolina Brand', 'carolina@somosbeta.com.br')
|
||||
BCC = [
|
||||
'sergio@somosbeta.com.br',
|
||||
# 'carolina@somosbeta.com.br',
|
||||
'carolina@somosbeta.com.br',
|
||||
]
|
||||
MESSAGE = """
|
||||
Oi, tudo bem?<br/><br/>
|
||||
|
||||
Reference in New Issue
Block a user