cancel enrollment on billing
This commit is contained in:
@@ -41,24 +41,23 @@ sqlite3.register_converter('json', json.loads)
|
|||||||
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||||
new_image = event.detail['new_image']
|
new_image = event.detail['new_image']
|
||||||
now_ = now()
|
now_ = now()
|
||||||
enrollment_id = new_image['id']
|
|
||||||
org_id = new_image['org_id']
|
org_id = new_image['org_id']
|
||||||
data = enrollment_layer.collection.get_items(
|
enrollment = enrollment_layer.collection.get_items(
|
||||||
TransactKey(enrollment_id) + SortKey('0') + SortKey('author')
|
TransactKey(new_image['id']) + SortKey('0') + SortKey('author')
|
||||||
)
|
)
|
||||||
|
|
||||||
if not data:
|
if not enrollment:
|
||||||
logger.debug('Enrollment not found')
|
logger.debug('Enrollment not found')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
logger.info('Enrollment found', data=data)
|
logger.info('Enrollment found', data=enrollment)
|
||||||
|
|
||||||
# Keep it until the migration has been completed
|
# Keep it until the migration has been completed
|
||||||
old_course = _get_course(data['course']['id'])
|
old_course = _get_course(enrollment['course']['id'])
|
||||||
if old_course:
|
if old_course:
|
||||||
data['course'] = old_course
|
enrollment['course'] = old_course
|
||||||
|
|
||||||
created_at: datetime = fromisoformat(data['create_date']) # type: ignore
|
created_at: datetime = fromisoformat(enrollment['create_date']) # type: ignore
|
||||||
start_date, end_date = get_billing_period(
|
start_date, end_date = get_billing_period(
|
||||||
billing_day=new_image['billing_day'],
|
billing_day=new_image['billing_day'],
|
||||||
date_=created_at,
|
date_=created_at,
|
||||||
@@ -69,7 +68,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
end=end_date.isoformat(),
|
end=end_date.isoformat(),
|
||||||
)
|
)
|
||||||
|
|
||||||
logger.info('Enrollment found', data=data)
|
logger.info('Enrollment found', data=enrollment)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
with order_layer.transact_writer() as transact:
|
with order_layer.transact_writer() as transact:
|
||||||
@@ -81,7 +80,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
'created_at': now_,
|
'created_at': now_,
|
||||||
},
|
},
|
||||||
cond_expr='attribute_not_exists(sk)',
|
cond_expr='attribute_not_exists(sk)',
|
||||||
exc_cls=ExistingBillingConflictError,
|
exc_cls=BillingConflictError,
|
||||||
)
|
)
|
||||||
transact.put(
|
transact.put(
|
||||||
item={
|
item={
|
||||||
@@ -93,12 +92,13 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
'created_at': now_,
|
'created_at': now_,
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
except ExistingBillingConflictError:
|
except BillingConflictError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
# Add enrollment entry to billing
|
||||||
try:
|
try:
|
||||||
author = data.get('author')
|
author = enrollment.get('author')
|
||||||
course_id = data['course']['id']
|
course_id = enrollment['course']['id']
|
||||||
course = course_layer.collection.get_items(
|
course = course_layer.collection.get_items(
|
||||||
KeyPair(
|
KeyPair(
|
||||||
pk=course_id,
|
pk=course_id,
|
||||||
@@ -115,15 +115,16 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
order_layer.put_item(
|
order_layer.put_item(
|
||||||
item={
|
item={
|
||||||
'id': pk,
|
'id': pk,
|
||||||
'sk': f'{sk}#ENROLLMENT#{enrollment_id}',
|
'sk': f'{sk}#ENROLLMENT#{enrollment["id"]}',
|
||||||
'user': pick(('id', 'name'), data['user']),
|
'user': pick(('id', 'name'), enrollment['user']),
|
||||||
'course': pick(('id', 'name'), data['course']),
|
'course': pick(('id', 'name'), enrollment['course']),
|
||||||
'unit_price': course['unit_price'],
|
'unit_price': course['unit_price'],
|
||||||
# Post-migration: uncomment the following line
|
# Post-migration: uncomment the following line
|
||||||
# 'enrolled_at': data['created_at'],
|
# 'enrolled_at': enrollment['created_at'],
|
||||||
'enrolled_at': data['create_date'],
|
'enrolled_at': enrollment['create_date'],
|
||||||
'created_at': now_,
|
'created_at': now_,
|
||||||
}
|
}
|
||||||
|
# Add author if present
|
||||||
| (
|
| (
|
||||||
{
|
{
|
||||||
'author': {
|
'author': {
|
||||||
@@ -146,7 +147,7 @@ def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
class ExistingBillingConflictError(Exception): ...
|
class BillingConflictError(Exception): ...
|
||||||
|
|
||||||
|
|
||||||
class BillingNotFoundError(Exception): ...
|
class BillingNotFoundError(Exception): ...
|
||||||
|
|||||||
84
order-events/app/events/billing/cancel_enrollment.py
Normal file
84
order-events/app/events/billing/cancel_enrollment.py
Normal file
@@ -0,0 +1,84 @@
|
|||||||
|
from datetime import datetime
|
||||||
|
|
||||||
|
from aws_lambda_powertools import Logger
|
||||||
|
from aws_lambda_powertools.utilities.data_classes import (
|
||||||
|
EventBridgeEvent,
|
||||||
|
event_source,
|
||||||
|
)
|
||||||
|
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||||
|
from layercake.dateutils import fromisoformat, now
|
||||||
|
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair, SortKey, TransactKey
|
||||||
|
from layercake.funcs import pick
|
||||||
|
|
||||||
|
from boto3clients import dynamodb_client
|
||||||
|
from config import ENROLLMENT_TABLE, ORDER_TABLE
|
||||||
|
from utils import get_billing_period
|
||||||
|
|
||||||
|
logger = Logger(__name__)
|
||||||
|
enrollment_layer = DynamoDBPersistenceLayer(ENROLLMENT_TABLE, dynamodb_client)
|
||||||
|
order_layer = DynamoDBPersistenceLayer(ORDER_TABLE, dynamodb_client)
|
||||||
|
|
||||||
|
|
||||||
|
@event_source(data_class=EventBridgeEvent)
|
||||||
|
@logger.inject_lambda_context
|
||||||
|
def lambda_handler(event: EventBridgeEvent, context: LambdaContext) -> bool:
|
||||||
|
now_ = now()
|
||||||
|
new_image = event.detail['new_image']
|
||||||
|
enrollment_id = new_image['id']
|
||||||
|
subscription = enrollment_layer.collection.get_items(
|
||||||
|
TransactKey(enrollment_id)
|
||||||
|
+ SortKey('METADATA#SUBSCRIPTION_COVERED')
|
||||||
|
# Post-migration: uncomment the following line
|
||||||
|
# + SortKey('CANCELED', path_spec='author', rename_key='author')
|
||||||
|
+ SortKey('canceled', path_spec='author', rename_key='author')
|
||||||
|
)
|
||||||
|
|
||||||
|
created_at: datetime = fromisoformat(new_image['create_date']) # type: ignore
|
||||||
|
start_date, end_date = get_billing_period(
|
||||||
|
billing_day=int(subscription['billing_day']),
|
||||||
|
date_=created_at,
|
||||||
|
)
|
||||||
|
pk = 'BILLING#ORG#{org_id}'.format(org_id=subscription['org_id'])
|
||||||
|
sk = 'START#{start}#END#{end}'.format(
|
||||||
|
start=start_date.isoformat(),
|
||||||
|
end=end_date.isoformat(),
|
||||||
|
)
|
||||||
|
|
||||||
|
if now_.date() > end_date:
|
||||||
|
logger.debug('Enrollment outside the billing period')
|
||||||
|
return False
|
||||||
|
|
||||||
|
try:
|
||||||
|
author = subscription.get('author')
|
||||||
|
# Retrieve canceled enrollment data
|
||||||
|
old_enrollment = order_layer.collection.get_item(
|
||||||
|
KeyPair(
|
||||||
|
pk=pk,
|
||||||
|
sk=f'{sk}#ENROLLMENT#{enrollment_id}',
|
||||||
|
),
|
||||||
|
exc_cls=EnrollmentNotFoundError,
|
||||||
|
)
|
||||||
|
|
||||||
|
order_layer.put_item(
|
||||||
|
item={
|
||||||
|
'id': pk,
|
||||||
|
'sk': f'{sk}#ENROLLMENT#{enrollment_id}#CANCELED',
|
||||||
|
'unit_price': old_enrollment['unit_price'] * -1,
|
||||||
|
'created_at': now_,
|
||||||
|
}
|
||||||
|
| pick(('user', 'course', 'enrolled_at'), old_enrollment)
|
||||||
|
# Add author if present
|
||||||
|
| ({'author': author} if author else {}),
|
||||||
|
cond_expr='attribute_not_exists(sk)',
|
||||||
|
)
|
||||||
|
except Exception as exc:
|
||||||
|
logger.exception(
|
||||||
|
exc,
|
||||||
|
keypair={'pk': pk, 'sk': sk},
|
||||||
|
)
|
||||||
|
return False
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
|
|
||||||
|
class EnrollmentNotFoundError(Exception): ...
|
||||||
@@ -26,7 +26,6 @@ Em anexo você encontra o relatório das matrículas realizadas no período de
|
|||||||
<strong>{start_date}</strong> a <strong>{end_date}</strong>.<br/><br/>
|
<strong>{start_date}</strong> a <strong>{end_date}</strong>.<br/><br/>
|
||||||
|
|
||||||
Qualquer dúvida, estamos à disposição.
|
Qualquer dúvida, estamos à disposição.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
logger = Logger(__name__)
|
logger = Logger(__name__)
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ Globals:
|
|||||||
Architectures:
|
Architectures:
|
||||||
- x86_64
|
- x86_64
|
||||||
Layers:
|
Layers:
|
||||||
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:86
|
- !Sub arn:aws:lambda:sa-east-1:336641857101:layer:layercake:94
|
||||||
Environment:
|
Environment:
|
||||||
Variables:
|
Variables:
|
||||||
TZ: America/Sao_Paulo
|
TZ: America/Sao_Paulo
|
||||||
@@ -70,6 +70,32 @@ Resources:
|
|||||||
new_image:
|
new_image:
|
||||||
sk: ["METADATA#SUBSCRIPTION_COVERED"]
|
sk: ["METADATA#SUBSCRIPTION_COVERED"]
|
||||||
|
|
||||||
|
EventBillingCancelEnrollmentFunction:
|
||||||
|
Type: AWS::Serverless::Function
|
||||||
|
Properties:
|
||||||
|
Handler: events.billing.cancel_enrollment.lambda_handler
|
||||||
|
LoggingConfig:
|
||||||
|
LogGroup: !Ref EventLog
|
||||||
|
Policies:
|
||||||
|
- DynamoDBCrudPolicy:
|
||||||
|
TableName: !Ref OrderTable
|
||||||
|
- DynamoDBReadPolicy:
|
||||||
|
TableName: !Ref EnrollmentTable
|
||||||
|
Events:
|
||||||
|
Event:
|
||||||
|
Type: EventBridgeRule
|
||||||
|
Properties:
|
||||||
|
Pattern:
|
||||||
|
resources: [!Ref EnrollmentTable]
|
||||||
|
detail-type: [MODIFY]
|
||||||
|
detail:
|
||||||
|
new_image:
|
||||||
|
sk: ["0"]
|
||||||
|
status: ["CANCELED"]
|
||||||
|
subscription_covered: [true]
|
||||||
|
old_image:
|
||||||
|
status: ["PENDING"]
|
||||||
|
|
||||||
EventBillingCloseWindowFunction:
|
EventBillingCloseWindowFunction:
|
||||||
Type: AWS::Serverless::Function
|
Type: AWS::Serverless::Function
|
||||||
Properties:
|
Properties:
|
||||||
|
|||||||
@@ -1,11 +1,10 @@
|
|||||||
import os
|
import os
|
||||||
from dataclasses import dataclass
|
from dataclasses import dataclass
|
||||||
from uuid import uuid4
|
|
||||||
|
|
||||||
import jsonlines
|
import jsonlines
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
PYTEST_TABLE_NAME = f'pytest-{uuid4()}'
|
PYTEST_TABLE_NAME = 'pytest'
|
||||||
PK = 'id'
|
PK = 'id'
|
||||||
SK = 'sk'
|
SK = 'sk'
|
||||||
|
|
||||||
@@ -69,7 +68,9 @@ def dynamodb_persistence_layer(dynamodb_client):
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture()
|
@pytest.fixture()
|
||||||
def dynamodb_seeds(dynamodb_client):
|
def dynamodb_seeds(dynamodb_persistence_layer):
|
||||||
with jsonlines.open('tests/seeds.jsonl') as lines:
|
with open('tests/seeds.jsonl', 'rb') as fp:
|
||||||
for line in lines:
|
reader = jsonlines.Reader(fp)
|
||||||
dynamodb_client.put_item(TableName=PYTEST_TABLE_NAME, Item=line)
|
|
||||||
|
for line in reader.iter(type=dict, skip_invalid=True):
|
||||||
|
dynamodb_persistence_layer.put_item(item=line)
|
||||||
|
|||||||
69
order-events/tests/events/billing/test_cancel_enrollment.py
Normal file
69
order-events/tests/events/billing/test_cancel_enrollment.py
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
from aws_lambda_powertools.utilities.typing import LambdaContext
|
||||||
|
from layercake.dateutils import now
|
||||||
|
from layercake.dynamodb import DynamoDBPersistenceLayer, KeyPair
|
||||||
|
|
||||||
|
import events.billing.cancel_enrollment as app
|
||||||
|
from utils import get_billing_period
|
||||||
|
|
||||||
|
enrollment_id = '77055ad7-03e1-4b07-98dc-a2f1a90913ba'
|
||||||
|
event = {
|
||||||
|
'detail': {
|
||||||
|
'new_image': {
|
||||||
|
'id': enrollment_id,
|
||||||
|
'sk': '0',
|
||||||
|
'user': {
|
||||||
|
'id': '5OxmMjL-ujoR5IMGegQz',
|
||||||
|
'name': 'Sérgio R Siqueira',
|
||||||
|
},
|
||||||
|
'course': {
|
||||||
|
'id': '123',
|
||||||
|
'name': 'pytest',
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
def test_cancel_enrollment(
|
||||||
|
dynamodb_seeds,
|
||||||
|
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||||
|
lambda_context: LambdaContext,
|
||||||
|
):
|
||||||
|
now_ = now()
|
||||||
|
start_date, end_date = get_billing_period(
|
||||||
|
billing_day=6,
|
||||||
|
date_=now_,
|
||||||
|
)
|
||||||
|
pk = 'BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG'
|
||||||
|
sk = 'START#{start}#END#{end}#ENROLLMENT#{enrollment_id}'.format(
|
||||||
|
start=start_date.isoformat(),
|
||||||
|
end=end_date.isoformat(),
|
||||||
|
enrollment_id=enrollment_id,
|
||||||
|
)
|
||||||
|
# Add up-to-date enrollment item to billing
|
||||||
|
dynamodb_persistence_layer.put_item(
|
||||||
|
item={
|
||||||
|
'id': pk,
|
||||||
|
'sk': sk,
|
||||||
|
'unit_price': 100,
|
||||||
|
'course': {'id': '123', 'name': 'pytest'},
|
||||||
|
'user': {'id': '5OxmMjL-ujoR5IMGegQz', 'name': 'Sérgio R Siqueira'},
|
||||||
|
'enrolled_at': now_,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
|
event['detail']['new_image']['create_date'] = now_.isoformat()
|
||||||
|
assert app.lambda_handler(event, lambda_context) # type: ignore
|
||||||
|
|
||||||
|
r = dynamodb_persistence_layer.collection.query(KeyPair(pk, sk))
|
||||||
|
assert len(r['items']) == 2
|
||||||
|
assert sum(x['unit_price'] for x in r['items']) == 0
|
||||||
|
|
||||||
|
|
||||||
|
def test_cancel_old_enrollment(
|
||||||
|
dynamodb_seeds,
|
||||||
|
dynamodb_persistence_layer: DynamoDBPersistenceLayer,
|
||||||
|
lambda_context: LambdaContext,
|
||||||
|
):
|
||||||
|
event['detail']['new_image']['create_date'] = '2025-06-05T12:13:54.371416+00:00'
|
||||||
|
assert not app.lambda_handler(event, lambda_context) # type: ignore
|
||||||
@@ -1,21 +1,40 @@
|
|||||||
{"id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "metadata#payment_policy"}, "due_days": {"N": "90"}}
|
// Org
|
||||||
{"id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "metadata#billing_policy"}, "billing_day": {"N": "1"}, "payment_method": {"S": "PIX"}}
|
{"id": "cJtK9SsnJhKPyxESe7g3DG", "sk": "metadata#payment_policy", "due_days": 90}
|
||||||
{"id": {"S": "9omWNKymwU5U4aeun6mWzZ"}, "sk": {"S": "0"}, "total": {"N": "398"}, "status": {"S": "PENDING"}, "payment_method": {"S": "MANUAL"}, "tenant_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
|
{"id": "cJtK9SsnJhKPyxESe7g3DG", "sk": "metadata#billing_policy", "billing_day": 1, "payment_method": "PIX"}
|
||||||
{"id": {"S": "cnpj"}, "sk": {"S": "15608435000190"}, "user_id": {"S": "cJtK9SsnJhKPyxESe7g3DG"}}
|
// Org admins
|
||||||
{"id": {"S": "cpf"}, "sk": {"S": "07879819908"}, "user_id": {"S": "5OxmMjL-ujoR5IMGegQz"}}
|
{"id": "cJtK9SsnJhKPyxESe7g3DG", "sk": "admins#1234", "create_date": "2025-03-12T16:51:52.632897-03:00", "email": "sergio@somosbeta.com.br", "name": "Sérgio R Siqueira"}
|
||||||
{"id": {"S": "email"}, "sk": {"S": "sergio@somosbeta.com.br"}, "user_id": {"S": "5OxmMjL-ujoR5IMGegQz"}}
|
|
||||||
{"id": {"S": "5OxmMjL-ujoR5IMGegQz"}, "sk": {"S": "0"}, "name": {"S": "Sérgio R Siqueira"}}
|
// Orders
|
||||||
{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#1"}}
|
{"id": "9omWNKymwU5U4aeun6mWzZ", "sk": "0", "total": 398, "status": "PENDING", "payment_method": "MANUAL", "tenant_id": "cJtK9SsnJhKPyxESe7g3DG"}
|
||||||
{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#2"}}
|
{"id": "18f934d8-035a-4ebc-9f8b-6c84782b8c73", "sk": "0", "payment_method": "PAID"}
|
||||||
{"id": {"S": "vacancies#cJtK9SsnJhKPyxESe7g3DG"}, "sk": {"S": "9omWNKymwU5U4aeun6mWzZ#3"}}
|
{"id": "6a60d026-d383-4707-b093-b6eddea1a24e", "sk": "items", "items": [{"id": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839", "name": "pytest", "quantity": 1, "unit_price": 109}]}
|
||||||
{"id": {"S": "18f934d8-035a-4ebc-9f8b-6c84782b8c73"}, "sk": {"S": "0"}, "payment_method": {"S": "PAID"}}
|
{"id": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839", "sk": "metadata#betaeducacao", "course_id": "dc1a0428-47bf-4db1-a5da-24be49c9fda6", "create_date": "2025-06-05T12:13:54.371416+00:00"}
|
||||||
{"id": {"S": "6a60d026-d383-4707-b093-b6eddea1a24e"}, "sk": {"S": "items"},"items": {"L": [{"M": {"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "name": {"S": "pytest"},"quantity": {"N": "1"},"unit_price": {"N": "109"}}}]}}
|
|
||||||
{"id": {"S": "a810dd22-56c0-4d9b-8cd2-7e2ee9c45839"}, "sk": {"S": "metadata#betaeducacao"},"course_id": {"S": "dc1a0428-47bf-4db1-a5da-24be49c9fda6"},"create_date": {"S": "2025-06-05T12:13:54.371416+00:00"}}
|
// User data
|
||||||
{"id": {"S": "945e8672-1d72-45c6-b76c-ac06aa8b52ab"}, "sk": {"S": "0"}, "course": {"M": {"id": {"S": "123"}, "name": {"S": "pytest"}}}, "user": {"M": {"id": {"S": "5OxmMjL-ujoR5IMGegQz"}, "name": {"S": "Sérgio R Siqueira"}}}, "create_date": {"S": "2025-06-05T12:13:54.371416+00:00"}}
|
{"id": "5OxmMjL-ujoR5IMGegQz", "sk": "0", "name": "Sérgio R Siqueira"}
|
||||||
{"id": {"S": "945e8672-1d72-45c6-b76c-ac06aa8b52ab"}, "sk": {"S": "author"}, "name": {"S": "Carolina Brand"}, "user_id": {"S": "SMEXYk5MQkKCzknJpxqr8n"}}
|
{"id": "cnpj", "sk": "15608435000190", "user_id": "cJtK9SsnJhKPyxESe7g3DG"}
|
||||||
{"id": {"S": "CUSTOM_PRICING#ORG#cJtK9SsnJhKPyxESe7g3DG"},"sk": {"S": "COURSE#123"},"created_at": {"S": "2025-07-24T16:10:09.304073-03:00"},"unit_price": {"N": "79.2"}}
|
{"id": "cpf", "sk": "07879819908", "user_id": "5OxmMjL-ujoR5IMGegQz"}
|
||||||
{"id": {"S": "123"},"sk": {"S": "0"},"access_period": {"N": "360"},"cert": {"M": {"exp_interval": {"N": "360"}}},"created_at": {"S": "2024-12-30T00:33:33.088916-03:00"},"metadata__konviva_class_id": {"N": "194"},"metadata__unit_price": {"N": "99"},"name": {"S": "Direção Defensiva (08 horas)"},"tenant_id": {"S": "*"},"updated_at": {"S": "2025-07-24T00:00:24.639003-03:00"}}
|
{"id": "email", "sk": "sergio@somosbeta.com.br", "user_id": "5OxmMjL-ujoR5IMGegQz"}
|
||||||
{"id": {"S": "BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG"},"sk": {"S": "START#2025-07-01#END#2025-07-31"},"created_at": {"S": "2025-07-24T15:20:52.464244-03:00"},"status": {"S": "PENDING"}}
|
|
||||||
{"id": {"S": "BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG"},"sk": {"S": "START#2025-07-01#END#2025-07-31#ENROLLMENT#a08c94a2-7ee4-45fd-bfe7-73568c738b8b"},"author": {"M": {"id": {"S": "SMEXYk5MQkKCzknJpxqr8n"},"name": {"S": "Carolina Brand"}}},"course": {"M": {"id": {"S": "7f7905aa-ec6d-4189-b884-50fa9b1bd0b8"},"name": {"S": "NR-10 Reciclagem: 08 horas"}}},"created_at": {"S": "2025-07-24T16:38:33.095216-03:00"},"enrolled_at": {"S": "2025-07-24T11:26:56.975207-03:00"},"unit_price": {"N": "169"},"user": {"M": {"id": {"S": "iPWidwn4HsYtikiZD33smV"},"name": {"S": "William da Silva Nascimento"}}}}
|
// Slots
|
||||||
{"id": {"S": "BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG"},"sk": {"S": "START#2025-07-01#END#2025-07-31#ENROLLMENT#ac09e8da-6cb2-4e31-84e7-238df2647a7a"},"author": {"M": {"id": {"S": "SMEXYk5MQkKCzknJpxqr8n"},"name": {"S": "Carolina Brand"}}},"course": {"M": {"id": {"S": "7f7905aa-ec6d-4189-b884-50fa9b1bd0b8"},"name": {"S": "NR-10 Reciclagem: 08 horas"}}},"created_at": {"S": "2025-07-21T16:38:58.694031-03:00"},"enrolled_at": {"S": "2025-07-21T11:26:56.913746-03:00"},"unit_price": {"N": "169"},"user": {"M": {"id": {"S": "ca8c9fca-b508-4842-8a48-fd5cc5632ac0"},"name": {"S": "Geovane Soares De Lima"}}}}
|
{"id": "vacancies#cJtK9SsnJhKPyxESe7g3DG", "sk": "9omWNKymwU5U4aeun6mWzZ#1"}
|
||||||
{"id": {"S": "cJtK9SsnJhKPyxESe7g3DG"},"sk": {"S": "admins#1234"},"create_date": {"S": "2025-03-12T16:51:52.632897-03:00"},"email": {"S": "sergio@somosbeta.com.br"},"name": {"S": "Sérgio R Siqueira"}}
|
{"id": "vacancies#cJtK9SsnJhKPyxESe7g3DG", "sk": "9omWNKymwU5U4aeun6mWzZ#2"}
|
||||||
|
{"id": "vacancies#cJtK9SsnJhKPyxESe7g3DG", "sk": "9omWNKymwU5U4aeun6mWzZ#3"}
|
||||||
|
|
||||||
|
// Enrollments
|
||||||
|
{"id": "945e8672-1d72-45c6-b76c-ac06aa8b52ab", "sk": "0", "course": {"id": "123", "name": "pytest"}, "user": {"id": "5OxmMjL-ujoR5IMGegQz", "name": "Sérgio R Siqueira"}, "create_date": "2025-06-05T12:13:54.371416+00:00"}
|
||||||
|
{"id": "945e8672-1d72-45c6-b76c-ac06aa8b52ab", "sk": "author", "name": "Carolina Brand", "user_id": "SMEXYk5MQkKCzknJpxqr8n"}
|
||||||
|
|
||||||
|
{"id": "77055ad7-03e1-4b07-98dc-a2f1a90913ba", "sk": "0", "course": {"id": "123", "name": "pytest"}, "user": {"id": "5OxmMjL-ujoR5IMGegQz", "name": "Sérgio R Siqueira"}, "create_date": "2025-06-05T12:13:54.371416+00:00"}
|
||||||
|
{"id": "77055ad7-03e1-4b07-98dc-a2f1a90913ba", "sk": "METADATA#SUBSCRIPTION_COVERED", "billing_day": 6, "org_id": "cJtK9SsnJhKPyxESe7g3DG"}
|
||||||
|
{"id": "77055ad7-03e1-4b07-98dc-a2f1a90913ba", "sk": "canceled", "canceled_at": "2025-08-18T15:41:49.927856-03:00", "author": {"id": "123", "name": "Dexter Holland"}}
|
||||||
|
|
||||||
|
|
||||||
|
// Course
|
||||||
|
{"id": "123", "sk": "0", "access_period": "360", "cert": {"exp_interval": 360}, "created_at": "2024-12-30T00:33:33.088916-03:00", "metadata__konviva_class_id": "194", "metadata__unit_price": 99, "name": "Direção Defensiva (08 horas)", "tenant_id": "*", "updated_at": "2025-07-24T00:00:24.639003-03:00"}
|
||||||
|
{"id": "CUSTOM_PRICING#ORG#cJtK9SsnJhKPyxESe7g3DG", "sk": "COURSE#123", "created_at": "2025-07-24T16:10:09.304073-03:00", "unit_price": "79.2"}
|
||||||
|
|
||||||
|
// Billing
|
||||||
|
{"id": "BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG", "sk": "START#2025-07-01#END#2025-07-31", "created_at": "2025-07-24T15:20:52.464244-03:00", "status": "PENDING"}
|
||||||
|
{"id": "BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG", "sk": "START#2025-07-01#END#2025-07-31#ENROLLMENT#a08c94a2-7ee4-45fd-bfe7-73568c738b8b", "author": {"id": "SMEXYk5MQkKCzknJpxqr8n", "name": "Carolina Brand"}, "course": {"id": "7f7905aa-ec6d-4189-b884-50fa9b1bd0b8", "name": "NR-10 Reciclagem: 08 horas"}, "created_at": "2025-07-24T16:38:33.095216-03:00", "enrolled_at": "2025-07-24T11:26:56.975207-03:00", "unit_price": 169, "user": {"id": "iPWidwn4HsYtikiZD33smV", "name": "William da Silva Nascimento"}}
|
||||||
|
{"id": "BILLING#ORG#cJtK9SsnJhKPyxESe7g3DG", "sk": "START#2025-07-01#END#2025-07-31#ENROLLMENT#ac09e8da-6cb2-4e31-84e7-238df2647a7a", "author": {"id": "SMEXYk5MQkKCzknJpxqr8n", "name": "Carolina Brand"}, "course": {"id": "7f7905aa-ec6d-4189-b884-50fa9b1bd0b8", "name": "NR-10 Reciclagem: 08 horas"}, "created_at": "2025-07-21T16:38:58.694031-03:00", "enrolled_at": "2025-07-21T11:26:56.913746-03:00", "unit_price": 169, "user": {"id": "ca8c9fca-b508-4842-8a48-fd5cc5632ac0", "name": "Geovane Soares De Lima"}}
|
||||||
|
|||||||
46
order-events/uv.lock
generated
46
order-events/uv.lock
generated
@@ -38,6 +38,18 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl", hash = "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3", size = 63815, upload-time = "2025-03-13T11:10:21.14Z" },
|
{ url = "https://files.pythonhosted.org/packages/77/06/bb80f5f86020c4551da315d78b3ab75e8228f89f0162f2c3a819e407941a/attrs-25.3.0-py3-none-any.whl", hash = "sha256:427318ce031701fea540783410126f03899a97ffc6f61596ad581ac2e40e3bc3", size = 63815, upload-time = "2025-03-13T11:10:21.14Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "authlib"
|
||||||
|
version = "1.6.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
dependencies = [
|
||||||
|
{ name = "cryptography" },
|
||||||
|
]
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/8e/a1/d8d1c6f8bc922c0b87ae0d933a8ed57be1bef6970894ed79c2852a153cd3/authlib-1.6.1.tar.gz", hash = "sha256:4dffdbb1460ba6ec8c17981a4c67af7d8af131231b5a36a88a1e8c80c111cdfd", size = 159988, upload-time = "2025-07-20T07:38:42.834Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/f9/58/cc6a08053f822f98f334d38a27687b69c6655fb05cd74a7a5e70a2aeed95/authlib-1.6.1-py2.py3-none-any.whl", hash = "sha256:e9d2031c34c6309373ab845afc24168fe9e93dc52d252631f52642f21f5ed06e", size = 239299, upload-time = "2025-07-20T07:38:39.259Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-encryption-sdk"
|
name = "aws-encryption-sdk"
|
||||||
version = "4.0.1"
|
version = "4.0.1"
|
||||||
@@ -55,15 +67,15 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "aws-lambda-powertools"
|
name = "aws-lambda-powertools"
|
||||||
version = "3.13.0"
|
version = "3.19.0"
|
||||||
source = { registry = "https://pypi.org/simple" }
|
source = { registry = "https://pypi.org/simple" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "jmespath" },
|
{ name = "jmespath" },
|
||||||
{ name = "typing-extensions" },
|
{ name = "typing-extensions" },
|
||||||
]
|
]
|
||||||
sdist = { url = "https://files.pythonhosted.org/packages/fd/2b/068efd467c0866e2272c5de7525ddb02ff4e694f71245c8d2a83d4948f23/aws_lambda_powertools-3.13.0.tar.gz", hash = "sha256:99dc11ac6eb81564f599fdd85ba79069f7740ae3481c99bca2cee8abb7c95543", size = 672664, upload-time = "2025-05-20T07:35:30.254Z" }
|
sdist = { url = "https://files.pythonhosted.org/packages/58/db/eb2708f7c27ab02b8d85936ce9308538e1e22c8c8224be5f00da3e6f44f7/aws_lambda_powertools-3.19.0.tar.gz", hash = "sha256:8897ba4be0b3a51f2b8f68946d650f3ef574fa2c40395544de03bd0c61979999", size = 689768, upload-time = "2025-08-12T08:45:46.887Z" }
|
||||||
wheels = [
|
wheels = [
|
||||||
{ url = "https://files.pythonhosted.org/packages/98/cd/2241ff877528c66ee11ea636684c4242ceeadb6459a33b08507a40151414/aws_lambda_powertools-3.13.0-py3-none-any.whl", hash = "sha256:9df045f4c3ff944176655813dbff8c1160e056babf5e6d71d4e18c0003818f2e", size = 802546, upload-time = "2025-05-20T07:35:27.767Z" },
|
{ url = "https://files.pythonhosted.org/packages/c6/52/5a73194286af329309263e9c4e2a57b8feac63bb6027be8d2d6222cd4da7/aws_lambda_powertools-3.19.0-py3-none-any.whl", hash = "sha256:98f18d35f843cd46b80ccadcf39eefc0c489325bea116383bd93048a5241d9fc", size = 832645, upload-time = "2025-08-12T08:45:44.982Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
[package.optional-dependencies]
|
[package.optional-dependencies]
|
||||||
@@ -564,19 +576,22 @@ wheels = [
|
|||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "layercake"
|
name = "layercake"
|
||||||
version = "0.8.2"
|
version = "0.9.12"
|
||||||
source = { directory = "../layercake" }
|
source = { directory = "../layercake" }
|
||||||
dependencies = [
|
dependencies = [
|
||||||
{ name = "arnparse" },
|
{ name = "arnparse" },
|
||||||
|
{ name = "authlib" },
|
||||||
{ name = "aws-lambda-powertools", extra = ["all"] },
|
{ name = "aws-lambda-powertools", extra = ["all"] },
|
||||||
{ name = "dictdiffer" },
|
{ name = "dictdiffer" },
|
||||||
{ name = "ftfy" },
|
{ name = "ftfy" },
|
||||||
{ name = "glom" },
|
{ name = "glom" },
|
||||||
{ name = "meilisearch" },
|
{ name = "meilisearch" },
|
||||||
{ name = "orjson" },
|
{ name = "orjson" },
|
||||||
|
{ name = "passlib" },
|
||||||
{ name = "pycpfcnpj" },
|
{ name = "pycpfcnpj" },
|
||||||
{ name = "pydantic", extra = ["email"] },
|
{ name = "pydantic", extra = ["email"] },
|
||||||
{ name = "pydantic-extra-types" },
|
{ name = "pydantic-extra-types" },
|
||||||
|
{ name = "pyjwt" },
|
||||||
{ name = "pytz" },
|
{ name = "pytz" },
|
||||||
{ name = "requests" },
|
{ name = "requests" },
|
||||||
{ name = "smart-open", extra = ["s3"] },
|
{ name = "smart-open", extra = ["s3"] },
|
||||||
@@ -587,15 +602,18 @@ dependencies = [
|
|||||||
[package.metadata]
|
[package.metadata]
|
||||||
requires-dist = [
|
requires-dist = [
|
||||||
{ name = "arnparse", specifier = ">=0.0.2" },
|
{ name = "arnparse", specifier = ">=0.0.2" },
|
||||||
{ name = "aws-lambda-powertools", extras = ["all"], specifier = ">=3.8.0" },
|
{ name = "authlib", specifier = ">=1.6.1" },
|
||||||
|
{ name = "aws-lambda-powertools", extras = ["all"], specifier = ">=3.18.0" },
|
||||||
{ name = "dictdiffer", specifier = ">=0.9.0" },
|
{ name = "dictdiffer", specifier = ">=0.9.0" },
|
||||||
{ name = "ftfy", specifier = ">=6.3.1" },
|
{ name = "ftfy", specifier = ">=6.3.1" },
|
||||||
{ name = "glom", specifier = ">=24.11.0" },
|
{ name = "glom", specifier = ">=24.11.0" },
|
||||||
{ name = "meilisearch", specifier = ">=0.34.0" },
|
{ name = "meilisearch", specifier = ">=0.34.0" },
|
||||||
{ name = "orjson", specifier = ">=3.10.15" },
|
{ name = "orjson", specifier = ">=3.10.15" },
|
||||||
|
{ name = "passlib", specifier = ">=1.7.4" },
|
||||||
{ name = "pycpfcnpj", specifier = ">=1.8" },
|
{ name = "pycpfcnpj", specifier = ">=1.8" },
|
||||||
{ name = "pydantic", extras = ["email"], specifier = ">=2.10.6" },
|
{ name = "pydantic", extras = ["email"], specifier = ">=2.10.6" },
|
||||||
{ name = "pydantic-extra-types", specifier = ">=2.10.3" },
|
{ name = "pydantic-extra-types", specifier = ">=2.10.3" },
|
||||||
|
{ name = "pyjwt", specifier = ">=2.10.1" },
|
||||||
{ name = "pytz", specifier = ">=2025.1" },
|
{ name = "pytz", specifier = ">=2025.1" },
|
||||||
{ name = "requests", specifier = ">=2.32.3" },
|
{ name = "requests", specifier = ">=2.32.3" },
|
||||||
{ name = "smart-open", extras = ["s3"], specifier = ">=7.1.0" },
|
{ name = "smart-open", extras = ["s3"], specifier = ">=7.1.0" },
|
||||||
@@ -823,6 +841,15 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" },
|
{ url = "https://files.pythonhosted.org/packages/20/12/38679034af332785aac8774540895e234f4d07f7545804097de4b666afd8/packaging-25.0-py3-none-any.whl", hash = "sha256:29572ef2b1f17581046b3a2227d5c611fb25ec70ca1ba8554b24b0e69331a484", size = 66469, upload-time = "2025-04-19T11:48:57.875Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "passlib"
|
||||||
|
version = "1.7.4"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/b6/06/9da9ee59a67fae7761aab3ccc84fa4f3f33f125b370f1ccdb915bf967c11/passlib-1.7.4.tar.gz", hash = "sha256:defd50f72b65c5402ab2c573830a6978e5f202ad0d984793c8dde2c4152ebe04", size = 689844, upload-time = "2020-10-08T19:00:52.121Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/3b/a4/ab6b7589382ca3df236e03faa71deac88cae040af60c071a78d254a62172/passlib-1.7.4-py2.py3-none-any.whl", hash = "sha256:aa6bca462b8d8bda89c70b382f0c298a20b5560af6cbfa2dce410c0a2fb669f1", size = 525554, upload-time = "2020-10-08T19:00:49.856Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pathable"
|
name = "pathable"
|
||||||
version = "0.4.4"
|
version = "0.4.4"
|
||||||
@@ -952,6 +979,15 @@ wheels = [
|
|||||||
{ url = "https://files.pythonhosted.org/packages/b6/5f/d6d641b490fd3ec2c4c13b4244d68deea3a1b970a97be64f34fb5504ff72/pydantic_settings-2.9.1-py3-none-any.whl", hash = "sha256:59b4f431b1defb26fe620c71a7d3968a710d719f5f4cdbbdb7926edeb770f6ef", size = 44356, upload-time = "2025-04-18T16:44:46.617Z" },
|
{ url = "https://files.pythonhosted.org/packages/b6/5f/d6d641b490fd3ec2c4c13b4244d68deea3a1b970a97be64f34fb5504ff72/pydantic_settings-2.9.1-py3-none-any.whl", hash = "sha256:59b4f431b1defb26fe620c71a7d3968a710d719f5f4cdbbdb7926edeb770f6ef", size = 44356, upload-time = "2025-04-18T16:44:46.617Z" },
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "pyjwt"
|
||||||
|
version = "2.10.1"
|
||||||
|
source = { registry = "https://pypi.org/simple" }
|
||||||
|
sdist = { url = "https://files.pythonhosted.org/packages/e7/46/bd74733ff231675599650d3e47f361794b22ef3e3770998dda30d3b63726/pyjwt-2.10.1.tar.gz", hash = "sha256:3cc5772eb20009233caf06e9d8a0577824723b44e6648ee0a2aedb6cf9381953", size = 87785, upload-time = "2024-11-28T03:43:29.933Z" }
|
||||||
|
wheels = [
|
||||||
|
{ url = "https://files.pythonhosted.org/packages/61/ad/689f02752eeec26aed679477e80e632ef1b682313be70793d798c1d5fc8f/PyJWT-2.10.1-py3-none-any.whl", hash = "sha256:dcdd193e30abefd5debf142f9adfcdd2b58004e644f25406ffaebd50bd98dacb", size = 22997, upload-time = "2024-11-28T03:43:27.893Z" },
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "pyparsing"
|
name = "pyparsing"
|
||||||
version = "3.2.3"
|
version = "3.2.3"
|
||||||
|
|||||||
Reference in New Issue
Block a user