add cep and cnpj to api
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import json
|
||||
from datetime import datetime, timedelta
|
||||
from typing import NotRequired, TypedDict
|
||||
|
||||
@@ -135,24 +134,22 @@ def _generate_cert(
|
||||
# Send template URI and data to Paperforge API to generate a PDF
|
||||
r = requests.post(
|
||||
PAPERFORGE_API,
|
||||
data=json.dumps(
|
||||
{
|
||||
'template_uri': cert['s3_uri'],
|
||||
'args': {
|
||||
'name': user['name'],
|
||||
'cpf': _cpffmt(user['cpf']),
|
||||
'score': score,
|
||||
'started_at': started_at.strftime('%d/%m/%Y'),
|
||||
'completed_at': completed_at.strftime('%d/%m/%Y'),
|
||||
'today': _datefmt(now_),
|
||||
'year': now_.strftime('%Y'),
|
||||
'expires_at': expires_at.strftime('%d/%m/%Y')
|
||||
if expires_at
|
||||
else None,
|
||||
},
|
||||
json={
|
||||
'template_uri': cert['s3_uri'],
|
||||
'args': {
|
||||
'name': user['name'],
|
||||
'cpf': _cpffmt(user['cpf']),
|
||||
'score': score,
|
||||
'started_at': started_at.strftime('%d/%m/%Y'),
|
||||
'completed_at': completed_at.strftime('%d/%m/%Y'),
|
||||
'today': _datefmt(now_),
|
||||
'year': now_.strftime('%Y'),
|
||||
'expires_at': expires_at.strftime('%d/%m/%Y')
|
||||
if expires_at
|
||||
else None,
|
||||
},
|
||||
),
|
||||
timeout=6,
|
||||
},
|
||||
timeout=(1, 3),
|
||||
)
|
||||
r.raise_for_status()
|
||||
|
||||
|
||||
@@ -369,7 +369,7 @@ Resources:
|
||||
Properties:
|
||||
Handler: events.issue_cert.lambda_handler
|
||||
Tracing: Active
|
||||
Timeout: 12
|
||||
# Timeout: 12
|
||||
LoggingConfig:
|
||||
LogGroup: !Ref EventLog
|
||||
Policies:
|
||||
@@ -443,6 +443,10 @@ Resources:
|
||||
sk: ['0']
|
||||
new_image:
|
||||
status: [COMPLETED]
|
||||
# Post-migration: uncomment the following line
|
||||
# cert:
|
||||
# expires_at:
|
||||
# - exists: true
|
||||
cert_expires_at:
|
||||
- exists: true
|
||||
org_id:
|
||||
|
||||
Reference in New Issue
Block a user